mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
fixed wrong referer if url contains webserver_url more then once, eg. "http://egroupware.org/egroupware/index.php" and "/egroupware"
This commit is contained in:
parent
2d77b83245
commit
a9988cc72a
@ -2045,21 +2045,21 @@
|
||||
* gets an eGW conformat referer from $_SERVER['HTTP_REFERER'], suitable for direct use in the link function
|
||||
*
|
||||
* @param string $default='' default to use if referer is not set by webserver or not determinable
|
||||
* @param string $referer='' referer string to use, default ('') use $_SERVER['HTTP_REFERER']
|
||||
* @return string
|
||||
*/
|
||||
function get_referer($default='')
|
||||
function get_referer($default='',$referer='')
|
||||
{
|
||||
$referer = $_SERVER['HTTP_REFERER'];
|
||||
if (!$referer) $referer = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
$webserver_url = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||
if (empty($webserver_url) || $webserver_url == '/') // fix for eGW installed in the docroot
|
||||
if (empty($webserver_url) || $webserver_url{0} == '/') // url is just a path
|
||||
{
|
||||
$referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part
|
||||
}
|
||||
else
|
||||
if (strlen($webserver_url) > 1)
|
||||
{
|
||||
$parts = explode($webserver_url,$referer);
|
||||
$referer = array_pop($parts);
|
||||
list(,$referer) = explode($webserver_url,$referer,2);
|
||||
}
|
||||
$referer = str_replace('/etemplate/process_exec.php','/index.php',$referer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user