From b7f4bda2987193da0399aed302df0c5624e0f9ce Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Aug 2005 04:11:37 +0100 Subject: support for feed-specific images (channel->url) --- functions.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index f3ff6a1f9..0de0e4056 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"]; -- cgit v1.2.3