]> git.wh0rd.org - tt-rss.git/commitdiff
api: fix getFeeds usage of getLabelCounters
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 5 Nov 2010 13:32:52 +0000 (16:32 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 5 Nov 2010 13:32:52 +0000 (16:32 +0300)
functions.php

index a45d69485f67f0c9f24a4a2f33a131a4851e2f8a..caa95e628d2b387ee18d020229d4e937311ee7bf 100644 (file)
                return $ret_arr;
        }
 
-       function getLabelCounters($link) {
+       function getLabelCounters($link, $descriptions = false) {
 
                $ret_arr = array();
 
                        $count = getFeedUnread($link, $id);
 
                        $cv = array("id" => $id,
-                               "counter" => $count,
-                               "description" => $label_name);
+                               "counter" => $count);
+
+                       if ($descriptions)
+                               $cv["description"] = $label_name;
 
                        if (get_pref($link, 'EXTENDED_FEEDLIST'))
                                $cv["xmsg"] = getFeedArticles($link, $id)." ".__("total");
                        if ($cat_id == -4 || $cat_id == -2) {
                                $counters = getLabelCounters($link, true);
 
-                               foreach (array_keys($counters) as $id) {
+                               foreach (array_values($counters) as $cv) {
 
-                                       $unread = $counters[$id]["counter"];
+                                       $unread = $cv["counter"];
        
                                        if ($unread || !$unread_only) {
        
                                                $row = array(
-                                                               "id" => $id,
-                                                               "title" => $counters[$id]["description"],
-                                                               "unread" => $counters[$id]["counter"],
+                                                               "id" => $cv["id"],
+                                                               "title" => $cv["description"],
+                                                               "unread" => $cv["counter"],
                                                                "cat_id" => -2,
                                                        );