3 function batch_edit_cbox($elem, $label = false) {
4 print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\"
5 onchange=\"batchFeedsToggleField(this, '$elem', '$label')\">";
8 function module_pref_feeds($link) {
10 global $update_intervals;
11 global $purge_intervals;
12 global $update_methods;
14 $subop = $_REQUEST["subop"];
15 $quiet = $_REQUEST["quiet"];
16 $mode = $_REQUEST["mode"];
18 if ($subop == "renamecat") {
19 $title = db_escape_string($_REQUEST['title']);
20 $id = db_escape_string($_REQUEST['id']);
23 db_query($link, "UPDATE ttrss_feed_categories SET
24 title = '$title' WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
29 if ($subop == "getfeedtree") {
33 $root['name'] = __('Feeds');
34 $root['items'] = array();
36 if (get_pref($link, 'ENABLE_FEED_CATS')) {
38 $result = db_query($link, "SELECT id, title FROM ttrss_feed_categories
39 WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title");
41 while ($line = db_fetch_assoc($result)) {
43 $cat['id'] = 'CAT:' . $line['id'];
44 $cat['bare_id'] = $feed_id;
45 $cat['name'] = $line['title'];
46 $cat['items'] = array();
48 $feed_result = db_query($link, "SELECT id, title FROM ttrss_feeds
49 WHERE cat_id = '".$line['id']."' AND owner_uid = ".$_SESSION["uid"].
50 " ORDER BY order_id, title");
52 while ($feed_line = db_fetch_assoc($feed_result)) {
54 $feed['id'] = 'FEED:' . $feed_line['id'];
55 $feed['bare_id'] = $feed_line['id'];
56 $feed['name'] = $feed_line['title'];
57 $feed['checkbox'] = false;
58 array_push($cat['items'], $feed);
61 array_push($root['items'], $cat);
64 /* Uncategorized is a special case */
69 $cat['name'] = __("Uncategorized");
70 $cat['items'] = array();
72 $feed_result = db_query($link, "SELECT id, title FROM ttrss_feeds
73 WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"].
74 " ORDER BY order_id, title");
76 while ($feed_line = db_fetch_assoc($feed_result)) {
78 $feed['id'] = 'FEED:' . $feed_line['id'];
79 $feed['bare_id'] = $feed_line['id'];
80 $feed['name'] = $feed_line['title'];
81 $feed['checkbox'] = false;
82 array_push($cat['items'], $feed);
85 array_push($root['items'], $cat);
87 $feed_result = db_query($link, "SELECT id, title FROM ttrss_feeds
88 WHERE owner_uid = ".$_SESSION["uid"].
89 " ORDER BY order_id, title");
91 while ($feed_line = db_fetch_assoc($feed_result)) {
93 $feed['id'] = 'FEED:' . $feed_line['id'];
94 $feed['bare_id'] = $feed_line['id'];
95 $feed['name'] = $feed_line['title'];
96 $feed['checkbox'] = false;
97 array_push($root['items'], $feed);
102 $fl['identifier'] = 'id';
103 $fl['label'] = 'name';
104 $fl['items'] = array($root);
106 print json_encode($fl);
110 if ($subop == "catsortreset") {
111 db_query($link, "UPDATE ttrss_feed_categories
112 SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
116 if ($subop == "feedsortreset") {
117 db_query($link, "UPDATE ttrss_feeds
118 SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
122 if ($subop == "savefeedorder") {
123 if ($_POST['payload']) {
124 file_put_contents("/tmp/blahblah.txt", $_POST['payload']);
127 $data = file_get_contents("/tmp/blahblah.txt");
128 $data = json_decode($data, true);
130 if (is_array($data) && is_array($data['items'])) {
135 foreach ($data['items'] as $item) {
136 $data_map[$item['id']] =& $item['items'];
139 foreach ($data['items'][0]['items'] as $item) {
140 $id = $item['_reference'];
141 $bare_id = substr($id, strpos($id, ':')+1);
146 db_query($link, "UPDATE ttrss_feed_categories
147 SET order_id = '$cat_order_id' WHERE id = '$bare_id' AND
148 owner_uid = " . $_SESSION["uid"]);
153 if (is_array($data_map[$id])) {
154 foreach ($data_map[$id] as $feed) {
155 $id = $feed['_reference'];
156 $bare_id = substr($id, strpos($id, ':')+1);
158 db_query($link, "UPDATE ttrss_feeds
159 SET order_id = '$feed_order_id' WHERE id = '$bare_id' AND
160 owner_uid = " . $_SESSION["uid"]);
171 if ($subop == "removeicon") {
172 $feed_id = db_escape_string($_REQUEST["feed_id"]);
174 $result = db_query($link, "SELECT id FROM ttrss_feeds
175 WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
177 if (db_num_rows($result) != 0) {
178 unlink(ICONS_DIR . "/$feed_id.ico");
184 if ($subop == "uploadicon") {
185 $icon_file = $_FILES['icon_file']['tmp_name'];
186 $feed_id = db_escape_string($_REQUEST["feed_id"]);
188 if (is_file($icon_file) && $feed_id) {
189 if (filesize($icon_file) < 20000) {
191 $result = db_query($link, "SELECT id FROM ttrss_feeds
192 WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
194 if (db_num_rows($result) != 0) {
195 unlink(ICONS_DIR . "/$feed_id.ico");
196 move_uploaded_file($icon_file, ICONS_DIR . "/$feed_id.ico");
208 print "<script type=\"text/javascript\">";
209 print "parent.uploadIconHandler($rc);";
214 if ($subop == "editfeed") {
215 header("Content-Type: text/xml");
217 print "<dlg id=\"$subop\">";
218 print "<title>".__('Feed Editor')."</title>";
219 print "<content><![CDATA[";
221 $feed_id = db_escape_string($_REQUEST["id"]);
223 $result = db_query($link,
224 "SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
225 owner_uid = " . $_SESSION["uid"]);
227 $title = htmlspecialchars(db_fetch_result($result,
230 $icon_file = ICONS_DIR . "/$feed_id.ico";
232 if (file_exists($icon_file) && filesize($icon_file) > 0) {
233 $feed_icon = "<img width=\"16\" height=\"16\"
234 src=\"" . ICONS_URL . "/$feed_id.ico\">";
239 print "<form id=\"edit_feed_form\" onsubmit=\"return false\">";
241 print "<input type=\"hidden\" name=\"id\" value=\"$feed_id\">";
242 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
243 print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">";
245 print "<div class=\"dlgSec\">".__("Feed")."</div>";
246 print "<div class=\"dlgSecCont\">";
250 print "<input style=\"font-size : 16px\" size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
251 name=\"title\" value=\"$title\">";
255 $feed_url = db_fetch_result($result, 0, "feed_url");
256 $feed_url = htmlspecialchars(db_fetch_result($result,
261 print __('URL:') . " ";
262 print "<input size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
263 name=\"feed_url\" value=\"$feed_url\">";
267 if (get_pref($link, 'ENABLE_FEED_CATS')) {
269 $cat_id = db_fetch_result($result, 0, "cat_id");
273 print __('Place in category:') . " ";
275 print_feed_cat_select($link, "cat_id", $cat_id, $disabled);
280 print "<div class=\"dlgSec\">".__("Update")."</div>";
281 print "<div class=\"dlgSecCont\">";
283 /* Update Interval */
285 $update_interval = db_fetch_result($result, 0, "update_interval");
287 print_select_hash("update_interval", $update_interval, $update_intervals);
291 $update_method = db_fetch_result($result, 0, "update_method");
293 print " " . __('using') . " ";
294 print_select_hash("update_method", $update_method, $update_methods);
296 $purge_interval = db_fetch_result($result, 0, "purge_interval");
298 if (FORCE_ARTICLE_PURGE == 0) {
304 print __('Article purging:') . " ";
306 print_select_hash("purge_interval", $purge_interval, $purge_intervals);
309 print "<input type='hidden' name='purge_interval' value='$purge_interval'>";
314 print "<div class=\"dlgSec\">".__("Authentication")."</div>";
315 print "<div class=\"dlgSecCont\">";
317 $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login"));
321 print "<tr><td>" . __('Login:') . "</td><td>";
323 print "<input size=\"20\" onkeypress=\"return filterCR(event, feedEditSave)\"
324 name=\"auth_login\" value=\"$auth_login\">";
326 print "</tr><tr><td>" . __("Password:") . "</td><td>";
328 $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass"));
330 print "<input size=\"20\" type=\"password\" name=\"auth_pass\"
331 onkeypress=\"return filterCR(event, feedEditSave)\"
332 value=\"$auth_pass\">";
334 print "</td></tr></table>";
337 print "<div class=\"dlgSec\">".__("Options")."</div>";
338 print "<div class=\"dlgSecCont\">";
340 print "<div style=\"line-height : 100%\">";
342 $private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
345 $checked = "checked";
350 print "<input type=\"checkbox\" name=\"private\" id=\"private\"
351 $checked> <label for=\"private\">".__('Hide from Popular feeds')."</label>";
353 $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
356 $checked = "checked";
361 print "<br/><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
362 $checked> <label for=\"rtl_content\">".__('Right-to-left content')."</label>";
364 $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest"));
366 if ($include_in_digest) {
367 $checked = "checked";
372 print "<br/><input type=\"checkbox\" id=\"include_in_digest\"
373 name=\"include_in_digest\"
374 $checked> <label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
377 $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
379 if ($always_display_enclosures) {
380 $checked = "checked";
385 print "<br/><input type=\"checkbox\" id=\"always_display_enclosures\"
386 name=\"always_display_enclosures\"
387 $checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
390 $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
393 $checked = "checked";
398 if (SIMPLEPIE_CACHE_IMAGES) {
402 $disabled = "disabled";
403 $label_class = "class='insensitive'";
406 print "<br/><input type=\"checkbox\" id=\"cache_images\"
407 name=\"cache_images\" $disabled
408 $checked> <label $label_class for=\"cache_images\">".
409 __('Cache images locally')."</label>";
421 print "<div class=\"dlgSec\">".__("Icon")."</div>";
422 print "<div class=\"dlgSecCont\">";
424 print "<iframe name=\"icon_upload_iframe\"
425 style=\"width: 400px; height: 100px; display: none;\"></iframe>";
427 print "<form style='display : block' target=\"icon_upload_iframe\"
428 enctype=\"multipart/form-data\" method=\"POST\"
429 action=\"backend.php\">
430 <input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\">
431 <input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
432 <input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
433 <input type=\"hidden\" name=\"subop\" value=\"uploadicon\">
434 <button onclick=\"return uploadFeedIcon();\"
435 type=\"submit\">".__('Replace')."</button>
436 <button onclick=\"return removeFeedIcon($feed_id);\"
437 type=\"submit\">".__('Remove')."</button>
442 $title = htmlspecialchars($title, ENT_QUOTES);
444 print "<div class='dlgButtons'>
445 <div style=\"float : left\">
446 <button onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
447 __('Unsubscribe')."</button>
449 <button onclick=\"return feedEditSave()\">".__('Save')."</button>
450 <button onclick=\"return feedEditCancel()\">".__('Cancel')."</button>
453 print "]]></content></dlg>";
458 if ($subop == "editfeeds") {
460 $feed_ids = db_escape_string($_REQUEST["ids"]);
462 header("Content-Type: text/xml");
463 print "<dlg id=\"$subop\">";
464 print "<title>".__('Multiple Feed Editor')."</title>";
465 print "<content><![CDATA[";
467 print "<form id=\"batch_edit_feed_form\" onsubmit=\"return false\">";
469 print "<input type=\"hidden\" name=\"ids\" value=\"$feed_ids\">";
470 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
471 print "<input type=\"hidden\" name=\"subop\" value=\"batchEditSave\">";
473 print "<div class=\"dlgSec\">".__("Feed")."</div>";
474 print "<div class=\"dlgSecCont\">";
478 print "<input disabled style=\"font-size : 16px\" size=\"35\" onkeypress=\"return filterCR(event, feedEditSave)\"
479 name=\"title\" value=\"$title\">";
481 batch_edit_cbox("title");
487 print __('URL:') . " ";
488 print "<input disabled size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
489 name=\"feed_url\" value=\"$feed_url\">";
491 batch_edit_cbox("feed_url");
495 if (get_pref($link, 'ENABLE_FEED_CATS')) {
499 print __('Place in category:') . " ";
501 print_feed_cat_select($link, "cat_id", $cat_id, "disabled");
503 batch_edit_cbox("cat_id");
509 print "<div class=\"dlgSec\">".__("Update")."</div>";
510 print "<div class=\"dlgSecCont\">";
512 /* Update Interval */
514 print_select_hash("update_interval", $update_interval, $update_intervals,
517 batch_edit_cbox("update_interval");
521 print " " . __('using') . " ";
522 print_select_hash("update_method", $update_method, $update_methods,
524 batch_edit_cbox("update_method");
528 if (FORCE_ARTICLE_PURGE != 0) {
532 print __('Article purging:') . " ";
534 print_select_hash("purge_interval", $purge_interval, $purge_intervals,
537 batch_edit_cbox("purge_interval");
541 print "<div class=\"dlgSec\">".__("Authentication")."</div>";
542 print "<div class=\"dlgSecCont\">";
544 print __('Login:') . " ";
545 print "<input disabled size=\"15\" onkeypress=\"return filterCR(event, feedEditSave)\"
546 name=\"auth_login\" value=\"$auth_login\">";
548 batch_edit_cbox("auth_login");
550 print " " . __("Password:") . " ";
552 print "<input disabled size=\"15\" type=\"password\" name=\"auth_pass\"
553 onkeypress=\"return filterCR(event, feedEditSave)\"
554 value=\"$auth_pass\">";
556 batch_edit_cbox("auth_pass");
559 print "<div class=\"dlgSec\">".__("Options")."</div>";
560 print "<div class=\"dlgSecCont\">";
562 print "<div style=\"line-height : 100%\">";
564 print "<input disabled type=\"checkbox\" name=\"private\" id=\"private\"
565 $checked> <label id=\"private_l\" class='insensitive' for=\"private\">".__('Hide from Popular feeds')."</label>";
567 print " "; batch_edit_cbox("private", "private_l");
569 print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
570 $checked> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>";
572 print " "; batch_edit_cbox("rtl_content", "rtl_content_l");
574 print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\"
575 name=\"include_in_digest\"
576 $checked> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
578 print " "; batch_edit_cbox("include_in_digest", "include_in_digest_l");
580 print "<br/><input disabled type=\"checkbox\" id=\"always_display_enclosures\"
581 name=\"always_display_enclosures\"
582 $checked> <label id=\"always_display_enclosures_l\" class='insensitive' for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
584 print " "; batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
586 print "<br/><input disabled type=\"checkbox\" id=\"cache_images\"
587 name=\"cache_images\"
588 $checked> <label class='insensitive' id=\"cache_images_l\"
589 for=\"cache_images\">".
590 __('Cache images locally')."</label>";
593 if (SIMPLEPIE_CACHE_IMAGES) {
594 print " "; batch_edit_cbox("cache_images", "cache_images_l");
602 print "<div class='dlgButtons'>
603 <input type=\"submit\" class=\"button\"
604 onclick=\"return feedsEditSave()\" value=\"".__('Save')."\">
605 <input type='submit' class='button'
606 onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\">
609 print "]]></content></dlg>";
614 if ($subop == "editSave" || $subop == "batchEditSave") {
616 $feed_title = db_escape_string(trim($_POST["title"]));
617 $feed_link = db_escape_string(trim($_POST["feed_url"]));
618 $upd_intl = db_escape_string($_POST["update_interval"]);
619 $purge_intl = db_escape_string($_POST["purge_interval"]);
620 $feed_id = db_escape_string($_POST["id"]); /* editSave */
621 $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */
622 $cat_id = db_escape_string($_POST["cat_id"]);
623 $auth_login = db_escape_string(trim($_POST["auth_login"]));
624 $auth_pass = db_escape_string(trim($_POST["auth_pass"]));
625 $private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
626 $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
627 $include_in_digest = checkbox_to_sql_bool(
628 db_escape_string($_POST["include_in_digest"]));
629 $cache_images = checkbox_to_sql_bool(
630 db_escape_string($_POST["cache_images"]));
631 $update_method = (int) db_escape_string($_POST["update_method"]);
633 $always_display_enclosures = checkbox_to_sql_bool(
634 db_escape_string($_POST["always_display_enclosures"]));
636 if (get_pref($link, 'ENABLE_FEED_CATS')) {
637 if ($cat_id && $cat_id != 0) {
638 $category_qpart = "cat_id = '$cat_id',";
639 $category_qpart_nocomma = "cat_id = '$cat_id'";
641 $category_qpart = 'cat_id = NULL,';
642 $category_qpart_nocomma = 'cat_id = NULL';
645 $category_qpart = "";
646 $category_qpart_nocomma = "";
649 if (SIMPLEPIE_CACHE_IMAGES) {
650 $cache_images_qpart = "cache_images = $cache_images,";
652 $cache_images_qpart = "";
655 if ($subop == "editSave") {
657 $result = db_query($link, "UPDATE ttrss_feeds SET
659 title = '$feed_title', feed_url = '$feed_link',
660 update_interval = '$upd_intl',
661 purge_interval = '$purge_intl',
662 auth_login = '$auth_login',
663 auth_pass = '$auth_pass',
665 rtl_content = $rtl_content,
667 include_in_digest = $include_in_digest,
668 always_display_enclosures = $always_display_enclosures,
669 update_method = '$update_method'
670 WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
672 } else if ($subop == "batchEditSave") {
673 $feed_data = array();
675 foreach (array_keys($_POST) as $k) {
676 if ($k != "op" && $k != "subop" && $k != "ids") {
677 $feed_data[$k] = $_POST[$k];
681 db_query($link, "BEGIN");
683 foreach (array_keys($feed_data) as $k) {
689 $qpart = "title = '$feed_title'";
693 $qpart = "feed_url = '$feed_link'";
696 case "update_interval":
697 $qpart = "update_interval = '$upd_intl'";
700 case "purge_interval":
701 $qpart = "purge_interval = '$purge_intl'";
705 $qpart = "auth_login = '$auth_login'";
709 $qpart = "auth_pass = '$auth_pass'";
713 $qpart = "private = '$private'";
716 case "include_in_digest":
717 $qpart = "include_in_digest = '$include_in_digest'";
720 case "always_display_enclosures":
721 $qpart = "always_display_enclosures = '$always_display_enclosures'";
725 $qpart = "cache_images = '$cache_images'";
729 $qpart = "rtl_content = '$rtl_content'";
732 case "update_method":
733 $qpart = "update_method = '$update_method'";
737 $qpart = $category_qpart_nocomma;
744 "UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids)
745 AND owner_uid = " . $_SESSION["uid"]);
750 db_query($link, "COMMIT");
755 if ($subop == "remove") {
757 $ids = split(",", db_escape_string($_REQUEST["ids"]));
759 foreach ($ids as $id) {
760 remove_feed($link, $id, $_SESSION["uid"]);
766 if ($subop == "clear") {
767 $id = db_escape_string($_REQUEST["id"]);
768 clear_feed_articles($link, $id);
771 if ($subop == "rescore") {
772 $ids = split(",", db_escape_string($_REQUEST["ids"]));
774 foreach ($ids as $id) {
776 $filters = load_filters($link, $id, $_SESSION["uid"], 6);
778 $result = db_query($link, "SELECT
779 title, content, link, ref_id, author,".
780 SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
782 ttrss_user_entries, ttrss_entries
783 WHERE ref_id = id AND feed_id = '$id' AND
784 owner_uid = " .$_SESSION['uid']."
789 while ($line = db_fetch_assoc($result)) {
791 $tags = get_article_tags($link, $line["ref_id"]);
793 $article_filters = get_article_filters($filters, $line['title'],
794 $line['content'], $line['link'], strtotime($line['updated']),
795 $line['author'], $tags);
797 $new_score = calculate_article_score($article_filters);
799 if (!$scores[$new_score]) $scores[$new_score] = array();
801 array_push($scores[$new_score], $line['ref_id']);
804 foreach (array_keys($scores) as $s) {
806 db_query($link, "UPDATE ttrss_user_entries SET score = '$s',
808 ref_id IN (" . join(',', $scores[$s]) . ")");
809 } else if ($s < -500) {
810 db_query($link, "UPDATE ttrss_user_entries SET score = '$s',
812 ref_id IN (" . join(',', $scores[$s]) . ")");
814 db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
815 ref_id IN (" . join(',', $scores[$s]) . ")");
820 print __("All done.");
824 if ($subop == "rescoreAll") {
826 $result = db_query($link,
827 "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
829 while ($feed_line = db_fetch_assoc($result)) {
831 $id = $feed_line["id"];
833 $filters = load_filters($link, $id, $_SESSION["uid"], 6);
835 $tmp_result = db_query($link, "SELECT
836 title, content, link, ref_id, author,".
837 SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
839 ttrss_user_entries, ttrss_entries
840 WHERE ref_id = id AND feed_id = '$id' AND
841 owner_uid = " .$_SESSION['uid']."
846 while ($line = db_fetch_assoc($tmp_result)) {
848 $tags = get_article_tags($link, $line["ref_id"]);
850 $article_filters = get_article_filters($filters, $line['title'],
851 $line['content'], $line['link'], strtotime($line['updated']),
852 $line['author'], $tags);
854 $new_score = calculate_article_score($article_filters);
856 if (!$scores[$new_score]) $scores[$new_score] = array();
858 array_push($scores[$new_score], $line['ref_id']);
861 foreach (array_keys($scores) as $s) {
863 db_query($link, "UPDATE ttrss_user_entries SET score = '$s',
865 ref_id IN (" . join(',', $scores[$s]) . ")");
867 db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
868 ref_id IN (" . join(',', $scores[$s]) . ")");
873 print __("All done.");
877 if ($subop == "add") {
879 $feed_url = db_escape_string(trim($_REQUEST["feed_url"]));
880 $cat_id = db_escape_string($_REQUEST["cat_id"]);
881 $p_from = db_escape_string($_REQUEST["from"]);
883 /* only read authentication information from POST */
885 $auth_login = db_escape_string(trim($_POST["auth_login"]));
886 $auth_pass = db_escape_string(trim($_POST["auth_pass"]));
888 if ($p_from != 'tt-rss') {
891 <title>Tiny Tiny RSS</title>
892 <link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\">
895 <img class=\"floatingLogo\" src=\"images/ttrss_logo.png\"
896 alt=\"Tiny Tiny RSS\"/>
897 <h1>Subscribe to feed...</h1>";
900 $rc = subscribe_to_feed($link, $feed_url, $cat_id, $auth_login, $auth_pass);
904 print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
907 print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
910 print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
914 if ($p_from != 'tt-rss') {
915 $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]);
918 $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]);
920 $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE
921 feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]);
923 $feed_id = db_fetch_result($result, 0, "id");
928 print "<form method=\"GET\" style='display: inline'
930 <input type=\"hidden\" name=\"tab\" value=\"feedConfig\">
931 <input type=\"hidden\" name=\"subop\" value=\"editFeed\">
932 <input type=\"hidden\" name=\"subopparam\" value=\"$feed_id\">
933 <input type=\"submit\" value=\"".__("Edit subscription options")."\">
937 print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\">
938 <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
941 print "</body></html>";
946 if ($subop == "categorize") {
949 $ids = split(",", db_escape_string($_REQUEST["ids"]));
951 $cat_id = db_escape_string($_REQUEST["cat_id"]);
954 $cat_id_qpart = 'NULL';
956 $cat_id_qpart = "'$cat_id'";
959 db_query($link, "BEGIN");
961 foreach ($ids as $id) {
963 db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
965 AND owner_uid = " . $_SESSION["uid"]);
969 db_query($link, "COMMIT");
973 if ($subop == "editCats") {
975 $action = $_REQUEST["action"];
977 if ($action == "save") {
979 $cat_title = db_escape_string(trim($_REQUEST["value"]));
980 $cat_id = db_escape_string($_REQUEST["cid"]);
982 db_query($link, "BEGIN");
984 $result = db_query($link, "SELECT title FROM ttrss_feed_categories
985 WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]);
987 if (db_num_rows($result) == 1) {
989 $old_title = db_fetch_result($result, 0, "title");
991 if ($cat_title != "") {
992 $result = db_query($link, "UPDATE ttrss_feed_categories SET
993 title = '$cat_title' WHERE id = '$cat_id' AND
994 owner_uid = ".$_SESSION["uid"]);
1001 print $_REQUEST["value"];
1004 db_query($link, "COMMIT");
1010 header("Content-Type: text/xml");
1011 print "<dlg id=\"$subop\">";
1012 print "<title>".__('Category editor')."</title>";
1013 print "<content><![CDATA[";
1015 if ($action == "add") {
1017 $feed_cat = db_escape_string(trim($_REQUEST["cat"]));
1019 if (!add_feed_category($link, $feed_cat))
1020 print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.", $feed_cat));
1024 if ($action == "remove") {
1026 $ids = split(",", db_escape_string($_REQUEST["ids"]));
1028 foreach ($ids as $id) {
1029 remove_feed_category($link, $id, $_SESSION["uid"]);
1034 <input id=\"fadd_cat\"
1035 onkeypress=\"return filterCR(event, addFeedCat)\"
1037 <button onclick=\"addFeedCat()\">".
1038 __('Create category')."</button></div>";
1040 $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories
1041 WHERE owner_uid = ".$_SESSION["uid"]."
1046 if (db_num_rows($result) != 0) {
1048 print __('Select:')."
1049 <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>,
1050 <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('None')."</a>";
1052 print "<div class=\"prefFeedCatHolder\">";
1054 print "<form id=\"feed_cat_edit_form\" onsubmit=\"return false\">";
1056 print "<table width=\"100%\" class=\"prefFeedCatList\"
1057 cellspacing=\"0\" id=\"prefFeedCatList\">";
1061 while ($line = db_fetch_assoc($result)) {
1063 $class = ($lnum % 2) ? "even" : "odd";
1065 $cat_id = $line["id"];
1066 $this_row_id = "id=\"FCATR-$cat_id\"";
1068 print "<tr class=\"$class\" $this_row_id>";
1070 $edit_title = htmlspecialchars($line["title"]);
1072 print "<td width='5%' align='center'><input
1073 onclick='toggleSelectRow(this);'
1074 type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>";
1076 print "<td><span id=\"FCATT-$cat_id\">" .
1077 $edit_title . "</span></td>";
1091 print "<p>".__('No feed categories defined.')."</p>";
1094 print "<div class='dlgButtons'>
1095 <div style='float : left'>
1096 <button onclick=\"return removeSelectedFeedCats()\">".
1097 __('Remove')."</button>
1100 print "<button onclick=\"selectTab('feedConfig')\">".
1101 __('Close this window')."</button></div>";
1103 print "]]></content></dlg>";
1111 print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
1112 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Feeds')."\">";
1114 set_pref($link, "_PREFS_ACTIVE_TAB", "feedConfig");
1116 $result = db_query($link, "SELECT COUNT(id) AS num_errors
1117 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
1119 $num_errors = db_fetch_result($result, 0, "num_errors");
1121 if ($num_errors > 0) {
1123 $error_button = "<button dojoType=\"dijit.form.Button\"
1124 onclick=\"showFeedsWithErrors\" id=\"errorButton\">" .
1125 __("Feeds with errors") . "</button>";
1127 // print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
1128 // __('Some feeds have update errors (click for details)')."</a>");
1131 $feed_search = db_escape_string($_REQUEST["search"]);
1133 if (array_key_exists("search", $_REQUEST)) {
1134 $_SESSION["prefs_feed_search"] = $feed_search;
1136 $feed_search = $_SESSION["prefs_feed_search"];
1139 print "<div dojoType=\"dijit.Toolbar\">";
1142 print "<div style='float : right'>
1143 <input id=\"feed_search\" size=\"20\" type=\"search\"
1144 onfocus=\"disableHotkeys();\"
1145 onblur=\"enableHotkeys();\"
1146 onchange=\"updateFeedList()\" value=\"$feed_search\">
1147 <button onclick=\"updateFeedList()\">".
1148 __('Search')."</button>
1151 print "<div dojoType=\"dijit.form.DropDownButton\">".
1152 "<span>" . __('Select')."</span>";
1153 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1154 print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\"
1155 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
1156 print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(false)\"
1157 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
1158 print "</div></div>";
1160 print "<div dojoType=\"dijit.form.DropDownButton\">".
1161 "<span>" . __('Feeds')."</span>";
1162 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1163 print "<div onclick=\"quickAddFeed()\"
1164 dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>";
1165 print "<div onclick=\"editSelectedFeed()\"
1166 dojoType=\"dijit.MenuItem\">".__('Edit feeds')."</div>";
1167 print "<div onclick=\"resetFeedOrder()\"
1168 dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
1169 print "</div></div>";
1171 if (get_pref($link, 'ENABLE_FEED_CATS')) {
1172 print "<div dojoType=\"dijit.form.DropDownButton\">".
1173 "<span>" . __('Categories')."</span>";
1174 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
1175 print "<div onclick=\"editFeedCats()\"
1176 dojoType=\"dijit.MenuItem\">".__('Edit categories')."</div>";
1177 print "<div onclick=\"resetCatOrder()\"
1178 dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
1179 print "</div></div>";
1183 print $error_button;
1185 print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">"
1186 .__('Unsubscribe')."</button dojoType=\"dijit.form.Button\"> ";
1188 if (defined('_ENABLE_FEED_DEBUGGING')) {
1190 print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">
1191 <option value=\"facDefault\" selected>".__('More actions...')."</option>";
1193 if (FORCE_ARTICLE_PURGE == 0) {
1195 "<option value=\"facPurge\">".__('Manual purge')."</option>";
1199 <option value=\"facClear\">".__('Clear feed data')."</option>
1200 <option value=\"facRescore\">".__('Rescore articles')."</option>";
1206 print "</div>"; # toolbar
1208 print "<div id=\"feedlistLoading\">
1209 <img src='images/indicator_tiny.gif'>".
1210 __("Loading, please wait...")."</div>";
1212 print "<div dojoType=\"fox.PrefFeedStore\" jsId=\"feedStore\"
1213 url=\"backend.php?op=pref-feeds&subop=getfeedtree\">
1215 <div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"feedModel\" store=\"feedStore\"
1216 query=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\"
1217 childrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">
1219 <div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\"
1220 dndController=\"dijit.tree.dndSource\"
1221 betweenThreshold=\"5\"
1222 model=\"feedModel\" openOnClick=\"false\">
1223 <script type=\"dojo/method\" event=\"onClick\" args=\"item\">
1224 var id = String(item.id);
1225 var bare_id = id.substr(id.indexOf(':')+1);
1227 if (id.match('FEED:')) {
1228 editFeed(bare_id, event);
1229 } else if (id.match('CAT:')) {
1230 editCat(bare_id, item, event);
1233 <script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
1234 Element.hide(\"feedlistLoading\");
1239 $feeds_sort = db_escape_string($_REQUEST["sort"]);
1241 if (!$feeds_sort || $feeds_sort == "undefined") {
1242 $feeds_sort = $_SESSION["pref_sort_feeds"];
1243 if (!$feeds_sort) $feeds_sort = "title";
1246 $_SESSION["pref_sort_feeds"] = $feeds_sort;
1250 $feed_search = split(" ", $feed_search);
1253 foreach ($feed_search as $token) {
1255 $token = trim($token);
1257 array_push($tokens, "(UPPER(F1.title) LIKE UPPER('%$token%') OR
1258 UPPER(C1.title) LIKE UPPER('%$token%') OR
1259 UPPER(F1.feed_url) LIKE UPPER('%$token%'))");
1262 $search_qpart = "(" . join($tokens, " AND ") . ") AND ";
1268 $show_last_article_info = false;
1269 $show_last_article_checked = "";
1270 $show_last_article_qpart = "";
1272 if ($_REQUEST["slat"] == "true") {
1273 $show_last_article_info = true;
1274 $show_last_article_checked = "checked";
1275 $show_last_article_qpart = ", (SELECT ".SUBSTRING_FOR_DATE."(MAX(updated),1,16) FROM ttrss_user_entries,
1276 ttrss_entries WHERE ref_id = ttrss_entries.id
1277 AND feed_id = F1.id) AS last_article";
1278 } else if ($feeds_sort == "last_article") {
1279 $feeds_sort = "title";
1282 if (get_pref($link, 'ENABLE_FEED_CATS')) {
1283 $order_by_qpart = "category,$feeds_sort,title";
1285 $order_by_qpart = "$feeds_sort,title";
1288 $result = db_query($link, "SELECT
1292 ".SUBSTRING_FOR_DATE."(F1.last_updated,1,16) AS last_updated,
1297 C1.title AS category,
1298 F1.include_in_digest
1299 $show_last_article_qpart
1302 LEFT JOIN ttrss_feed_categories AS C1
1303 ON (F1.cat_id = C1.id)
1305 $search_qpart F1.owner_uid = '".$_SESSION["uid"]."'
1306 ORDER by $order_by_qpart");
1308 if (db_num_rows($result) != 0) {
1310 print "<p><table width=\"100%\" cellspacing=\"0\"
1311 class=\"prefFeedList\" id=\"prefFeedList\">";
1312 print "<tr><td class=\"selectPrompt\" colspan=\"8\">".
1313 "<div style='float : right'>".
1314 "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()'
1315 $show_last_article_checked><label
1316 for='show_last_article_times'>".__('Show last article times')."</label></div>".
1318 <a href=\"#\" onclick=\"selectTableRows('prefFeedList', 'all')\">".__('All')."</a>,
1319 <a href=\"#\" onclick=\"selectTableRows('prefFeedList', 'none')\">".__('None')."</a>
1322 if (!get_pref($link, 'ENABLE_FEED_CATS')) {
1323 print "<tr class=\"title\">
1324 <td width='5%' align='center'> </td>";
1326 print "<td width='3%'> </td>";
1328 print "<td width='60%'><a href=\"#\" onclick=\"updateFeedList('title')\">".__('Title')."</a></td>";
1330 if ($show_last_article_info) {
1331 print "<td width='20%' align='right'><a href=\"#\" onclick=\"updateFeedList('last_article')\">".__('Last Article')."</a></td>";
1334 print "<td width='20%' align='right'><a href=\"#\" onclick=\"updateFeedList('last_updated')\">".__('Updated')."</a></td>";
1341 while ($line = db_fetch_assoc($result)) {
1343 $feed_id = $line["id"];
1344 $cat_id = $line["cat_id"];
1346 $edit_title = htmlspecialchars($line["title"]);
1347 $edit_cat = htmlspecialchars($line["category"]);
1349 $last_error = $line["last_error"];
1351 if (!$edit_cat) $edit_cat = __("Uncategorized");
1353 $last_updated = $line["last_updated"];
1355 if (!$last_updated) {
1356 $last_updated = "—";
1358 $last_updated = make_local_datetime($link, $last_updated, false);
1361 $last_article = $line["last_article"];
1363 if (!$last_article) {
1364 $last_article = "—";
1366 $last_article = make_local_datetime($link, $last_article, false);
1369 if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) {
1372 print "<tr><td colspan=\"6\" class=\"feedEditCat\">$edit_cat</td></tr>";
1374 print "<tr class=\"title\">
1375 <td width='5%'> </td>";
1377 print "<td width='3%'> </td>";
1379 print "<td width='60%'><a href=\"#\" onclick=\"updateFeedList('title')\">".__('Title')."</a></td>";
1381 if ($show_last_article_info) {
1382 print "<td width='20%' align='right'>
1383 <a href=\"#\" onclick=\"updateFeedList('last_article')\">".__('Last Article')."</a></td>";
1386 print "<td width='20%' align='right'>
1387 <a href=\"#\" onclick=\"updateFeedList('last_updated')\">".__('Updated')."</a></td>";
1389 $cur_cat_id = $cat_id;
1392 $class = ($lnum % 2) ? "even" : "odd";
1393 $this_row_id = "id=\"FEEDR-$feed_id\"";
1395 print "<tr class=\"$class\" $this_row_id>";
1397 $icon_file = ICONS_DIR . "/$feed_id.ico";
1399 if (file_exists($icon_file) && filesize($icon_file) > 0) {
1400 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/$feed_id.ico\">";
1402 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
1405 print "<td class='feedSelect'><input
1406 onclick='toggleSelectRowById(this, \"FEEDR-".$line['id']."\");'
1407 type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
1409 $onclick = "onclick='editFeed($feed_id, event)' title='".__('Click to edit')."'";
1411 print "<td $onclick class='feedIcon'>$feed_icon</td>";
1414 $edit_title = "<span class=\"feed_error\">$edit_title</span>";
1415 $last_updated = "<span class=\"feed_error\">$last_updated</span>";
1416 $last_article = "<span class=\"feed_error\">$last_article</span>";
1419 print "<td $onclick>" . $edit_title . "</td>";
1421 if ($show_last_article_info) {
1422 print "<td align='right' $onclick>" .
1423 "$last_article</td>";
1426 print "<td $onclick align='right'>$last_updated</td>";
1441 if (!$feed_search) {
1442 print_warning(__("You don't have any subscribed feeds."));
1444 print_warning(__('No matching feeds found.'));
1450 print "</div>"; # feeds pane
1452 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('OPML')."\">";
1454 print "<p>" . __("Using OPML you can export and import your feeds and Tiny Tiny RSS settings.");
1456 print "<div class=\"insensitive\">" . __("Note: Only main settings profile can be migrated using OPML.") . "</div>";
1460 print "<iframe name=\"upload_iframe\"
1461 style=\"width: 400px; height: 100px; display: none;\"></iframe>";
1463 print "<div style='float : left'>";
1464 print "<form style='display : block' target=\"upload_iframe\"
1465 enctype=\"multipart/form-data\" method=\"POST\"
1466 action=\"backend.php\">
1467 <input id=\"opml_file\" name=\"opml_file\" type=\"file\">
1468 <input type=\"hidden\" name=\"op\" value=\"dlg\">
1469 <input type=\"hidden\" name=\"id\" value=\"importOpml\">
1470 <button onclick=\"return opmlImport();\"
1471 type=\"submit\">".__('Import')."</button>
1473 print "</div> ";
1475 print "<button onclick=\"gotoExportOpml()\">".__('Export OPML')."</button>";
1477 print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.');
1479 print "<div class=\"insensitive\">" . __("Note: Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</div>" . "</p>";
1481 print "<button onclick=\"return displayDlg('pubOPMLUrl')\">".
1482 __('Display URL')."</button> ";
1485 print "</div>"; # pane
1487 if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) {
1489 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Firefox integration')."\">";
1491 print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.') . "</p>";
1495 print "<button onclick='window.navigator.registerContentHandler(" .
1496 "\"application/vnd.mozilla.maybe.feed\", " .
1497 "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
1498 __('Click here to register this site as a feed reader.') .
1503 print "</div>"; # pane
1506 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Subscribing using bookmarklet')."\">";
1508 print "<p>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</p>";
1510 $bm_subscribe_url = str_replace('%s', '', add_feed_url());
1512 $confirm_str = __('Subscribe to %s in Tiny Tiny RSS?');
1514 $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}");
1516 print "<a href=\"$bm_url\" class='visibleLink'>" . __('Subscribe in Tiny Tiny RSS'). "</a>";
1518 print "</div>"; #pane
1520 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Published articles and generated feeds')."\">";
1522 print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>";
1524 $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() .
1525 "/backend.php?op=rss&id=-2&view-mode=all_articles");;
1527 print "<button onclick=\"return displayDlg('generatedFeed', '$rss_url')\">".
1528 __('Display URL')."</button> ";
1530 print "<button onclick=\"return clearFeedAccessKeys()\">".
1531 __('Clear all generated URLs')."</button> ";
1533 print "</div>"; #pane
1534 print "</div>"; #container
1538 function print_feed_browser($link, $search, $limit, $mode = 1) {
1540 $owner_uid = $_SESSION["uid"];
1543 $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR
1544 UPPER(title) LIKE UPPER('%$search%'))";
1550 $result = db_query($link, "SELECT feed_url, subscribers FROM
1551 ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
1552 WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
1553 AND owner_uid = '$owner_uid') $search_qpart
1554 ORDER BY subscribers DESC LIMIT $limit");
1555 } else if ($mode == 2) {
1556 $result = db_query($link, "SELECT *,
1557 (SELECT COUNT(*) FROM ttrss_user_entries WHERE
1558 orig_feed_id = ttrss_archived_feeds.id) AS articles_archived
1560 ttrss_archived_feeds
1562 (SELECT COUNT(*) FROM ttrss_feeds
1563 WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND
1564 owner_uid = '$owner_uid') = 0 AND
1565 owner_uid = '$owner_uid' $search_qpart
1566 ORDER BY id DESC LIMIT $limit");
1571 while ($line = db_fetch_assoc($result)) {
1575 $feed_url = $line["feed_url"];
1576 $subscribers = $line["subscribers"];
1578 $det_result = db_query($link, "SELECT site_url,title,id
1579 FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
1581 $details = db_fetch_assoc($det_result);
1583 $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico";
1585 if (file_exists($icon_file) && filesize($icon_file) > 0) {
1586 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL .
1587 "/".$details["id"].".ico\">";
1589 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
1592 $check_box = "<input onclick='toggleSelectListRow(this)'
1593 class='feedBrowseCB'
1594 type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
1596 $class = ($feedctr % 2) ? "even" : "odd";
1598 $feed_url = htmlspecialchars($line["feed_url"]);
1600 if ($details["site_url"]) {
1601 $site_url = "<a target=\"_blank\" href=\"".
1602 htmlspecialchars($details["site_url"])."\">
1603 <img style='border-width : 0px' src='images/www.png' alt='www'></a>";
1608 $feed_url = "<a target=\"_blank\" href=\"$feed_url\"><img
1609 style='border-width : 0px; vertical-align : middle'
1610 src='images/feed-icon-12x12.png'></a>";
1612 print "<li title=\"".htmlspecialchars($details["site_url"])."\"
1613 class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
1614 "$feed_icon $feed_url " . htmlspecialchars($details["title"]) .
1615 " <span class='subscribers'>($subscribers)</span>
1618 } else if ($mode == 2) {
1619 $feed_url = htmlspecialchars($line["feed_url"]);
1620 $site_url = htmlspecialchars($line["site_url"]);
1621 $title = htmlspecialchars($line["title"]);
1623 $icon_file = ICONS_DIR . "/" . $line["id"] . ".ico";
1625 if (file_exists($icon_file) && filesize($icon_file) > 0) {
1626 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL .
1627 "/".$line["id"].".ico\">";
1629 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
1632 $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB'
1633 type=\"checkbox\" id=\"FBCHK-" . $line["id"] . "\">";
1635 $class = ($feedctr % 2) ? "even" : "odd";
1637 if ($line['articles_archived'] > 0) {
1638 $archived = sprintf(__("%d archived articles"), $line['articles_archived']);
1639 $archived = " <span class='subscribers'>($archived)</span>";
1644 if ($line["site_url"]) {
1645 $site_url = "<a target=\"_blank\" href=\"$site_url\">
1646 <img style='border-width : 0px' src='images/www.png' alt='www'></a>";
1651 $feed_url = "<a target=\"_blank\" href=\"$feed_url\"><img
1652 style='border-width : 0px; vertical-align : middle'
1653 src='images/feed-icon-12x12.png'></a>";
1655 print "<li title='".$line['site_url']."' class='$class'
1656 id=\"FBROW-".$line["id"]."\">".
1657 $check_box . "$feed_icon $feed_url " . $title .
1658 $archived . $site_url . "</li>";
1666 if ($feedctr == 0) {
1667 print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";