Пример #1
0
 public function getUserDataAction()
 {
     $id = $this->_getParam('id');
     $this->view->entries = User::GetUserData($id);
 }
Пример #2
0
function pass_edit($eventData)
{
    global $env, $hui_mainstatus, $amp_locale;
    if ($eventData['newpassworda'] == $eventData['newpasswordb']) {
        if (strlen($eventData['newpassworda'])) {
            $temp_user = new User($env['ampdb'], $env['currentsiteserial']);
            $temp_user->SetUserIdByUsername($env['currentuser']);
            $user_data = $temp_user->GetUserData();
            if (md5($eventData['oldpassword']) == $user_data['password']) {
                $temp_user->ChPasswd($eventData['newpassworda']);
                $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('passwordchanged_status');
            } else {
                $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('wrongoldpassword_status');
            }
        } else {
            $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('newpasswordisempty_status');
        }
    } else {
        $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('newpasswordnomatch_status');
    }
}
Пример #3
0
 public function chPasswd($password)
 {
     $hook = new Hook($this->ampdb, 'ampoliros', 'site.chpasswd');
     if ($hook->CallHooks('calltime', $this, array('password' => $password)) == HOOK_RESULT_OK) {
         if (strlen($password) and $this->siteserial) {
             // We may require old password if superuser password cannot be changed
             //
             $sitequery =& $this->ampdb->Execute('SELECT sitepassword ' . 'FROM sites ' . 'WHERE id=' . (int) $this->siteserial);
             // Changes site password
             //
             if ($this->ampdb->Execute('UPDATE sites ' . 'SET sitepassword='******' ' . 'WHERE id=' . (int) $this->siteserial)) {
                 // Changes site superuser password
                 //
                 $tmpuser = new User($this->ampdb, $this->siteserial);
                 $tmpuser->SetUserIDByUserName($this->siteid);
                 $userdata = $tmpuser->GetUserData();
                 $qres = $this->ampdb->Execute('UPDATE users SET password = '******' WHERE id=' . (int) $userdata[id]);
                 if ($qres) {
                     if ($hook->CallHooks('passwordchanged', $this, array('password' => $password)) == HOOK_RESULT_OK) {
                         return true;
                     }
                 } else {
                     // Fallback to old site password
                     //
                     $this->ampdb->Execute('UPDATE sites ' . 'SET sitepassword='******'sitepassword')) . ' ' . 'WHERE id=' . (int) $this->siteserial);
                     $this->sitelog->LogEvent($this->siteid, 'Unable to change password for user ' . $this->siteid . '; restored old site password', LOGGER_ERROR);
                 }
             } else {
                 $this->sitelog->LogEvent($this->siteid, 'Unable to change site password', LOGGER_ERROR);
             }
         } else {
             if (!strlen($password)) {
                 $this->sitelog->LogEvent($this->siteid, 'Empty password', LOGGER_ERROR);
             }
             if (!$this->siteserial) {
                 $this->sitelog->LogEvent($this->siteid, 'Empty site serial', LOGGER_ERROR);
             }
         }
     }
     return false;
 }