X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fxorg.inc.php;h=0d46e8d4ec9374b8ebf13b39a00390c946ec6348;hb=f70f2bcdc077c220e40ecebaf569e097f6028743;hp=cb1fb377c1e14bbf9c9c03612aa2f40a47d63ec3;hpb=b435c0894bc6fe67fa4d1c7da1485300fd088c32;p=platal.git diff --git a/include/xorg.inc.php b/include/xorg.inc.php index cb1fb37..0d46e8d 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -1,6 +1,6 @@ assign('xorg_tpl', $tpl_name); } -// }}} -function new_identification_page() -{ - _new_page(SKINNED, '', AUTH_MDP); -} -// {{{ function new_skinned_page() +/****************************************************************************** + * Dynamic configuration update/edition stuff + *****************************************************************************/ -function new_skinned_page($tpl_name, $min_auth) +function update_NbIns() { - _new_page(SKINNED, $tpl_name, $min_auth); + global $globals; + $res = XDB::query("SELECT COUNT(*) + FROM auth_user_md5 + WHERE perms IN ('admin','user') AND deces=0"); + $cnt = $res->fetchOneCell(); + $globals->changeDynamicConfig(array('NbIns' => $cnt)); } -// }}} -// {{{ function new_simple_page() - -function new_simple_page($tpl_name, $min_auth) +function update_NbValid() { - global $page; - _new_page(SKINNED, $tpl_name, $min_auth); - $page->assign('simple', true); + global $globals; + $res = XDB::query("SELECT COUNT(*) + FROM requests"); + $globals->changeDynamicConfig(array('NbValid' => $res->fetchOneCell())); } -// }}} -// {{{ function new_nonhtml_page() - -function new_nonhtml_page($tpl_name, $min_auth) +function update_NbNotifs() { - _new_page(NO_SKIN, $tpl_name, $min_auth, false); + require_once 'notifs.inc.php'; + $n = select_notifs(false, S::i('uid'), S::v('watch_last'), false); + $_SESSION['notifs'] = $n->numRows(); } -// }}} -// {{{ function new_admin_page() -function new_admin_page($tpl_name) -{ - _new_page(SKINNED, $tpl_name, AUTH_MDP, true); -} -// }}} -// {{{ function new_admin_table_editor() +// {{{ class XorgPage -function new_admin_table_editor($table, $idfield, $idedit=false) +class XorgPage extends PlPage { - array_walk($_GET, 'unfix_gpc_magic'); - array_walk($_POST, 'unfix_gpc_magic'); - array_walk($_REQUEST, 'unfix_gpc_magic'); + public function __construct() + { + parent::__construct(); - global $editor; - new_admin_page('table-editor.tpl'); - require_once('xorg.table-editor.inc.php'); - $editor = new XOrgAdminTableEditor($table,$idfield,$idedit); -} + // Set the default page + $this->changeTpl('platal/index.tpl'); + } -// }}} + public function run() + { + global $globals, $platal; + if (isset($platal) && $platal->path == 'register') { + $skin = $globals->register_skin . ".tpl"; + } else { + $skin = S::v('skin', $globals->skin . ".tpl"); + } + $this->_run('skin/' . $skin); + } +} -// 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: ?>