{site}.inc.php is the base for all jobs.
[platal.git] / include / xnet / session.inc.php
index 92c189a..e3e544e 100644 (file)
 
 class XnetSession
 {
+    public function __construct()
+    {
+        self::init();
+    }
+
     // {{{ function init
 
     public static function init()
@@ -29,6 +34,10 @@ class XnetSession
 
         S::init();
 
+        if (!S::logged() && Get::has('auth')) {
+            XnetSession::doAuthX();
+        }
+
         if (!S::logged()) {
             // prevent connexion to be linked to deconnexion
             if (($i = strpos($_SERVER['REQUEST_URI'], 'exit')) !== false)
@@ -106,14 +115,11 @@ class XnetSession
 
     public static function doAuthX()
     {
-        global $globals, $page;
+        global $globals;
 
         if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::i('uid').'1') != Get::v('auth')) {
             Get::kill('auth');
-            if (!$page) {
-                require_once 'xnet.inc.php';
-                new_skinned_page('platal/index.tpl');
-            }
+            $page =& Platal::page();
             $page->kill("Erreur d'authentification avec polytechnique.org !");
         }