X.net built on new Core schema.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 21 Jun 2008 16:46:18 +0000 (18:46 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 21 Jun 2008 16:46:18 +0000 (18:46 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/xnet.inc.php
include/xnet/page.inc.php
include/xnet/session.inc.php
include/xorg.inc.php

index e9689e3..58d9ffd 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+define('PL_GLOBALS_CLASS', 'PlatalGlobals');
+define('PL_SESSION_CLASS', 'XnetSession');
+define('PL_PAGE_CLASS', 'XnetPage');
+
 require_once('platal.inc.php');
 require_once('globals.inc.php');
 require_once('xnet/session.inc.php');
-$globals = new PlatalGlobals('XnetSession');
-XnetSession::init();
-
-function new_skinned_page($tpl_name)
-{
-    global $page;
-    require_once("xnet/page.inc.php");
-    if (!$page instanceof XnetPage) {
-        $page = new XnetPage($tpl_name);
-    } else {
-        $page->changeTpl($tpl_name);
-    }
-}
+require_once('xnet/page.inc.php');
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index 7d47777..1fce8e4 100644 (file)
@@ -25,16 +25,21 @@ class XnetPage extends PlPage
 
     // {{{ function XnetPage()
 
-    public function __construct($tpl, $type=SKINNED)
+    public function __construct()
     {
-        parent::__construct($tpl, $type);
+        parent::__construct();
 
         $this->register_function('list_all_my_groups', 'list_all_my_groups');
         $this->register_modifier('cat_pp', 'cat_pp');
         $this->assign('it_is_xnet', true);
 
-        if (!S::logged() && Get::has('auth')) {
-            XnetSession::doAuthX();
+        global $globals;
+        $this->assign('is_logged', S::logged());
+        if ($globals->asso('id')) {
+            $this->assign('asso', $globals->asso());
+            $this->setType($globals->asso('cat'));
+            $this->assign('is_admin', may_update());
+            $this->assign('is_member', is_member());
         }
     }
 
@@ -50,22 +55,6 @@ class XnetPage extends PlPage
     }
 
     // }}}
-    // {{{ function changeTpl()
-
-    public function changeTpl($tpl, $type = SKINNED)
-    {
-        global $globals;
-        parent::changeTpl($tpl, $type);
-        $this->assign('is_logged', S::logged());
-        if ($globals->asso('id')) {
-            $this->assign('asso', $globals->asso());
-            $this->setType($globals->asso('cat'));
-            $this->assign('is_admin', may_update());
-            $this->assign('is_member', is_member());
-        }
-    }
-
-    // }}}
     // {{{ function setType
 
     public function setType($type)
index 92c189a..2251662 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)
index 0be0ddd..5f7af96 100644 (file)
@@ -27,7 +27,6 @@ require_once('platal.inc.php');
 require_once('globals.inc.php');
 require_once('xorg/session.inc.php');
 
-$globals = new PlatalGlobals();
 // {{{ class XorgPage
 
 class XorgPage extends PlPage