From f324892e58f26c520cbfd75050bd8952d87b2161 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 Nov 2005 08:38:10 +0100 Subject: [PATCH] handle site_url in ttrss_feeds (and display in feed details) --- backend.php | 15 +++++++++++---- functions.php | 13 +++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/backend.php b/backend.php index cd7d65c2..9f328bf4 100644 --- a/backend.php +++ b/backend.php @@ -2175,7 +2175,7 @@ $result = db_query($link, "SELECT - title,feed_url,last_updated,icon_url, + title,feed_url,last_updated,icon_url,site_url, (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE feed_id = id) AS total, (SELECT COUNT(int_id) FROM ttrss_user_entries @@ -2194,7 +2194,7 @@ $total = db_fetch_result($result, 0, "total"); $unread = db_fetch_result($result, 0, "unread"); $marked = db_fetch_result($result, 0, "marked"); - + $site_url = db_fetch_result($result, 0, "site_url"); $result = db_query($link, "SELECT COUNT(id) AS subscribed FROM ttrss_feeds WHERE feed_url = '$feed_url'"); @@ -2216,8 +2216,15 @@ print ""; - print " - "; + if ($site_url) { + print " + + "; + } else { + print " + "; + } print ""; print ""; print ""; diff --git a/functions.php b/functions.php index 37ad6c1d..77388106 100644 --- a/functions.php +++ b/functions.php @@ -180,14 +180,23 @@ check_feed_favicon($feed_url, $feed, $link); } - $result = db_query($link, "SELECT title,icon_url FROM ttrss_feeds WHERE id = '$feed'"); + $result = db_query($link, "SELECT title,icon_url,site_url + FROM ttrss_feeds WHERE id = '$feed'"); $registered_title = db_fetch_result($result, 0, "title"); $orig_icon_url = db_fetch_result($result, 0, "icon_url"); + $orig_site_url = db_fetch_result($result, 0, "site_url"); if (!$registered_title) { $feed_title = db_escape_string($rss->channel["title"]); - db_query($link, "UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'"); + db_query($link, "UPDATE ttrss_feeds SET + title = '$feed_title' WHERE id = '$feed'"); + } + + if (!$orig_site_url && $rss->channel["link"]) { + $site_url = db_escape_string($rss->channel["link"]); + db_query($link, "UPDATE ttrss_feeds SET + site_url = '$site_url' WHERE id = '$feed'"); } // print "I: " . $rss->channel["image"]["url"]; -- 2.39.5
Feed URL$feed_url
Link$site_url + (feed)
Feed URL$feed_url
Last updated$last_updated
Total articles$total
Unread articles$unread