"; $lnum = 0; while ($line = pg_fetch_assoc($result)) { $feed = $line["title"]; $feed_id = $line["id"]; $total = $line["total"]; $unread = $line["unread"]; $class = ($lnum % 2) ? "even" : "odd"; if ($unread > 0) $class .= "Unread"; print ""; $feed = "$feed"; print "$feed"; print "$unread"; print "$total"; print ""; ++$lnum; } print " Update all feeds"; print ""; } if ($op == "view") { $id = $_GET["id"]; $result = pg_query("UPDATE ttrss_entries SET unread = false WHERE id = '$id'"); $result = pg_query("SELECT title,link,content FROM ttrss_entries WHERE id = '$id'"); if ($result) { $line = pg_fetch_assoc($result); print ""; print ""; print ""; print "
Title:".$line["title"]."
Link:".$line["link"]."
"; print $line["content"]; } } if ($op == "viewfeed") { $feed = $_GET["feed"]; $skip = $_GET["skip"]; $ext = $_GET["ext"]; if (!$skip) $skip = 0; if ($ext == "undefined") $ext = ""; // FIXME: check for null value here $result = pg_query("SELECT *, EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout FROM ttrss_feeds WHERE id = '$feed'"); if ($result) { $line = pg_fetch_assoc($result); if (!$ext && $line["update_timeout"] > MIN_UPDATE_TIME) { update_rss_feed($link, $line["feed_url"], $feed); } else { if ($ext == "MarkAllRead") { pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$feed'"); } } } print ""; /* print ""; print ""; */ print ""; print ""; if ($ext == "SEARCH") { $search = $_GET["search"]; $search_query_part = "(upper(title) LIKE upper('%$search%') OR content LIKE '%$search%') AND"; } $result = pg_query("SELECT id,title,updated,unread,feed_id FROM ttrss_entries WHERE $search_query_part feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip"); $lnum = 0; while ($line = pg_fetch_assoc($result)) { $class = ($lnum % 2) ? "even" : "odd"; if ($line["unread"] == "t") $class .= "Unread"; $content_link = "".$line["title"].""; print ""; print ""; print ""; print ""; ++$lnum; } if ($lnum == 0) { print ""; } print ""; print "
Search: " . $line["title"] . "
Search:
" . $line["title"] . "
".$line["updated"]."$content_link
No entries found.
"; $next_skip = $skip + HEADLINES_PER_PAGE; $prev_skip = $skip - HEADLINES_PER_PAGE; print "Previous Page"; print " "; print "Next Page"; print "   "; print "Refresh"; print "   "; print "Mark all as read"; print "
"; $result = pg_query("SELECT id, (SELECT count(id) FROM ttrss_entries WHERE feed_id = ttrss_feeds.id) AS total, (SELECT count(id) FROM ttrss_entries WHERE feed_id = ttrss_feeds.id AND unread = true) as unread FROM ttrss_feeds WHERE id = '$feed'"); $total = pg_fetch_result($result, 0, "total"); $unread = pg_fetch_result($result, 0, "unread"); print "
$feed
"; print "
$total
"; print "
$unread
"; } ?>