From b7f4bda2987193da0399aed302df0c5624e0f9ce Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Aug 2005 04:11:37 +0100 Subject: [PATCH] support for feed-specific images (channel->url) --- TODO | 2 +- backend.php | 34 ++++++++++++++++++++-------------- functions.php | 14 +++++++++++++- tt-rss.css | 28 +++++++++++++++++++++++++++- ttrss_schema.sql | 1 + 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index b7e7394e..13ed2585 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/backend.php b/backend.php index 6dd80a41..e34cde94 100644 --- a/backend.php +++ b/backend.php @@ -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 ""; - print ""; - print ""; - print "
Title:".$line["title"]."
Link:".$line["link"]."
"; - - print $line["content"]; */ - + if ($line["icon_url"]) { + $feed_icon = ""; + } else { + $feed_icon = " "; + } - print ""; + print "
"; + print " - "; + + "; print " - "; - - print ""; - print "
Title:".$line["title"]."
".$line["title"]." 
Link:".$line["link"]."
" . $line["content"] . "
"; + ".$line["link"]." +   "; + print "" . $line["content"] . " + $feed_icon + "; + print ""; + } } diff --git a/functions.php b/functions.php index f3ff6a1f..0de0e405 100644 --- a/functions.php +++ b/functions.php @@ -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"]; diff --git a/tt-rss.css b/tt-rss.css index 8b4e69eb..74f32892 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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; +} diff --git a/ttrss_schema.sql b/ttrss_schema.sql index cdc7abfb..0ee3a755 100644 --- a/ttrss_schema.sql +++ b/ttrss_schema.sql @@ -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'); -- 2.39.5