private function updateSettings() { //update prefs $asErrorsPrefs = array(); try { $sLang = AnwEnv::_POST("lang", ""); AnwCurrentSession::setLang($sLang); $nTimezone = AnwEnv::_POST("timezone", 0); AnwCurrentSession::setTimezone($nTimezone); } catch (AnwBadLangException $e) { $asErrorsPrefs[] = $this->g_("err_badlang"); } catch (AnwBadTimezoneException $e) { $asErrorsPrefs[] = $this->g_("err_badtimezone"); } catch (AnwException $e) { $asErrorsPrefs[] = $this->g_("err_unkn"); } $asErrorsAccount = array(); if (AnwCurrentSession::isLoggedIn() && AnwUsers::isDriverInternal()) { //update account try { //displayname change requested ? if (self::globalCfgUsersChangeDisplayname()) { $sDisplayname = AnwEnv::_POST("displayname", ""); if (AnwCurrentSession::getUser()->getDisplayName() != $sDisplayname) { AnwCurrentSession::getUser()->changeDisplayName($sDisplayname); } } //email change requested ? $sEmail = AnwEnv::_POST("email", ""); if (AnwCurrentSession::getUser()->getEmail() != $sEmail) { AnwCurrentSession::getUser()->changeEmail($sEmail); } //password change requested ? $sNewPassword = AnwEnv::_POST("newpassword"); $sNewPasswordRepeat = AnwEnv::_POST("newpassword_repeat"); $sCurrentPassword = AnwEnv::_POST("currentpassword", ""); if ($sNewPassword) { if ($sNewPassword == $sNewPasswordRepeat) { try { //authenticate with current password AnwCurrentSession::getUser()->authenticate($sCurrentPassword); //authentication ok, change the password try { AnwCurrentSession::getUser()->changePassword($sNewPassword); } catch (AnwBadPasswordException $e) { $asErrorsAccount[] = $this->t_("err_badnewpassword"); } } catch (AnwBadPasswordException $e) { $asErrorsAccount[] = $this->g_("err_incorrectpassword"); } catch (AnwAuthException $e) { $asErrorsAccount[] = $this->g_("err_incorrectpassword"); } } else { $asErrorsAccount[] = $this->g_("err_passwordsmatch"); } } } catch (AnwDisplayNameAlreadyTakenException $e) { $asErrorsAccount[] = $this->g_("err_displaynamealreadytaken"); } catch (AnwBadDisplayNameException $e) { $asErrorsAccount[] = $this->g_("err_baddisplayname"); } catch (AnwEmailAlreadyTakenException $e) { $asErrorsAccount[] = $this->g_("err_emailalreadytaken"); } catch (AnwBadEmailException $e) { $asErrorsAccount[] = $this->g_("err_bademail"); } catch (AnwException $e) { $asErrorsAccount[] = $this->g_("err_unkn"); } } if (count($asErrorsPrefs) > 0 || count($asErrorsAccount) > 0) { $this->formSettings(false, $asErrorsPrefs, $asErrorsAccount); } else { AnwUtils::redirect($this->linkMe(array("done" => 1))); } }