]> git.wh0rd.org Git - tt-rss.git/commitdiff
api: add getUnread
authorAndrew Dolgov <fox@bah.org.ru>
Wed, 16 Dec 2009 10:07:02 +0000 (13:07 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Wed, 16 Dec 2009 10:07:02 +0000 (13:07 +0300)
api/index.php

index 3bb83e1b536d321cb81c4391748a9cc74b825a94..b0a084ce12d079007fba9f176564cf0ef3bf48dd 100644 (file)
                case "isLoggedIn":
                        print json_encode(array("status" => $_SESSION["uid"] != ''));
                        break;
+               case "getUnread":
+                       $feed_id = db_escape_string($_REQUEST["feed_id"]);
+                       $is_cat = db_escape_string($_REQUEST["is_cat"]);
+
+                       if ($feed_id) {
+                               print json_encode(array("unread" => getFeedUnread($link, $feed_id, $is_cat)));
+                       } else {
+                               print json_encode(array("unread" => getGlobalUnread($link)));
+                       }
+                       break;
                case "getFeeds":
                        $cat_id = db_escape_string($_REQUEST["cat_id"]);
                        $unread_only = (bool)db_escape_string($_REQUEST["unread_only"]);