<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2008 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
+
require_once('platal.inc.php');
-require_once('xorg/globals.inc.php');
+require_once('globals.inc.php');
require_once('xorg/session.inc.php');
-XorgGlobals::init();
-XorgGlobals::setlocale();
-XorgSession::init();
-
-require_once('platal/page.inc.php');
+$globals = new PlatalGlobals('XorgSession');
+$globals->bootstrap(array('NbIns'), 'update_NbIns');
+$globals->bootstrap(array('NbValid'), 'update_NbValid');
// {{{ class XorgPage
class XorgPage extends PlatalPage
{
- function XorgPage($tpl, $type=SKINNED)
+ public function __construct($tpl, $type = SKINNED)
{
- $this->PlatalPage($tpl, $type);
+ parent::__construct($tpl, $type);
}
- function run()
+ public function run()
{
- global $globals;
- if ($this->_page_type != NO_SKIN) {
- $this->assign('menu', $globals->menu->menu());
- }
- $this->_run('skin/'.S::v('skin'));
- }
-
- function doLogin($new_name = false)
- {
- global $page;
- if (S::logged() and !$new_name) {
- $page->changeTpl('password_prompt_logged.tpl');
- $page->addJsLink('javascript/do_challenge_response_logged.js');
+ global $globals, $platal;
+ $this->assign('globals', $globals);
+ if (isset($platal) && $platal->path == 'register') {
+ $skin = $globals->register_skin . ".tpl";
} else {
- $page->changeTpl('password_prompt.tpl');
- $page->addJsLink('javascript/do_challenge_response.js');
- }
- $page->run();
- }
-}
-
-// }}}
-// {{{ class XorgAdmin
-
-/** Une classe pour les pages réservées aux admins (authentifiés!).
- */
-class XorgAdmin extends XorgPage
-{
- // {{{ function XorgAdmin()
-
- function XorgAdmin($tpl, $type=SKINNED)
- {
- $this->XorgPage($tpl, $type);
- check_perms();
+ $skin = S::v('skin', $globals->skin . ".tpl");
+ }
+ $this->_run('skin/' . $skin);
}
-
- // }}}
}
-// }}}
+// {{{ function new_skinned_page()
-function _new_page($type, $tpl_name, $admin=false)
+function new_skinned_page($tpl_name)
{
global $page;
- if (!empty($admin)) {
- $page = new XorgAdmin($tpl_name, $type);
+ if (!$page instanceof XorgPage) {
+ $page = new XorgPage($tpl_name);
} else {
- $page = new XorgPage($tpl_name, $type);
+ $page->changeTpl($tpl_name);
}
-
- $page->assign('xorg_tpl', $tpl_name);
}
-// {{{ function new_skinned_page()
-
-function new_skinned_page($tpl_name)
-{
- _new_page(SKINNED, $tpl_name);
-}
-
-// }}}
-// {{{ function new_admin_page()
-
-function new_admin_page($tpl_name)
-{
- _new_page(SKINNED, $tpl_name, true);
-}
-
-// }}}
-// {{{ function new_admin_table_editor()
-
-function new_admin_table_editor($table, $idfield, $idedit=false)
-{
- array_walk($_GET, 'unfix_gpc_magic');
- array_walk($_POST, 'unfix_gpc_magic');
- array_walk($_REQUEST, 'unfix_gpc_magic');
-
- global $editor;
- new_admin_page('table-editor.tpl');
- require_once('xorg.table-editor.inc.php');
- $editor = new XOrgAdminTableEditor($table, $idfield, $idedit);
-}
-
-// }}}
+XorgSession::init();
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>