]> git.mjollnir.org Git - s9y.git/commitdiff
Fix exit tracking, when no URL id is found.
authorgarvinhicking <garvinhicking>
Tue, 4 Oct 2005 13:05:08 +0000 (13:05 +0000)
committergarvinhicking <garvinhicking>
Tue, 4 Oct 2005 13:05:08 +0000 (13:05 +0000)
docs/NEWS
exit.php
plugins/serendipity_event_trackexits/serendipity_event_trackexits.php
plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php

index 3f3cdcb72481248d4edebf5b9a10b8f64ea6aa7e..be4a6a0eb5304fdc46fbc587a5bb30cb1ea0e0bd 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.9-beta2 ()
 ------------------------------------------------------------------------
 
+    * Fix track exits plugin to redirect to the right URL when no URL-ID
+      was found. (garvinhicking)
+
     * "Recent comments" plugin can be configured whether to show
        trackbacks, comments or both. (garvinhicking)
 
index e6e7f3d2ac87f52612b2ac94c5146a3750be3460..b3554fc05efc4827a551ea8d4bc8c93d7cbd6c8e 100644 (file)
--- a/exit.php
+++ b/exit.php
@@ -22,7 +22,7 @@ if (isset($_GET['url_id']) && !empty($_GET['url_id']) && isset($_GET['entry_id']
 
 } elseif (isset($_GET['url']) && !empty($_GET['url'])) {
     // No entry-link ID was submitted. Possibly a spammer tried to mis-use the script to get into the top-list.
-    $url = str_replace('&amp;', '&', base64_decode($_GET['url']));
+    $url = strip_tags(str_replace('&amp;', '&', base64_decode($_GET['url'])));
 }
 
 if (serendipity_isResponseClean($url)) {
index 1e55a28db062b2bd00b6d79c9ac4a96c7e89b42b..4c4d4aa828df009133fbc7496f004e8bda811ab2 100644 (file)
@@ -27,7 +27,7 @@ class serendipity_event_trackexits extends serendipity_event
         $propbag->add('description',   PLUGIN_EVENT_TRACKBACK_DESC);
         $propbag->add('stackable',     false);
         $propbag->add('author',        'Serendipity Team');
-        $propbag->add('version',       '1.2');
+        $propbag->add('version',       '1.3');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -193,13 +193,14 @@ class serendipity_event_trackexits extends serendipity_event
         $is_over  = (stristr($buffer[0], 'onmouseover=') !== false ? true : false);
         $is_out   = (stristr($buffer[0], 'onmouseout=')  !== false ? true : false);
 
-        $link     = '<a%shref="%sexit.php?url_id=%s%s" ' . (!$is_title ? 'title="%s" ' : '%s') . (!$is_over ? ' onmouseover="window.status=\'%s\';return true;" ' : '%s') . (!$is_out ? 'onmouseout="window.status=\'\';return true;"' : '') . '%s>';
+        $link     = '<a%shref="%sexit.php?url%s=%s%s" ' . (!$is_title ? 'title="%s" ' : '%s') . (!$is_over ? ' onmouseover="window.status=\'%s\';return true;" ' : '%s') . (!$is_out ? 'onmouseout="window.status=\'\';return true;"' : '') . '%s>';
         
         if (is_array($this->links) && isset($this->links[$url])) {
             return sprintf(
                 $link,
                 $buffer[1],
                 $serendipity['baseURL'],
+                '_id',
                 $this->links[$url],
                 ($entry_id != 0) ? '&amp;entry_id=' . $entry_id : '',
                 (!$is_title ? $url : ''),
@@ -211,6 +212,7 @@ class serendipity_event_trackexits extends serendipity_event
                 $link,
                 $buffer[1],
                 $serendipity['baseURL'],
+                '',
                 base64_encode($url),
                 ($entry_id != 0) ? '&amp;entry_id=' . $entry_id : '',
                 (!$is_title ? $url : ''),
index dc7b03e6beb6e72c5ea4972b9c9bbea5546d206a..d264a0e45449e5136d7f4859e5df82bdaaf2ae2d 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.3');
+        $propbag->add('version',       '1.4');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -383,6 +383,19 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
         return true;
     }
 
+    // Check if a given URI is readable.
+    function urlcheck($uri) {
+        return true;
+        require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
+        $req = &new HTTP_Request($uri);
+        
+        if (PEAR::isError($req->sendRequest()) || !preg_match('@^[23]..@', $req->getResponseCode())) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
     function generate_content(&$title) {
         global $serendipity;
 
@@ -415,8 +428,9 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
         if (trim($rssuri)) {
             $feedcache = $serendipity['serendipityPath'] . 'templates_c/remoterss_cache_' . preg_replace('@[^a-z0-9]*@i', '', $rssuri) . '.dat';
             if (!file_exists($feedcache) || filesize($feedcache) == 0 || filemtime($feedcache) < (time() - $cachetime)) {
-
-                if ($feedtype == 'rss') {
+                if (!$this->urlcheck($rssuri)) {
+                    echo '<!-- No valid URL! -->';
+                } elseif ($feedtype == 'rss') {
                     require_once S9Y_PEAR_PATH . 'Onyx/RSS.php';
                     $c = &new Onyx_RSS($charset);
                     $c->parse($rssuri);