summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-12-21 13:04:23 +0300
committerAndrew Dolgov <[email protected]>2009-12-21 13:04:23 +0300
commit37882ef39272299a28496f2bd4c632eb53b23d7c (patch)
tree82881045d03a1a08387ab854b2c72ae7199dffbc /api
parent534965eb829d1168c78c3fc4270ccf9e02238fb2 (diff)
getFeeds: add necessary parameters for pagination
Diffstat (limited to 'api')
-rw-r--r--api/index.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/api/index.php b/api/index.php
index c9d134df1..29608d578 100644
--- a/api/index.php
+++ b/api/index.php
@@ -92,18 +92,28 @@
case "getFeeds":
$cat_id = db_escape_string($_REQUEST["cat_id"]);
$unread_only = (bool)db_escape_string($_REQUEST["unread_only"]);
+ $limit = (int) db_escape_string($_REQUEST["limit"]);
+ $offset = (int) db_escape_string($_REQUEST["offset"]);
+
+ if ($limit) {
+ $limit_qpart = "LIMIT $limit OFFSET $offset";
+ } else {
+ $limit_qpart = "";
+ }
if (!$cat_id) {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
- FROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]);
+ FROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"] .
+ "ORDER BY cat_id, title " . $limit_qpart);
} else {
$result = db_query($link, "SELECT
id, feed_url, cat_id, title, ".
SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE
- cat_id = '$cat_id' AND owner_uid = " . $_SESSION["uid"]);
+ cat_id = '$cat_id' AND owner_uid = " . $_SESSION["uid"] .
+ "ORDER BY cat_id, title " . $limit_qpart);
}
$feeds = array();