Move clearAuth() from horde/Auth to horde/Core
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 1 Jun 2010 18:55:42 +0000 (12:55 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Jun 2010 03:32:19 +0000 (21:32 -0600)
framework/Auth/lib/Horde/Auth.php
framework/Core/lib/Horde/Registry.php
horde/login.php
koward/lib/Koward/Controller/IndexController.php

index 0269b06..07fc34e 100644 (file)
@@ -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.
index e28fe7b..c27961b 100644 (file)
@@ -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:
index e643541..66065f4 100644 (file)
@@ -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'])) {
index 21bd5b6..ce97b18 100644 (file)
@@ -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;