"; $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 ($ext == "undefined") $ext = ""; $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 ""; $result = pg_query("SELECT id,title,updated,unread,feed_id FROM ttrss_entries WHERE feed_id = '$feed' ORDER BY updated 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; } print ""; print "
" . $line["title"] . "
".$line["updated"]."$content_link
"; $next_skip = $skip + HEADLINES_PER_PAGE; $prev_skip = $skip - HEADLINES_PER_PAGE; print "Previous Page"; print " "; print "Next Page"; 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
"; } ?>