X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fs.php;h=58cbcbea00a2feab1dcdc07ea110d2335ac003da;hb=e92ecb8c24421ca1dd4f87ad7478d0d8277e1f60;hp=e07a257642854a8cdd8537365b19d195f10d3cd7;hpb=a7f778a593a0a7e168a7112ec28cb84d032adaf3;p=platal.git diff --git a/classes/s.php b/classes/s.php index e07a257..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,18 +117,24 @@ 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 has_perms() + public static function changeSession(array $newSession) { - // XXX: Deprecated, use S::admin() instead - return self::admin(); + $oldSession = $_SESSION; + $_SESSION = $newSession; + self::$user = null; + return $oldSession; } public static function logged()