api: add search parameters to getHeadlines (bump API level)

This commit is contained in:
Andrew Dolgov 2012-01-19 14:07:59 +04:00
parent 0cf816377f
commit 3e4af5b0b3
2 changed files with 10 additions and 9 deletions

View File

@ -2,7 +2,7 @@
class API extends Handler { class API extends Handler {
const API_LEVEL = 1; const API_LEVEL = 2;
const STATUS_OK = 0; const STATUS_OK = 0;
const STATUS_ERR = 1; const STATUS_ERR = 1;
@ -170,9 +170,15 @@ class API extends Handler {
$include_attachments = (bool)db_escape_string($_REQUEST["include_attachments"]); $include_attachments = (bool)db_escape_string($_REQUEST["include_attachments"]);
$since_id = (int)db_escape_string($_REQUEST["since_id"]); $since_id = (int)db_escape_string($_REQUEST["since_id"]);
/* do not rely on params below */
$search = db_escape_string($_REQUEST["search"]);
$search_mode = db_escape_string($_REQUEST["search_mode"]);
$match_on = db_escape_string($_REQUEST["match_on"]);
$headlines = api_get_headlines($this->link, $feed_id, $limit, $offset, $headlines = 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, false,
$include_attachments, $since_id); $include_attachments, $since_id, $search, $search_mode, $match_on);
print $this->wrap(self::STATUS_OK, $headlines); print $this->wrap(self::STATUS_OK, $headlines);
} else { } else {

View File

@ -4388,13 +4388,8 @@
function api_get_headlines($link, $feed_id, $limit, $offset, function api_get_headlines($link, $feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
$include_attachments, $since_id) { $include_attachments, $since_id,
$search = "", $search_mode = "", $match_on = "") {
/* do not rely on params below */
$search = db_escape_string($_REQUEST["search"]);
$search_mode = db_escape_string($_REQUEST["search_mode"]);
$match_on = db_escape_string($_REQUEST["match_on"]);
$qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $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,