]> git.wh0rd.org Git - tt-rss.git/commitdiff
add ability to customize amount of returned entries for syndicated feeds
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 5 Jan 2009 08:09:05 +0000 (09:09 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 5 Jan 2009 08:09:05 +0000 (09:09 +0100)
backend.php
functions.php

index 13c470a988a6f0d24449175a9d7aa18a00cd386b..549661156634a6a2d145db383de464800a651c4f 100644 (file)
 
                case "publish":
                        $key = db_escape_string($_GET["key"]);
+                       $limit = (int)db_escape_string($_GET["limit"]);
 
                        $result = db_query($link, "SELECT login, owner_uid 
                                FROM ttrss_user_prefs, ttrss_users WHERE
                                $owner = db_fetch_result($result, 0, "owner_uid");
                                $login = db_fetch_result($result, 0, "login");
 
-                               generate_syndicated_feed($link, $owner, -2, false);
+                               generate_syndicated_feed($link, $owner, -2, false, $limit);
 
                        } else {
                                print "<error>User not found</error>";
                        $user = db_escape_string($_GET["user"]);
                        $pass = db_escape_string($_GET["pass"]);
                        $is_cat = $_GET["is_cat"] != false;
+                       $limit = (int)db_escape_string($_GET["limit"]);
 
                        $search = db_escape_string($_GET["q"]);
                        $match_on = db_escape_string($_GET["m"]);
                        if ($_SESSION["uid"] ||
                                http_authenticate_user($link)) {
 
-                                       generate_syndicated_feed($link, 0, $feed, $is_cat, 
+                                       generate_syndicated_feed($link, 0, $feed, $is_cat, $limit,
                                                $search, $search_mode, $match_on);
                        }
                break; // rss
index 38b11c665cd88cdda3acee6eb501f8d452e38c1a..593edaf1f1038ff76895e31de35777ffab06ef4f 100644 (file)
        }
 
        function generate_syndicated_feed($link, $owner_uid, $feed, $is_cat,
-               $search, $search_mode, $match_on) {
+               $limit, $search, $search_mode, $match_on) {
+
+               if (!$limit) $limit = 30;
 
                $qfh_ret = queryFeedHeadlines($link, $feed, 
-                       30, false, $is_cat, $search, $search_mode, $match_on, "updated DESC", 0,
+                       $limit, false, $is_cat, $search, $search_mode, $match_on, "updated DESC", 0,
                        $owner_uid);
 
                $result = $qfh_ret[0];