]> git.mjollnir.org Git - s9y.git/commitdiff
More fixes to RSS fetchin when file is not present. Thanks to Mark Kubacki!
authorgarvinhicking <garvinhicking>
Thu, 6 Oct 2005 07:28:41 +0000 (07:28 +0000)
committergarvinhicking <garvinhicking>
Thu, 6 Oct 2005 07:28:41 +0000 (07:28 +0000)
plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php

index d264a0e45449e5136d7f4859e5df82bdaaf2ae2d..47f31523a8dfe572d348ebb2cacceccbf98223d4 100644 (file)
@@ -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 '<!-- No valid URL! -->';
                 } 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);