* 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')) {
+ if (($forceFetch || self::$user == null) && class_exists('User')) {
if (S::has('user') && S::v('user') instanceof User) {
self::$user = S::v('user');
} else {
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();