From: garvinhicking Date: Thu, 6 Oct 2005 07:28:41 +0000 (+0000) Subject: More fixes to RSS fetchin when file is not present. Thanks to Mark Kubacki! X-Git-Tag: 0.9~86 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=64139edb6b03689cf4dd44569442f5ec8b27ed53;p=s9y.git More fixes to RSS fetchin when file is not present. Thanks to Mark Kubacki! --- diff --git a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php index d264a0e..47f3152 100644 --- a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php +++ b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php @@ -273,7 +273,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin { $propbag->add('description', PLUGIN_REMOTERSS_BLAHBLAH); $propbag->add('stackable', true); $propbag->add('author', 'Udo Gerhards, Richard Thomas Harrison'); - $propbag->add('version', '1.4'); + $propbag->add('version', '1.5'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -385,6 +385,13 @@ class serendipity_plugin_remoterss extends serendipity_plugin { // Check if a given URI is readable. function urlcheck($uri) { + + // These two substring comparisons are faster than one regexp. + if ('http://' != substr($uri, 0, 7) || 'https://' != substr($uri, 0, 8)) { + return false; + } + + // Disabled by now. May get enabled in the future, but for now the extra HTTP call isn't worth trying. return true; require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; $req = &new HTTP_Request($uri); @@ -431,6 +438,8 @@ class serendipity_plugin_remoterss extends serendipity_plugin { if (!$this->urlcheck($rssuri)) { echo ''; } elseif ($feedtype == 'rss') { + // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. + @touch($feedcache); require_once S9Y_PEAR_PATH . 'Onyx/RSS.php'; $c = &new Onyx_RSS($charset); $c->parse($rssuri); @@ -468,6 +477,9 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } } } elseif ($feedtype == 'opml') { + // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. + @touch($feedcache); + $opml = new s9y_remoterss_OPML(); $opmltree = $opml->parseOPML($rssuri);