Index: branches/5.2.x/core/kernel/managers/request_manager.php =================================================================== diff -u -N -r14628 -r14663 --- branches/5.2.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 14628) +++ branches/5.2.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 14663) @@ -1,6 +1,6 @@ Application->EventManager->verifyEventPrefix($event, true) ) { $false = false; - + return $false; } @@ -167,7 +167,7 @@ protected function performRedirect(&$event) { // we need to pass category if the action was submitted to self-template, with the category passed - // and it has not explicly set redirect template or pass_cateogry param + // and it has not explicitly set redirect template or pass_cateogry param if ( $this->samePageRedirect($event) && ($event->getEventParam('pass_category') === false) && $this->Application->GetVar('m_cat_id') ) { $event->SetRedirectParam('pass_category', 1); } Index: branches/5.2.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r14628 -r14663 --- branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 14628) +++ branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 14663) @@ -1,6 +1,6 @@ $event_name) { $this->Set($prefix_special . '_event', $event_name); } @@ -534,32 +533,42 @@ { $mod_rw_helper =& $this->Application->recallObject('ModRewriteHelper'); /* @var $mod_rw_helper kModRewriteHelper */ - + $mod_rw_helper->processRewriteURL(); } function getDefaultTemplate($t) { - $t = $this->getTemplateName( trim($t, '/') ); - if (!$t) $t = 'index'; + $t = $this->getTemplateName(trim($t, '/')); + + if ( !$t ) { + $t = 'index'; + } + return trim($t, '/'); } function extractSIDAndTemplate(&$parts) { + $template = ''; $vars = Array (); - $sub_parts = array_shift($parts); - list ($sid, $t) = explode('-', $sub_parts, 2); + if ( preg_match('/^([\d]+|)-(.*)$/', $parts[0], $regs) ) { + // first "env" component matches "sid-template" format + // (will be false, when mod-rewrite url to home page is built) + $sid = $regs[1]; + $template = $regs[2]; + array_shift($parts); - if ($sid) { - // Save Session ID - $this->Set('sid', $sid); - $vars['sid'] = $sid; + if ( $sid ) { + // Save Session ID + $this->Set('sid', $sid); + $vars['sid'] = $sid; + } } // Save Template Name - $vars['t'] = $this->getDefaultTemplate($t); + $vars['t'] = $this->getDefaultTemplate($template); return $vars; } @@ -570,13 +579,13 @@ * set template name and sid in * desired application variables. * - * @param string $env_var enviroment string value + * @param string $env_var environment string value * * @access public */ function processQueryString($env_var, $pass_name = 'passed') { - // env=SID:TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 + // env=SID-TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 $vars = Array (); if ($env_var) { $more_vars = strpos($env_var, '&'); @@ -612,7 +621,7 @@ } /** - * Converts enviroment part into variable array (based on query map for given prefix) + * Converts environment part into variable array (based on query map for given prefix) * * @param string $mixed_part * @return Array @@ -659,13 +668,13 @@ */ function getTemplateName($t) { - if (array_key_exists('t', $this->Get) && $this->Get['t']) { + if ( array_key_exists('t', $this->Get) && $this->Get['t'] ) { // template name is passed directly in url (GET method) $t = $this->Get['t']; } // if t was set through env, even in mod_rewrite mode! - if ($this->Get('env') && $this->Application->RewriteURLs() && $this->Get('t')) { + if ( $this->Get('env') && $this->Application->RewriteURLs() && $this->Get('t') ) { $t = $this->Get('t'); } Index: branches/5.2.x/core/units/users/users_event_handler.php =================================================================== diff -u -N -r14633 -r14663 --- branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14633) +++ branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14663) @@ -1,6 +1,6 @@ Name == 'OnLoginAs' ) { + $admin_session =& $this->Application->recallObject('Session.admin'); + /* @var $admin_session Session */ + + return $admin_session->LoggedIn(); + } + if ( !$this->Application->isAdminUser ) { $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); @@ -1761,4 +1768,28 @@ $event->SetRedirectParam('reset', 1); $event->SetRedirectParam('pass', 'm'); } + + /** + * Perform login of user, selected in Admin Console, on Front-End in a separate window + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnLoginAs(kEvent &$event) + { + $user_helper =& $this->Application->recallObject('UserHelper'); + /* @var $user_helper UserHelper */ + + $user =& $user_helper->getUserObject(); + $user->Load( $this->Application->GetVar('user_id') ); + + if ( !$user->isLoaded() ) { + return ; + } + + if ( $user_helper->checkLoginPermission() ) { + $user_helper->loginUserById( $user->GetID() ); + } + } } Index: branches/5.2.x/core/admin_templates/users/users_list.tpl =================================================================== diff -u -N -r14437 -r14663 --- branches/5.2.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 14437) +++ branches/5.2.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 14663) @@ -55,6 +55,22 @@ a_toolbar.AddButton( new ToolBarSeparator('sep2') ); + a_toolbar.AddButton( new ToolBarButton('frontend_mail', '', + function() { + var $user_ids = Grids['u.regular'].GetSelected(); + + if ($user_ids.length > 1) { + alert(''); + } + else { + var $user_id = $user_ids.shift(), + $url = ''; + + window.open($url.replace('#USER_ID#', $user_id), 'frontend_login'); + } + } + ) ); + a_toolbar.AddButton( new ToolBarButton( @@ -93,6 +109,6 @@ \ No newline at end of file Index: branches/5.2.x/admin/system_presets/simple/users_u.php =================================================================== diff -u -N -r14630 -r14663 --- branches/5.2.x/admin/system_presets/simple/users_u.php (.../users_u.php) (revision 14630) +++ branches/5.2.x/admin/system_presets/simple/users_u.php (.../users_u.php) (revision 14663) @@ -25,7 +25,7 @@ // toolbar buttons $remove_buttons = Array ( // list of users; section: Users Management -> Users - 'users_list' => Array (/*'new_item', 'edit', 'delete', 'approve', 'decline', 'e-mail',*/ 'export', /*'view', 'dbl-click'*/), + 'users_list' => Array (/*'new_item', 'edit', 'delete', 'approve', 'decline',*/ 'frontend_mail', /*'e-mail',*/ 'export', /*'view', 'dbl-click'*/), // "General" tab during user adding/editing // 'users_edit' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'), Index: branches/5.2.x/core/units/users/users_config.php =================================================================== diff -u -N -r14630 -r14663 --- branches/5.2.x/core/units/users/users_config.php (.../users_config.php) (revision 14630) +++ branches/5.2.x/core/units/users/users_config.php (.../users_config.php) (revision 14663) @@ -1,6 +1,6 @@ Array ( 'prefixes' => Array ('u_List'), 'format' => "!la_title_Users!", - 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'setprimary', 'approve', 'decline', 'e-mail', 'export', 'view', 'dbl-click'), + 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'setprimary', 'approve', 'decline', 'frontend_mail', 'e-mail', 'export', 'view', 'dbl-click'), ), 'users_edit' => Array ( Index: branches/5.2.x/core/units/users/users_tag_processor.php =================================================================== diff -u -N -r14653 -r14663 --- branches/5.2.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 14653) +++ branches/5.2.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 14663) @@ -1,6 +1,6 @@ 'all,m,u', 'u_event' => 'OnLogout', 'm_cat_id' => 0, '__NO_REWRITE__' => 1); + $pass = Array('pass' => 'all,m,u', 'u_event' => 'OnLogout', 'm_cat_id' => 0); $logout_template = $this->SelectParam($params, 'template,t'); return $this->Application->HREF($logout_template, '', $pass); } Index: branches/5.2.x/core/install/english.lang =================================================================== diff -u -N -r14662 -r14663 --- branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14662) +++ branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14663) @@ -258,6 +258,7 @@ VW5rbm93biBzZWN0aW9u VXNlciBCYW5uZWQ= dXNlciBub3QgZm91bmQ= + WW91IG11c3Qgc2VsZWN0IG9ubHkgb25lIHVzZXI= SW5jb3JyZWN0IGRhdGUgZm9ybWF0LCBwbGVhc2UgdXNlICglcykgZXguICglcyk= SW5jb3JyZWN0IGRhdGEgZm9ybWF0LCBwbGVhc2UgdXNlICVz SW52YWxpZCBGb3JtYXQ= @@ -1377,6 +1378,7 @@ SG9tZQ== SW1wb3J0 SW1wb3J0IExhbmd1YWdl + TG9naW4gQXM= TW92ZSBEb3du TW92ZSBVcA== TmV3IEFnZW50