From: Florent Bruneau Date: Sat, 21 Jun 2008 16:46:18 +0000 (+0200) Subject: X.net built on new Core schema. X-Git-Tag: core/1.0.0~86 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6b79b8efce6128e1a2382e1954de19d29485495f;p=platal.git X.net built on new Core schema. Signed-off-by: Florent Bruneau --- diff --git a/include/xnet.inc.php b/include/xnet.inc.php index e9689e3..58d9ffd 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -19,22 +19,14 @@ * 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: ?> diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 7d47777..1fce8e4 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -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) diff --git a/include/xnet/session.inc.php b/include/xnet/session.inc.php index 92c189a..2251662 100644 --- a/include/xnet/session.inc.php +++ b/include/xnet/session.inc.php @@ -21,6 +21,11 @@ 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) diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 0be0ddd..5f7af96 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -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