From fc4725ff945e700a8765e4fa9a7f4480b6aaea42 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sun, 17 Apr 2005 15:48:16 +0000 Subject: [PATCH] adjustments wrt sessions + configs git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-548 --- include/platal/page.inc.php | 2 -- include/xnet.inc.php | 29 +++++++++++++++++ include/xnet/globals.inc.php | 76 ++++++++++++++++++++++++++++++++++++++++++++ include/xnet/session.inc.php | 65 +++++++++++++++++++++++++++++++++++++ include/xorg/page.inc.php | 3 ++ 5 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 include/xnet.inc.php create mode 100644 include/xnet/globals.inc.php create mode 100644 include/xnet/session.inc.php diff --git a/include/platal/page.inc.php b/include/platal/page.inc.php index 16732ba..48cf158 100644 --- a/include/platal/page.inc.php +++ b/include/platal/page.inc.php @@ -98,8 +98,6 @@ class PlatalPage extends DiogenesCorePage exit; } - $this->assign('menu', $globals->menu->menu()); - if ($globals->debug) { if ($globals->debug & 1) { diff --git a/include/xnet.inc.php b/include/xnet.inc.php new file mode 100644 index 0000000..5c0dc66 --- /dev/null +++ b/include/xnet.inc.php @@ -0,0 +1,29 @@ + diff --git a/include/xnet/globals.inc.php b/include/xnet/globals.inc.php new file mode 100644 index 0000000..eb0f066 --- /dev/null +++ b/include/xnet/globals.inc.php @@ -0,0 +1,76 @@ +PlatalGlobals('XnetSession'); + } + + function init() + { + global $globals; +# require_once('xorg/hook.inc.php'); +# require_once('xorg/menu.inc.php'); + + $globals = new XnetGlobals; + $globals->core = new CoreConfig; + $globals->root = dirname(dirname(dirname(__FILE__))); +# $globals->hook = new XOrgHook(); +# $globals->menu = new XOrgMenu(); + +# $globals->hook->config(null); + + $array = parse_ini_file($globals->root.'/configs/platal.conf', true); + if (!is_array($array)) { + return; + } + + foreach ($array as $cat=>$conf) { + $c = strtolower($cat); + foreach ($conf as $key=>$val) { + if ($c == 'core' && isset($globals->$key)) { + $globals->$key=$val; + } else { + $globals->$c->$key = $val; + } + } + } + +# $globals->hook->menu(null); + + $globals->dbconnect(); + if ($globals->debug & 1) { + $globals->db->trace_on(); + } + $globals->xdb =& new XOrgDB; + } +} + +// }}} + +// 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 new file mode 100644 index 0000000..bd395a3 --- /dev/null +++ b/include/xnet/session.inc.php @@ -0,0 +1,65 @@ +DiogenesCoreSession(); + if (!Session::has('uid')) { + try_cookie(); + } + set_skin(); + } + + // }}} + // {{{ function init + + function init() { + @session_start(); + if (!Session::has('session')) { + $_SESSION['session'] = new XorgSession; + } + } + + // }}} + // {{{ function destroy() + + function destroy() { + @session_destroy(); + unset($_SESSION); + XorgSession::init(); + } + + // }}} +} + +// }}} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +?> diff --git a/include/xorg/page.inc.php b/include/xorg/page.inc.php index 014ec4b..7dc18f6 100644 --- a/include/xorg/page.inc.php +++ b/include/xorg/page.inc.php @@ -37,6 +37,9 @@ class XorgPage extends PlatalPage function run() { + if ($this->_page_type != NO_SKIN) { + $this->assign('menu', $globals->menu->menu()); + } $this->_run('skin/'.Session::get('skin')); } -- 2.1.4