]>
Commit | Line | Data |
---|---|---|
ef8be8ea | 1 | <?php |
d20f3544 | 2 | |
758e1c4a | 3 | function batch_edit_cbox($elem, $label = false) { |
cd935c42 | 4 | print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\" |
758e1c4a AD |
5 | onchange=\"batchFeedsToggleField(this, '$elem', '$label')\">"; |
6 | } | |
7 | ||
ef8be8ea AD |
8 | function module_pref_feeds($link) { |
9 | ||
d20f3544 AD |
10 | global $update_intervals; |
11 | global $purge_intervals; | |
16211ddb | 12 | global $update_methods; |
d20f3544 | 13 | |
ef8be8ea AD |
14 | $subop = $_REQUEST["subop"]; |
15 | $quiet = $_REQUEST["quiet"]; | |
16 | ||
17 | if ($subop == "massSubscribe") { | |
18 | $ids = split(",", db_escape_string($_GET["ids"])); | |
19 | ||
20 | $subscribed = array(); | |
21 | ||
22 | foreach ($ids as $id) { | |
23 | $result = db_query($link, "SELECT feed_url,title FROM ttrss_feeds | |
24 | WHERE id = '$id'"); | |
25 | ||
26 | $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url")); | |
27 | $title = db_escape_string(db_fetch_result($result, 0, "title")); | |
28 | ||
29 | $title_orig = db_fetch_result($result, 0, "title"); | |
30 | ||
31 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE | |
32 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
33 | ||
34 | if (db_num_rows($result) == 0) { | |
35 | $result = db_query($link, | |
36 | "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id) | |
37 | VALUES ('".$_SESSION["uid"]."', '$feed_url', '$title', NULL)"); | |
38 | ||
39 | array_push($subscribed, $title_orig); | |
40 | } | |
41 | } | |
42 | ||
43 | if (count($subscribed) > 0) { | |
31cc42f6 | 44 | $msg = "<b>".__('Subscribed to feeds:')."</b>". |
0d32b41e AD |
45 | "<ul class=\"nomarks\">"; |
46 | ||
ef8be8ea | 47 | foreach ($subscribed as $title) { |
0d32b41e | 48 | $msg .= "<li>$title</li>"; |
ef8be8ea | 49 | } |
0d32b41e AD |
50 | $msg .= "</ul>"; |
51 | ||
52 | print format_notice($msg); | |
ef8be8ea AD |
53 | } |
54 | } | |
55 | ||
56 | if ($subop == "browse") { | |
57 | ||
58 | if (!ENABLE_FEED_BROWSER) { | |
31cc42f6 | 59 | print __("Feed browser is administratively disabled."); |
ef8be8ea AD |
60 | return; |
61 | } | |
62 | ||
b56465dd | 63 | print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>"; |
ef8be8ea AD |
64 | |
65 | print "<div class=\"infoBoxContents\">"; | |
66 | ||
b56465dd | 67 | $browser_search = db_escape_string($_GET["search"]); |
ef8be8ea | 68 | |
b56465dd | 69 | //print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>"; |
c2913898 AD |
70 | |
71 | print " | |
72 | <div style='float : right'> | |
73 | <input id=\"feed_browser_search\" size=\"20\" type=\"search\" | |
b56465dd AD |
74 | onfocus=\"javascript:disableHotkeys();\" |
75 | onblur=\"javascript:enableHotkeys();\" | |
76 | onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\"> | |
77 | <input type=\"submit\" class=\"button\" | |
c2913898 AD |
78 | onclick=\"javascript:updateFeedBrowser()\" value=\"".__('Search')."\"> |
79 | </div>"; | |
80 | ||
81 | print __('Top')." <select id=\"feed_browser_limit\">"; | |
82 | ||
83 | foreach (array(25, 50, 100, 200) as $l) { | |
84 | $issel = ($l == $limit) ? "selected" : ""; | |
85 | print "<option $issel>$l</option>"; | |
86 | } | |
87 | ||
88 | print "</select> | |
89 | <input type=\"submit\" class=\"button\" | |
90 | onclick=\"updateFeedBrowser()\" value=\"".__('Show')."\">"; | |
ef8be8ea | 91 | |
b56465dd | 92 | print "<p>"; |
ef8be8ea | 93 | |
b56465dd | 94 | $owner_uid = $_SESSION["uid"]; |
ef8be8ea | 95 | |
b56465dd | 96 | print "<ul class='browseFeedList' id='browseFeedList'>"; |
c2913898 | 97 | $subscribe_btn_disabled = print_feed_browser($link, $search, 25) == 0 ? "disabled" : ""; |
ef8be8ea AD |
98 | print "</ul>"; |
99 | ||
100 | print "<div align='center'> | |
c2913898 | 101 | <input type=\"submit\" class=\"button\" id=\"feed_browser_subscribe\" |
23582ce2 | 102 | $subscribe_btn_disabled |
31cc42f6 | 103 | onclick=\"feedBrowserSubscribe()\" value=\"".__('Subscribe')."\"> |
ef8be8ea | 104 | <input type='submit' class='button' |
31cc42f6 | 105 | onclick=\"closeInfoBox()\" value=\"".__('Cancel')."\"></div>"; |
ef8be8ea AD |
106 | |
107 | print "</div>"; | |
108 | return; | |
109 | } | |
110 | ||
111 | if ($subop == "editfeed") { | |
112 | $feed_id = db_escape_string($_REQUEST["id"]); | |
113 | ||
114 | $result = db_query($link, | |
115 | "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND | |
116 | owner_uid = " . $_SESSION["uid"]); | |
117 | ||
47439031 AD |
118 | $title = htmlspecialchars(db_fetch_result($result, |
119 | 0, "title")); | |
ef8be8ea AD |
120 | |
121 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
122 | ||
123 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
124 | $feed_icon = "<img width=\"16\" height=\"16\" | |
125 | src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
126 | } else { | |
127 | $feed_icon = ""; | |
128 | } | |
129 | ||
ecace165 | 130 | print "<div id=\"infoBoxTitle\">".__('Feed Editor')."</div>"; |
ef8be8ea AD |
131 | |
132 | print "<div class=\"infoBoxContents\">"; | |
133 | ||
e6312f6c | 134 | print "<form id=\"edit_feed_form\" onsubmit=\"return false\">"; |
ef8be8ea AD |
135 | |
136 | print "<input type=\"hidden\" name=\"id\" value=\"$feed_id\">"; | |
137 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
138 | print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; | |
139 | ||
ecace165 AD |
140 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; |
141 | print "<div class=\"dlgSecCont\">"; | |
ef8be8ea | 142 | |
ecace165 AD |
143 | /* Title */ |
144 | ||
145 | print "<input style=\"font-size : 16px\" size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
146 | name=\"title\" value=\"$title\">"; | |
147 | ||
148 | /* Feed URL */ | |
ef8be8ea AD |
149 | |
150 | $feed_url = db_fetch_result($result, 0, "feed_url"); | |
47439031 AD |
151 | $feed_url = htmlspecialchars(db_fetch_result($result, |
152 | 0, "feed_url")); | |
ecace165 AD |
153 | |
154 | print "<br/>"; | |
155 | ||
156 | print __('URL:') . " "; | |
157 | print "<input size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
158 | name=\"feed_url\" value=\"$feed_url\">"; | |
159 | ||
160 | /* Category */ | |
ef8be8ea AD |
161 | |
162 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
163 | ||
164 | $cat_id = db_fetch_result($result, 0, "cat_id"); | |
165 | ||
ecace165 AD |
166 | print "<br/>"; |
167 | ||
168 | print __('Place in category:') . " "; | |
ef8be8ea AD |
169 | |
170 | $parent_feed = db_fetch_result($result, 0, "parent_feed"); | |
171 | ||
172 | if (sprintf("%d", $parent_feed) > 0) { | |
173 | $disabled = "disabled"; | |
174 | } else { | |
175 | $disabled = ""; | |
176 | } | |
177 | ||
ecace165 | 178 | print_feed_cat_select($link, "cat_id", $cat_id, $disabled); |
ef8be8ea AD |
179 | } |
180 | ||
ecace165 | 181 | /* Link to */ |
ef8be8ea | 182 | |
ecace165 | 183 | print "<br/>"; |
ef8be8ea | 184 | |
ecace165 | 185 | print __('Link to feed:') . " "; |
ef8be8ea AD |
186 | |
187 | $tmp_result = db_query($link, "SELECT COUNT(id) AS count | |
188 | FROM ttrss_feeds WHERE parent_feed = '$feed_id'"); | |
189 | ||
190 | $linked_count = db_fetch_result($tmp_result, 0, "count"); | |
191 | ||
192 | $parent_feed = db_fetch_result($result, 0, "parent_feed"); | |
193 | ||
194 | if ($linked_count > 0) { | |
195 | $disabled = "disabled"; | |
196 | } else { | |
197 | $disabled = ""; | |
198 | } | |
199 | ||
ecace165 | 200 | print "<select $disabled name=\"parent_feed\">"; |
ef8be8ea | 201 | |
31cc42f6 | 202 | print "<option value=\"0\">".__('Not linked')."</option>"; |
ef8be8ea AD |
203 | |
204 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
205 | if ($cat_id) { | |
206 | $cat_qpart = "AND cat_id = '$cat_id'"; | |
207 | } else { | |
208 | $cat_qpart = "AND cat_id IS NULL"; | |
209 | } | |
210 | } | |
211 | ||
212 | $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds | |
213 | WHERE id != '$feed_id' AND owner_uid = ".$_SESSION["uid"]." AND | |
214 | (SELECT COUNT(id) FROM ttrss_feeds AS T2 WHERE T2.id = ttrss_feeds.parent_feed) = 0 | |
215 | $cat_qpart ORDER BY title"); | |
216 | ||
217 | if (db_num_rows($tmp_result) > 0) { | |
218 | print "<option disabled>--------</option>"; | |
219 | } | |
220 | ||
221 | while ($tmp_line = db_fetch_assoc($tmp_result)) { | |
222 | if ($tmp_line["id"] == $parent_feed) { | |
223 | $is_selected = "selected"; | |
224 | } else { | |
225 | $is_selected = ""; | |
226 | } | |
227 | printf("<option $is_selected value='%d'>%s</option>", | |
228 | $tmp_line["id"], $tmp_line["title"]); | |
229 | } | |
230 | ||
231 | print "</select>"; | |
ef8be8ea | 232 | |
ef8be8ea | 233 | |
ecace165 | 234 | print "</div>"; |
ef8be8ea | 235 | |
e6bf0f4b | 236 | print "<div class=\"dlgSec\">".__("Update")."</div>"; |
ecace165 | 237 | print "<div class=\"dlgSecCont\">"; |
ef8be8ea | 238 | |
ecace165 | 239 | /* Update Interval */ |
ef8be8ea | 240 | |
ecace165 AD |
241 | $update_interval = db_fetch_result($result, 0, "update_interval"); |
242 | ||
243 | print_select_hash("update_interval", $update_interval, $update_intervals); | |
16211ddb | 244 | |
ecace165 AD |
245 | /* Update method */ |
246 | ||
247 | if (ALLOW_SELECT_UPDATE_METHOD) { | |
34459667 | 248 | $update_method = db_fetch_result($result, 0, "update_method"); |
ecace165 AD |
249 | |
250 | print " " . __('using') . " "; | |
251 | print_select_hash("update_method", $update_method, $update_methods); | |
34459667 | 252 | } |
16211ddb | 253 | |
22c1bc60 AD |
254 | $purge_interval = db_fetch_result($result, 0, "purge_interval"); |
255 | ||
3907ef71 | 256 | if (FORCE_ARTICLE_PURGE == 0) { |
ecace165 | 257 | |
3907ef71 AD |
258 | /* Purge intl */ |
259 | ||
260 | print "<br/>"; | |
261 | ||
3907ef71 | 262 | print __('Article purging:') . " "; |
ecace165 | 263 | |
3907ef71 | 264 | print_select_hash("purge_interval", $purge_interval, $purge_intervals); |
ecace165 | 265 | |
22c1bc60 AD |
266 | } else { |
267 | print "<input type='hidden' name='purge_interval' value='$purge_interval'>"; | |
268 | ||
3907ef71 | 269 | } |
ecace165 AD |
270 | |
271 | print "</div>"; | |
272 | print "<div class=\"dlgSec\">".__("Authentication")."</div>"; | |
273 | print "<div class=\"dlgSecCont\">"; | |
274 | ||
47439031 | 275 | $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login")); |
ef8be8ea | 276 | |
ecace165 AD |
277 | print __('Login:') . " "; |
278 | print "<input size=\"20\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
279 | name=\"auth_login\" value=\"$auth_login\">"; | |
280 | ||
281 | print " " . __("Password:") . " "; | |
ef8be8ea | 282 | |
47439031 | 283 | $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass")); |
ef8be8ea | 284 | |
ecace165 | 285 | print "<input size=\"20\" type=\"password\" name=\"auth_pass\" |
ef8be8ea | 286 | onkeypress=\"return filterCR(event, feedEditSave)\" |
ecace165 | 287 | value=\"$auth_pass\">"; |
ef8be8ea | 288 | |
ecace165 AD |
289 | print "</div>"; |
290 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
291 | print "<div class=\"dlgSecCont\">"; | |
ef8be8ea | 292 | |
ecace165 | 293 | print "<div style=\"line-height : 100%\">"; |
ef8be8ea | 294 | |
886d4bce AD |
295 | $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); |
296 | ||
297 | if ($private) { | |
298 | $checked = "checked"; | |
299 | } else { | |
300 | $checked = ""; | |
301 | } | |
302 | ||
ecace165 AD |
303 | print "<input type=\"checkbox\" name=\"private\" id=\"private\" |
304 | $checked> <label for=\"private\">".__('Hide from "Other Feeds"')."</label>"; | |
ef8be8ea AD |
305 | |
306 | $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); | |
307 | ||
308 | if ($rtl_content) { | |
309 | $checked = "checked"; | |
310 | } else { | |
311 | $checked = ""; | |
312 | } | |
313 | ||
ecace165 AD |
314 | print "<br/><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\" |
315 | $checked> <label for=\"rtl_content\">".__('Right-to-left content')."</label>"; | |
ef8be8ea AD |
316 | |
317 | $hidden = sql_bool_to_bool(db_fetch_result($result, 0, "hidden")); | |
318 | ||
319 | if ($hidden) { | |
320 | $checked = "checked"; | |
321 | } else { | |
322 | $checked = ""; | |
323 | } | |
324 | ||
ecace165 AD |
325 | print "<br/><input type=\"checkbox\" id=\"hidden\" name=\"hidden\" |
326 | $checked> <label for=\"hidden\">".__('Hide from my feed list')."</label>"; | |
ef8be8ea AD |
327 | |
328 | $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); | |
329 | ||
330 | if ($include_in_digest) { | |
331 | $checked = "checked"; | |
332 | } else { | |
333 | $checked = ""; | |
334 | } | |
335 | ||
ecace165 | 336 | print "<br/><input type=\"checkbox\" id=\"include_in_digest\" |
ef8be8ea | 337 | name=\"include_in_digest\" |
ecace165 | 338 | $checked> <label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>"; |
ef8be8ea | 339 | |
bc0f0785 AD |
340 | $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); |
341 | ||
342 | if ($cache_images) { | |
343 | $checked = "checked"; | |
344 | } else { | |
345 | $checked = ""; | |
346 | } | |
347 | ||
348 | if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { | |
349 | $disabled = ""; | |
350 | $label_class = ""; | |
351 | } else { | |
352 | $disabled = "disabled"; | |
353 | $label_class = "class='insensitive'"; | |
354 | } | |
355 | ||
ecace165 | 356 | print "<br/><input type=\"checkbox\" id=\"cache_images\" |
bc0f0785 | 357 | name=\"cache_images\" $disabled |
ecace165 | 358 | $checked> <label $label_class for=\"cache_images\">". |
bc0f0785 AD |
359 | __('Cache images locally')."</label>"; |
360 | ||
ef8be8ea | 361 | |
ecace165 AD |
362 | print "</div>"; |
363 | print "</div>"; | |
ef8be8ea AD |
364 | |
365 | print "</form>"; | |
366 | ||
ddb61e79 AD |
367 | $title = htmlspecialchars($title, ENT_QUOTES); |
368 | ||
ecace165 | 369 | print "<div class='dlgButtons'> |
143a4973 AD |
370 | <div style=\"float : left\"> |
371 | <input type='submit' class='button' | |
372 | onclick='return unsubscribeFeed($feed_id, \"$title\")' value=\"".__('Unsubscribe')."\"> | |
373 | </div> | |
ef8be8ea | 374 | <input type=\"submit\" class=\"button\" |
31cc42f6 | 375 | onclick=\"return feedEditSave()\" value=\"".__('Save')."\"> |
ef8be8ea | 376 | <input type='submit' class='button' |
c8d5dcfe | 377 | onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"> |
c8d5dcfe | 378 | </div>"; |
ef8be8ea | 379 | |
ef8be8ea AD |
380 | return; |
381 | } | |
382 | ||
758e1c4a AD |
383 | if ($subop == "editfeeds") { |
384 | ||
385 | $feed_ids = db_escape_string($_REQUEST["ids"]); | |
386 | ||
b0f015a2 | 387 | print "<div id=\"infoBoxTitle\">".__('Multiple Feed Editor')."</div>"; |
758e1c4a AD |
388 | |
389 | print "<div class=\"infoBoxContents\">"; | |
390 | ||
758e1c4a AD |
391 | print "<form id=\"batch_edit_feed_form\" onsubmit=\"return false\">"; |
392 | ||
393 | print "<input type=\"hidden\" name=\"ids\" value=\"$feed_ids\">"; | |
394 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
395 | print "<input type=\"hidden\" name=\"subop\" value=\"batchEditSave\">"; | |
396 | ||
397 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; | |
398 | print "<div class=\"dlgSecCont\">"; | |
399 | ||
400 | /* Title */ | |
401 | ||
402 | print "<input disabled style=\"font-size : 16px\" size=\"35\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
403 | name=\"title\" value=\"$title\">"; | |
404 | ||
405 | batch_edit_cbox("title"); | |
406 | ||
407 | /* Feed URL */ | |
408 | ||
409 | print "<br/>"; | |
410 | ||
411 | print __('URL:') . " "; | |
412 | print "<input disabled size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
413 | name=\"feed_url\" value=\"$feed_url\">"; | |
414 | ||
415 | batch_edit_cbox("feed_url"); | |
416 | ||
417 | /* Category */ | |
418 | ||
419 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
420 | ||
421 | print "<br/>"; | |
422 | ||
423 | print __('Place in category:') . " "; | |
424 | ||
425 | print_feed_cat_select($link, "cat_id", $cat_id, "disabled"); | |
426 | ||
427 | batch_edit_cbox("cat_id"); | |
428 | ||
429 | } | |
430 | ||
431 | print "</div>"; | |
432 | ||
433 | print "<div class=\"dlgSec\">".__("Update")."</div>"; | |
434 | print "<div class=\"dlgSecCont\">"; | |
435 | ||
436 | /* Update Interval */ | |
437 | ||
438 | print_select_hash("update_interval", $update_interval, $update_intervals, | |
439 | "disabled"); | |
440 | ||
441 | batch_edit_cbox("update_interval"); | |
442 | ||
443 | /* Update method */ | |
444 | ||
445 | if (ALLOW_SELECT_UPDATE_METHOD) { | |
446 | print " " . __('using') . " "; | |
447 | print_select_hash("update_method", $update_method, $update_methods, | |
448 | "disabled"); | |
449 | batch_edit_cbox("update_method"); | |
450 | } | |
451 | ||
452 | /* Purge intl */ | |
453 | ||
3907ef71 | 454 | if (FORCE_ARTICLE_PURGE != 0) { |
758e1c4a | 455 | |
3907ef71 | 456 | print "<br/>"; |
758e1c4a | 457 | |
3907ef71 | 458 | print __('Article purging:') . " "; |
758e1c4a | 459 | |
3907ef71 AD |
460 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
461 | "disabled"); | |
462 | ||
463 | batch_edit_cbox("purge_interval"); | |
464 | } | |
758e1c4a AD |
465 | |
466 | print "</div>"; | |
467 | print "<div class=\"dlgSec\">".__("Authentication")."</div>"; | |
468 | print "<div class=\"dlgSecCont\">"; | |
469 | ||
470 | print __('Login:') . " "; | |
471 | print "<input disabled size=\"15\" onkeypress=\"return filterCR(event, feedEditSave)\" | |
472 | name=\"auth_login\" value=\"$auth_login\">"; | |
473 | ||
474 | batch_edit_cbox("auth_login"); | |
475 | ||
476 | print " " . __("Password:") . " "; | |
477 | ||
478 | print "<input disabled size=\"15\" type=\"password\" name=\"auth_pass\" | |
479 | onkeypress=\"return filterCR(event, feedEditSave)\" | |
480 | value=\"$auth_pass\">"; | |
481 | ||
482 | batch_edit_cbox("auth_pass"); | |
483 | ||
484 | print "</div>"; | |
485 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
486 | print "<div class=\"dlgSecCont\">"; | |
487 | ||
488 | print "<div style=\"line-height : 100%\">"; | |
489 | ||
490 | print "<input disabled type=\"checkbox\" name=\"private\" id=\"private\" | |
491 | $checked> <label id=\"private_l\" class='insensitive' for=\"private\">".__('Hide from "Other Feeds"')."</label>"; | |
492 | ||
493 | print " "; batch_edit_cbox("private", "private_l"); | |
494 | ||
495 | print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\" | |
496 | $checked> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>"; | |
497 | ||
498 | print " "; batch_edit_cbox("rtl_content", "rtl_content_l"); | |
499 | ||
500 | print "<br/><input disabled type=\"checkbox\" id=\"hidden\" name=\"hidden\" | |
501 | $checked> <label class='insensitive' id=\"hidden_l\" for=\"hidden\">".__('Hide from my feed list')."</label>"; | |
502 | ||
503 | print " "; batch_edit_cbox("hidden", "hidden_l"); | |
504 | ||
505 | print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\" | |
506 | name=\"include_in_digest\" | |
507 | $checked> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>"; | |
508 | ||
509 | print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l"); | |
510 | ||
511 | print "<br/><input disabled type=\"checkbox\" id=\"cache_images\" | |
512 | name=\"cache_images\" | |
513 | $checked> <label class='insensitive' id=\"cache_images_l\" | |
514 | for=\"cache_images\">". | |
515 | __('Cache images locally')."</label>"; | |
516 | ||
517 | ||
518 | if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { | |
519 | print " "; batch_edit_cbox("cache_images", "cache_images_l"); | |
520 | } | |
521 | ||
522 | print "</div>"; | |
523 | print "</div>"; | |
524 | ||
525 | print "</form>"; | |
526 | ||
527 | print "<div class='dlgButtons'> | |
528 | <input type=\"submit\" class=\"button\" | |
529 | onclick=\"return feedsEditSave()\" value=\"".__('Save')."\"> | |
530 | <input type='submit' class='button' | |
531 | onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"> | |
532 | </div>"; | |
533 | ||
534 | return; | |
535 | } | |
536 | ||
b0f015a2 | 537 | if ($subop == "editSave" || $subop == "batchEditSave") { |
ef8be8ea AD |
538 | |
539 | $feed_title = db_escape_string(trim($_POST["title"])); | |
540 | $feed_link = db_escape_string(trim($_POST["feed_url"])); | |
541 | $upd_intl = db_escape_string($_POST["update_interval"]); | |
542 | $purge_intl = db_escape_string($_POST["purge_interval"]); | |
b0f015a2 AD |
543 | $feed_id = db_escape_string($_POST["id"]); /* editSave */ |
544 | $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */ | |
ef8be8ea AD |
545 | $cat_id = db_escape_string($_POST["cat_id"]); |
546 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
547 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
548 | $parent_feed = db_escape_string($_POST["parent_feed"]); | |
549 | $private = checkbox_to_sql_bool(db_escape_string($_POST["private"])); | |
550 | $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"])); | |
551 | $hidden = checkbox_to_sql_bool(db_escape_string($_POST["hidden"])); | |
552 | $include_in_digest = checkbox_to_sql_bool( | |
553 | db_escape_string($_POST["include_in_digest"])); | |
bc0f0785 AD |
554 | $cache_images = checkbox_to_sql_bool( |
555 | db_escape_string($_POST["cache_images"])); | |
16211ddb | 556 | $update_method = (int) db_escape_string($_POST["update_method"]); |
ef8be8ea AD |
557 | |
558 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
559 | if ($cat_id && $cat_id != 0) { | |
560 | $category_qpart = "cat_id = '$cat_id',"; | |
561 | $category_qpart_nocomma = "cat_id = '$cat_id'"; | |
562 | } else { | |
563 | $category_qpart = 'cat_id = NULL,'; | |
564 | $category_qpart_nocomma = 'cat_id = NULL'; | |
565 | } | |
566 | } else { | |
567 | $category_qpart = ""; | |
568 | $category_qpart_nocomma = ""; | |
569 | } | |
570 | ||
571 | if ($parent_feed && $parent_feed != 0) { | |
572 | $parent_qpart = "parent_feed = '$parent_feed'"; | |
573 | } else { | |
574 | $parent_qpart = 'parent_feed = NULL'; | |
575 | } | |
576 | ||
bc0f0785 AD |
577 | if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { |
578 | $cache_images_qpart = "cache_images = $cache_images,"; | |
579 | } else { | |
580 | $cache_images_qpart = ""; | |
581 | } | |
582 | ||
b0f015a2 AD |
583 | if ($subop == "editSave") { |
584 | ||
585 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
586 | $category_qpart $parent_qpart, | |
587 | title = '$feed_title', feed_url = '$feed_link', | |
588 | update_interval = '$upd_intl', | |
589 | purge_interval = '$purge_intl', | |
590 | auth_login = '$auth_login', | |
591 | auth_pass = '$auth_pass', | |
592 | private = $private, | |
593 | rtl_content = $rtl_content, | |
594 | hidden = $hidden, | |
595 | $cache_images_qpart | |
596 | include_in_digest = $include_in_digest, | |
597 | update_method = '$update_method' | |
5ffd798d | 598 | WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); |
b0f015a2 AD |
599 | |
600 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
601 | # update linked feed categories | |
602 | $result = db_query($link, "UPDATE ttrss_feeds SET | |
603 | $category_qpart_nocomma WHERE parent_feed = '$feed_id' AND | |
604 | owner_uid = " . $_SESSION["uid"]); | |
605 | } | |
606 | } else if ($subop == "batchEditSave") { | |
607 | $feed_data = array(); | |
ef8be8ea | 608 | |
b0f015a2 AD |
609 | foreach (array_keys($_POST) as $k) { |
610 | if ($k != "op" && $k != "subop" && $k != "ids") { | |
611 | $feed_data[$k] = $_POST[$k]; | |
612 | } | |
613 | } | |
614 | ||
615 | db_query($link, "BEGIN"); | |
616 | ||
617 | foreach (array_keys($feed_data) as $k) { | |
618 | ||
619 | $qpart = ""; | |
620 | ||
621 | switch ($k) { | |
622 | case "title": | |
623 | $qpart = "title = '$feed_title'"; | |
624 | break; | |
625 | ||
626 | case "feed_url": | |
627 | $qpart = "feed_url = '$feed_link'"; | |
628 | break; | |
629 | ||
630 | case "update_interval": | |
631 | $qpart = "update_interval = '$upd_intl'"; | |
632 | break; | |
633 | ||
634 | case "purge_interval": | |
635 | $qpart = "purge_interval = '$purge_intl'"; | |
636 | break; | |
637 | ||
638 | case "auth_login": | |
639 | $qpart = "auth_login = '$auth_login'"; | |
640 | break; | |
641 | ||
642 | case "auth_pass": | |
643 | $qpart = "auth_pass = '$auth_pass'"; | |
644 | break; | |
645 | ||
646 | case "private": | |
647 | $qpart = "private = '$private'"; | |
648 | break; | |
649 | ||
650 | case "hidden": | |
651 | $qpart = "hidden = '$hidden'"; | |
652 | break; | |
653 | ||
654 | case "include_in_digest": | |
655 | $qpart = "include_in_digest = '$include_in_digest'"; | |
656 | break; | |
657 | ||
5d538f4f AD |
658 | case "cache_images": |
659 | $qpart = "cache_images = '$cache_images'"; | |
660 | break; | |
661 | ||
662 | case "rtl_content": | |
663 | $qpart = "rtl_content = '$rtl_content'"; | |
664 | break; | |
665 | ||
b0f015a2 AD |
666 | case "update_method": |
667 | $qpart = "update_method = '$update_method'"; | |
668 | break; | |
669 | ||
670 | case "cat_id": | |
671 | $qpart = $category_qpart_nocomma; | |
672 | break; | |
673 | ||
674 | } | |
675 | ||
676 | if ($qpart) { | |
cff7a3a2 | 677 | db_query($link, |
b0f015a2 | 678 | "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids) |
cd935c42 AD |
679 | AND owner_uid = " . $_SESSION["uid"]); |
680 | print "<br/>"; | |
b0f015a2 AD |
681 | } |
682 | } | |
683 | ||
684 | db_query($link, "COMMIT"); | |
ef8be8ea | 685 | } |
b0f015a2 | 686 | |
ef8be8ea AD |
687 | } |
688 | ||
ef8be8ea AD |
689 | if ($subop == "remove") { |
690 | ||
810b1561 | 691 | $ids = split(",", db_escape_string($_GET["ids"])); |
ef8be8ea | 692 | |
810b1561 | 693 | foreach ($ids as $id) { |
ef8be8ea | 694 | |
810b1561 | 695 | if ($id > 0) { |
ef8be8ea | 696 | |
810b1561 AD |
697 | db_query($link, "DELETE FROM ttrss_feeds |
698 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
ef8be8ea | 699 | |
810b1561 | 700 | $icons_dir = ICONS_DIR; |
ef8be8ea | 701 | |
810b1561 AD |
702 | if (file_exists($icons_dir . "/$id.ico")) { |
703 | unlink($icons_dir . "/$id.ico"); | |
ef8be8ea | 704 | } |
1380f8ee AD |
705 | } else { |
706 | label_remove($link, -11-$id, $_SESSION["uid"]); | |
ef8be8ea AD |
707 | } |
708 | } | |
709 | } | |
710 | ||
d1f0c584 AD |
711 | if ($subop == "clear") { |
712 | $id = db_escape_string($_GET["id"]); | |
713 | clear_feed_articles($link, $id); | |
714 | } | |
715 | ||
fee840fb AD |
716 | if ($subop == "rescore") { |
717 | $ids = split(",", db_escape_string($_GET["ids"])); | |
718 | ||
719 | foreach ($ids as $id) { | |
720 | ||
721 | $filters = load_filters($link, $id, $_SESSION["uid"], 6); | |
722 | ||
723 | $result = db_query($link, "SELECT title, content, link, ref_id FROM | |
724 | ttrss_user_entries, ttrss_entries | |
725 | WHERE ref_id = id AND feed_id = '$id' AND | |
726 | owner_uid = " .$_SESSION['uid']." | |
ef1b0366 | 727 | "); |
fee840fb AD |
728 | |
729 | $scores = array(); | |
730 | ||
731 | while ($line = db_fetch_assoc($result)) { | |
732 | ||
733 | $article_filters = get_article_filters($filters, $line['title'], | |
734 | $line['content'], $line['link']); | |
735 | ||
736 | $new_score = calculate_article_score($article_filters); | |
737 | ||
738 | if (!$scores[$new_score]) $scores[$new_score] = array(); | |
739 | ||
740 | array_push($scores[$new_score], $line['ref_id']); | |
741 | } | |
742 | ||
743 | foreach (array_keys($scores) as $s) { | |
744 | if ($s > 1000) { | |
745 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
746 | marked = true WHERE | |
95a948a5 | 747 | ref_id IN (" . join(',', $scores[$s]) . ")"); |
1618a849 AD |
748 | } else if ($s < -500) { |
749 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
750 | unread = false WHERE | |
751 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
95a948a5 AD |
752 | } else { |
753 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE | |
754 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
755 | } | |
756 | } | |
757 | } | |
758 | ||
759 | print __("All done."); | |
760 | ||
761 | } | |
762 | ||
763 | if ($subop == "rescoreAll") { | |
764 | ||
765 | $result = db_query($link, | |
766 | "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']); | |
767 | ||
768 | while ($feed_line = db_fetch_assoc($result)) { | |
769 | ||
770 | $id = $feed_line["id"]; | |
771 | ||
772 | $filters = load_filters($link, $id, $_SESSION["uid"], 6); | |
773 | ||
774 | $tmp_result = db_query($link, "SELECT title, content, link, ref_id FROM | |
775 | ttrss_user_entries, ttrss_entries | |
776 | WHERE ref_id = id AND feed_id = '$id' AND | |
777 | owner_uid = " .$_SESSION['uid']." | |
778 | "); | |
779 | ||
780 | $scores = array(); | |
781 | ||
782 | while ($line = db_fetch_assoc($tmp_result)) { | |
783 | ||
784 | $article_filters = get_article_filters($filters, $line['title'], | |
785 | $line['content'], $line['link']); | |
786 | ||
787 | $new_score = calculate_article_score($article_filters); | |
788 | ||
789 | if (!$scores[$new_score]) $scores[$new_score] = array(); | |
790 | ||
791 | array_push($scores[$new_score], $line['ref_id']); | |
792 | } | |
793 | ||
794 | foreach (array_keys($scores) as $s) { | |
795 | if ($s > 1000) { | |
796 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s', | |
797 | marked = true WHERE | |
fee840fb AD |
798 | ref_id IN (" . join(',', $scores[$s]) . ")"); |
799 | } else { | |
800 | db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE | |
801 | ref_id IN (" . join(',', $scores[$s]) . ")"); | |
802 | } | |
803 | } | |
804 | } | |
805 | ||
806 | print __("All done."); | |
807 | ||
808 | } | |
809 | ||
ef8be8ea AD |
810 | if ($subop == "add") { |
811 | ||
812 | if (!WEB_DEMO_MODE) { | |
813 | ||
f27de515 AD |
814 | $feed_url = db_escape_string(trim($_REQUEST["feed_url"])); |
815 | $cat_id = db_escape_string($_REQUEST["cat_id"]); | |
816 | $p_from = db_escape_string($_REQUEST["from"]); | |
817 | ||
818 | /* only read authentication information from POST */ | |
819 | ||
820 | $auth_login = db_escape_string(trim($_POST["auth_login"])); | |
821 | $auth_pass = db_escape_string(trim($_POST["auth_pass"])); | |
aa2122d4 | 822 | |
e513a74a | 823 | if ($p_from != 'tt-rss') { |
aa2122d4 AD |
824 | print "<html> |
825 | <head> | |
6906f145 AD |
826 | <title>Tiny Tiny RSS</title> |
827 | <link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\"> | |
aa2122d4 AD |
828 | </head> |
829 | <body> | |
6906f145 | 830 | <img class=\"floatingLogo\" src=\"images/ttrss_logo.png\" |
aa2122d4 | 831 | alt=\"Tiny Tiny RSS\"/> |
6906f145 | 832 | <h1>Subscribe to feed...</h1>"; |
aa2122d4 | 833 | } |
ef8be8ea | 834 | |
f27de515 | 835 | if (subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass)) { |
4dccf1ed | 836 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 837 | } else { |
4dccf1ed | 838 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); |
ef8be8ea | 839 | } |
aa2122d4 | 840 | |
e513a74a | 841 | if ($p_from != 'tt-rss') { |
d70c5ae4 | 842 | $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]); |
aa2122d4 | 843 | |
d70c5ae4 AD |
844 | |
845 | $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]); | |
e513a74a | 846 | |
e513a74a AD |
847 | $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE |
848 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); | |
849 | ||
850 | $feed_id = db_fetch_result($result, 0, "id"); | |
851 | ||
6906f145 AD |
852 | print "<p>"; |
853 | ||
e513a74a | 854 | if ($feed_id) { |
6906f145 AD |
855 | print "<form method=\"GET\" style='display: inline' |
856 | action=\"$tp_uri\"> | |
857 | <input type=\"hidden\" name=\"tab\" value=\"feedConfig\"> | |
858 | <input type=\"hidden\" name=\"subop\" value=\"editFeed\"> | |
859 | <input type=\"hidden\" name=\"subopparam\" value=\"$feed_id\"> | |
860 | <input type=\"submit\" value=\"".__("Edit subscription options")."\"> | |
861 | </form>"; | |
e513a74a AD |
862 | } |
863 | ||
6906f145 AD |
864 | print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\"> |
865 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
866 | </form></p>"; | |
aa2122d4 | 867 | |
6906f145 | 868 | print "</body></html>"; |
aa2122d4 AD |
869 | return; |
870 | } | |
442d77f1 | 871 | |
ef8be8ea AD |
872 | } |
873 | } | |
874 | ||
ef8be8ea AD |
875 | if ($subop == "categorize") { |
876 | ||
877 | if (!WEB_DEMO_MODE) { | |
878 | ||
879 | $ids = split(",", db_escape_string($_GET["ids"])); | |
880 | ||
881 | $cat_id = db_escape_string($_GET["cat_id"]); | |
882 | ||
883 | if ($cat_id == 0) { | |
884 | $cat_id_qpart = 'NULL'; | |
885 | } else { | |
886 | $cat_id_qpart = "'$cat_id'"; | |
887 | } | |
888 | ||
889 | db_query($link, "BEGIN"); | |
890 | ||
891 | foreach ($ids as $id) { | |
892 | ||
893 | db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart | |
894 | WHERE id = '$id' AND parent_feed IS NULL | |
895 | AND owner_uid = " . $_SESSION["uid"]); | |
896 | ||
897 | # update linked feed categories | |
898 | db_query($link, "UPDATE ttrss_feeds SET | |
899 | cat_id = $cat_id_qpart WHERE parent_feed = '$id' AND | |
900 | owner_uid = " . $_SESSION["uid"]); | |
901 | ||
902 | } | |
903 | ||
904 | db_query($link, "COMMIT"); | |
905 | } | |
906 | ||
907 | } | |
908 | ||
9c483746 AD |
909 | if ($subop == "editCats") { |
910 | ||
9c483746 AD |
911 | $action = $_REQUEST["action"]; |
912 | ||
913 | if ($action == "save") { | |
914 | ||
11f083e7 AD |
915 | $cat_title = db_escape_string(trim($_REQUEST["value"])); |
916 | $cat_id = db_escape_string($_GET["cid"]); | |
11f083e7 | 917 | |
8f708155 AD |
918 | db_query($link, "BEGIN"); |
919 | ||
920 | $result = db_query($link, "SELECT title FROM ttrss_feed_categories | |
921 | WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]); | |
922 | ||
923 | if (db_num_rows($result) == 1) { | |
924 | ||
925 | $old_title = db_fetch_result($result, 0, "title"); | |
926 | ||
927 | if ($cat_title != "") { | |
928 | $result = db_query($link, "UPDATE ttrss_feed_categories SET | |
929 | title = '$cat_title' WHERE id = '$cat_id' AND | |
930 | owner_uid = ".$_SESSION["uid"]); | |
931 | ||
932 | print $cat_title; | |
933 | } else { | |
934 | print $old_title; | |
935 | } | |
936 | } else { | |
937 | print $_REQUEST["value"]; | |
938 | } | |
939 | ||
940 | db_query($link, "COMMIT"); | |
11f083e7 AD |
941 | |
942 | return; | |
943 | ||
9c483746 AD |
944 | } |
945 | ||
11f083e7 AD |
946 | print "<div id=\"infoBoxTitle\">".__('Category editor')."</div>"; |
947 | ||
948 | print "<div class=\"infoBoxContents\">"; | |
949 | ||
950 | ||
9c483746 AD |
951 | if ($action == "add") { |
952 | ||
953 | if (!WEB_DEMO_MODE) { | |
954 | ||
955 | $feed_cat = db_escape_string(trim($_GET["cat"])); | |
956 | ||
957 | $result = db_query($link, | |
958 | "SELECT id FROM ttrss_feed_categories | |
959 | WHERE title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]); | |
960 | ||
961 | if (db_num_rows($result) == 0) { | |
962 | ||
963 | $result = db_query($link, | |
964 | "INSERT INTO ttrss_feed_categories (owner_uid,title) | |
965 | VALUES ('".$_SESSION["uid"]."', '$feed_cat')"); | |
966 | ||
967 | } else { | |
968 | ||
4dccf1ed AD |
969 | print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.", |
970 | $feed_cat)); | |
9c483746 AD |
971 | } |
972 | ||
973 | } | |
974 | } | |
975 | ||
976 | if ($action == "remove") { | |
977 | ||
978 | if (!WEB_DEMO_MODE) { | |
979 | ||
980 | $ids = split(",", db_escape_string($_GET["ids"])); | |
981 | ||
982 | foreach ($ids as $id) { | |
983 | ||
984 | db_query($link, "BEGIN"); | |
985 | ||
986 | $result = db_query($link, | |
987 | "SELECT count(id) as num_feeds FROM ttrss_feeds | |
988 | WHERE cat_id = '$id'"); | |
989 | ||
990 | $num_feeds = db_fetch_result($result, 0, "num_feeds"); | |
991 | ||
992 | if ($num_feeds == 0) { | |
993 | db_query($link, "DELETE FROM ttrss_feed_categories | |
994 | WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); | |
995 | } else { | |
996 | ||
31cc42f6 | 997 | print format_warning(__("Unable to delete non empty feed categories.")); |
9c483746 AD |
998 | |
999 | } | |
1000 | ||
1001 | db_query($link, "COMMIT"); | |
1002 | } | |
1003 | } | |
1004 | } | |
1005 | ||
1006 | print "<div class=\"prefGenericAddBox\"> | |
1007 | <input id=\"fadd_cat\" | |
1043a8c3 | 1008 | onkeypress=\"return filterCR(event, addFeedCat)\" |
9c483746 | 1009 | onkeyup=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
b5015f72 | 1010 | onchange=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\" |
9c483746 AD |
1011 | size=\"40\"> |
1012 | <input | |
1013 | type=\"submit\" class=\"button\" disabled=\"true\" id=\"catadd_submit_btn\" | |
31cc42f6 | 1014 | onclick=\"javascript:addFeedCat()\" value=\"".__('Create category')."\"></div>"; |
9c483746 AD |
1015 | |
1016 | $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories | |
1017 | WHERE owner_uid = ".$_SESSION["uid"]." | |
1018 | ORDER BY title"); | |
1019 | ||
1020 | print "<p>"; | |
1021 | ||
1022 | if (db_num_rows($result) != 0) { | |
1023 | ||
1024 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
1025 | cellspacing=\"0\">"; | |
1026 | ||
1027 | print "<tr><td class=\"selectPrompt\" colspan=\"8\"> | |
e8d0177d AD |
1028 | ".__('Select:')." |
1029 | <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>, | |
1030 | <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a> | |
9c483746 AD |
1031 | </td></tr>"; |
1032 | ||
1033 | print "</table>"; | |
1034 | ||
1035 | print "<div class=\"prefFeedCatHolder\">"; | |
1036 | ||
e6312f6c | 1037 | print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">"; |
9c483746 AD |
1038 | |
1039 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
1040 | cellspacing=\"0\" id=\"prefFeedCatList\">"; | |
9c483746 AD |
1041 | |
1042 | $lnum = 0; | |
1043 | ||
1044 | while ($line = db_fetch_assoc($result)) { | |
1045 | ||
1046 | $class = ($lnum % 2) ? "even" : "odd"; | |
1047 | ||
1048 | $cat_id = $line["id"]; | |
11f083e7 | 1049 | $this_row_id = "id=\"FCATR-$cat_id\""; |
9c483746 AD |
1050 | |
1051 | print "<tr class=\"$class\" $this_row_id>"; | |
1052 | ||
47439031 | 1053 | $edit_title = htmlspecialchars($line["title"]); |
9c483746 | 1054 | |
11f083e7 AD |
1055 | print "<td width='5%' align='center'><input |
1056 | onclick='toggleSelectPrefRow(this, \"fcat\");' | |
1057 | type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>"; | |
1058 | ||
1059 | print "<td><span id=\"FCATT-$cat_id\">" . | |
1060 | $edit_title . "</span></td>"; | |
9c483746 AD |
1061 | |
1062 | print "</tr>"; | |
1063 | ||
1064 | ++$lnum; | |
1065 | } | |
1066 | ||
1067 | print "</table>"; | |
1068 | ||
1069 | print "</form>"; | |
1070 | ||
1071 | print "</div>"; | |
1072 | ||
6f5b1e04 | 1073 | } else { |
31cc42f6 | 1074 | print "<p>".__('No feed categories defined.')."</p>"; |
6f5b1e04 | 1075 | } |
9c483746 | 1076 | |
6f5b1e04 AD |
1077 | print "<div style='float : right'> |
1078 | <input type='submit' class='button' | |
31cc42f6 | 1079 | onclick=\"selectTab('feedConfig')\" value=\"".__('Close this window')."\"></div>"; |
9c483746 | 1080 | |
6f5b1e04 | 1081 | print "<div id=\"catOpToolbar\">"; |
9c483746 | 1082 | |
11f083e7 | 1083 | print " |
6f5b1e04 | 1084 | <input type=\"submit\" class=\"button\" disabled=\"true\" |
31cc42f6 | 1085 | onclick=\"return removeSelectedFeedCats()\" value=\"".__('Remove')."\">"; |
11f083e7 | 1086 | |
9c483746 AD |
1087 | print "</div>"; |
1088 | ||
6f5b1e04 AD |
1089 | print "</div>"; |
1090 | ||
9c483746 AD |
1091 | return; |
1092 | ||
1093 | } | |
1094 | ||
ef8be8ea AD |
1095 | if ($quiet) return; |
1096 | ||
442d77f1 AD |
1097 | set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig"); |
1098 | ||
a3656a41 | 1099 | $result = db_query($link, "SELECT COUNT(id) AS num_errors |
ef8be8ea AD |
1100 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); |
1101 | ||
a3656a41 | 1102 | $num_errors = db_fetch_result($result, 0, "num_errors"); |
ef8be8ea | 1103 | |
a3656a41 | 1104 | if ($num_errors > 0) { |
ef8be8ea | 1105 | |
31cc42f6 AD |
1106 | print format_notice("<a href=\"javascript:showFeedsWithErrors()\">". |
1107 | __('Some feeds have update errors (click for details)')."</a>"); | |
ef8be8ea AD |
1108 | } |
1109 | ||
1110 | $feed_search = db_escape_string($_GET["search"]); | |
1111 | ||
1112 | if (array_key_exists("search", $_GET)) { | |
1113 | $_SESSION["prefs_feed_search"] = $feed_search; | |
1114 | } else { | |
1115 | $feed_search = $_SESSION["prefs_feed_search"]; | |
1116 | } | |
1117 | ||
1118 | print "<div class=\"feedEditSearch\"> | |
3dc8ee84 | 1119 | <input id=\"feed_search\" size=\"20\" type=\"search\" |
4cf6fc6a AD |
1120 | onfocus=\"javascript:disableHotkeys();\" |
1121 | onblur=\"javascript:enableHotkeys();\" | |
ef8be8ea AD |
1122 | onchange=\"javascript:updateFeedList()\" value=\"$feed_search\"> |
1123 | <input type=\"submit\" class=\"button\" | |
a3c159c4 | 1124 | onclick=\"javascript:updateFeedList()\" value=\"".__('Search')."\"> |
ef8be8ea | 1125 | </div>"; |
5e6f933a | 1126 | |
442d77f1 | 1127 | print "<input onclick=\"javascript:displayDlg('quickAddFeed')\" |
a349077c | 1128 | type=\"submit\" id=\"subscribe_to_feed_btn\" |
442d77f1 | 1129 | class=\"button\" value=\"".__('Subscribe to feed')."\">"; |
ef8be8ea AD |
1130 | |
1131 | if (ENABLE_FEED_BROWSER && !SINGLE_USER_MODE) { | |
1132 | print " <input type=\"submit\" class=\"button\" | |
a349077c | 1133 | id=\"top25_feeds_btn\" |
eb70b777 | 1134 | onclick=\"javascript:browseFeeds()\" value=\"".__('More Feeds')."\">"; |
ef8be8ea AD |
1135 | } |
1136 | ||
ef8be8ea AD |
1137 | $feeds_sort = db_escape_string($_GET["sort"]); |
1138 | ||
1139 | if (!$feeds_sort || $feeds_sort == "undefined") { | |
1140 | $feeds_sort = $_SESSION["pref_sort_feeds"]; | |
1141 | if (!$feeds_sort) $feeds_sort = "title"; | |
1142 | } | |
1143 | ||
1144 | $_SESSION["pref_sort_feeds"] = $feeds_sort; | |
1145 | ||
1146 | if ($feed_search) { | |
1147 | $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR | |
1148 | UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND"; | |
1149 | } else { | |
1150 | $search_qpart = ""; | |
1151 | } | |
1152 | ||
400b60d8 AD |
1153 | $show_last_article_info = false; |
1154 | $show_last_article_checked = ""; | |
1155 | $show_last_article_qpart = ""; | |
1156 | ||
1157 | if ($_GET["slat"] == "true") { | |
1158 | $show_last_article_info = true; | |
1159 | $show_last_article_checked = "checked"; | |
fc2b26a6 | 1160 | $show_last_article_qpart = ", (SELECT ".SUBSTRING_FOR_DATE."(MAX(updated),1,16) FROM ttrss_user_entries, |
400b60d8 AD |
1161 | ttrss_entries WHERE ref_id = ttrss_entries.id |
1162 | AND feed_id = F1.id) AS last_article"; | |
d2ca9130 AD |
1163 | } else if ($feeds_sort == "last_article") { |
1164 | $feeds_sort = "title"; | |
1165 | } | |
1166 | ||
1167 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
1168 | $order_by_qpart = "category,$feeds_sort,title"; | |
1169 | } else { | |
1170 | $order_by_qpart = "$feeds_sort,title"; | |
400b60d8 AD |
1171 | } |
1172 | ||
ef8be8ea AD |
1173 | $result = db_query($link, "SELECT |
1174 | F1.id, | |
1175 | F1.title, | |
1176 | F1.feed_url, | |
2ac6b765 | 1177 | ".SUBSTRING_FOR_DATE."(F1.last_updated,1,16) AS last_updated, |
ef8be8ea AD |
1178 | F1.parent_feed, |
1179 | F1.update_interval, | |
365f95dc | 1180 | F1.last_error, |
ef8be8ea AD |
1181 | F1.purge_interval, |
1182 | F1.cat_id, | |
1183 | F2.title AS parent_title, | |
1184 | C1.title AS category, | |
1185 | F1.hidden, | |
400b60d8 AD |
1186 | F1.include_in_digest |
1187 | $show_last_article_qpart | |
ef8be8ea AD |
1188 | FROM |
1189 | ttrss_feeds AS F1 | |
1190 | LEFT JOIN ttrss_feeds AS F2 | |
1191 | ON (F1.parent_feed = F2.id) | |
1192 | LEFT JOIN ttrss_feed_categories AS C1 | |
1193 | ON (F1.cat_id = C1.id) | |
1194 | WHERE | |
1195 | $search_qpart F1.owner_uid = '".$_SESSION["uid"]."' | |
1196 | ORDER by $order_by_qpart"); | |
1197 | ||
1198 | if (db_num_rows($result) != 0) { | |
1199 | ||
1200 | // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; | |
1201 | ||
1202 | print "<p><table width=\"100%\" cellspacing=\"0\" | |
1203 | class=\"prefFeedList\" id=\"prefFeedList\">"; | |
400b60d8 AD |
1204 | print "<tr><td class=\"selectPrompt\" colspan=\"8\">". |
1205 | "<div style='float : right'>". | |
1206 | "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()' | |
1207 | $show_last_article_checked><label | |
1208 | for='show_last_article_times'>".__('Show last article times')."</label></div>". | |
1209 | __('Select:')." | |
e8d0177d AD |
1210 | <a href=\"javascript:selectPrefRows('feed', true)\">".__('All')."</a>, |
1211 | <a href=\"javascript:selectPrefRows('feed', false)\">".__('None')."</a> | |
ef8be8ea AD |
1212 | </td</tr>"; |
1213 | ||
1214 | if (!get_pref($link, 'ENABLE_FEED_CATS')) { | |
1215 | print "<tr class=\"title\"> | |
1216 | <td width='5%' align='center'> </td>"; | |
1217 | ||
1218 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
1219 | print "<td width='3%'> </td>"; | |
1220 | } | |
1221 | ||
c4b0f96c AD |
1222 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
1223 | ||
1224 | if ($show_last_article_info) { | |
1225 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
1226 | } | |
1227 | ||
1228 | print "<td width='20%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
1229 | } |
1230 | ||
1231 | $lnum = 0; | |
1232 | ||
1233 | $cur_cat_id = -1; | |
1234 | ||
1235 | while ($line = db_fetch_assoc($result)) { | |
1236 | ||
1237 | $feed_id = $line["id"]; | |
1238 | $cat_id = $line["cat_id"]; | |
1239 | ||
47439031 AD |
1240 | $edit_title = htmlspecialchars($line["title"]); |
1241 | $edit_cat = htmlspecialchars($line["category"]); | |
ef8be8ea AD |
1242 | |
1243 | $hidden = sql_bool_to_bool($line["hidden"]); | |
1244 | ||
365f95dc AD |
1245 | $last_error = $line["last_error"]; |
1246 | ||
3692e98f | 1247 | if (!$edit_cat) $edit_cat = __("Uncategorized"); |
ef8be8ea AD |
1248 | |
1249 | $last_updated = $line["last_updated"]; | |
1250 | ||
7a74abd5 AD |
1251 | if (!$last_updated) { |
1252 | $last_updated = "—"; | |
1253 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
1254 | $last_updated = smart_date_time(strtotime($last_updated)); |
1255 | } else { | |
1256 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
1257 | $last_updated = date($short_date, strtotime($last_updated)); | |
1258 | } | |
1259 | ||
1260 | $last_article = $line["last_article"]; | |
1261 | ||
7a74abd5 AD |
1262 | if (!$last_article) { |
1263 | $last_article = "—"; | |
1264 | } else if (get_pref($link, 'HEADLINES_SMART_DATE')) { | |
ef8be8ea AD |
1265 | $last_article = smart_date_time(strtotime($last_article)); |
1266 | } else { | |
1267 | $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); | |
1268 | $last_article = date($short_date, strtotime($last_article)); | |
1269 | } | |
1270 | ||
1271 | if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) { | |
1272 | $lnum = 0; | |
1273 | ||
1274 | print "<tr><td colspan=\"6\" class=\"feedEditCat\">$edit_cat</td></tr>"; | |
1275 | ||
1276 | print "<tr class=\"title\"> | |
1277 | <td width='5%'> </td>"; | |
1278 | ||
1279 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { | |
1280 | print "<td width='3%'> </td>"; | |
1281 | } | |
1282 | ||
400b60d8 AD |
1283 | print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>"; |
1284 | ||
1285 | if ($show_last_article_info) { | |
1286 | print "<td width='20%' align='right'> | |
1287 | <a href=\"javascript:updateFeedList('last_article')\">".__('Last Article')."</a></td>"; | |
1288 | } | |
1289 | ||
1290 | print "<td width='20%' align='right'> | |
1291 | <a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>"; | |
ef8be8ea AD |
1292 | |
1293 | $cur_cat_id = $cat_id; | |
1294 | } | |
1295 | ||
1296 | $class = ($lnum % 2) ? "even" : "odd"; | |
1297 | $this_row_id = "id=\"FEEDR-$feed_id\""; | |
1298 | ||
1299 | print "<tr class=\"$class\" $this_row_id>"; | |
1300 | ||
1301 | $icon_file = ICONS_DIR . "/$feed_id.ico"; | |
1302 | ||
1303 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
1304 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/$feed_id.ico\">"; | |
1305 | } else { | |
1306 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
1307 | } | |
1308 | ||
1309 | print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \"feed\");' | |
1310 | type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>"; | |
1311 | ||
a95da136 AD |
1312 | $onclick = "onclick='editFeed($feed_id)' title='".__('Click to edit')."'"; |
1313 | ||
ef8be8ea | 1314 | if (get_pref($link, 'ENABLE_FEED_ICONS')) { |
a95da136 | 1315 | print "<td $onclick class='feedIcon'>$feed_icon</td>"; |
ef8be8ea AD |
1316 | } |
1317 | ||
ef8be8ea | 1318 | if ($hidden) { |
2a52d96f AD |
1319 | $edit_title = "<span class=\"insensitive\">$edit_title ". |
1320 | __('(Hidden)')."</span>"; | |
ef8be8ea AD |
1321 | $last_updated = "<span class=\"insensitive\">$last_updated</span>"; |
1322 | $last_article = "<span class=\"insensitive\">$last_article</span>"; | |
365f95dc AD |
1323 | } |
1324 | ||
1325 | if ($last_error) { | |
1fc77c25 | 1326 | $edit_title = "<span class=\"feed_error\">$edit_title</span>"; |
365f95dc AD |
1327 | $last_updated = "<span class=\"feed_error\">$last_updated</span>"; |
1328 | $last_article = "<span class=\"feed_error\">$last_article</span>"; | |
ef8be8ea AD |
1329 | } |
1330 | ||
1331 | $parent_title = $line["parent_title"]; | |
1332 | if ($parent_title) { | |
2a52d96f AD |
1333 | $linked_to = sprintf(__("(linked to %s)"), $parent_title); |
1334 | $parent_title = "<span class='groupPrompt'>$linked_to</span>"; | |
ef8be8ea AD |
1335 | } |
1336 | ||
a95da136 | 1337 | print "<td $onclick>" . "$edit_title $parent_title" . "</td>"; |
ef8be8ea | 1338 | |
400b60d8 | 1339 | if ($show_last_article_info) { |
a95da136 AD |
1340 | print "<td align='right' $onclick>" . |
1341 | "$last_article</td>"; | |
400b60d8 | 1342 | } |
ef8be8ea | 1343 | |
fe5bfa00 | 1344 | print "<td $onclick align='right'>$last_updated</td>"; |
ef8be8ea AD |
1345 | |
1346 | print "</tr>"; | |
1347 | ||
1348 | ++$lnum; | |
1349 | } | |
1350 | ||
1351 | print "</table>"; | |
1352 | ||
e88a65f4 | 1353 | print "<p>"; |
c4a36709 | 1354 | |
19d96beb AD |
1355 | print "<div id=\"feedOpToolbar\">"; |
1356 | ||
1357 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
1358 | ||
1359 | print __('Selection:') . " "; | |
1360 | ||
1361 | print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled"); | |
1362 | ||
1363 | print " <input type=\"submit\" class=\"button\" disabled=\"true\" | |
1364 | onclick=\"javascript:categorizeSelectedFeeds()\" value=\"". | |
1365 | __('Recategorize')."\">"; | |
1366 | } | |
1367 | ||
1368 | print "</div>"; | |
1369 | ||
c4a36709 AD |
1370 | print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\"> |
1371 | <option value=\"facDefault\" selected>".__('Actions...')."</option> | |
2b38f79c AD |
1372 | <option disabled>--------</option> |
1373 | <option style=\"color : #5050aa\" disabled>".__('Selection:')."</option> | |
1374 | <option value=\"facEdit\"> ".__('Edit')."</option>"; | |
8f708155 AD |
1375 | |
1376 | if (FORCE_ARTICLE_PURGE == 0) { | |
1377 | ||
2b38f79c | 1378 | "<option value=\"facPurge\"> ".__('Manual purge')."</option>"; |
8f708155 AD |
1379 | } |
1380 | ||
1381 | print " | |
2b38f79c AD |
1382 | <option value=\"facClear\"> ".__('Clear feed data')."</option> |
1383 | <option value=\"facRescore\"> ".__('Rescore articles')."</option> | |
1384 | <option value=\"facUnsubscribe\"> ".__('Unsubscribe')."</option>"; | |
2b60628a | 1385 | |
c4a36709 AD |
1386 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
1387 | ||
2b38f79c AD |
1388 | print "<option disabled>--------</option> |
1389 | <option style=\"color : #5050aa\" disabled>".__('Other:')."</option> | |
1390 | <option value=\"facEditCats\"> ".__('Edit categories')." | |
1391 | </option>"; | |
c4a36709 AD |
1392 | } |
1393 | ||
19d96beb | 1394 | print "</select>"; |
ef8be8ea AD |
1395 | } |
1396 | ||
a3c159c4 | 1397 | print "<h3>".__('OPML')."</h3> |
94a4ba88 AD |
1398 | |
1399 | <div style='float : left'> | |
ef8be8ea | 1400 | <form enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\"> |
999703d1 AD |
1401 | ".__('File:')." <input id=\"opml_file\" name=\"opml_file\" type=\"file\"> |
1402 | <input type=\"hidden\" name=\"op\" value=\"Import\"> | |
1403 | <input class=\"button\" onclick=\"return validateOpmlImport();\" | |
a3c159c4 | 1404 | type=\"submit\" value=\"".__('Import')."\"> |
94a4ba88 AD |
1405 | </form></div>"; |
1406 | ||
3692e98f | 1407 | print " "; |
94a4ba88 AD |
1408 | |
1409 | print "<input type=\"submit\" | |
1410 | class=\"button\" onclick=\"gotoExportOpml()\" | |
a3c159c4 | 1411 | value=\"".__('Export OPML')."\">"; |
94a4ba88 | 1412 | |
e4f4b46f | 1413 | |
755a43ee AD |
1414 | print "<h3>" . __("Firefox Integration") . "</h3>"; |
1415 | ||
1416 | print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.'); | |
cff7a3a2 | 1417 | print "</p><p> <a class='visibleLinkB' href='javascript:window.navigator.registerContentHandler(" . |
755a43ee AD |
1418 | "\"application/vnd.mozilla.maybe.feed\", " . |
1419 | "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" . | |
1420 | __('Click here to register this site as a feed reader.') . "</a></p>"; | |
1421 | ||
1422 | ||
e400230e | 1423 | print "<h3>".__("Published articles")."</h3>"; |
e4f4b46f AD |
1424 | |
1425 | if (!get_pref($link, "_PREFS_PUBLISH_KEY")) { | |
1426 | set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key()); | |
1427 | } | |
1428 | ||
e635d56a | 1429 | print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>"; |
e4f4b46f | 1430 | |
f56e3080 | 1431 | $url_path = article_publish_url($link); |
e4f4b46f | 1432 | |
e0142e27 | 1433 | print "<p><a class=\"visibleLinkB\" id=\"pubGenAddress\" target=\"_blank\" href=\"$url_path\">".__("Link to published articles feed.")."</a></p>"; |
e4f4b46f | 1434 | |
8a8f7c55 | 1435 | print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\" class=\"button\" |
e635d56a AD |
1436 | value=\"".__('Generate another link')."\">"; |
1437 | /* print " <input type=\"submit\" onclick=\"return pubToClipboard()\" class=\"button\" | |
1438 | value=\"".__('Copy link to clipboard')."\">"; */ | |
1439 | print "</p>"; | |
e4f4b46f | 1440 | |
ef8be8ea | 1441 | } |
b56465dd AD |
1442 | |
1443 | function print_feed_browser($link, $search, $limit) { | |
1444 | ||
c2913898 AD |
1445 | $owner_uid = $_SESSION["uid"]; |
1446 | ||
1447 | if ($search) { | |
1448 | $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR | |
1449 | UPPER(title) LIKE UPPER('%$search%'))"; | |
1450 | } else { | |
1451 | $search_qpart = ""; | |
1452 | } | |
1453 | ||
b56465dd AD |
1454 | $result = db_query($link, "SELECT feed_url, subscribers FROM |
1455 | ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf | |
c2913898 AD |
1456 | WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url |
1457 | AND owner_uid = '$owner_uid') $search_qpart | |
1458 | ORDER BY subscribers DESC LIMIT $limit"); | |
b56465dd AD |
1459 | |
1460 | $feedctr = 0; | |
1461 | ||
1462 | while ($line = db_fetch_assoc($result)) { | |
1463 | $feed_url = $line["feed_url"]; | |
1464 | $subscribers = $line["subscribers"]; | |
1465 | ||
1466 | $det_result = db_query($link, "SELECT site_url,title,id | |
1467 | FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1"); | |
1468 | ||
1469 | $details = db_fetch_assoc($det_result); | |
1470 | ||
1471 | $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico"; | |
1472 | ||
1473 | if (file_exists($icon_file) && filesize($icon_file) > 0) { | |
1474 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . | |
1475 | "/".$details["id"].".ico\">"; | |
1476 | } else { | |
1477 | $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; | |
1478 | } | |
1479 | ||
1480 | $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB' | |
1481 | type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">"; | |
1482 | ||
1483 | $class = ($feedctr % 2) ? "even" : "odd"; | |
1484 | ||
2bab8824 AD |
1485 | if ($details["site_url"]) { |
1486 | $site_url = "<a target=\"_blank\" href=\"".$details["site_url"]."\"> | |
1487 | <img style='border-width : 0px' src='images/www.png' alt='www'></a>"; | |
1488 | } else { | |
1489 | $site_url = ""; | |
1490 | } | |
1491 | ||
b56465dd AD |
1492 | print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box". |
1493 | "$feed_icon " . $details["title"] . | |
2bab8824 AD |
1494 | " <span class='subscribers'>($subscribers)</span> |
1495 | $site_url | |
1496 | </li>"; | |
b56465dd AD |
1497 | |
1498 | ++$feedctr; | |
1499 | } | |
1500 | ||
1501 | if ($feedctr == 0) { | |
1502 | print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>"; | |
1503 | } | |
1504 | ||
1505 | return $feedctr; | |
1506 | ||
1507 | } | |
ef8be8ea | 1508 | ?> |