From af983686d3ed9e126d9a0c85ed3bd5289b1017f2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 1 Jun 2010 12:55:42 -0600 Subject: [PATCH] Move clearAuth() from horde/Auth to horde/Core --- framework/Auth/lib/Horde/Auth.php | 13 +------------ framework/Core/lib/Horde/Registry.php | 17 +++++++++++++++++ horde/login.php | 3 +-- koward/lib/Koward/Controller/IndexController.php | 3 +-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index 0269b067c..07fc34e35 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -642,7 +642,7 @@ class Horde_Auth } /* Clear any existing info. */ - self::clearAuth(); + $GLOBALS['registry']->clearAuth(false); $_SESSION['horde_auth'] = array( 'app' => $app_array, @@ -708,17 +708,6 @@ class Horde_Auth } /** - * Clears any authentication tokens in the current session. - */ - static public function clearAuth() - { - unset($_SESSION['horde_auth']); - - /* Remove the user's cached preferences if they are present. */ - $GLOBALS['registry']->unloadPrefs(); - } - - /** * Converts an authentication username to a unique Horde username. * * @param string $username The username to convert. diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index e28fe7bca..c27961be6 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -1589,6 +1589,23 @@ class Horde_Registry } /** + * Clears any authentication tokens in the current session. + * + * @param boolean $destroy Destroy the session? + */ + public function clearAuth($destroy = true) + { + unset($_SESSION['horde_auth']); + + /* Remove the user's cached preferences if they are present. */ + $this->unloadPrefs(); + + if ($destroy) { + @session_destroy(); + } + } + + /** * Is a user an administrator? * * @param array $options Options: diff --git a/horde/login.php b/horde/login.php index e64354135..66065f4d9 100644 --- a/horde/login.php +++ b/horde/login.php @@ -154,8 +154,7 @@ if ($error_reason) { $entry = sprintf('User %s [%s] logged out of Horde', Horde_Auth::getAuth(), $_SERVER['REMOTE_ADDR']); Horde::logMessage($entry, 'NOTICE'); - Horde_Auth::clearAuth(); - @session_destroy(); + $registry->clearAuth(); /* Redirect the user on logout if redirection is enabled. */ if (!empty($conf['auth']['redirect_on_logout'])) { diff --git a/koward/lib/Koward/Controller/IndexController.php b/koward/lib/Koward/Controller/IndexController.php index 21bd5b694..ce97b1898 100644 --- a/koward/lib/Koward/Controller/IndexController.php +++ b/koward/lib/Koward/Controller/IndexController.php @@ -66,8 +66,7 @@ class IndexController extends Koward_Controller_Application $entry = sprintf('User %s [%s] logged out of Horde', Horde_Auth::getAuth(), $_SERVER['REMOTE_ADDR']); Horde::logMessage($entry, 'NOTICE'); - Horde_Auth::clearAuth(); - @session_destroy(); + $GLOBALS['registry']->clearAuth(); header('Location: ' . $this->urlFor(array('controller' => 'index', 'action' => 'login'))); exit; -- 2.11.0