summaryrefslogtreecommitdiff
path: root/classes/API.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/API.php')
-rw-r--r--classes/API.php38
1 files changed, 16 insertions, 22 deletions
diff --git a/classes/API.php b/classes/API.php
index 6dbb1f246..826d1f333 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -235,7 +235,7 @@ class API extends Handler {
}
function updateArticle(): bool {
- $article_ids = explode(",", clean($_REQUEST["article_ids"]));
+ $article_ids = array_filter(explode(",", clean($_REQUEST["article_ids"] ?? "")));
$mode = (int) clean($_REQUEST["mode"]);
$data = clean($_REQUEST["data"] ?? "");
$field_raw = (int)clean($_REQUEST["field"]);
@@ -300,10 +300,9 @@ class API extends Handler {
}
function getArticle(): bool {
- $article_ids = explode(',', clean($_REQUEST['article_id'] ?? ''));
+ $article_ids = array_filter(explode(',', clean($_REQUEST['article_id'] ?? '')));
$sanitize_content = self::_param_to_bool($_REQUEST['sanitize'] ?? true);
- // @phpstan-ignore-next-line
if (count($article_ids)) {
$entries = ORM::for_table('ttrss_entries')
->table_alias('e')
@@ -550,26 +549,22 @@ class API extends Handler {
/* Virtual feeds */
- $vfeeds = PluginHost::getInstance()->get_feeds(Feeds::CATEGORY_SPECIAL);
-
- if (is_array($vfeeds)) {
- foreach ($vfeeds as $feed) {
- if (!implements_interface($feed['sender'], 'IVirtualFeed'))
- continue;
+ foreach (PluginHost::getInstance()->get_feeds(Feeds::CATEGORY_SPECIAL) as $feed) {
+ if (!implements_interface($feed['sender'], 'IVirtualFeed'))
+ continue;
- /** @var IVirtualFeed $feed['sender'] */
- $unread = $feed['sender']->get_unread($feed['id']);
+ /** @var IVirtualFeed $feed['sender'] */
+ $unread = $feed['sender']->get_unread($feed['id']);
- if ($unread || !$unread_only) {
- $row = [
- 'id' => PluginHost::pfeed_to_feed_id($feed['id']),
- 'title' => $feed['title'],
- 'unread' => $unread,
- 'cat_id' => Feeds::CATEGORY_SPECIAL,
- ];
+ if ($unread || !$unread_only) {
+ $row = [
+ 'id' => PluginHost::pfeed_to_feed_id($feed['id']),
+ 'title' => $feed['title'],
+ 'unread' => $unread,
+ 'cat_id' => Feeds::CATEGORY_SPECIAL,
+ ];
- array_push($feeds, $row);
- }
+ array_push($feeds, $row);
}
}
@@ -696,7 +691,6 @@ class API extends Handler {
if (!$is_cat && is_numeric($feed_id) && $feed_id < PLUGIN_FEED_BASE_INDEX && $feed_id > LABEL_BASE_INDEX) {
$pfeed_id = PluginHost::feed_to_pfeed_id($feed_id);
- /** @var IVirtualFeed|false $handler */
$handler = PluginHost::getInstance()->get_feed_handler($pfeed_id);
if ($handler) {
@@ -858,7 +852,7 @@ class API extends Handler {
array_push($headlines, $headline_row);
}
- } else if (is_numeric($result) && $result == -1) {
+ } else if ($result == -1) {
$headlines_header['first_id_changed'] = true;
}