diff options
Diffstat (limited to 'classes')
-rwxr-xr-x | classes/feeds.php | 1 | ||||
-rwxr-xr-x | classes/handler/public.php | 1 | ||||
-rwxr-xr-x | classes/rssutils.php | 40 |
3 files changed, 28 insertions, 14 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index de2f750cd..b4b20d2fc 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -706,6 +706,7 @@ class Feeds extends Handler_Protected { <?= javascript_tag("js/common.js") ?> <?= javascript_tag("lib/dojo/dojo.js") ?> <?= javascript_tag("lib/dojo/tt-rss-layer.js") ?> + <?= Config::get_override_links() ?> </head> <body class="flat ttrss_utility feed_debugger css_loading"> <script type="text/javascript"> diff --git a/classes/handler/public.php b/classes/handler/public.php index c6ec39f36..f89be14bb 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -451,6 +451,7 @@ class Handler_Public extends Handler { echo javascript_tag("lib/dojo/dojo.js"); echo javascript_tag("lib/dojo/tt-rss-layer.js"); ?> + <?= Config::get_override_links() ?> </head> <body class='flat ttrss_utility'> <div class='container'> diff --git a/classes/rssutils.php b/classes/rssutils.php index 561171d09..385ab31e6 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -316,14 +316,20 @@ class RSSUtils { $feed_data = trim($feed_data); - $rss = new FeedParser($feed_data); - $rss->init(); - - if (!$rss->error()) { - $basic_info = [ - 'title' => mb_substr(clean($rss->get_title()), 0, 199), - 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245), - ]; + if ($feed_data) { + $rss = new FeedParser($feed_data); + $rss->init(); + + if (!$rss->error()) { + $basic_info = [ + 'title' => mb_substr(clean($rss->get_title()), 0, 199), + 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245), + ]; + } else { + Debug::log(sprintf("unable to parse feed for basic info: %s", $rss->error()), Debug::LOG_VERBOSE); + } + } else { + Debug::log(sprintf("unable to fetch feed for basic info: %s [%s]", UrlHelper::$fetch_last_error, UrlHelper::$fetch_last_error_code), Debug::LOG_VERBOSE); } } @@ -597,10 +603,13 @@ class RSSUtils { Debug::log("site_url: {$feed_obj->site_url}", Debug::LOG_VERBOSE); Debug::log("feed_title: {$rss->get_title()}", Debug::LOG_VERBOSE); - Debug::log("favicon: needs check: {$feed_obj->favicon_needs_check} is custom: {$feed_obj->favicon_is_custom} avg color: {$feed_obj->favicon_avg_color}", + Debug::log('favicon: needs check: ' . ($feed_obj->favicon_needs_check ? 'true' : 'false') + . ', is custom: ' . ($feed_obj->favicon_is_custom ? 'true' : 'false') + . ", avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); - if ($feed_obj->favicon_needs_check || $force_refetch) { + if ($feed_obj->favicon_needs_check || $force_refetch + || ($feed_obj->favicon_is_custom && !$feed_obj->favicon_avg_color)) { // restrict update attempts to once per 12h $feed_obj->favicon_last_checked = Db::NOW(); @@ -631,13 +640,16 @@ class RSSUtils { $feed_obj->favicon_avg_color = 'fail'; $feed_obj->save(); - $feed_obj->favicon_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); - $feed_obj->save(); + $calculated_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); + if ($calculated_avg_color) { + $feed_obj->favicon_avg_color = $calculated_avg_color; + $feed_obj->save(); + } - Debug::log("favicon: avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); + Debug::log("favicon: calculated avg color: {$calculated_avg_color}, setting avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); } else if ($feed_obj->favicon_avg_color == 'fail') { - Debug::log("floicon failed on $feed, not trying to recalculate avg color", Debug::LOG_VERBOSE); + Debug::log("floicon failed on $feed or a suitable avg color couldn't be determined, not trying to recalculate avg color", Debug::LOG_VERBOSE); } } |