From 331900c642bbea3f8b7e242975fae4cfec459433 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 22 Aug 2005 05:56:40 +0100 Subject: basic functionality pass 10 --- backend.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) (limited to 'backend.php') diff --git a/backend.php b/backend.php index 3b9ff5421..6ea1355b9 100644 --- a/backend.php +++ b/backend.php @@ -11,10 +11,11 @@ pg_query("set client_encoding = 'utf-8'"); $op = $_GET["op"]; + $fetch = $_GET["fetch"]; if ($op == "feeds") { - update_all_feeds($link); + if ($fetch) update_all_feeds($link); $result = pg_query("SELECT *, (SELECT count(id) FROM ttrss_entries @@ -53,7 +54,7 @@ } print " - Update all feeds"; + Update all feeds"; print ""; @@ -201,9 +202,43 @@ if ($op == "pref-feeds") { + $subop = $_GET["subop"]; + + if ($subop == "edit") { + print "

[Edit feed placeholder]

"; + } + + if ($subop == "remove") { + $ids = split(",", $_GET["ids"]); + + foreach ($ids as $id) { + pg_query("BEGIN"); + pg_query("DELETE FROM ttrss_entries WHERE feed_id = '$id'"); + pg_query("DELETE FROM ttrss_feeds WHERE id = '$id'"); + pg_query("COMMIT"); + + } + } + + if ($subop == "add") { + $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 * FROM ttrss_feeds ORDER by title"); - print "

"; + print "

"; print ""; @@ -212,13 +247,18 @@ while ($line = pg_fetch_assoc($result)) { $class = ($lnum % 2) ? "even" : "odd"; - - print ""; + + $feed_id = $line["id"]; + + print ""; print ""; - print ""; - print ""; + type=\"checkbox\" id=\"FRCHK-".$line["id"]."\">"; + print ""; + print ""; + print ""; print ""; -- cgit v1.2.3-54-g00ecf
SelectTitleLinkLast Updated
" . $line["title"] . "" . $line["feed_url"] . "" . + $line["title"] . "" . + $line["feed_url"] . "" . $line["last_updated"] . "