]> git.wh0rd.org Git - tt-rss.git/commitdiff
misc fixes in site_url/icon_url parsing
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 17 Jan 2012 06:22:47 +0000 (10:22 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 17 Jan 2012 06:22:47 +0000 (10:22 +0400)
include/rssfuncs.php

index 96e8cbd44747da4e5f36e2b5717ba51cc73ec2c8..d93e2eee2f079fff1f211d77ed3335bf6b1cb926 100644 (file)
                        $owner_uid = db_fetch_result($result, 0, "owner_uid");
 
                        if ($use_simplepie) {
-                               $site_url = $rss->get_link();
+                               $site_url = db_escape_string(trim($rss->get_link()));
                        } else {
-                               $site_url = $rss->channel["link"];
+                               $site_url = db_escape_string(trim($rss->channel["link"]));
+                       }
+
+                       // weird, weird Magpie
+                       if (!$use_simplepie) {
+                               if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
                        }
 
                        $site_url = rewrite_relative_url($fetch_url, $site_url);
+                       $site_url = substr($site_url, 0, 250);
 
                        if ($debug_enabled) {
                                _debug("update_rss_feed: checking favicon...");
                                        title = '$feed_title' WHERE id = '$feed'");
                        }
 
-                       // weird, weird Magpie
-                       if (!$use_simplepie) {
-                               if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
-                       }
-
-                       if ($site_url && $orig_site_url != db_escape_string($site_url)) {
+                       if ($site_url && $orig_site_url != $site_url) {
                                db_query($link, "UPDATE ttrss_feeds SET
                                        site_url = '$site_url' WHERE id = '$feed'");
                        }
 //                     print "I: " . $rss->channel["image"]["url"];
 
                        if (!$use_simplepie) {
-                               $icon_url = db_escape_string($rss->image["url"]);
+                               $icon_url = db_escape_string(trim($rss->image["url"]));
                        } else {
-                               $icon_url = db_escape_string($rss->get_image_url());
+                               $icon_url = db_escape_string(trim($rss->get_image_url()));
                        }
 
+                       $icon_url = rewrite_relative_url($fetch_url, $icon_url);
                        $icon_url = substr($icon_url, 0, 250);
 
                        if ($icon_url && $orig_icon_url != $icon_url) {