separate session from the rest
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 13 Dec 2004 10:22:28 +0000 (10:22 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:37 +0000 (23:26 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-81

htdocs/emails/broken.php
include/xorg.globals.inc.php.in
include/xorg.inc.php
include/xorg.page.inc.php
include/xorg/session.inc.php

index 9e6a4c7..c5a56cd 100644 (file)
@@ -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
index be46d3e..d7d643a 100644 (file)
@@ -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();
index 013133d..58c09af 100644 (file)
@@ -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);
     }
index 01a6968..ce1e17d 100644 (file)
@@ -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();
     }
index ab0cb04..95c346c 100644 (file)
@@ -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.