]> git.wh0rd.org Git - tt-rss.git/commitdiff
api: show virtual feeds in getFeeds (fixes)
authorAndrew Dolgov <fox@bah.org.ru>
Wed, 16 Dec 2009 11:16:56 +0000 (14:16 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Wed, 16 Dec 2009 11:16:56 +0000 (14:16 +0300)
api/index.php

index f0f7aa20248e64951935e9a7ca73e111dfcad969..6cae3087160c267676480db08e052978d7aa2f44 100644 (file)
                                }
                        }
 
-                       if (!$cat_id || $cat_id == -1) {
+                       /* Labels */
+
+                       if (!$cat_id || $cat_id == -2) {
                                $counters = getLabelCounters($link, false, true);
 
                                foreach (array_keys($counters) as $id) {
                                                                "id" => $id,
                                                                "title" => $counters[$id]["description"],
                                                                "unread" => $counters[$id]["counter"],
-                                                               "cat_id" => -1,
+                                                               "cat_id" => -2,
                                                        );
        
                                                array_push($feeds, $row);
                                }
                        }
 
+                       /* Virtual feeds */
+
+                       if (!$cat_id || $cat_id == -1) {
+                               foreach (array(-1, -2, -3, -4) as $i) {
+                                       $unread = getFeedUnread($link, $i);
+
+                                       if ($unread || !$unread_only) {
+                                               $title = getFeedTitle($link, $i);
+
+                                               $row = array(
+                                                               "id" => $i,
+                                                               "title" => $title,
+                                                               "unread" => $unread,
+                                                               "cat_id" => -1,
+                                                       );
+                                               array_push($feeds, $row);
+                                       }
+
+                               }
+                       }
+
                        print json_encode($feeds);
 
                        break;
                                $article = array(
                                        "title" => $line["title"],
                                        "link" => $line["link"],
+                                       "labels" => get_article_labels($link, $article_id),
                                        "unread" => sql_bool_to_bool($line["unread"]),
                                        "marked" => sql_bool_to_bool($line["marked"]),
                                        "published" => sql_bool_to_bool($line["published"]),