Add XDB::runTransaction($callback, $arg1, $arg2, $arg2...) to run a
[platal.git] / classes / plsession.php
index 5f69aa3..7a243be 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -103,7 +103,6 @@ abstract class PlSession
      */
     public function start($level)
     {
-        $backup = S::i($level);
         if ($this->checkAuth($level)) {
             return true;
         }
@@ -190,8 +189,7 @@ abstract class PlSession
         if (S::suid()) {
             return false;
         }
-        $backup   = $_SESSION;
-        $_SESSION = array();
+        $backup = S::changeSession(array());
         $this->fillSession();
         S::set('suid', $backup);
         if (!$this->startSessionAs($user, AUTH_SUID)) {
@@ -212,7 +210,7 @@ abstract class PlSession
         if (!S::suid()) {
             return false;
         }
-        $_SESSION = $_SESSION['suid'];
+        S::changeSession(S::v('suid'));
         return true;
     }