summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTroy Engel <[email protected]>2015-12-04 13:45:10 -0600
committerTroy Engel <[email protected]>2015-12-04 13:45:10 -0600
commitbeaddcba961cd187e6d3ce968b94610838d70b54 (patch)
tree457dd70dce87e7e208210613cf665a84ee8cc67b /plugins
parentbfd902bbcc349757f656baa169cda4ae6dd72de9 (diff)
Fix accidental use of emtpy array: [E_WARNING (2) plugins/af_readability/init.php:186 Invalid argument supplied for foreach()]
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_readability/init.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php
index 675e5c5d5..97acb4375 100755
--- a/plugins/af_readability/init.php
+++ b/plugins/af_readability/init.php
@@ -33,9 +33,11 @@ class Af_Readability extends Plugin {
print_notice("Enable the plugin for specific feeds in the feed editor.");
$enabled_feeds = $this->host->get($this, "enabled_feeds");
- if (!array($enabled_feeds)) $enabled_feeds = array();
-
- $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
+ if (!array($enabled_feeds)) {
+ $enabled_feeds = array();
+ } else {
+ $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
+ }
$this->host->set($this, "enabled_feeds", $enabled_feeds);
if (count($enabled_feeds) > 0) {
@@ -183,12 +185,14 @@ class Af_Readability extends Plugin {
private function filter_unknown_feeds($enabled_feeds) {
$tmp = array();
- foreach ($enabled_feeds as $feed) {
+ if (!empty($enabled_feeds)) {
+ 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"]);
- if (db_num_rows($result) != 0) {
- array_push($tmp, $feed);
+ if (db_num_rows($result) != 0) {
+ array_push($tmp, $feed);
+ }
}
}