Index: kernel/db/db_event_handler.php =================================================================== --- kernel/db/db_event_handler.php (revision 12969) +++ kernel/db/db_event_handler.php (working copy) @@ -533,18 +533,21 @@ } trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in '.($status_checked ? 'checkItemStatus' : 'CheckPermission').'', E_USER_WARNING); - $redirect_template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); + $template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); - $redirect_params = $this->Application->HttpQuery->getRedirectParams(true); - $redirect_params['no_amp'] = 1; - $next_template = $this->Application->HREF('', '', $redirect_params); + if (MOD_REWRITE) { + $redirect_params = Array ( + 'm_cat_id' => 0, + 'next_template' => urlencode('external:' . $_SERVER['REQUEST_URI']), + ); + } + else { + $redirect_params = Array ( + 'next_template' => $this->Application->GetVar('t'), + ); + } - $redirect_params = Array ( - 'm_cat_id' => 0, - 'next_template' => urlencode('external:' . $next_template), - ); - - $this->Application->Redirect($redirect_template, $redirect_params); + $this->Application->Redirect($template, $redirect_params); } } Index: kernel/processors/main_processor.php =================================================================== --- kernel/processors/main_processor.php (revision 12969) +++ kernel/processors/main_processor.php (working copy) @@ -768,24 +768,20 @@ if ((!$this->Application->LoggedIn() || !$group_access) && $condition) { $redirect_params = $this->Application->HttpQuery->getRedirectParams(true); - $redirect_params['no_amp'] = 1; if (array_key_exists('pass_category', $params)) { $redirect_params['pass_category'] = $params['pass_category']; } - if (array_key_exists('expired', $redirect_params)) { - $session_expired = $redirect_params['expired']; - unset($redirect_params['expired']); + if (MOD_REWRITE) { + // TODO: $next_t variable is ignored !!! (is anyone using m_RequireLogin tag with "next_template" parameter?) + $redirect_params = Array ( + 'm_cat_id' => 0, + 'next_template' => urlencode('external:' . $_SERVER['REQUEST_URI']), + ); } - - $redirect_params = Array ( - 'm_cat_id' => 0, - 'next_template' => urlencode('external:' . $this->Application->HREF($t, '', $redirect_params)), - ); - - if (isset($session_expired) && $session_expired) { - $redirect_params['expired'] = $session_expired; + else { + $redirect_params['next_template'] = $t; } if ( $this->Application->LoggedIn() && !$group_access) { Index: units/helpers/permissions_helper.php =================================================================== --- units/helpers/permissions_helper.php (revision 12969) +++ units/helpers/permissions_helper.php (working copy) @@ -264,14 +264,14 @@ function finalizePermissionCheck(&$event, $perm_status) { if (!$perm_status) { - $t = $this->Application->GetVar('t'); - $redirect_params = $this->Application->HttpQuery->getRedirectParams(true); - $redirect_params['no_amp'] = 1; - $next_template = $this->Application->HREF($t, '', $redirect_params); + if (MOD_REWRITE) { +// $event->SetRedirectParam('m_cat_id', 0); // category means nothing on admin login screen + $event->SetRedirectParam('next_template', urlencode('external:' . $_SERVER['REQUEST_URI'])); + } + else { + $event->SetRedirectParam('next_template', $this->Application->GetVar('t')); + } - $event->SetRedirectParam('m_cat_id', 0); // category means nothing on admin login screen - $event->SetRedirectParam('next_template', urlencode('external:' . $next_template)); - if ($this->Application->isDebugMode()) { // for debugging purposes $event->SetRedirectParam('section', $event->getSection()); @@ -462,10 +462,16 @@ $redirect_params['pass_category'] = $params['pass_cateogry']; } - $redirect_params = Array ( - 'm_cat_id' => 0, // category means nothing on admin login screen - 'next_template' => urlencode('external:' . $this->Application->HREF($t, '', $redirect_params)), - ); + if (MOD_REWRITE) { + // TODO: $next_t variable is ignored !!! (is anyone using m_RequireLogin tag with "next_template" parameter?) + $redirect_params = Array ( + 'm_cat_id' => 0, // category means nothing on admin login screen + 'next_template' => urlencode('external:' . $_SERVER['REQUEST_URI']), + ); + } + else { + $redirect_params['next_template'] = $t; + } if ($this->Application->isAdmin) { $redirect_params['m_wid'] = ''; // remove wid, otherwise parent window may add wid to its name breaking all the frameset (for targets)