]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix inverse status not being set correctly for filters when creating
authorAndrew Dolgov <fox@fakecake.org>
Tue, 25 Jun 2013 22:17:49 +0000 (02:17 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Tue, 25 Jun 2013 22:17:49 +0000 (02:17 +0400)
them
fix inverse rules not being saved/restored properly through opml

classes/opml.php
classes/pref/filters.php

index c5d14cdde4e44d962c13fe6544730011ab006497..e9a07bb5274a3edd8b2f0bc6da83d1f702241da9 100644 (file)
@@ -190,6 +190,7 @@ class Opml extends Handler_Protected {
                                        }
 
                                        $tmp_line["cat_filter"] = sql_bool_to_bool($tmp_line["cat_filter"]);
+                                       $tmp_line["inverse"] = sql_bool_to_bool($tmp_line["inverse"]);
 
                                        unset($tmp_line["feed_id"]);
                                        unset($tmp_line["cat_id"]);
@@ -363,9 +364,10 @@ class Opml extends Handler_Protected {
                                                $cat_filter = bool_to_sql_bool($rule["cat_filter"]);
                                                $reg_exp = $this->dbh->escape_string($rule["reg_exp"]);
                                                $filter_type = (int)$rule["filter_type"];
+                                               $inverse = bool_to_sql_bool($rule["inverse"]);
 
-                                               $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter)
-                                                       VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter)");
+                                               $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse)
+                                                       VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter,$inverse)");
                                        }
 
                                        foreach ($filter["actions"] as $action) {
index bcc7b5aec424abbbf53a9447dc6fae386dbc3483..6a70e622c242e8236d3b9aba99d200d5011e4847 100644 (file)
@@ -585,14 +585,15 @@ class Pref_Filters extends Handler_Protected {
                $enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
                $match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
                $title = $this->dbh->escape_string($_REQUEST["title"]);
+               $inverse = checkbox_to_sql_bool($_REQUEST["inverse"]);
 
                $this->dbh->query("BEGIN");
 
                /* create base filter */
 
                $result = $this->dbh->query("INSERT INTO ttrss_filters2
-                       (owner_uid, match_any_rule, enabled, title) VALUES
-                       (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title')");
+                       (owner_uid, match_any_rule, enabled, title, inverse) VALUES
+                       (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title', $inverse)");
 
                $result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2
                        WHERE owner_uid = ".$_SESSION["uid"]);