mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 20:45:55 +00:00
Fix accidental use of emtpy array: [E_WARNING (2) plugins/af_readability/init.php:186 Invalid argument supplied for foreach()]
This commit is contained in:
@@ -33,9 +33,11 @@ class Af_Readability extends Plugin {
|
|||||||
print_notice("Enable the plugin for specific feeds in the feed editor.");
|
print_notice("Enable the plugin for specific feeds in the feed editor.");
|
||||||
|
|
||||||
$enabled_feeds = $this->host->get($this, "enabled_feeds");
|
$enabled_feeds = $this->host->get($this, "enabled_feeds");
|
||||||
if (!array($enabled_feeds)) $enabled_feeds = array();
|
if (!array($enabled_feeds)) {
|
||||||
|
$enabled_feeds = array();
|
||||||
|
} else {
|
||||||
$enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
|
$enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
|
||||||
|
}
|
||||||
$this->host->set($this, "enabled_feeds", $enabled_feeds);
|
$this->host->set($this, "enabled_feeds", $enabled_feeds);
|
||||||
|
|
||||||
if (count($enabled_feeds) > 0) {
|
if (count($enabled_feeds) > 0) {
|
||||||
@@ -183,6 +185,7 @@ class Af_Readability extends Plugin {
|
|||||||
private function filter_unknown_feeds($enabled_feeds) {
|
private function filter_unknown_feeds($enabled_feeds) {
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
|
||||||
|
if (!empty($enabled_feeds)) {
|
||||||
foreach ($enabled_feeds as $feed) {
|
foreach ($enabled_feeds as $feed) {
|
||||||
|
|
||||||
$result = db_query("SELECT id FROM ttrss_feeds WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
|
$result = db_query("SELECT id FROM ttrss_feeds WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
@@ -191,6 +194,7 @@ class Af_Readability extends Plugin {
|
|||||||
array_push($tmp, $feed);
|
array_push($tmp, $feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user