]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/af_readability/init.php
Merge branch 'master' of git.tt-rss.org:git/tt-rss into pdo-experimental
[tt-rss.git] / plugins / af_readability / init.php
index fbc8fe0ab1586373138b77fc850dbd3ba7fa6c72..04673000a19240f56512f1e15050df6c62bd2d81 100755 (executable)
@@ -1,6 +1,7 @@
 <?php
 class Af_Readability extends Plugin {
 
+       /* @var PluginHost $host */
        private $host;
 
        function about() {
@@ -14,7 +15,7 @@ class Af_Readability extends Plugin {
        }
 
        function save() {
-               $enable_share_anything = checkbox_to_sql_bool($_POST["enable_share_anything"]) == "true";
+               $enable_share_anything = checkbox_to_sql_bool($_POST["enable_share_anything"]);
 
                $this->host->set($this, "enable_share_anything", $enable_share_anything);
 
@@ -112,7 +113,7 @@ class Af_Readability extends Plugin {
                $enabled_feeds = $this->host->get($this, "enabled_feeds");
                if (!is_array($enabled_feeds)) $enabled_feeds = array();
 
-               $enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]) == 'true';
+               $enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]);
                $key = array_search($feed_id, $enabled_feeds);
 
                if ($enable) {
@@ -240,9 +241,10 @@ class Af_Readability extends Plugin {
 
                foreach ($enabled_feeds as $feed) {
 
-                       $result = db_query("SELECT id FROM ttrss_feeds WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
+                       $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
+                       $sth->execute([$feed, $_SESSION['uid']]);
 
-                       if (db_num_rows($result) != 0) {
+                       if ($row = $sth->fetch()) {
                                array_push($tmp, $feed);
                        }
                }