]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
strip out session ID from root URL
authorEvan Prodromou <evan@status.net>
Mon, 11 Jan 2010 23:09:46 +0000 (15:09 -0800)
committerEvan Prodromou <evan@status.net>
Mon, 11 Jan 2010 23:10:02 +0000 (15:10 -0800)
lib/util.php

index a56a41a577d315327ca331fcbaf503c113d8bed2..5ffc0226f3a636a66184b8afa7387ae4c7f212f1 100644 (file)
@@ -833,7 +833,7 @@ function common_path($relative, $ssl=false)
     }
 
     $relative = common_inject_session($relative, $serverpart);
-    
+
     return $proto.'://'.$serverpart.'/'.$pathpart.$relative;
 }
 
@@ -844,7 +844,7 @@ function common_inject_session($url, $serverpart = null)
        if (empty($serverpart)) {
            $serverpart = parse_url($url, PHP_URL_HOST);
        }
-       
+
         $currentServer = $_SERVER['HTTP_HOST'];
 
         // Are we pointing to another server (like an SSL server?)
@@ -861,7 +861,7 @@ function common_inject_session($url, $serverpart = null)
             }
         }
     }
-    
+
     return $url;
 }
 
@@ -1052,7 +1052,12 @@ function common_profile_url($nickname)
 
 function common_root_url($ssl=false)
 {
-    return common_path('', $ssl);
+    $url = common_path('', $ssl);
+    $i = strpos($url, '?');
+    if ($i !== false) {
+        $url = substr($url, 0, $i);
+    }
+    return $url;
 }
 
 // returns $bytes bytes of random data as a hexadecimal string