Index: branches/5.2.x/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r14955 -r14974 --- branches/5.2.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 14955) +++ branches/5.2.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 14974) @@ -1,6 +1,6 @@ redirect to no pemrission template + if ( !$perm_status ) { + // when no permission to view item -> redirect to no permission template if ( $this->Application->isDebugMode() ) { $this->Application->Debugger->appendTrace(); } - trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in '.($status_checked ? 'checkItemStatus' : 'CheckPermission').'', E_USER_NOTICE); + trigger_error('ItemLoad Permission Failed for prefix [' . $event->getPrefixSpecial() . '] in ' . ($status_checked ? 'checkItemStatus' : 'CheckPermission') . '', E_USER_NOTICE); $template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); - 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'), - ); - } + if ( $this->Application->GetVar('t') != $template ) { + // don't perform "no_permission" redirect if already on a "no_permission" template + 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'), + ); + } - $this->Application->Redirect($template, $redirect_params); + $this->Application->Redirect($template, $redirect_params); + } } }