From: j0nson Date: Tue, 2 Apr 2013 01:21:36 +0000 (-0300) Subject: adds sort order to API X-Git-Tag: 1.7.6~43^2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=0bbd14146a7332e086cd82595af718fa55e03803;p=tt-rss.git adds sort order to API Allows sort by feed date or by reverse order api Params: order_by (string = feed_dates, date_reverse) --- diff --git a/classes/api.php b/classes/api.php index ea57a61a..f0f94369 100644 --- a/classes/api.php +++ b/classes/api.php @@ -198,14 +198,22 @@ class API extends Handler { $since_id = (int)db_escape_string($this->link, $_REQUEST["since_id"]); $include_nested = sql_bool_to_bool($_REQUEST["include_nested"]); $sanitize_content = true; - + $override_order = false; + switch ($_REQUEST["order_by"]) { + case "date_reverse": + $override_order = "date_entered, updated"; + break; + case "feed_dates": + $override_order = "updated DESC"; + break; + } /* do not rely on params below */ $search = db_escape_string($this->link, $_REQUEST["search"]); $search_mode = db_escape_string($this->link, $_REQUEST["search_mode"]); $headlines = $this->api_get_headlines($this->link, $feed_id, $limit, $offset, - $filter, $is_cat, $show_excerpt, $show_content, $view_mode, false, + $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $override_order, $include_attachments, $since_id, $search, $search_mode, $include_nested, $sanitize_content);