summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2008-04-30 11:12:41 +0100
committerAndrew Dolgov <[email protected]>2008-04-30 11:12:41 +0100
commitfee840fbe3c2ec42dd0174ca26060e140001154f (patch)
tree26eb85c2ccca5dd14d66c9b5253ea1ae61459d17 /functions.php
parent32d59314bc73322ed8094685c08887d49faf19d1 (diff)
pref-feeds: add action to rescore feeds
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index d42316886..cda69bb74 100644
--- a/functions.php
+++ b/functions.php
@@ -5519,4 +5519,35 @@
$text = preg_replace("/\]\]\>/", "", $text);
return $text;
}
+
+ function load_filters($link, $feed, $owner_uid, $action_id = false) {
+ $filters = array();
+
+ if ($action_id) $ftype_query_part = "action_id = '$action_id' AND";
+
+ $result = db_query($link, "SELECT reg_exp,
+ ttrss_filter_types.name AS name,
+ ttrss_filter_actions.name AS action,
+ inverse,
+ action_param
+ FROM ttrss_filters,ttrss_filter_types,ttrss_filter_actions WHERE
+ enabled = true AND
+ $ftype_query_part
+ owner_uid = $owner_uid AND
+ ttrss_filter_types.id = filter_type AND
+ ttrss_filter_actions.id = action_id AND
+ (feed_id IS NULL OR feed_id = '$feed') ORDER BY reg_exp");
+
+ while ($line = db_fetch_assoc($result)) {
+ if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
+ $filter["reg_exp"] = $line["reg_exp"];
+ $filter["action"] = $line["action"];
+ $filter["action_param"] = $line["action_param"];
+ $filter["inverse"] = sql_bool_to_bool($line["inverse"]);
+
+ array_push($filters[$line["name"]], $filter);
+ }
+
+ return $filters;
+ }
?>