summaryrefslogtreecommitdiff
path: root/classes/API.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/API.php')
-rw-r--r--classes/API.php39
1 files changed, 18 insertions, 21 deletions
diff --git a/classes/API.php b/classes/API.php
index 6dbb1f246..d6d622c52 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"]);
@@ -550,26 +550,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,10 +692,11 @@ 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) {
+ if ($handler && implements_interface($handler, 'IVirtualFeed')) {
+ /** @var Plugin&IVirtualFeed $handler */
+
$params = array(
"feed" => $feed_id,
"limit" => $limit,
@@ -858,7 +855,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;
}