remove the ugly $_SESSION['session'] hack where we can use
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 19:50:03 +0000 (19:50 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 19:50:03 +0000 (19:50 +0000)
$globals->session \o/

simplify wiki code. fix globals.inc.php.in that had one dirname too much

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@759 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Platal.php
include/globals.inc.php.in
include/wiki.inc.php
include/xnet/session.inc.php
include/xorg/session.inc.php

index c34d34d..15916b9 100644 (file)
@@ -99,8 +99,9 @@ class Platal
         $args[0] = &$page;
 
         if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
-            // FIXME: don't use 'session' object anymore
-            if (!$_SESSION['session']->doAuth()) {
+            global $globals;
+
+            if (call_user_func(array($globals->session, 'doAuth'))) {
                 $this->force_login($page);
             }
         }
index 7672412..65b91e5 100644 (file)
@@ -43,7 +43,7 @@ class PlatalGlobals
 
         $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
         $this->baseurl   = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
-        $this->spoolroot = dirname(dirname(dirname(__FILE__)));
+        $this->spoolroot = dirname(dirname(__FILE__));
 
         $this->read_config();
 
index cb05c88..d34e578 100644 (file)
@@ -111,18 +111,17 @@ function wiki_apply_perms($perm) {
         return;
 
       case 'logged':
-        if (empty($GLOBALS['IS_XNET_SITE']) && !XorgSession::doAuthCookie()) {
-            $platal = new Platal();
-            $platal->force_login($page);
-        }
-        if ($GLOBALS['IS_XNET_SITE'] && !$_SESSION['session']->doAuth()) {
-            $platal = new Xnet();
-            $platal->force_login($page);
+        if (empty($GLOBALS['IS_XNET_SITE'])) {
+            if (!XorgSession::doAuthCookie()) {
+                $platal = new Platal();
+                $platal->force_login($page);
+            }
+            return;
         }
-        return;
+        /* fallthrough */
 
       default:
-        if (!$_SESSION['session']->doAuth()) {
+        if (call_user_func(array($globals->session, 'doAuth'))) {
             $platal = empty($GLOBALS['IS_XNET_SITE']) ? new Platal() : new Xnet();
             $platal->force_login($page);
         }
index 388dee1..0a27fc3 100644 (file)
@@ -30,8 +30,6 @@ class XnetSession
 
         S::init();
 
-        $_SESSION['session'] = new XnetSession;
-
         if (!S::logged()) {
             // prevent connexion to be linked to deconnexion
             if (($i = strpos($_SERVER['REQUEST_URI'], 'exit')) !== false)
index 6c20f39..45ff08b 100644 (file)
@@ -32,7 +32,6 @@ class XorgSession
        if (!S::has('uid')) {
            try_cookie();
         }
-        $_SESSION['session'] = new XorgSession;
     }
 
     // }}}