From 026c10301631d7d79bf16e5b4bb2a6f7cef418e7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 3 Jul 2004 12:38:01 +0000 Subject: [PATCH] fix for bug [ 984343 ] Login not possible after session timeout: eGW was installed in the docroot and the webserver-url was empty, as not domain was given, not realy the regular situation, anhow it should work now --- phpgwapi/inc/functions.inc.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 37c2d1747d..3492ca672d 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -293,8 +293,18 @@ { if (! $GLOBALS['phpgw']->session->verify()) { - // we forward to the same place after the relogin - list(,$relpath) = explode($GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2); + // we forward to the same place after the re-login + if ($GLOBALS['phpgw_info']['server']['webserver_url'] && $GLOBALS['phpgw_info']['server']['webserver_url'] != '/') + { + list(,$relpath) = explode($GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2); + } + else // the webserver-url is empty or just a slash '/' (eGW is installed in the docroot and no domain given) + { + if (preg_match('/^https?:\/\/[^\/]*\/(.*)$/',$relpath=$_SERVER['PHP_SELF'],$matches)) + { + $relpath = $matches[1]; + } + } // this removes the sessiondata if its saved in the URL $query = preg_replace('/[&]?sessionid=[^&]+&kp3=[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']); Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=10&phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')));