/** * Load the user object into the user property * * @return TBGUser */ public static function loadUser($user = null) { try { self::$_user = $user === null ? TBGUser::loginCheck(self::getRequest(), self::getCurrentAction()) : $user; if (self::$_user->isAuthenticated()) { if (self::$_user->isOffline() || self::$_user->isAway()) { self::$_user->setOnline(); } if (!self::getRequest()->hasCookie('tbg3_original_username')) { self::$_user->updateLastSeen(); } if (!TBGContext::getScope()->isDefault() && !self::getRequest()->isAjaxCall() && !in_array(self::getRouting()->getCurrentRouteName(), array('add_scope', 'serve', 'debug', 'logout')) && !self::$_user->isGuest() && !self::$_user->isConfirmedMemberOfScope(TBGContext::getScope())) { self::getResponse()->headerRedirect(self::getRouting()->generate('add_scope')); } self::$_user->save(); if (!self::$_user->getGroup() instanceof TBGGroup) { throw new Exception('This user account belongs to a group that does not exist anymore. <br>Please contact the system administrator.'); } } } catch (TBGElevatedLoginException $e) { throw $e; } catch (Exception $e) { self::$_user = new TBGUser(); throw $e; } return self::$_user; }
/** * Load the user object into the user property * * @return TBGUser */ public static function loadUser($user = null) { try { self::$_user = $user === null ? TBGUser::loginCheck(self::getRequest()->getParameter('tbg3_username'), self::getRequest()->getParameter('tbg3_password')) : $user; if (self::$_user->isAuthenticated()) { if (self::$_user->isOffline() || self::$_user->isAway()) { self::$_user->setOnline(); } self::$_user->updateLastSeen(); self::$_user->setTimezone(TBGSettings::getUserTimezone()); self::$_user->setLanguage(TBGSettings::getUserLanguage()); self::$_user->save(); if (!self::$_user->getGroup() instanceof TBGGroup) { throw new Exception('This user account belongs to a group that does not exist anymore. <br>Please contact the system administrator.'); } } } catch (Exception $e) { throw $e; } return self::$_user; }