]> git.wh0rd.org Git - tt-rss.git/commitdiff
api: implement pagination for getHeadlines; misc tweaks
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 21 Dec 2009 16:36:40 +0000 (19:36 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 21 Dec 2009 16:36:40 +0000 (19:36 +0300)
api/index.php

index 29608d57808e143930c3e28fb4d38870500c6556..dc3d183f828aadfd602b22efbedea187efeb08cf 100644 (file)
                        } else {
                                print json_encode(array("unread" => getGlobalUnread($link)));
                        }
+                       break;
+               case "getCounters":
+
+                       /* TODO */
+
                        break;
                case "getFeeds":
                        $cat_id = db_escape_string($_REQUEST["cat_id"]);
 
                                $unread = getFeedUnread($link, $line["id"]);
 
+                               $icon_path = "../" . ICONS_DIR . "/" . $line["id"] . ".ico";
+                               $has_icon = file_exists($icon_path) && filesize($icon_path) > 0;
+
                                if ($unread || !$unread_only) {
 
                                        $row = array(
                                                        "title" => $line["title"],
                                                        "id" => (int)$line["id"],
                                                        "unread" => (int)$unread,
+                                                       "has_icon" => $has_icon,
                                                        "cat_id" => (int)$line["cat_id"],
                                                        "last_updated" => strtotime($line["last_updated"])
                                                );
                case "getHeadlines":
                        $feed_id = db_escape_string($_REQUEST["feed_id"]);
                        $limit = (int)db_escape_string($_REQUEST["limit"]);
+                       $offset = (int)db_escape_string($_REQUEST["skip"]);
                        $filter = db_escape_string($_REQUEST["filter"]);
                        $is_cat = (bool)db_escape_string($_REQUEST["is_cat"]);
                        $show_excerpt = (bool)db_escape_string($_REQUEST["show_excerpt"]);
                        $match_on = db_escape_string($_REQUEST["match_on"]);
                        
                        $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, 
-                               $view_mode, $is_cat, $search, $search_mode, $match_on);
+                               $view_mode, $is_cat, $search, $search_mode, $match_on,
+                               false, $offset);
 
                        $result = $qfh_ret[0];
                        $feed_title = $qfh_ret[1];