From 2bd5b7f81f8eb5a1a04bb3741c46c2a535d090d9 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Thu, 13 Jul 2006 22:27:17 +0000 Subject: [PATCH] simplify the design, drop login.php for now, it will come back (maybe) at some point, but is not needed yet, and will complicate the migration anyway: htdocs.net/groupe/inscrire.php | 3 - htdocs.net/login.php | 10 --- htdocs.net/wiki.php | 10 +-- include/xnet.inc.php | 82 ++++++++++++++++++++---------- include/xnet/page.inc.php | 110 +---------------------------------------- include/xnet/session.inc.php | 5 - templates/xnet/skin.tpl | 1 7 files changed, 66 insertions(+), 155 deletions(-) git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@471 839d8a87-29fc-0310-9880-83ba4fa771e5 --- htdocs.net/groupe/inscrire.php | 3 +- htdocs.net/login.php | 10 ---- htdocs.net/wiki.php | 10 ++-- include/xnet.inc.php | 82 +++++++++++++++++++----------- include/xnet/page.inc.php | 110 ++--------------------------------------- include/xnet/session.inc.php | 5 +- templates/xnet/skin.tpl | 1 - 7 files changed, 66 insertions(+), 155 deletions(-) delete mode 100644 htdocs.net/login.php diff --git a/htdocs.net/groupe/inscrire.php b/htdocs.net/groupe/inscrire.php index 2b3326d..abd5294 100644 --- a/htdocs.net/groupe/inscrire.php +++ b/htdocs.net/groupe/inscrire.php @@ -1,7 +1,8 @@ doAuth(true); $page->useMenu(); $page->setType($globals->asso('cat')); $page->assign('asso', $globals->asso()); diff --git a/htdocs.net/login.php b/htdocs.net/login.php deleted file mode 100644 index adad92b..0000000 --- a/htdocs.net/login.php +++ /dev/null @@ -1,10 +0,0 @@ -run(); -?> diff --git a/htdocs.net/wiki.php b/htdocs.net/wiki.php index 8d2925e..505eb73 100644 --- a/htdocs.net/wiki.php +++ b/htdocs.net/wiki.php @@ -25,9 +25,7 @@ require_once("xnet.inc.php"); // the wiki engine used is pmwiki. // the templates created are stored in wiki.d/cache_wikiword.tpl -// some page can be seen by everybody (public), but to validate a password -// if we arrive here before setting new access we need to try an auth -new_page('wiki.tpl', Env::has('response') ? AUTH_MDP : AUTH_PUBLIC); +new_page('wiki.tpl')); if ($globals->wiki->wikidir && $globals->xnet->wiki) { $wikisite = 'xnet'; @@ -45,8 +43,10 @@ if ($globals->wiki->wikidir && $globals->xnet->wiki) { wiki_assign_auth(); } -if (!Env::get('action')) - $page->assign('xorg_extra_header', "\n"); +if (!Env::get('action')) { + $page->addJsLink('javascript/wiki.js'); +} + $page->assign('is_member', is_member()); $page->assign('has_perms', has_perms() || may_update()); diff --git a/include/xnet.inc.php b/include/xnet.inc.php index 93724d8..836efe4 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -28,31 +28,27 @@ XnetSession::init(); // {{{ function new_skinned_page() -function new_page($tpl_name, $min_auth) +function new_page($tpl_name, $type = SKINNED) { - global $page,$globals; + global $page, $globals; require_once("xnet/page.inc.php"); - switch($min_auth) { - case AUTH_PUBLIC: - $page = new XnetPage($tpl_name, $type); - break; - - default: - $page = new XnetAuth($tpl_name, $type); - } + $page = new XnetPage($tpl_name, $type); $page->assign('xorg_tpl', $tpl_name); } -function new_skinned_page($tpl_name, $min_auth) +function new_skinned_page($tpl_name) { - return new_page($tpl_name, $min_auth); + return new_page($tpl_name); } // }}} + function new_identification_page() { - new_page('', AUTH_MDP); global $page; + + new_page(''); + $page->doAuth(true); $page->useMenu(); } @@ -60,10 +56,18 @@ function new_identification_page() function new_group_page($tpl_name) { - global $page,$globals; - require_once("xnet/page.inc.php"); - $page = new XnetGroupPage($tpl_name); - $page->assign('xorg_tpl', $tpl_name); + global $page, $globals; + + new_page($tpl_name); + + $page->doAuth(true); + if (!is_member() && !has_perms()) { + $page->kill("You have not sufficient credentials"); + } + + $page->useMenu(); + $page->assign('asso', $globals->asso()); + $page->setType($globals->asso('cat')); } // }}} @@ -71,10 +75,17 @@ function new_group_page($tpl_name) function new_groupadmin_page($tpl_name) { - global $page,$globals; - require_once("xnet/page.inc.php"); - $page = new XnetGroupAdmin($tpl_name); - $page->assign('xorg_tpl', $tpl_name); + global $page, $globals; + + new_page($tpl_name); + + if (!may_update()) { + $page->kill("You have not sufficient credentials"); + } + + $page->useMenu(); + $page->assign('asso', $globals->asso()); + $page->setType($globals->asso('cat')); } // }}} @@ -82,10 +93,17 @@ function new_groupadmin_page($tpl_name) function new_admin_page($tpl_name) { - global $page,$globals; - require_once("xnet/page.inc.php"); - $page = new XnetAdmin($tpl_name); - $page->assign('xorg_tpl', $tpl_name); + global $page, $globals; + + new_page($tpl_name); + + check_perms(); + + $page->useMenu(); + if ($globals->asso('cat')) { + $page->assign('asso', $globals->asso()); + $page->setType($globals->asso('cat')); + } } // }}} @@ -94,9 +112,17 @@ function new_admin_page($tpl_name) function new_nonhtml_page($tpl_name) { global $page, $globals; - require_once("xnet/page.inc.php"); - $page = new XnetGroupPage($tpl_name, NO_SKIN); - $page->assign('xorg_tpl', $tpl_name); + + new_page($tpl_name, NO_SKIN); + + $page->doAuth(true); + if (!is_member() && !has_perms()) { + $page->kill("You have not sufficient credentials"); + } + + $page->useMenu(); + $page->assign('asso', $globals->asso()); + $page->setType($globals->asso('cat')); } // }}} diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 261da94..7b43294 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -109,11 +109,14 @@ class XnetPage extends PlatalPage // }}} // {{{ function doAuth() - function doAuth() + function doAuth($force = false) { $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 (!logged() && $force) { + $_SESSION['session']->doLogin($this); + } if (!logged() && Get::has('auth')) { $_SESSION['session']->doAuthX($this); } @@ -123,110 +126,5 @@ class XnetPage extends PlatalPage } // }}} -// {{{ class XnetAuth - -/** Une classe pour les pages nécessitant l'authentification. - * (equivalent de controlauthentification.inc.php) - */ -class XnetAuth extends XnetPage -{ - // {{{ function XnetAuth() - - function XnetAuth($tpl, $type=SKINNED) - { - $this->XnetPage($tpl, $type); - } - - // }}} - // {{{ function doAuth() - - function doAuth() - { - parent::doAuth(); - $_SESSION['session']->doAuth($this); - } - - // }}} -} - -// }}} -// {{{ class XnetAdmin - -/** Une classe pour les pages réservées aux admins (authentifiés!). - */ -class XnetAdmin extends XnetAuth -{ - // {{{ function XnetAdmin() - - function XnetAdmin($tpl, $type=SKINNED) - { - global $globals; - - $this->XnetAuth($tpl, $type); - check_perms(); - - $this->useMenu(); - if ($globals->asso('cat')) { - $this->assign('asso', $globals->asso()); - $this->setType($globals->asso('cat')); - } - } - - // }}} -} - -// }}} -// {{{ class XnetGroupPage - -/** Une classe pour les pages réservées aux admins (authentifiés!). - */ -class XnetGroupPage extends XnetAuth -{ - // {{{ function XnetAdmin() - - function XnetGroupPage($tpl, $type=SKINNED) - { - global $globals; - - $this->XnetAuth($tpl, $type); - if (!is_member() && !has_perms()) { - $this->kill("You have not sufficient credentials"); - } - - $this->useMenu(); - $this->assign('asso', $globals->asso()); - $this->setType($globals->asso('cat')); - } - - // }}} -} - -// }}} -// {{{ class XnetGroupAdmin - -/** Une classe pour les pages réservées aux admins (authentifiés!). - */ -class XnetGroupAdmin extends XnetAuth -{ - // {{{ function XnetAdmin() - - function XnetGroupAdmin($tpl, $type=SKINNED) - { - global $globals; - - $this->XnetAuth($tpl, $type); - if (!may_update()) { - $this->kill("You have not sufficient credentials"); - } - - $this->useMenu(); - $this->assign('asso', $globals->asso()); - $this->setType($globals->asso('cat')); - } - - // }}} -} - -// }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/include/xnet/session.inc.php b/include/xnet/session.inc.php index ad2c4bf..95f1b34 100644 --- a/include/xnet/session.inc.php +++ b/include/xnet/session.inc.php @@ -135,10 +135,7 @@ class XnetSession extends DiogenesCoreSession // {{{ doLogin function doLogin(&$page) { - // login for non-x has been disabled, so don't need this js anymore - //$page->addJsLink('javascript/do_challenge_response.js'); - $page->assign("xorg_tpl", "xnet/login.tpl"); - $page->run(); + redirect($_SESSION['session']->loginX); } // }}} diff --git a/templates/xnet/skin.tpl b/templates/xnet/skin.tpl index f6af18b..1bbb4c7 100644 --- a/templates/xnet/skin.tpl +++ b/templates/xnet/skin.tpl @@ -144,7 +144,6 @@ {only_public}
Me connecter :
polytechnicien - {/only_public} -- 2.1.4