Index: branches/5.0.x/core/units/users/users_event_handler.php =================================================================== diff -u -N -r12511 -r12726 --- branches/5.0.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 12511) +++ branches/5.0.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 12726) @@ -1,6 +1,6 @@ addFilter('primary_filter', 'ug.GroupId <> 11'); } - if (!$this->Application->IsAdmin()) { + if (!$this->Application->isAdminUser) { $object->addFilter('status_filter', '%1$s.Status = '.STATUS_ACTIVE); } @@ -104,7 +104,7 @@ return true; } - if (!$this->Application->IsAdmin()) { + if (!$this->Application->isAdminUser) { $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); @@ -164,8 +164,7 @@ 'no_pass_through' => 1, // this way kApplication::HREF won't add them again ); - if ($this->Application->IsAdmin()) { - + if ($this->Application->isAdmin) { $this->Application->Redirect('index', $admin_url_params, '', 'index.php'); } @@ -199,11 +198,11 @@ function OnLogin(&$event) { // persistent session data after login is not refreshed, because redirect will follow in any case - $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme + $prefix_special = $this->Application->isAdmin ? 'u.current' : 'u'; // "u" used on front not to change theme $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true)); $password = $this->Application->GetVar('password'); - $invalid_pseudo = $this->Application->IsAdmin() ? 'la_invalid_password' : 'lu_invalid_password'; + $invalid_pseudo = $this->Application->isAdmin ? 'la_invalid_password' : 'lu_invalid_password'; $remember_login_cookie = $this->Application->GetVar('remember_login'); if (!$password && !$remember_login_cookie) { @@ -213,18 +212,18 @@ } $email_as_login = $this->Application->ConfigValue('Email_As_Login'); - list ($login_field, $submit_field) = $email_as_login && !$this->Application->IsAdmin() ? Array('Email', 'email') : Array('Login', 'login'); + list ($login_field, $submit_field) = $email_as_login && !$this->Application->isAdmin ? Array('Email', 'email') : Array('Login', 'login'); $login_value = $this->Application->GetVar($submit_field); // process "Save Username" checkbox - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdmin) { $save_username = $this->Application->GetVar('cb_save_username') ? $login_value : ''; $this->Application->Session->SetCookie('save_username', $save_username, adodb_mktime() + 31104000); // 1 year expiration $this->Application->SetVar('save_username', $save_username); // cookie will be set on next refresh, but refresh won't occur if login error present, so duplicate cookie in HTTPQuery } $super_admin = ($login_value == 'super-root') && $this->verifySuperAdmin(); - if ($this->Application->IsAdmin() && ($login_value == 'root') || ($super_admin && $login_value == 'super-root')) { + if ($this->Application->isAdmin && ($login_value == 'root') || ($super_admin && $login_value == 'super-root')) { // logging in "root" (admin only) $login_value = 'root'; @@ -350,7 +349,7 @@ { $remember_login_cookie = $this->Application->GetVar('remember_login'); - if (!$remember_login_cookie || $this->Application->IsAdmin() || $this->Application->LoggedIn()) { + if (!$remember_login_cookie || $this->Application->isAdmin || $this->Application->LoggedIn()) { return ; } @@ -377,8 +376,9 @@ function checkLoginPermission($user_name) { $ret = true; - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdmin) { $modules_helper =& $this->Application->recallObject('ModulesHelper'); + if ($user_name != 'root') { // root is virtual user, so allow him to login to admin in any case $ret = $this->Application->CheckPermission('ADMIN', 1); @@ -387,6 +387,7 @@ else { $ret = $this->Application->CheckPermission('LOGIN', 1); } + return $ret; } @@ -397,7 +398,7 @@ */ function processLoginRedirect(&$event, $password) { - $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme + $prefix_special = $this->Application->isAdmin ? 'u.current' : 'u'; // "u" used on front not to change theme $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true)); $next_template = $this->Application->GetVar('next_template'); @@ -533,7 +534,7 @@ $this->Conn->Query($sql); // set primary group to user - if ($this->Application->IsAdmin() && $this->Application->GetVar('user_group')) { + if ($this->Application->isAdminUser && $this->Application->GetVar('user_group')) { // while in admin you can set any group for new users $group_id = $this->Application->GetVar('user_group'); } @@ -640,7 +641,9 @@ { $this->OnAfterItemCreate($event); $object->SendEmailEvents(); - if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect) $this->autoLoginUser($event); + if (!$this->Application->isAdmin && ($event->status == erSUCCESS) && $event->redirect) { + $this->autoLoginUser($event); + } } } return $is_subscriber; @@ -653,10 +656,11 @@ */ function OnCreate(&$event) { - if( !$this->Application->IsAdmin() ) $this->setUserStatus($event); + if (!$this->Application->isAdminUser) { + $this->setUserStatus($event); + } - if( !$this->isSubscriberOnly($event) ) - { + if (!$this->isSubscriberOnly($event)) { $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); $cs_helper->CheckStateField($event, 'State', 'Country'); @@ -674,8 +678,7 @@ $this->setNextTemplate($event); - if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect) - { + if (!$this->Application->isAdmin && ($event->status == erSUCCESS) && $event->redirect) { $object->SendEmailEvents(); $this->autoLoginUser($event); } @@ -1144,14 +1147,18 @@ */ function setNextTemplate(&$event) { - if( !$this->Application->IsAdmin() ) - { - $event->redirect_params['opener'] = 's'; - $object =& $event->getObject(); - if($object->GetDBField('Status') == STATUS_ACTIVE) - { - $next_template = $this->Application->GetVar('next_template'); - if($next_template) $event->redirect = $next_template; + if ($this->Application->isAdmin) { + return ; + } + + $event->redirect_params['opener'] = 's'; + $object =& $event->getObject(); + + if ($object->GetDBField('Status') == STATUS_ACTIVE) { + $next_template = $this->Application->GetVar('next_template'); + + if ($next_template) { + $event->redirect = $next_template; } } } @@ -1437,7 +1444,7 @@ $object =& $event->getObject(); /* @var $object UsersItem */ - if (!$this->Application->IsAdmin() || $object->IsTempTable()) { + if (!$this->Application->isAdmin || $object->IsTempTable()) { return ; } @@ -1549,7 +1556,7 @@ $file_helper->createItemFiles($event->Prefix, true); // create image fields - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdminUser) { // 4. when in administrative console, then create all users with Active status $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); // $fields['Password']['required'] = 1; // set password required (will broke approve/decline buttons) @@ -1728,7 +1735,7 @@ */ function saveUserImages(&$event) { - if (!$this->Application->IsAdmin()) { + if (!$this->Application->isAdmin) { $image_helper =& $this->Application->recallObject('ImageHelper'); /* @var $image_helper ImageHelper */