Fix a double entity
[platal.git] / modules / xnet.php
index 66972df..d592f5b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -56,7 +56,7 @@ class XnetModule extends PLModule
         }
         exit;
     }
-    
+
     function handler_index(&$page)
     {
         $page->nomenu = true;
@@ -72,7 +72,7 @@ class XnetModule extends PLModule
 
     function handler_admin(&$page)
     {
-        new_admin_page('xnet/admin.tpl');
+        $page->changeTpl('xnet/admin.tpl');
 
         if (Get::has('del')) {
             $res = XDB::query('SELECT id, nom, mail_domain
@@ -197,11 +197,14 @@ class XnetModule extends PLModule
 
         $page->setType($cat);
     }
-    
+
     function handler_autologin(&$page)
     {
+        $allkeys = func_get_args();
+        unset($allkeys[0]);
+        $url = join('/',$allkeys);
         header("Content-type: text/javascript; charset=utf-8");
-        echo '$.ajax({ url: "index?forceXml=1", dataType: "xml", success: function(xml) { $("body").empty(); $("body",xml).prependTo("body"); }});';
+        echo '$.ajax({ url: "'.$url.'?forceXml=1", dataType: "xml", success: function(xml) { $("body",xml).insertBefore("body"); $("body:eq(1)").remove(); }});';
         exit;
     }
 }