}
if (!empty($GLOBALS['conf']['auth']['checkbrowser'])) {
- $browser = Horde_Browser::singleton();
- if ($_SESSION['horde_auth']['browser'] != $browser->getAgentString()) {
+ if ($_SESSION['horde_auth']['browser'] != self::_browser()->getAgentString()) {
self::setAuthError(self::REASON_BROWSER);
return false;
}
/* Clear any existing info. */
self::clearAuth();
- $browser = Horde_Browser::singleton();
-
$_SESSION['horde_auth'] = array(
'app' => $app_array,
- 'browser' => $browser->getAgentString(),
+ 'browser' => self::_browser()->getAgentString(),
'change' => !empty($options['change']),
'credentials' => Horde_Secret::write(Horde_Secret::getKey('auth'), serialize($credentials)),
'driver' => $GLOBALS['conf']['auth']['driver'],
}
/**
+ * Returns a cached Horde_Brower instance.
+ *
+ * @return Horde_Browser A Horde_Browser instance.
+ */
+ static private function _browser()
+ {
+ static $browser;
+ if (!isset($browser)) {
+ $browser = new Horde_Browser();
+ }
+ return $browser;
+ }
+
+ /**
* Converts to allowed 64 characters for APRMD5 passwords.
*
* @param string $value TODO