]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
A different search pagination fix (see ticket #1333) that doesn't require fixing...
authorCiaranG <ciaran@ciarang.com>
Wed, 25 Mar 2009 15:39:58 +0000 (15:39 +0000)
committerCiaranG <ciaran@ciarang.com>
Wed, 25 Mar 2009 15:39:58 +0000 (15:39 +0000)
extlib/Net/URL/Mapper/Path.php
lib/router.php

index eb1c34a3fab95a7180619028c6df7a959502c79f..b541002c7af6a4473ec16b43b0b34eceac472f33 100644 (file)
@@ -241,12 +241,7 @@ class Net_URL_Mapper_Path
         }
         $path = '/'.trim(Net_URL::resolvePath($path), '/');
         if (!empty($qstring)) {
-            if (!strpos($path, '?')) {
-                $path .= '?';
-            } else {
-                $path .= '&';
-            }
-           $path .= http_build_query($qstring);
+            $path .= '?'.http_build_query($qstring);
         }
         if (!empty($anchor)) {
             $path .= '#'.ltrim($anchor, '#');
@@ -432,4 +427,4 @@ class Net_URL_Mapper_Path
 
 }
 
-?>
+?>
\ No newline at end of file
index 83b3ffe607ebd009447d97f16b34baa7b0ddf5fd..d1217ca3ce094ac356178561e5355575bd8f1b0a 100644 (file)
@@ -437,6 +437,16 @@ class Router
 
         if($params!=null)
            common_log(LOG_DEBUG,"generate args:".print_r($args,true));
-        return $this->m->generate($args, $params, $fragment);
+        $url=$this->m->generate($args, $params, $fragment);
+
+        // Due to a bug in the Net_URL_Mapper code, the returned URL may
+        // contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We
+        // repair that here rather than modifying the upstream code...
+        $qpos = strpos($url,'?');
+        if ($qpos !== false) {
+            $url = substr($url, 0, $qpos+1) .
+                     str_replace('?', '&', substr($url, $qpos+1));
+        }
+        return $url;
     }
 }