support for feed-specific images (channel->url)

master
Andrew Dolgov 20 years ago
parent a14b6d21d9
commit b7f4bda298

@ -6,7 +6,7 @@
+ update detection based on content checksum
+ cleanup posts older then specified number of days
~ keyboard navigation
- support channel -> image -> url (like in LJ feeds)
+ support for channel -> image -> url (like in LJ feeds)
1.1

@ -178,30 +178,36 @@
$result = pg_query("UPDATE ttrss_entries SET unread = false,last_read = NOW() WHERE id = '$id'");
$result = pg_query("SELECT title,link,content FROM ttrss_entries
$result = pg_query("SELECT title,link,content,feed_id,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url
FROM ttrss_entries
WHERE id = '$id'");
if ($result) {
$line = pg_fetch_assoc($result);
/* print "<table class=\"feedOverview\">";
print "<tr><td><b>Title:</b></td><td>".$line["title"]."</td></tr>";
print "<tr><td><b>Link:</b></td><td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>";
print "</table>";
print $line["content"]; */
if ($line["icon_url"]) {
$feed_icon = "<img class=\"feedIcon\" src=\"" . $line["icon_url"] . "\">";
} else {
$feed_icon = "&nbsp;";
}
print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"0\">";
print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td>
<td width=\"100%\">".$line["title"]."</td></tr>";
<td width=\"100%\">".$line["title"]."</td>
<td>&nbsp;</td></tr>";
print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td>
<td><a href=\"".$line["link"]."\">".$line["link"]."</a></td></tr>";
print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td></tr>";
print "</table>";
<td><a href=\"".$line["link"]."\">".$line["link"]."</a></td>
<td>&nbsp;</td> </tr>";
print "<tr><td class=\"post\" colspan=\"2\">" . $line["content"] . "</td>
<td valign=\"top\">$feed_icon</td>
</tr>";
print "</table>";
}
}

@ -83,6 +83,8 @@
error_reporting (E_ERROR | E_WARNING | E_PARSE);
pg_query("BEGIN");
$feed = pg_escape_string($feed);
if ($rss) {
@ -90,15 +92,25 @@
check_feed_favicon($feed_url, $feed);
}
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'");
$result = pg_query("SELECT title,icon_url FROM ttrss_feeds WHERE id = '$feed'");
$registered_title = pg_fetch_result($result, 0, "title");
$orig_icon_url = pg_fetch_result($result, 0, "icon_url");
if (!$registered_title) {
$feed_title = $rss->channel["title"];
pg_query("UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'");
}
// print "I: " . $rss->channel["image"]["url"];
$icon_url = $rss->image["url"];
if ($icon_url && !$orig_icon_url) {
$icon_url = pg_escape_string($icon_url);
pg_query("UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
}
foreach ($rss->items as $item) {
$entry_guid = $item["id"];

@ -315,11 +315,16 @@ div.errorBox {
margin : 20px;
background : #f0f0f0;
}
table.postTable tr.titleTop, table.postTable tr.titleBottom {
background : #f0f0f0;
}
table.postTable td.titleIcon {
border-width : 0px 0px 1px 0px;
border-color : #d0d0d0;
border-style : solid;
}
table.postTable tr.titleTop td {
padding : 5px 10px 0px 10px;
}
@ -332,6 +337,22 @@ table.postTable tr.titleBottom td {
}
/*
table.postTable tr.titleTop td {
padding : 5px 10px 0px 10px;
}
table.postTable tr.titleBottom td {
padding : 3px 10px 5px 10px;
}
table.postTable tr.headerRow td.headers, table.postTable tr.headerRow td.iconBox {
background : #f0f0f0;
border-width : 0px 0px 1px 0px;
border-color : #d0d0d0;
border-style : solid;
}*/
table.postTable td.post {
padding : 20px;
@ -354,3 +375,8 @@ table.postTable td.post {
-moz-border-radius : 10px;
opacity : 0.8;
}
img.feedIcon {
margin : 3px;
border : 1px solid #c0c0c0;
}

@ -4,6 +4,7 @@ drop table ttrss_feeds;
create table ttrss_feeds (id serial not null primary key,
title varchar(200) not null unique,
feed_url varchar(250) unique not null,
icon_url varchar(250) not null default '',
last_updated timestamp default null);
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');

Loading…
Cancel
Save