diff options
Diffstat (limited to 'classes/api.php')
-rwxr-xr-x | classes/api.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/classes/api.php b/classes/api.php index 262d5c5bc..b282a39ce 100755 --- a/classes/api.php +++ b/classes/api.php @@ -1,7 +1,7 @@ <?php class API extends Handler { - const API_LEVEL = 18; + const API_LEVEL = 20; const STATUS_OK = 0; const STATUS_ERR = 1; @@ -12,6 +12,7 @@ class API extends Handler { const E_INCORRECT_USAGE = "INCORRECT_USAGE"; const E_UNKNOWN_METHOD = "UNKNOWN_METHOD"; const E_OPERATION_FAILED = "E_OPERATION_FAILED"; + const E_NOT_FOUND = "E_NOT_FOUND"; /** @var int|null */ private $seq; @@ -503,9 +504,14 @@ class API extends Handler { } function shareToPublished(): bool { - $title = strip_tags(clean($_REQUEST["title"])); - $url = strip_tags(clean($_REQUEST["url"])); - $content = strip_tags(clean($_REQUEST["content"])); + $title = clean($_REQUEST["title"]); + $url = clean($_REQUEST["url"]); + $sanitize_content = self::_param_to_bool($_REQUEST["sanitize"] ?? true); + + if ($sanitize_content) + $content = clean($_REQUEST["content"]); + else + $content = $_REQUEST["content"]; if (Article::_create_published_article($title, $url, $content, "", $_SESSION["uid"])) { return $this->_wrap(self::STATUS_OK, array("status" => 'OK')); @@ -912,6 +918,17 @@ class API extends Handler { array("categories" => $pf->_makefeedtree())); } + function getFeedIcon(): bool { + $id = (int)$_REQUEST['id']; + $cache = DiskCache::instance('feed-icons'); + + if ($cache->exists((string)$id)) { + return $cache->send((string)$id) > 0; + } else { + return $this->_wrap(self::STATUS_ERR, array("error" => self::E_NOT_FOUND)); + } + } + // only works for labels or uncategorized for the time being private function _is_cat_empty(int $id): bool { if ($id == -2) { |