From cde95cd926faee52ed46c4c5af9e273facb73a22 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 21 Nov 2005 08:21:11 +0000 Subject: [PATCH] fixed bug in common::get_referer, which gives a warning and wrong result if eGW is installed in the docroot --- phpgwapi/inc/class.common.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index f722d11ed9..e701b2d4c4 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -2047,9 +2047,17 @@ { $referer = $_SERVER['HTTP_REFERER']; - $parts = explode($GLOBALS['egw_info']['server']['webserver_url'],$referer); - - $referer = str_replace('/etemplate/process_exec.php','/index.php',array_pop($parts)); + $webserver_url = $GLOBALS['egw_info']['server']['webserver_url']; + if (empty($webserver_url) || $webserver_url == '/') // fix for eGW installed in the docroot + { + $referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part + } + else + { + $parts = explode($webserver_url,$referer); + $referer = array_pop($parts); + } + $referer = str_replace('/etemplate/process_exec.php','/index.php',$referer); if (empty($referer)) $referer = $default;