<?
- header("Content-Type: application/xml");
+// header("Content-Type: application/xml");
require_once "config.php";
require_once "functions.php";
// FIXME: check for null value here
- $result = pg_query("SELECT *,
+ $result = pg_query("SELECT *,SUBSTRING(last_updated,1,16) as last_updated,
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout
FROM ttrss_feeds WHERE id = '$feed'");
print "<table class=\"headlinesList\" id=\"headlinesList\" width=\"100%\">";
+ $feed_last_updated = "Updated: " . $line["last_updated"];
+
print "<tr><td class=\"search\" colspan=\"3\">
Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
- print "<tr><td colspan=\"3\" class=\"title\">" . $line["title"] . "</td></tr>";
+ print "<tr>
+ <td colspan=\"3\" class=\"title\">" . $line["title"] . "</td></tr>";
if ($ext == "SEARCH") {
$search = $_GET["search"];
}
print " ";
+ // start unholy navbar block
+
+
if ($next_skip < $total_entries) {
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
print "<a class=\"disabledButton\">Next Page</a>";
}
print " Feed: ";
-// print "<a class=\"button\"
-// href=\"javascript:viewfeed($feed, $skip, '');\">Refresh Page</a>";
-// print " ";
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, 0, 'ForceUpdate');\">Update</a>";
href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
print "</td></tr>";
+
+ // end unholy navbar block
+
print "</table>";
$result = pg_query("SELECT id, (SELECT count(id) FROM ttrss_entries
if ($rss) {
- pg_query("BEGIN");
-
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'");
$registered_title = pg_fetch_result($result, 0, "title");
pg_query("UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'");
}
+ pg_query("BEGIN");
+
foreach ($rss->items as $item) {
$entry_guid = $item["id"];
$entry_content = $item["description"];
if (!$entry_content) $entry_content = $item["content"];
-
+
+ if (!$entry_content) continue;
+
$entry_content = pg_escape_string($entry_content);
$entry_title = pg_escape_string($entry_title);
FROM
ttrss_entries
WHERE
- guid = '$entry_guid' OR md5_hash = '$content_md5'");
+ guid = '$entry_guid'");
if (pg_num_rows($result) == 0) {
$update_timestamp_qpart = "updated = '$entry_timestamp_fmt',";
}
+// print "$content_md5 vs $md5_hash [$entry_title vs $orig_title, $entry_id, $feed_id]<br>";
+
+ if ($content_md5 != $md5_hash) {
+ $update_md5_qpart = "md5_hash = '$content_md5',";
+ }
+
$query = "UPDATE ttrss_entries
SET
title ='$entry_title',
link = '$entry_link',
$update_timestamp_qpart
$last_read_qpart
+ $update_md5_qpart
content = '$entry_content',
- md5_hash = '$content_md5',
unread = '$unread'
WHERE
id = '$entry_id'";
-
+
+// print "<pre>".htmlspecialchars($query)."</pre>";
+
$result = pg_query($link, $query);
if ($result) ++$num_unread;
}
-
+
}
if ($result) {
padding-bottom : 3px;
}
+table.headlinesList td.feedLastUpdateNotice {
+ font-size : x-small;
+ border-width : 0px 0px 1px 0px;
+ border-color : #d0d0d0;
+ border-style : solid;
+ text-align : left;
+ padding-bottom : 3px;
+ color : #a0a0a0;
+}
+
table.headlinesList td.headlineUpdated {
width : 200px;
}
width : 25px;
text-align : center;
}
+
+
feed_url varchar(250) unique not null,
last_updated timestamp default null);
-insert into ttrss_feeds (id,title,feed_url) values (0, 'Daily Strips', 'http://naboo.lan/~fox/strips/backend.php?op=rss');
-insert into ttrss_feeds (id,title,feed_url) values (1, 'Footnotes', 'http://gnomedesktop.org/node/feed');
-insert into ttrss_feeds (id,title,feed_url) values (2, 'Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');
-insert into ttrss_feeds (id,title,feed_url) values (3, 'Planet Debian', 'http://planet.debian.org/rss20.xml');
-insert into ttrss_feeds (id,title,feed_url) values (5, 'Planet GNOME', 'http://planet.gnome.org/rss20.xml');
-insert into ttrss_feeds (id,title,feed_url) values (6, 'Monologue', 'http://www.go-mono.com/monologue/index.rss');
+insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
+insert into ttrss_feeds (title,feed_url) values ('Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');
+insert into ttrss_feeds (title,feed_url) values ('Planet Debian', 'http://planet.debian.org/rss20.xml');
+insert into ttrss_feeds (title,feed_url) values ('Planet GNOME', 'http://planet.gnome.org/rss20.xml');
+insert into ttrss_feeds (title,feed_url) values ('Monologue', 'http://www.go-mono.com/monologue/index.rss');
-insert into ttrss_feeds (id,title,feed_url) values (8, 'Latest Linux Kernel Versions',
+insert into ttrss_feeds (title,feed_url) values ('Latest Linux Kernel Versions',
'http://kernel.org/kdist/rss.xml');
-insert into ttrss_feeds (id,title,feed_url) values (9, 'RPGDot Newsfeed',
+insert into ttrss_feeds (title,feed_url) values ('RPGDot Newsfeed',
'http://www.rpgdot.com/team/rss/rss0.xml');
-insert into ttrss_feeds (id,title,feed_url) values (10, 'Digg.com News',
+insert into ttrss_feeds (title,feed_url) values ('Digg.com News',
'http://digg.com/rss/index.xml');
-insert into ttrss_feeds (id,title,feed_url) values (11, 'Technocrat.net',
+insert into ttrss_feeds (id,title,feed_url) values ('Technocrat.net',
'http://syndication.technocrat.net/rss');
create table ttrss_entries (id serial not null primary key,
title varchar(250) not null,
guid varchar(300) not null unique,
link varchar(300) not null unique,
- md5_hash varchar(200) not null unique,
+ md5_hash varchar(200) not null,
content text not null,
last_read timestamp,
no_orig_date boolean not null default false,