]> git.wh0rd.org - tt-rss.git/commitdiff
checkbox to sql bool related changes, some more boolean fixes
authorAndrew Dolgov <noreply@fakecake.org>
Sat, 2 Dec 2017 11:07:48 +0000 (14:07 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sat, 2 Dec 2017 11:07:48 +0000 (14:07 +0300)
classes/pref/filters.php
include/functions.php
plugins/af_psql_trgm/init.php
plugins/af_readability/init.php
plugins/af_redditimgur/init.php
plugins/af_zz_imgproxy/init.php

index 76259d739414c0c2fe53bc70834a00979b098d85..4cd52487aac98564b041cd0239c7e9aaf79f3519 100755 (executable)
@@ -696,7 +696,7 @@ class Pref_Filters extends Handler_Protected {
                                if ($rule) {
 
                                        $reg_exp = trim($rule["reg_exp"]);
-                                       $inverse = isset($rule["inverse"]) ? "true" : "false";
+                                       $inverse = isset($rule["inverse"]) ? true : false;
 
                                        $filter_type = (int)trim($rule["filter_type"]);
                                        $match_on = json_encode($rule["feed_id"]);
index 0b301b82e0f3b34faed5320503c125a4b255d979..887de1c8110e9bcd69afb4d9d0a03e9abac4d8a6 100644 (file)
        }
 
        function checkbox_to_sql_bool($val) {
-               return ($val == "on") ? "true" : "false";
+               return ($val == "on") ? true : false;
        }
 
        function uniqid_short() {
index 175176e0bdf47b80375fb79dbf6fc7f096366735..7ce385f2988f4d0e82449312f27ee44543025c2a 100644 (file)
@@ -12,7 +12,7 @@ class Af_Psql_Trgm extends Plugin {
        function save() {
                $similarity = (float) db_escape_string($_POST["similarity"]);
                $min_title_length = (int) db_escape_string($_POST["min_title_length"]);
-               $enable_globally = checkbox_to_sql_bool($_POST["enable_globally"]) == "true";
+               $enable_globally = checkbox_to_sql_bool($_POST["enable_globally"]);
 
                if ($similarity < 0) $similarity = 0;
                if ($similarity > 1) $similarity = 1;
@@ -226,7 +226,7 @@ class Af_Psql_Trgm extends Plugin {
                $enabled_feeds = $this->host->get($this, "enabled_feeds");
                if (!is_array($enabled_feeds)) $enabled_feeds = array();
 
-               $enable = checkbox_to_sql_bool($_POST["trgm_similarity_enabled"]) == 'true';
+               $enable = checkbox_to_sql_bool($_POST["trgm_similarity_enabled"]);
                $key = array_search($feed_id, $enabled_feeds);
 
                if ($enable) {
index 192ad90b6efef9d8e8cb61fe1c25c006d4573c71..873eba1bae90c16c818412834966b38763033f60 100755 (executable)
@@ -14,7 +14,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 +112,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) {
index 8074894fd72203cf5c5ef806fef06cdb1b6296dd..82e3226a7c764c848b0cbbaa1f4731d0f1da699c 100755 (executable)
@@ -64,8 +64,8 @@ class Af_RedditImgur extends Plugin {
        }
 
        function save() {
-               $enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
-               $enable_content_dupcheck = checkbox_to_sql_bool($_POST["enable_content_dupcheck"]) == "true";
+               $enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]);
+               $enable_content_dupcheck = checkbox_to_sql_bool($_POST["enable_content_dupcheck"]);
 
                $this->host->set($this, "enable_readability", $enable_readability, false);
                $this->host->set($this, "enable_content_dupcheck", $enable_content_dupcheck);
index 4cfca4180516612192316e42ff2f7fbf579a869d..a6f0083245673ea8b1bf26f9f4e876e663fb6f2b 100644 (file)
@@ -241,8 +241,8 @@ class Af_Zz_ImgProxy extends Plugin {
        }
 
        function save() {
-               $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"]) == "true";
-               $disable_cache = checkbox_to_sql_bool($_POST["disable_cache"]) == "true";
+               $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"]);
+               $disable_cache = checkbox_to_sql_bool($_POST["disable_cache"]);
 
                $this->host->set($this, "proxy_all", $proxy_all, false);
                $this->host->set($this, "disable_cache", $disable_cache);