]> git.wh0rd.org Git - tt-rss.git/commitdiff
move outputFeedList to getFeedUnread, misc. hidden-related fixes
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 16 Aug 2006 13:13:33 +0000 (14:13 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 16 Aug 2006 13:13:33 +0000 (14:13 +0100)
backend.php
functions.php
mobile/functions.php

index 8928582b3fc9541d46f67ee7db08b640e831ee09..428939fe98bed46e16d5132cdaf3ef82a765d78c 100644 (file)
                                print "<li id=\"feedCatHolder\"><ul class=\"feedCatList\">";
                        }
 
-                       $result = db_query($link, "SELECT count(id) as num_starred 
-                               FROM ttrss_entries,ttrss_user_entries 
-                               WHERE marked = true AND 
-                               ttrss_user_entries.ref_id = ttrss_entries.id AND
-                               unread = true AND owner_uid = '$owner_uid'");
-                       $num_starred = db_fetch_result($result, 0, "num_starred");
+                       $num_starred = getFeedUnread($link, -1);
 
                        $class = "virt";
 
                                while ($line = db_fetch_assoc($result)) {
        
                                        error_reporting (0);
-               
-                                       $tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count 
-                                               FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
-                                               WHERE (" . $line["sql_exp"] . ") AND unread = true AND
-                                               ttrss_user_entries.ref_id = ttrss_entries.id AND
-                                               ttrss_user_entries.feed_id = ttrss_feeds.id
-                                               AND ttrss_user_entries.owner_uid = '$owner_uid'");
-       
-                                       $count = db_fetch_result($tmp_result, 0, "count");
-       
+
+                                       $label_id = -$line['id'] - 11;
+                                       $count = getFeedUnread($link, $label_id);
+
                                        $class = "label";
        
                                        if ($count > 0) {
                                        
                                        error_reporting (DEFAULT_ERROR_LEVEL);
        
-                                       printFeedEntry(-$line["id"]-11
+                                       printFeedEntry($label_id
                                                $class, db_unescape_string($line["description"]), 
                                                $count, "images/label.png", $link);
                
index 5a0e75c1818c90d9a50574670495897ef167ccb5..728d10f4e29d99680ff0de295ea5d0296616ce3a 100644 (file)
                } else if ($n_feed > 0) {
 
                        $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE parent_feed = '$n_feed'
+                                       AND hidden = false
                                        AND owner_uid = " . $_SESSION["uid"]);
 
                        if (db_num_rows($result) > 0) {
                                $match_part = implode(" OR ", $linked_feeds);
 
                                $result = db_query($link, "SELECT COUNT(int_id) AS unread 
-                                       FROM ttrss_user_entries 
+                                       FROM ttrss_user_entries
                                        WHERE   unread = true AND ($match_part) AND owner_uid = " . $_SESSION["uid"]);
 
                                $unread = 0;
                                $match_part = "feed_id = '$n_feed'";
                        }
                } else if ($feed < -10) {
+
                        $label_id = -$feed - 11;
 
                        $result = db_query($link, "SELECT sql_exp FROM ttrss_labels WHERE
index 29db101ca9affe4ca02ca223476a8fd57643dfb5..d35e6e23704c37f150be292953c5a567ca2ad5b2 100644 (file)
                                print "<li class=\"feedCatHolder\"><ul class=\"feedCatList\">";
                        }
 
-                       $result = db_query($link, "SELECT count(id) as num_starred 
-                               FROM ttrss_entries,ttrss_user_entries 
-                               WHERE marked = true AND 
-                               ttrss_user_entries.ref_id = ttrss_entries.id AND
-                               unread = true AND owner_uid = '$owner_uid'");
-                       $num_starred = db_fetch_result($result, 0, "num_starred");
+                       $num_starred = getFeedUnread($link, -1);
 
                        $class = "virt";
 
@@ -52,7 +47,7 @@
 
                        if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
        
-                               $result = db_query($link, "SELECT id,sql_exp,description FROM
+                               $result = db_query($link, "SELECT id,description FROM
                                        ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description");
                
                                if (db_num_rows($result) > 0) {
        
                                        error_reporting (0);
                
-                                       $tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count 
-                                               FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
-                                               WHERE (" . $line["sql_exp"] . ") AND unread = true AND
-                                               ttrss_user_entries.ref_id = ttrss_entries.id AND
-                                               ttrss_user_entries.feed_id = ttrss_feeds.id
-                                               AND ttrss_user_entries.owner_uid = '$owner_uid'");
-
-                                       $count = db_fetch_result($tmp_result, 0, "count");
+                                       $count = getFeedUnread($link, -$line["id"]-11);
        
                                        $class = "label";