From 679529006d1a7a20fd3c23ad0730474c4fcd9f0d Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Mon, 31 Jul 2006 19:50:03 +0000 Subject: [PATCH] remove the ugly $_SESSION['session'] hack where we can use $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 | 5 +++-- include/globals.inc.php.in | 2 +- include/wiki.inc.php | 17 ++++++++--------- include/xnet/session.inc.php | 2 -- include/xorg/session.inc.php | 1 - 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/classes/Platal.php b/classes/Platal.php index c34d34d..15916b9 100644 --- a/classes/Platal.php +++ b/classes/Platal.php @@ -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); } } diff --git a/include/globals.inc.php.in b/include/globals.inc.php.in index 7672412..65b91e5 100644 --- a/include/globals.inc.php.in +++ b/include/globals.inc.php.in @@ -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(); diff --git a/include/wiki.inc.php b/include/wiki.inc.php index cb05c88..d34e578 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -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); } diff --git a/include/xnet/session.inc.php b/include/xnet/session.inc.php index 388dee1..0a27fc3 100644 --- a/include/xnet/session.inc.php +++ b/include/xnet/session.inc.php @@ -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) diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index 6c20f39..45ff08b 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -32,7 +32,6 @@ class XorgSession if (!S::has('uid')) { try_cookie(); } - $_SESSION['session'] = new XorgSession; } // }}} -- 2.1.4