From 5f0d346c330196f9755ea53d6232fdaef39ecbef Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Mon, 13 Dec 2004 10:22:28 +0000 Subject: [PATCH] separate session from the rest git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-81 --- htdocs/emails/broken.php | 2 +- include/xorg.globals.inc.php.in | 3 --- include/xorg.inc.php | 8 +++++--- include/xorg.page.inc.php | 4 ---- include/xorg/session.inc.php | 12 +++++++++++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/htdocs/emails/broken.php b/htdocs/emails/broken.php index 9e6a4c7..c5a56cd 100644 --- a/htdocs/emails/broken.php +++ b/htdocs/emails/broken.php @@ -22,7 +22,7 @@ require_once('xorg.inc.php'); new_skinned_page('emails/broken.tpl',AUTH_COOKIE); require_once('emails.inc.php'); - + if (array_key_exists('email', $_GET) && array_key_exists('action', $_GET)) { $email = valide_email($_GET['email']); // vérifications d'usage diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index be46d3e..d7d643a 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -58,7 +58,6 @@ class XorgGlobals extends DiogenesCoreGlobals { global $globals; require_once("xorg/menu.inc.php"); - require_once('xorg/session.inc.php'); $globals = new XorgGlobals; @@ -86,8 +85,6 @@ class XorgGlobals extends DiogenesCoreGlobals $globals->menu = new XOrgMenu($globals->root.'/include/conf.d/'); - @session_start(); - $globals->dbconnect(); if ($globals->debug) { $globals->db->trace_on(); diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 013133d..58c09af 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -41,10 +41,12 @@ define('SKINNED', 0); define('NO_SKIN', 1); // }}} -// {{{ import class definitions +// {{{ globals + session init require_once("xorg.globals.inc.php"); +require_once('xorg/session.inc.php'); XorgGlobals::init(); +XorgSession::init(); // }}} // {{{ function _new_page() @@ -59,11 +61,11 @@ function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) case AUTH_PUBLIC: $page = new XorgPage($tpl_name, $type); break; - + case AUTH_COOKIE: $page = new XorgCookie($tpl_name, $type); break; - + case AUTH_MDP: $page = new XorgAuth($tpl_name, $type); } diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index 01a6968..ce1e17d 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -76,10 +76,6 @@ class XorgPage extends DiogenesCorePage $this->register_block('dynamic', 'block_dynamic', false); $this->register_prefilter('at_to_globals'); - // if necessary, construct new session - if (empty($_SESSION['session'])) - $_SESSION['session'] = new XorgSession; - $this->assign('site_dev',$globals->debug); $this->doAuth(); } diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index ab0cb04..95c346c 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -27,7 +27,7 @@ require_once("diogenes.misc.inc.php"); class XorgSession extends DiogenesCoreSession { // {{{ function XorgSession() - + function XorgSession() { $this->DiogenesCoreSession(); @@ -38,6 +38,16 @@ class XorgSession extends DiogenesCoreSession } // }}} + // {{{ function init + + function init() { + @session_start(); + if (empty($_SESSION['session'])) { + $_SESSION['session'] = new XorgSession; + } + } + + // }}} // {{{ function doAuth() /** Try to do an authentication. -- 2.1.4