Пример #1
0
 static function rebuildUser($nId, $sLogin, $sDisplayName, $sEmail, $sLang, $nTimezone)
 {
     $oUser = new AnwUserById($nId);
     if (!AnwUsers::isValidLogin($sLogin)) {
         throw new AnwBadLoginException();
     }
     $oUser->sLogin = $sLogin;
     if (!AnwUsers::isValidDisplayName($sDisplayName)) {
         throw new AnwBadDisplayNameException();
     }
     $oUser->sDisplayName = $sDisplayName;
     if (!AnwUsers::isValidEmail($sEmail)) {
         throw new AnwBadEmailException();
     }
     $oUser->sEmail = $sEmail;
     if (!Anwi18n::isValidLang($sLang)) {
         $sLang = AnwComponent::globalCfgLangDefault();
     }
     $oUser->sLang = $sLang;
     if (!AnwUsers::isValidTimezone($nTimezone)) {
         $nTimezone = AnwComponent::globalCfgTimezoneDefault();
     }
     $oUser->nTimezone = $nTimezone;
     $oUser->bExists = true;
     $oUser->bInfoLoaded = true;
     return $oUser;
 }