strip out session ID from root URL

This commit is contained in:
Evan Prodromou 2010-01-11 15:09:46 -08:00
parent 92deb35bc4
commit 3b007934e4
1 changed files with 9 additions and 4 deletions

View File

@ -833,7 +833,7 @@ function common_path($relative, $ssl=false)
} }
$relative = common_inject_session($relative, $serverpart); $relative = common_inject_session($relative, $serverpart);
return $proto.'://'.$serverpart.'/'.$pathpart.$relative; return $proto.'://'.$serverpart.'/'.$pathpart.$relative;
} }
@ -844,7 +844,7 @@ function common_inject_session($url, $serverpart = null)
if (empty($serverpart)) { if (empty($serverpart)) {
$serverpart = parse_url($url, PHP_URL_HOST); $serverpart = parse_url($url, PHP_URL_HOST);
} }
$currentServer = $_SERVER['HTTP_HOST']; $currentServer = $_SERVER['HTTP_HOST'];
// Are we pointing to another server (like an SSL server?) // Are we pointing to another server (like an SSL server?)
@ -861,7 +861,7 @@ function common_inject_session($url, $serverpart = null)
} }
} }
} }
return $url; return $url;
} }
@ -1052,7 +1052,12 @@ function common_profile_url($nickname)
function common_root_url($ssl=false) 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 // returns $bytes bytes of random data as a hexadecimal string