diff options
author | Andrew Dolgov <[email protected]> | 2010-11-21 20:54:25 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-21 20:54:25 +0300 |
commit | d4f46bc1fdd3bbd76e7d01cc0c79baaacc69ce5b (patch) | |
tree | 21a4a235357f7c42fdb0c5672cd1a95edadd63d0 /functions.php | |
parent | dbf8845e3b2bbe9a92995f21d0d15fa01a5561d7 (diff) |
feedlist: do not show labels folder when there are no labels
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/functions.php b/functions.php index eb64f51f9..2dc2a16d6 100644 --- a/functions.php +++ b/functions.php @@ -4220,31 +4220,34 @@ $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']); + } } } |