+ } else {
+ // old style subtoolbar:
+
+ print "<td class=\"headlineActions$rtl_cpart\">".
+ _('Select:')."
+ <a href=\"$sel_all_link\">All</a>,
+ <a href=\"$sel_unread_link\">Unread</a>,
+ <a href=\"$sel_none_link\">None</a>
+ ".
+ _('Toggle:')." <a href=\"$tog_unread_link\">Unread</a>,
+ <a href=\"$tog_marked_link\">Starred</a>
+ ".
+ _('Mark as read:')."
+ <a href=\"#\" onclick=\"$catchup_page_link\">Page</a>,
+ <a href=\"#\" onclick=\"$catchup_feed_link\">Feed</a>";
+ print "</td>";
+
+ }
+
+ if ($search && $feed_id >= 0 && get_pref($link, 'ENABLE_LABELS') && GLOBAL_ENABLE_LABELS) {
+ print "<td class=\"headlineActions$rtl_cpart\">
+ <a href=\"javascript:labelFromSearch('$search', '$search_mode',
+ '$match_on', '$feed_id', '$is_cat');\">
+ "._('Convert to Label')."</a></td>";
+ }
+
+ print "<td class=\"headlineTitle$rtl_cpart\">";
+
+ if ($feed_site_url) {
+ if (!$bottom) {
+ $target = "target=\"_blank\"";
+ }
+ print "<a $target href=\"$feed_site_url\">$feed_title</a>";
+ } else {
+ print $feed_title;
+ }
+
+ if ($search) {
+ $search_q = "&q=$search&m=$match_on&smode=$search_mode";
+ }
+
+ if ($user_page_offset > 1) {
+ print " [$user_page_offset] ";
+ }
+
+ if (!$bottom) {
+ print "
+ <a target=\"_new\"
+ href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat$search_q\">
+ <img class=\"noborder\"
+ alt=\"Generated feed\" src=\"images/feed-icon-12x12.png\">
+ </a>";
+ }
+
+ print "</td>";
+ print "</tr></table>";
+
+ }
+
+ function outputFeedList($link, $tags = false) {
+
+ print "<ul class=\"feedList\" id=\"feedList\">\n";
+
+ $owner_uid = $_SESSION["uid"];
+
+ /* virtual feeds */
+
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "<li class=\"feedCat\">"._('Special')."</li>";
+ print "<li id=\"feedCatHolder\"><ul class=\"feedCatList\">";
+ }
+
+ $num_starred = getFeedUnread($link, -1);
+
+ $class = "virt";
+
+ if ($num_starred > 0) $class .= "Unread";
+
+ printFeedEntry(-1, $class, _("Starred articles"), $num_starred,
+ "images/mark_set.png", $link);
+
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "</ul>\n";
+ }
+
+ if (!$tags) {
+
+ if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
+
+ $result = db_query($link, "SELECT id,sql_exp,description FROM
+ ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description");
+
+ if (db_num_rows($result) > 0) {
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "<li class=\"feedCat\">"._('Labels')."</li>";
+ print "<li id=\"feedCatHolder\"><ul class=\"feedCatList\">";
+ } else {
+ print "<li><hr></li>";
+ }
+ }
+
+ while ($line = db_fetch_assoc($result)) {
+
+ error_reporting (0);
+
+ $label_id = -$line['id'] - 11;
+ $count = getFeedUnread($link, $label_id);
+
+ $class = "label";
+
+ if ($count > 0) {
+ $class .= "Unread";
+ }
+
+ error_reporting (DEFAULT_ERROR_LEVEL);
+
+ printFeedEntry($label_id,
+ $class, db_unescape_string($line["description"]),
+ $count, "images/label.png", $link);
+
+ }
+
+ if (db_num_rows($result) > 0) {
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "</ul>";
+ }
+ }
+
+ }
+
+ if (!get_pref($link, 'ENABLE_FEED_CATS')) {
+ print "<li><hr></li>";
+ }
+
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
+ $order_by_qpart = "category,unread DESC,title";
+ } else {
+ $order_by_qpart = "category,title";
+ }
+ } else {
+ if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
+ $order_by_qpart = "unread DESC,title";
+ } else {
+ $order_by_qpart = "title";
+ }
+ }
+
+ $result = db_query($link, "SELECT ttrss_feeds.*,
+ SUBSTRING(last_updated,1,19) AS last_updated_noms,
+ (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
+ WHERE feed_id = ttrss_feeds.id AND unread = true
+ AND ttrss_user_entries.ref_id = ttrss_entries.id
+ AND owner_uid = '$owner_uid') as unread,
+ cat_id,last_error,
+ ttrss_feed_categories.title AS category,
+ ttrss_feed_categories.collapsed
+ FROM ttrss_feeds LEFT JOIN ttrss_feed_categories
+ ON (ttrss_feed_categories.id = cat_id)
+ WHERE
+ ttrss_feeds.hidden = false AND
+ ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL
+ ORDER BY $order_by_qpart");
+
+ $actid = $_GET["actid"];
+
+ /* real feeds */
+
+ $lnum = 0;
+
+ $total_unread = 0;
+
+ $category = "";
+
+ $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
+
+ while ($line = db_fetch_assoc($result)) {
+
+ $feed = db_unescape_string($line["title"]);
+ $feed_id = $line["id"];
+
+ $subop = $_GET["subop"];
+
+ $unread = $line["unread"];
+
+ if (get_pref($link, 'HEADLINES_SMART_DATE')) {
+ $last_updated = smart_date_time(strtotime($line["last_updated_noms"]));
+ } else {
+ $last_updated = date($short_date, strtotime($line["last_updated_noms"]));
+ }
+
+ $rtl_content = sql_bool_to_bool($line["rtl_content"]);
+
+ if ($rtl_content) {
+ $rtl_tag = "dir=\"RTL\"";
+ } else {
+ $rtl_tag = "";
+ }
+
+ $tmp_result = db_query($link,
+ "SELECT id,COUNT(unread) AS unread
+ FROM ttrss_feeds LEFT JOIN ttrss_user_entries
+ ON (ttrss_feeds.id = ttrss_user_entries.feed_id)
+ WHERE parent_feed = '$feed_id' AND unread = true
+ GROUP BY ttrss_feeds.id");
+
+ if (db_num_rows($tmp_result) > 0) {
+ while ($l = db_fetch_assoc($tmp_result)) {
+ $unread += $l["unread"];
+ }
+ }
+
+ $cat_id = $line["cat_id"];
+
+ $tmp_category = $line["category"];
+
+ if (!$tmp_category) {
+ $tmp_category = _("Uncategorized");
+ }
+
+ // $class = ($lnum % 2) ? "even" : "odd";
+
+ if ($line["last_error"]) {
+ $class = "error";
+ } else {
+ $class = "feed";
+ }
+
+ if ($unread > 0) $class .= "Unread";
+
+ if ($actid == $feed_id) {
+ $class .= "Selected";
+ }
+
+ $total_unread += $unread;
+
+ if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) {
+
+ if ($category) {
+ print "</ul></li>";
+ }
+
+ $category = $tmp_category;
+
+ $collapsed = $line["collapsed"];
+
+ // workaround for NULL category
+ if ($category == _("Uncategorized")) {
+ if ($_COOKIE["ttrss_vf_uclps"] == 1) {
+ $collapsed = "t";
+ }
+ }