/** * 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; }