summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-12-08 08:21:44 +0100
committerAndrew Dolgov <[email protected]>2006-12-08 08:21:44 +0100
commit073ca0e663781bb90e01c56b058b7c0801f19bcb (patch)
tree7062c3e6da971edc6257184dcd5fb8c12534656e /functions.php
parentde07b5eee928a3d78fede1e3b7ef2d80b5199d42 (diff)
new filter action: tag article
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php32
1 files changed, 25 insertions, 7 deletions
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"]);
}
}
}