Index: branches/5.3.x/core/units/users/users_event_handler.php =================================================================== diff -u -N -r15677 -r15698 --- branches/5.3.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 15677) +++ branches/5.3.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 15698) @@ -1,6 +1,6 @@ Load($id); - $status_field = $user_dummy->getStatusField(); + $status_field = $event->getUnitConfig()->getStatusField(true); if ( $user_dummy->GetDBField($status_field) != STATUS_ACTIVE ) { // not active user is not allowed to update his record (he could not activate himself manually) @@ -875,16 +875,16 @@ } } - if ( $found && $allow_reset ) { + if ($found && $allow_reset) { $this->Application->emailUser('USER.PSWDC', $user->GetID()); $event->redirect = $this->Application->GetVar('template_success'); - return; + return ; } if ( strlen($email_or_username) ) { $object->SetError('ForgotLogin', $found ? 'reset_denied' : ($is_email ? 'unknown_email' : 'unknown_username')); - } + } if ( !$object->ValidateField('ForgotLogin') ) { $event->status = kEvent::erFAIL; @@ -1174,7 +1174,7 @@ /* @var $user_dummy kDBItem */ $user_dummy->Load($id); - $status_field = $user_dummy->getStatusField(); + $status_field = $event->getUnitConfig()->getStatusField(true); if ( $user_dummy->GetDBField($status_field) != STATUS_ACTIVE ) { // not active user is not allowed to update his record (he could not activate himself manually) @@ -1199,7 +1199,7 @@ if ( $object->Validate() ) { // validation on, password match too $fields_hash = Array ('VariableValue' => $object->GetDBField('RootPassword')); - $conf_table = $this->Application->getUnitOption('conf', 'TableName'); + $conf_table = $this->Application->getUnitConfig('conf')->getTableName(); $this->Conn->doUpdate($fields_hash, $conf_table, 'VariableName = "RootPass"'); $event->SetRedirectParam('opener', 'u'); } @@ -1405,12 +1405,12 @@ */ function getUserStatus($user_id) { - $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); - $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); + $config = $this->getUnitConfig(); $sql = 'SELECT Status - FROM '.$table_name.' - WHERE '.$id_field.' = '.$user_id; + FROM '. $config->getTableName() .' + WHERE '. $config->getIDField() .' = '.$user_id; + return $this->Conn->GetOne($sql); } @@ -1507,8 +1507,9 @@ { parent::OnAfterConfigRead($event); - $forms = $this->Application->getUnitOption($event->Prefix, 'Forms'); - $form_fields =& $forms['default']['Fields']; + $config = $event->getUnitConfig(); + $default_form = $config->getFormByName('default'); + $form_fields =& $default_form['Fields']; // 1. arrange user registration countries $site_helper = $this->Application->recallObject('SiteHelper'); @@ -1540,7 +1541,7 @@ // 5. remove groups tab on editing forms when AdvancedUserManagement config variable not set if (!$this->Application->ConfigValue('AdvancedUserManagement')) { - $edit_tab_presets = $this->Application->getUnitOption($event->Prefix, 'EditTabPresets'); + $edit_tab_presets = $config->getEditTabPresets(); foreach ($edit_tab_presets as $preset_name => $preset_tabs) { if (array_key_exists('groups', $preset_tabs)) { @@ -1553,7 +1554,7 @@ } } - $this->Application->setUnitOption($event->Prefix, 'EditTabPresets', $edit_tab_presets); + $config->setEditTabPresets($edit_tab_presets); } } @@ -1566,7 +1567,7 @@ $form_fields['Username']['max_len'] = $max_username ? $max_username : 255; } - $this->Application->setUnitOption($event->Prefix, 'Forms', $forms); + $config->addForms($default_form, 'default'); } /** @@ -1635,18 +1636,18 @@ $this->clearSelectedIDs($event); $dst_field = $this->Application->RecallVar('dst_field'); - if ( $dst_field != 'PrimaryGroupId' ) { - return; + if ($dst_field != 'PrimaryGroupId') { + return ; } $group_ids = array_keys($this->Application->GetVar('g')); $primary_group_id = $group_ids ? array_shift($group_ids) : false; - if ( !$user_ids || !$primary_group_id ) { - return; + if (!$user_ids || !$primary_group_id) { + return ; } - $table_name = $this->Application->getUnitOption('ug', 'TableName'); + $table_name = $this->Application->getUnitConfig('ug')->getTableName(); // 1. mark group as primary $sql = 'UPDATE ' . TABLE_PREFIX . 'Users