From 073ca0e663781bb90e01c56b058b7c0801f19bcb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 8 Dec 2006 08:21:44 +0100 Subject: new filter action: tag article --- functions.php | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 5fe75c288..c03264213 100644 --- a/functions.php +++ b/functions.php @@ -450,7 +450,8 @@ $result = db_query($link, "SELECT reg_exp, ttrss_filter_types.name AS name, - ttrss_filter_actions.name AS action + ttrss_filter_actions.name AS action, + action_param FROM ttrss_filters,ttrss_filter_types,ttrss_filter_actions WHERE enabled = true AND owner_uid = $owner_uid AND @@ -463,7 +464,8 @@ $filter["reg_exp"] = $line["reg_exp"]; $filter["action"] = $line["action"]; - + $filter["action_param"] = $line["action_param"]; + array_push($filters[$line["name"]], $filter); } @@ -653,9 +655,12 @@ // error_reporting(0); - $filter_name = get_filter_name($entry_title, $entry_content, + $tuple = get_filter_name($entry_title, $entry_content, $entry_link, $filters); + $filter_name = $tuple[0]; + $filter_param = $tuple[1]; + if ($filter_name == "filter") { continue; } @@ -750,6 +755,19 @@ $entry_tags = $entry_tags[1]; + # check for manual tags + + if ($filter_name == "tag") { + + $manual_tags = trim_array(split(",", $filter_param)); + + foreach ($manual_tags as $tag) { + if (!preg_match("/^[0-9]*$/", $tag)) { + array_push($entry_tags, $tag); + } + } + } + if (count($entry_tags) > 0) { db_query($link, "BEGIN"); @@ -838,7 +856,7 @@ foreach ($filters["title"] as $filter) { $reg_exp = $filter["reg_exp"]; if (preg_match("/$reg_exp/i", $title)) { - return $filter["action"]; + return array($filter["action"], $filter["action_param"]); } } } @@ -847,7 +865,7 @@ foreach ($filters["content"] as $filter) { $reg_exp = $filter["reg_exp"]; if (preg_match("/$reg_exp/i", $content)) { - return $filter["action"]; + return array($filter["action"], $filter["action_param"]); } } } @@ -857,7 +875,7 @@ $reg_exp = $filter["reg_exp"]; if (preg_match("/$reg_exp/i", $title) || preg_match("/$reg_exp/i", $content)) { - return $filter["action"]; + return array($filter["action"], $filter["action_param"]); } } } @@ -867,7 +885,7 @@ foreach ($filters["link"] as $filter) { $reg_exp = $filter["reg_exp"]; if (preg_match("/$reg_exp/i", $link)) { - return $filter["action"]; + return array($filter["action"], $filter["action_param"]); } } } -- cgit v1.2.3