]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/filters.php
support disabling of e-mail digests entirely
[tt-rss.git] / classes / pref / filters.php
index 74aecd30901ddbaad2f83ce783182cdd8d9e5c47..451b591bc5a9babcf3ba3f516bbcb6ae7c1a834d 100755 (executable)
@@ -16,7 +16,7 @@ class Pref_Filters extends Handler_Protected {
        }
 
        function savefilterorder() {
-               $data = json_decode(clean($_POST['payload']), true);
+               $data = json_decode($_POST['payload'], true);
 
                #file_put_contents("/tmp/saveorder.json", clean($_POST['payload']));
                #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
@@ -301,7 +301,7 @@ class Pref_Filters extends Handler_Protected {
 
                        $match_ok = false;
                        if ($filter_search) {
-                               $rules_sth = $this->pdo->prepare("SELECT reg_exp 
+                               $rules_sth = $this->pdo->prepare("SELECT reg_exp
                                        FROM ttrss_filters2_rules WHERE filter_id = ?");
                                $rules_sth->execute([$line['id']]);
 
@@ -356,7 +356,7 @@ class Pref_Filters extends Handler_Protected {
 
                $filter_id = clean($_REQUEST["id"]);
 
-               $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2 
+               $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2
                        WHERE id = ? AND owner_uid = ?");
                $sth->execute([$filter_id, $_SESSION['uid']]);
 
@@ -514,21 +514,22 @@ class Pref_Filters extends Handler_Protected {
                        print "<div class=\"dlgButtons\">";
 
                        print "<div style=\"float : left\">";
-                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">".
+                       print "<button dojoType=\"dijit.form.Button\" class=\"btn-danger\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">".
                                __('Remove')."</button>";
                        print "</div>";
 
                        print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">".
                                __('Test')."</button> ";
 
-                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
+                       print "<button dojoType=\"dijit.form.Button\" type=\"submit\" class=\"btn-primary\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
                                __('Save')."</button> ";
 
                        print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
                                __('Cancel')."</button>";
 
                        print "</div>";
-                       
+                       print "</form>";
+
                }
        }
 
@@ -645,7 +646,7 @@ class Pref_Filters extends Handler_Protected {
                $ids = explode(",", clean($_REQUEST["ids"]));
                $ids_qmarks = arr_qmarks($ids);
 
-               $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2 WHERE id IN ($ids_qmarks) 
+               $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2 WHERE id IN ($ids_qmarks)
                        AND owner_uid = ?");
                $sth->execute(array_merge($ids, [$_SESSION['uid']]));
        }
@@ -661,7 +662,7 @@ class Pref_Filters extends Handler_Protected {
 
                if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = [];
                if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = [];
-               
+
                if ($filter_id) {
                        /* create rules */
 
@@ -962,7 +963,7 @@ class Pref_Filters extends Handler_Protected {
                        $inverse_checked = "";
                }
 
-               print "<form name='filter_new_rule_form' id='filter_new_rule_form'>";
+               print "<form name='filter_new_rule_form' id='filter_new_rule_form' onsubmit='return false;'>";
 
                $res = $this->pdo->query("SELECT id,description
                        FROM ttrss_filter_types WHERE id != 5 ORDER BY description");
@@ -982,6 +983,10 @@ class Pref_Filters extends Handler_Protected {
                         style=\"font-size : 16px; width : 20em;\"
                         name=\"reg_exp\" value=\"$reg_exp\"/>";
 
+               print "<div dojoType=\"dijit.Tooltip\" connectId=\"filterDlg_regExp\" position=\"below\">
+                       ".__("Regular expression, without outer delimiters (i.e. slashes)")."
+               </div>";
+
                print "<hr/>";
                print "<input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\"
                         name=\"inverse\" $inverse_checked/>";
@@ -1010,7 +1015,7 @@ class Pref_Filters extends Handler_Protected {
                </div>";
 
 
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewRuleDlg').execute()\">".
+               print "<button dojoType=\"dijit.form.Button\" class=\"btn-primary \" type=\"submit\" onclick=\"return dijit.byId('filterNewRuleDlg').execute()\">".
                        ($rule ? __("Save rule") : __('Add rule'))."</button> ";
 
                print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewRuleDlg').hide()\">".
@@ -1032,7 +1037,7 @@ class Pref_Filters extends Handler_Protected {
                        $action_id = 0;
                }
 
-               print "<form name='filter_new_action_form' id='filter_new_action_form'>";
+               print "<form name='filter_new_action_form' id='filter_new_action_form' onsubmit='return false;'>";
 
                print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
 
@@ -1103,7 +1108,7 @@ class Pref_Filters extends Handler_Protected {
 
                print "<div class=\"dlgButtons\">";
 
-               print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').execute()\">".
+               print "<button dojoType=\"dijit.form.Button\" class=\"btn-primary\" type=\"submit\" onclick=\"return dijit.byId('filterNewActionDlg').execute()\">".
                        ($action ? __("Save action") : __('Add action'))."</button> ";
 
                print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewActionDlg').hide()\">".
@@ -1135,7 +1140,7 @@ class Pref_Filters extends Handler_Protected {
 
                        $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules);
 
-                       $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2_actions 
+                       $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2_actions
                                WHERE filter_id = ? ORDER BY id LIMIT 1");
                        $sth->execute([$id]);
 
@@ -1242,4 +1247,4 @@ class Pref_Filters extends Handler_Protected {
 
                $this->pdo->commit();
        }
-}
\ No newline at end of file
+}