X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fs.php;h=58cbcbea00a2feab1dcdc07ea110d2335ac003da;hb=7446ea512d015e4b6b07ed378bed4bb9fd5418ba;hp=0ee548e1fb44b7e89828637ca07c60509ab4aa21;hpb=2ab75571bf840471fa9559292b75852bfce004d3;p=platal.git diff --git a/classes/s.php b/classes/s.php index 0ee548e..58cbcbe 100644 --- a/classes/s.php +++ b/classes/s.php @@ -1,6 +1,6 @@ isValid($uid)) { + global $platal; if (S::has('suid')) { $suid = S::v('suid'); - S::set('log', PlLogger::get(S::i('uid', $uid), $suid['uid'])); + S::set('log', $platal->buildLogger(S::i('uid', $uid), $suid['uid'])); } else if (S::has('uid') || $uid) { - S::set('log', PlLogger::get(S::i('uid', $uid))); + S::set('log', $platal->buildLogger(S::i('uid', $uid))); } else { S::set('log', PlLogger::dummy($uid)); } @@ -116,14 +117,26 @@ class S * move into the php session (and data it helds should be removed from * the php session). */ private static $user = null; - public static function &user() + public static function &user($forceFetch = false) { - if (self::$user == null && class_exists('User')) { - self::$user = User::getSilentWithValues(S::i('uid'), $_SESSION); + if (($forceFetch || self::$user == null) && class_exists('User')) { + if (S::has('user') && S::v('user') instanceof User) { + self::$user = S::v('user'); + } else { + self::$user = User::getSilentWithValues(S::i('uid'), $_SESSION); + } } return self::$user; } + public static function changeSession(array $newSession) + { + $oldSession = $_SESSION; + $_SESSION = $newSession; + self::$user = null; + return $oldSession; + } + public static function logged() { return S::i('auth', AUTH_PUBLIC) >= Platal::session()->loggedLevel();