* fix showing headlines for tag-based virtual feeds

* API: allow retrieving headlines for tag-based feeds (bump api level to 18)
This commit is contained in:
Andrew Dolgov 2021-11-29 10:20:13 +03:00
parent 831648e3c8
commit 28fb571dca
2 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?php
class API extends Handler {
const API_LEVEL = 17;
const API_LEVEL = 18;
const STATUS_OK = 0;
const STATUS_ERR = 1;
@ -186,11 +186,9 @@ class API extends Handler {
}
function getHeadlines(): bool {
$feed_id = clean($_REQUEST["feed_id"]);
if ($feed_id !== "" && is_numeric($feed_id)) {
$feed_id = (int) $feed_id;
$feed_id = clean($_REQUEST["feed_id"] ?? "");
if (!empty($feed_id)) {
$limit = (int)clean($_REQUEST["limit"] ?? 0 );
if (!$limit || $limit >= 200) $limit = 200;
@ -632,9 +630,10 @@ class API extends Handler {
}
/**
* @param string|int $feed_id
* @return array{0: array<int, array<string, mixed>>, 1: array<string, mixed>} $headlines, $headlines_header
*/
private static function _api_get_headlines(int $feed_id, int $limit, int $offset,
private static function _api_get_headlines(mixed $feed_id, int $limit, int $offset,
string $filter, bool $is_cat, bool $show_excerpt, bool $show_content, ?string $view_mode, string $order,
bool $include_attachments, int $since_id, string $search = "", bool $include_nested = false,
bool $sanitize_content = true, bool $force_update = false, int $excerpt_length = 100, ?int $check_first_id = null,

View File

@ -18,9 +18,10 @@ class Feeds extends Handler_Protected {
}
/**
* @param string|int $feed
* @return array{0: array<int, int>, 1: int, 2: int, 3: bool, 4: array<string, mixed>} $topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply
*/
private function _format_headlines_list(int $feed, string $method, string $view_mode, int $limit, bool $cat_view,
private function _format_headlines_list(mixed $feed, string $method, string $view_mode, int $limit, bool $cat_view,
int $offset, string $override_order, bool $include_children, ?int $check_first_id = null,
bool $skip_first_id_check, string $order_by): array {
@ -1213,7 +1214,10 @@ class Feeds extends Handler_Protected {
}
}
static function _get_title(int $id, bool $cat = false): string {
/**
* @param string|int $id
*/
static function _get_title(mixed $id, bool $cat = false): string {
$pdo = Db::pdo();
if ($cat) {