From 18ad09af0120fe19f9a0722b737978a4892fc474 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 31 Mar 2013 16:40:24 +0400 Subject: implement filter titles --- classes/pref/filters.php | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 883ff0ebd..91ff348f3 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -178,7 +178,7 @@ class Pref_Filters extends Handler_Protected { $fg_color = db_fetch_result($label_result, 0, "fg_color"); $bg_color = db_fetch_result($label_result, 0, "bg_color"); - $name[1] = "α" . $name[1]; + if ($name[1]) $name[1] = "α" . $name[1]; } } @@ -218,6 +218,7 @@ class Pref_Filters extends Handler_Protected { $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled")); $match_any_rule = sql_bool_to_bool(db_fetch_result($result, 0, "match_any_rule")); $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse")); + $title = htmlspecialchars(db_fetch_result($result, 0, "title")); print "
"; @@ -226,6 +227,12 @@ class Pref_Filters extends Handler_Protected { print ""; print ""; + print "
".__("Caption")."
"; + + print ""; + + print ""; + print "
".__("Match")."
"; print "
"; @@ -422,10 +429,12 @@ class Pref_Filters extends Handler_Protected { $enabled = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["enabled"])); $match_any_rule = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["match_any_rule"])); $inverse = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"])); + $title = db_escape_string($this->link, $_REQUEST["title"]); $result = db_query($this->link, "UPDATE ttrss_filters2 SET enabled = $enabled, match_any_rule = $match_any_rule, - inverse = $inverse + inverse = $inverse, + title = '$title' WHERE id = '$filter_id' AND owner_uid = ". $_SESSION["uid"]); @@ -539,14 +548,15 @@ class Pref_Filters extends Handler_Protected { $enabled = checkbox_to_sql_bool($_REQUEST["enabled"]); $match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]); + $title = db_escape_string($this->link, $_REQUEST["title"]); db_query($this->link, "BEGIN"); /* create base filter */ $result = db_query($this->link, "INSERT INTO ttrss_filters2 - (owner_uid, match_any_rule, enabled) VALUES - (".$_SESSION["uid"].",$match_any_rule,$enabled)"); + (owner_uid, match_any_rule, enabled, title) VALUES + (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title')"); $result = db_query($this->link, "SELECT MAX(id) AS id FROM ttrss_filters2 WHERE owner_uid = ".$_SESSION["uid"]); @@ -668,6 +678,10 @@ class Pref_Filters extends Handler_Protected { print ""; print ""; + print "
".__("Caption")."
"; + + print ""; + print "
".__("Match")."
"; print "
"; @@ -894,6 +908,16 @@ class Pref_Filters extends Handler_Protected { } private function getFilterName($id) { + + $result = db_query($this->link, + "SELECT title FROM ttrss_filters2 WHERE id = '$id'"); + + $title = db_fetch_result($result, 0, "title"); + + if ($title) { + return array($title); + } else { + $result = db_query($this->link, "SELECT * FROM ttrss_filters2_rules WHERE filter_id = '$id' ORDER BY id LIMIT 3"); @@ -937,6 +961,8 @@ class Pref_Filters extends Handler_Protected { } return array(join(", ", $titles), join(", ", $actions)); + + } } function join() { -- cgit v1.2.3