diff options
author | Andrew Dolgov <[email protected]> | 2005-08-26 04:11:37 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-08-26 04:11:37 +0100 |
commit | b7f4bda2987193da0399aed302df0c5624e0f9ce (patch) | |
tree | 9d84e618b3fa1ae777e3f164aef5951141fc5f9c /functions.php | |
parent | a14b6d21d977058359acda6719ff528fde583209 (diff) |
support for feed-specific images (channel->url)
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 14 |
1 files changed, 13 insertions, 1 deletions
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"]; |