summaryrefslogtreecommitdiff
path: root/classes/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/api.php')
-rwxr-xr-xclasses/api.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/classes/api.php b/classes/api.php
index a0ee773c1..a1ed7968c 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -1,7 +1,7 @@
<?php
class API extends Handler {
- const API_LEVEL = 15;
+ const API_LEVEL = 16;
const STATUS_OK = 0;
const STATUS_ERR = 1;
@@ -49,7 +49,7 @@ class API extends Handler {
}
function getVersion() {
- $rv = array("version" => get_version());
+ $rv = array("version" => Config::get_version());
$this->_wrap(self::STATUS_OK, $rv);
}
@@ -98,8 +98,8 @@ class API extends Handler {
}
function getUnread() {
- $feed_id = clean($_REQUEST["feed_id"]);
- $is_cat = clean($_REQUEST["is_cat"]);
+ $feed_id = clean($_REQUEST["feed_id"] ?? "");
+ $is_cat = clean($_REQUEST["is_cat"] ?? "");
if ($feed_id) {
$this->_wrap(self::STATUS_OK, array("unread" => getFeedUnread($feed_id, $is_cat)));
@@ -188,15 +188,15 @@ class API extends Handler {
if (is_numeric($feed_id)) $feed_id = (int) $feed_id;
- $limit = (int)clean($_REQUEST["limit"]);
+ $limit = (int)clean($_REQUEST["limit"] ?? 0 );
if (!$limit || $limit >= 200) $limit = 200;
- $offset = (int)clean($_REQUEST["skip"]);
+ $offset = (int)clean($_REQUEST["skip"] ?? 0);
$filter = clean($_REQUEST["filter"] ?? "");
$is_cat = self::_param_to_bool(clean($_REQUEST["is_cat"] ?? false));
$show_excerpt = self::_param_to_bool(clean($_REQUEST["show_excerpt"] ?? false));
- $show_content = self::_param_to_bool(clean($_REQUEST["show_content"]));
+ $show_content = self::_param_to_bool(clean($_REQUEST["show_content"] ?? false));
/* all_articles, unread, adaptive, marked, updated */
$view_mode = clean($_REQUEST["view_mode"] ?? null);
$include_attachments = self::_param_to_bool(clean($_REQUEST["include_attachments"] ?? false));
@@ -258,6 +258,10 @@ class API extends Handler {
break;
case 3:
$field = "note";
+ break;
+ case 4:
+ $field = "score";
+ break;
};
switch ($mode) {
@@ -273,6 +277,7 @@ class API extends Handler {
}
if ($field == "note") $set_to = $this->pdo->quote($data);
+ if ($field == "score") $set_to = (int) $data;
if ($field && $set_to && count($article_ids) > 0) {
@@ -363,6 +368,7 @@ class API extends Handler {
}
$this->_wrap(self::STATUS_OK, $articles);
+ // @phpstan-ignore-next-line
} else {
$this->_wrap(self::STATUS_ERR, array("error" => self::E_INCORRECT_USAGE));
}
@@ -786,7 +792,8 @@ class API extends Handler {
list ($flavor_image, $flavor_stream, $flavor_kind) = Article::_get_image($enclosures,
$line["content"], // unsanitized
- $line["site_url"]);
+ $line["site_url"],
+ $headline_row);
$headline_row["flavor_image"] = $flavor_image;
$headline_row["flavor_stream"] = $flavor_stream;