fix inverse rule to only mean negative regexp matching except for whole rule (refs #631)

This commit is contained in:
Andrew Dolgov 2013-03-25 20:08:34 +04:00
parent bcd4d24086
commit ec1f8a3d8a
2 changed files with 7 additions and 9 deletions

View file

@ -792,6 +792,11 @@ class Pref_Filters extends Handler_Protected {
style=\"font-size : 16px; width : 20em;\" style=\"font-size : 16px; width : 20em;\"
name=\"reg_exp\" value=\"$reg_exp\"/>"; name=\"reg_exp\" value=\"$reg_exp\"/>";
print "<hr/>";
print "<input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\"
name=\"inverse\" $inverse_checked/>";
print "<label for=\"filterDlg_inverse\">".__("Inverse regular expression matching")."</label>";
print "<hr/>" . __("on field") . " "; print "<hr/>" . __("on field") . " ";
print_select_hash("filter_type", $filter_type, $filter_types, print_select_hash("filter_type", $filter_type, $filter_types,
'dojoType="dijit.form.Select"'); 'dojoType="dijit.form.Select"');
@ -806,13 +811,6 @@ class Pref_Filters extends Handler_Protected {
'dojoType="dijit.form.FilteringSelect"'); 'dojoType="dijit.form.FilteringSelect"');
print "</span>"; print "</span>";
print "<p>";
print "<input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\"
name=\"inverse\" $inverse_checked/>";
print "<label for=\"filterDlg_inverse\">".__("Inverse matching")."</label>";
print "</div>"; print "</div>";
print "<div class=\"dlgButtons\">"; print "<div class=\"dlgButtons\">";

View file

@ -3905,6 +3905,8 @@
break; break;
} }
if (isset($rule['inverse'])) $qpart = "NOT ($qpart)";
if (isset($rule["feed_id"]) && $rule["feed_id"] > 0) { if (isset($rule["feed_id"]) && $rule["feed_id"] > 0) {
$qpart .= " AND feed_id = " . db_escape_string($link, $rule["feed_id"]); $qpart .= " AND feed_id = " . db_escape_string($link, $rule["feed_id"]);
} }
@ -3925,8 +3927,6 @@
$qpart .= " AND $cat_qpart"; $qpart .= " AND $cat_qpart";
} }
if (isset($rule['inverse'])) $qpart = "NOT ($qpart)";
array_push($query, "($qpart)"); array_push($query, "($qpart)");
} }