fix auth problem
[platal.git] / include / xnet / session.inc.php
index c0b6d26..147fab8 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('platal/session.inc.php');
+require_once dirname(__FILE__).'/../../classes/Session.php';
 
 class XnetSession
 {
@@ -70,11 +70,9 @@ class XnetSession
 
         if (Get::has('auth')) {
             return XnetSession::doAuthX();
-        } else {
-            global $page;
-
-            $page->doLogin();
         }
+
+        return false;
     }
 
     // }}}
@@ -83,7 +81,7 @@ class XnetSession
     function doAuthX() {
         global $globals, $page;
 
-        if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::getInt('uid').'1') != Get::get('auth')) {
+        if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::i('uid').'1') != Get::v('auth')) {
             $page->kill("Erreur d'authentification avec polytechnique.org !");
         }
 
@@ -95,21 +93,23 @@ class XnetSession
         INNER JOIN  aliases         AS a  ON (u.user_id = a.id AND a.type='a_vie')
         INNER JOIN  aliases         AS a2 ON (u.user_id = a2.id AND FIND_IN_SET('bestalias',a2.flags))
              WHERE  u.user_id = {?} AND u.perms IN('admin','user')
-             LIMIT  1", Get::getInt('uid'));
+             LIMIT  1", Get::i('uid'));
         $_SESSION = array_merge($_SESSION, $res->fetchOneAssoc());
         $_SESSION['auth'] = AUTH_MDP;
         S::kill('challenge');
         S::kill('loginX');
         Get::kill('auth');
         Get::kill('uid');
-        $args = array();
-        $path = Get::get('p');
+        $path = Get::v('p');
         Get::kill('p');
+        Get::kill('PHPSESSID');
 
+        $args = array();
         foreach($_GET as $key => $val) {
             $args[] = urlencode($key).'='.urlencode($val);
         }
-        redirect($globals->baseurl . '/' . $path . '?' . join('&', $args));
+
+        http_redirect($globals->baseurl . '/' . $path, join('&', $args));
     }
 
     // }}}