X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Fapi.php;h=e505dcc915dd90f5d09feaab07d62da51970091b;hb=e52034b4bcce994312ce2af31be0a46a70172691;hp=4c321d77ef856b46bdbf668349978aad11004445;hpb=e6532439d68234d86176e4d967609d68dd564c1d;p=tt-rss.git diff --git a/classes/api.php b/classes/api.php old mode 100644 new mode 100755 index 4c321d77..e505dcc9 --- a/classes/api.php +++ b/classes/api.php @@ -11,7 +11,7 @@ class API extends Handler { static function param_to_bool($p) { return $p && ($p !== "f" && $p !== "false"); } - + function before($method) { if (parent::before($method)) { header("Content-Type: text/json"); @@ -186,7 +186,7 @@ class API extends Handler { function getHeadlines() { $feed_id = clean($_REQUEST["feed_id"]); - if ($feed_id != "") { + if ($feed_id !== "") { if (is_numeric($feed_id)) $feed_id = (int) $feed_id; @@ -293,8 +293,8 @@ class API extends Handler { $article_qmarks = arr_qmarks($article_ids); - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET - $field = $set_to $additional_fields + $sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET + $field = $set_to $additional_fields WHERE ref_id IN ($article_qmarks) AND owner_uid = ?"); $sth->execute(array_merge($article_ids, [$_SESSION['uid']])); @@ -379,6 +379,8 @@ class API extends Handler { $article = $p->hook_render_article_api(array("article" => $article)); } + $article['content'] = rewrite_cached_urls($article['content']); + array_push($articles, $article); } @@ -623,7 +625,7 @@ class API extends Handler { id, feed_url, cat_id, title, order_id, ". SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated FROM ttrss_feeds WHERE - (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) + (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND owner_uid = :uid ORDER BY cat_id, title " . $limit_qpart); $sth->execute([":uid" => $_SESSION['uid'], ":cat" => $cat_id]); @@ -753,7 +755,7 @@ class API extends Handler { "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], - "feed_id" => $line["feed_id"], + "feed_id" => $line["feed_id"] ? $line['feed_id'] : 0, "tags" => $tags, ); @@ -799,6 +801,8 @@ class API extends Handler { $headline_row = $p->hook_render_article_api(array("headline" => $headline_row)); } + $headline_row['content'] = rewrite_cached_urls($headline_row['content']); + array_push($headlines, $headline_row); } } else if (is_numeric($result) && $result == -1) {