From 0afbd8519316ed633db6e1729653728913f63ebc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 3 Sep 2005 08:50:18 +0100 Subject: [PATCH] implemented filter editor, piggified default filter --- backend.php | 39 +++++++++++++++++++++++++++++---------- prefs.php | 2 +- ttrss_schema.sql | 4 ++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/backend.php b/backend.php index 3b07bd38..2c87cb7c 100644 --- a/backend.php +++ b/backend.php @@ -490,7 +490,7 @@ print "

"; print " - "; + "; $lnum = 0; @@ -545,7 +545,9 @@ print ""; } - + + if (!$line["last_updated"]) $line["last_updated"] = "Never"; + print ""; print ""; @@ -553,6 +555,10 @@ ++$lnum; } + if ($lnum == 0) { + print ""; + } + print "
 SelectTitleLinkLast Updated
LinkLast updated
" . $line["last_updated"] . "
No feeds defined.
"; print "

"; @@ -589,13 +595,18 @@ $subop = $_GET["subop"]; if ($subop == "editSave") { -/* $feed_title = pg_escape_string($_GET["t"]); - $feed_link = pg_escape_string($_GET["l"]); - $feed_id = $_GET["id"]; - - $result = pg_query("UPDATE ttrss_feeds SET - title = '$feed_title', feed_url = '$feed_link' WHERE id = '$feed_id'"); */ + $regexp = pg_escape_string($_GET["r"]); + $descr = pg_escape_string($_GET["d"]); + $match = pg_escape_string($_GET["m"]); + $filter_id = pg_escape_string($_GET["id"]); + + $result = pg_query("UPDATE ttrss_filters SET + regexp = '$regexp', + description = '$descr', + filter_type = (SELECT id FROM ttrss_filter_types WHERE + description = '$match') + WHERE id = '$filter_id'"); } if ($subop == "remove") { @@ -655,8 +666,8 @@ print "

"; print " - - "; + + "; $lnum = 0; @@ -675,6 +686,8 @@ if (!$edit_filter_id || $subop != "edit") { + if (!$line["description"]) $line["description"] = "[No description]"; + print ""; @@ -688,6 +701,8 @@ } else if ($filter_id != $edit_filter_id) { + if (!$line["description"]) $line["description"] = "[No description]"; + print ""; @@ -717,6 +732,10 @@ ++$lnum; } + if ($lnum == 0) { + print ""; + } + print "
SelectFilter ExpressionDescriptionMatch
SelectFilter expressionDescriptionMatch
No filters defined.
"; print "

"; diff --git a/prefs.php b/prefs.php index 5a3afb1f..73526355 100644 --- a/prefs.php +++ b/prefs.php @@ -28,8 +28,8 @@ +

Feed Configuration

 
-

Feed Configuration

Click to expand >> diff --git a/ttrss_schema.sql b/ttrss_schema.sql index 79a58677..d78e0b16 100644 --- a/ttrss_schema.sql +++ b/ttrss_schema.sql @@ -59,3 +59,7 @@ create table ttrss_filters (id serial primary key, regexp varchar(250) not null, description varchar(250) not null default ''); +COPY ttrss_filters (id, filter_type, regexp, description) FROM stdin; +1 3 PIGGIES MOORE! MOOOOORE PIGGIES! +\. +