]> git.wh0rd.org Git - tt-rss.git/commitdiff
feedlist: do not show labels folder when there are no labels
authorAndrew Dolgov <fox@fakecake.org>
Sun, 21 Nov 2010 17:54:25 +0000 (20:54 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sun, 21 Nov 2010 17:54:25 +0000 (20:54 +0300)
functions.php

index eb64f51f91ce0037b2b1f9ceb7005dc8b56c20c8..2dc2a16d6b50c8a02695b374fbeb3575f705fd01 100644 (file)
        
                        $result = db_query($link, "SELECT * FROM
                                ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
-               
-                       if (get_pref($link, 'ENABLE_FEED_CATS')) {
-                               $cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
-                               $cat = feedlist_init_cat($link, -2, $cat_hidden);
-                       } else {
-                               $cat['items'] = array();
-                       }
-
-                       while ($line = db_fetch_assoc($result)) {
-       
-                               $label_id = -$line['id'] - 11;
-                               $count = getFeedUnread($link, $label_id);
 
-                               $feed = feedlist_init_feed($link, $label_id, false, $count);
+                       if (db_num_rows($result) > 0) {
 
-                               $feed['fg_color'] = $line['fg_color'];
-                               $feed['bg_color'] = $line['bg_color'];
+                               if (get_pref($link, 'ENABLE_FEED_CATS')) {
+                                       $cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
+                                       $cat = feedlist_init_cat($link, -2, $cat_hidden);
+                               } else {
+                                       $cat['items'] = array();
+                               }
 
-                               array_push($cat['items'], $feed);
-                       }
+                               while ($line = db_fetch_assoc($result)) {
+               
+                                       $label_id = -$line['id'] - 11;
+                                       $count = getFeedUnread($link, $label_id);
        
-                       if ($enable_cats) {
-                               array_push($feedlist['items'], $cat);
-                       } else {
-                               $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
+                                       $feed = feedlist_init_feed($link, $label_id, false, $count);
+       
+                                       $feed['fg_color'] = $line['fg_color'];
+                                       $feed['bg_color'] = $line['bg_color'];
+       
+                                       array_push($cat['items'], $feed);
+                               }
+               
+                               if ($enable_cats) {
+                                       array_push($feedlist['items'], $cat);
+                               } else {
+                                       $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
+                               }
                        }
                }