static function rebuildSession($oUser, $bResume, $sLang, $nTimezone, $sId, $nTimeStart, $nTimeSeen, $nTimeAuth = 0) { $oSession = new AnwSession(); $oSession->oUser = $oUser; $oSession->bResume = $bResume; if (!Anwi18n::isValidLang($sLang)) { $sLang = AnwComponent::globalCfgLangDefault(); } $oSession->sLang = $sLang; if ($oUser->exists()) { $oSession->bLoggedIn = true; } else { $oSession->bLoggedIn = false; } $oSession->sId = $sId; if (!AnwUsers::isValidTimezone($nTimezone)) { $nTimezone = AnwComponent::globalCfgTimezoneDefault(); } $oSession->nTimezone = $nTimezone; $oSession->nTimeStart = $nTimeStart; $oSession->nTimeSeen = $nTimeSeen; $oSession->nTimeAuth = $nTimeAuth; return $oSession; }
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; }