}
/* Clear any existing info. */
- self::clearAuth();
+ $GLOBALS['registry']->clearAuth(false);
$_SESSION['horde_auth'] = array(
'app' => $app_array,
}
/**
- * 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.
}
/**
+ * 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:
$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'])) {
$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;