]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 1.0.x
authorEvan Prodromou <evan@status.net>
Mon, 3 Oct 2011 13:32:24 +0000 (09:32 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 3 Oct 2011 13:32:24 +0000 (09:32 -0400)
index.php

index 850208c9d1501a80337a7a8d568a85aa88100527..1566399fa2f351e8381796397d0f697b5b4e617f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -49,21 +49,29 @@ $action = null;
 
 function getPath($req)
 {
+    $p = null;
+
     if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER))
         && array_key_exists('p', $req)
     ) {
-        return $req['p'];
+        $p = $req['p'];
     } else if (array_key_exists('PATH_INFO', $_SERVER)) {
         $path = $_SERVER['PATH_INFO'];
         $script = $_SERVER['SCRIPT_NAME'];
         if (substr($path, 0, mb_strlen($script)) == $script) {
-            return substr($path, mb_strlen($script));
+            $p = substr($path, mb_strlen($script) + 1);
         } else {
-            return $path;
+            $p = $path;
         }
     } else {
-        return null;
+        $p = null;
     }
+
+    // Trim all initial '/'
+
+    $p = ltrim($p, '/');
+
+    return $p;
 }
 
 /**