From a0d5388913ca8f9a97fa1ef257517230412bafdd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 3 Sep 2005 08:22:29 +0100 Subject: reworked preferences dialog, start work on post filters (schema updated) --- backend.php | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 166 insertions(+), 1 deletion(-) (limited to 'backend.php') diff --git a/backend.php b/backend.php index ef6caf0b1..9c0b5c8b0 100644 --- a/backend.php +++ b/backend.php @@ -475,7 +475,13 @@ } } } - + + print " + + +
+ Add feed
"; + $result = pg_query("SELECT id,title,feed_url,substring(last_updated,1,16) as last_updated FROM @@ -578,5 +584,164 @@ } + if ($op == "pref-filters") { + + $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'"); */ + + } + + if ($subop == "remove") { + + if (!WEB_DEMO_MODE) { + + $ids = split(",", $_GET["ids"]); + + foreach ($ids as $id) { + pg_query("DELETE FROM ttrss_filters WHERE id = '$id'"); + + } + } + } + + if ($subop == "add") { + +/* if (!WEB_DEMO_MODE) { + + $feed_link = pg_escape_string($_GET["link"]); + + $result = pg_query( + "INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')"); + + $result = pg_query( + "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'"); + + $feed_id = pg_fetch_result($result, 0, "id"); + + if ($feed_id) { + update_rss_feed($link, $feed_link, $feed_id); + } + } */ + } + + $result = pg_query("SELECT description + FROM ttrss_filter_types ORDER BY description"); + + $filter_types = array(); + + while ($line = pg_fetch_assoc($result)) { + array_push($filter_types, $line["description"]); + } + + print " + + +
Expr: "; + print_select("fadd_match", "", $filter_types); + + print" + Add filter
"; + + $result = pg_query("SELECT + id,regexp,description, + (SELECT name FROM ttrss_filter_types WHERE + id = filter_type) as filter_type_name, + (SELECT description FROM ttrss_filter_types + WHERE id = filter_type) as filter_type_descr + FROM + ttrss_filters ORDER by id"); + + print "

"; + + print " + + "; + + $lnum = 0; + + while ($line = pg_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + + $filter_id = $line["id"]; + $edit_filter_id = $_GET["id"]; + + if ($subop == "edit" && $filter_id != $edit_filter_id) { + $class .= "Grayed"; + } + + print ""; + + if (!$edit_filter_id || $subop != "edit") { + + print ""; + + print ""; + + print ""; + + print ""; + + } else if ($filter_id != $edit_filter_id) { + + print ""; + + print ""; + print ""; + print ""; + + } else { + + print ""; + + print ""; + + print ""; + + print ""; + + } + + + print ""; + + ++$lnum; + } + + print "
SelectFilter ExpressionDescriptionMatch
" . + $line["regexp"] . "" . + $line["description"] . "".$line["filter_type_descr"]."".$line["regexp"]."".$line["description"]."".$line["filter_type_descr"].""; + print_select("iedit_match", $line["filter_type_descr"], $filter_types); + print "
"; + + print "

"; + + if ($subop == "edit") { + print "Edit feed:  + Cancel  + Save"; + + } else { + + print " + Selection:  + Edit  + Remove "; + } + } + pg_close($link); ?> -- cgit v1.2.3-54-g00ecf