]> git.wh0rd.org Git - tt-rss.git/commitdiff
af_psql_trgm: clear no longer existing feeds from stored list of enabled ids
authorAndrew Dolgov <noreply@fakecake.org>
Thu, 11 Jun 2015 14:17:19 +0000 (17:17 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Thu, 11 Jun 2015 14:17:19 +0000 (17:17 +0300)
plugins/af_psql_trgm/init.php

index 02a0faba3f9fe9e9acc5860c8b78776531cb0441..aebe3d082983fb36247a76c1b96426d8a6abd717 100644 (file)
@@ -179,6 +179,9 @@ class Af_Psql_Trgm extends Plugin {
                $enabled_feeds = $this->host->get($this, "enabled_feeds");
                if (!array($enabled_feeds)) $enabled_feeds = array();
 
+               $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds);
+               $this->host->set($this, "enabled_feeds", $enabled_feeds);
+
                if (count($enabled_feeds) > 0) {
                        print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>";
 
@@ -276,5 +279,20 @@ class Af_Psql_Trgm extends Plugin {
                return 2;
        }
 
+       private function filter_unknown_feeds($enabled_feeds) {
+               $tmp = array();
+
+               foreach ($enabled_feeds as $feed) {
+
+                       $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);
+                       }
+               }
+
+               return $tmp;
+       }
+
 }
 ?>