diff --git a/login.php b/login.php index 974349485c..dcee281d13 100755 --- a/login.php +++ b/login.php @@ -51,25 +51,30 @@ if(isset($GLOBALS['sitemgr_info']) && $GLOBALS['egw_info']['user']['userid'] == } } -$forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward']; -if (!$forward) +function parseForward(&$extra_vars) { - $extra_vars = 'cd=yes'; - $forward = '/index.php'; -} -else -{ - list($forward,$extra_vars) = explode('?',$forward,2); - // only append cd=yes, if there is not already a cd value! - if (strpos($extra_vars, 'cd=') === false) + $forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward']; + if (!$forward) { - $extra_vars .= ($extra_vars ? '&' : '').'cd=yes'; + $extra_vars = 'cd=yes'; + $forward = '/index.php'; } + else + { + list($forward, $extra_vars) = explode('?', $forward, 2); + // only append cd=yes, if there is not already a cd value! + if (strpos($extra_vars, 'cd=') === false) + { + $extra_vars .= ($extra_vars ? '&' : '') . 'cd=yes'; + } + } + return $forward; } // SSO login: CAS, SAML, ... if (($GLOBALS['sessionid'] = Api\Auth::login())) { + $forward = parseForward($extra_vars); $GLOBALS['egw']->redirect_link($forward, $extra_vars); } else @@ -262,6 +267,8 @@ else // check if new translations are available Api\Translation::check_invalidate_cache(); + $forward = parseForward($extra_vars); + if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) { // login requuest does not come from login.php // redirect to referer on logout