From 3f2ff803b391b719397f606dabd0c182db6ec274 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 30 Jan 2007 17:23:35 +0100 Subject: add interface/schema for inverse matching filters --- modules/pref-filters.php | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'modules/pref-filters.php') diff --git a/modules/pref-filters.php b/modules/pref-filters.php index 2a4747b8f..cbd942142 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -17,6 +17,7 @@ $action_param = db_fetch_result($result, 0, "action_param"); $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled")); + $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse")); print "
Filter editor
"; print "
"; @@ -87,9 +88,18 @@ $checked = ""; } - print "Options: + print "Options: - "; +
"; + + if ($inverse) { + $checked = "checked"; + } else { + $checked = ""; + } + + print " + "; print ""; @@ -121,6 +131,7 @@ $action_id = db_escape_string($_GET["action_id"]); $action_param = db_escape_string($_GET["action_param"]); $enabled = checkbox_to_sql_bool(db_escape_string($_GET["enabled"])); + $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"])); if (!$feed_id) { $feed_id = 'NULL'; @@ -134,6 +145,7 @@ action_id = '$action_id', filter_type = '$filter_type', enabled = $enabled, + inverse = $inverse, action_param = '$action_param' WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); } @@ -161,6 +173,8 @@ $action_id = db_escape_string($_GET["action_id"]); $action_param = db_escape_string($_GET["action_param"]); + $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"])); + if (!$regexp) return; if (!$feed_id) { @@ -171,10 +185,10 @@ $result = db_query($link, "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id, - action_id, action_param) + action_id, action_param, inverse) VALUES ('$regexp', '$filter_type','".$_SESSION["uid"]."', - $feed_id, '$action_id', '$action_param')"); + $feed_id, '$action_id', '$action_param', $inverse)"); } } @@ -209,6 +223,7 @@ ttrss_filter_types.name AS filter_type_name, ttrss_filter_types.description AS filter_type_descr, enabled, + inverse, feed_id, ttrss_filter_actions.description AS action_description, ttrss_feeds.title AS feed_title @@ -251,7 +266,8 @@ $edit_filter_id = $_GET["id"]; $enabled = sql_bool_to_bool($line["enabled"]); - + $inverse = sql_bool_to_bool($line["inverse"]); + if ($subop == "edit" && $filter_id != $edit_filter_id) { $class .= "Grayed"; $this_row_id = ""; @@ -286,9 +302,15 @@ print "" . $line["feed_title"] . ""; + + $inverse_label = ""; + + if ($inverse) { + $inverse_label = " (Inverse)"; + } print "" . - $line["filter_type_descr"] . ""; + $line["filter_type_descr"] . "$inverse_label"; print "" . $line["action_description"] . ""; -- cgit v1.2.3