}
/* Determine the unique user name. */
- if (Horde_Auth::isAuthenticated()) {
+ if (Horde_Auth::getAuth()) {
$sess['uniquser'] = Horde_Auth::removeHook(Horde_Auth::getAuth());
} else {
$sess['uniquser'] = $credentials['userid'];
self::authenticate(array(
'password' => $credentials['password'],
'server' => $credentials['server'],
- 'userid' => $sess['uniquser']
+ 'userid' => $credentials['userid']
));
} catch (Horde_Auth_Exception $e) {
unset($_SESSION['imp']);
break;
default:
- // TODO: Directly load mailbox.php
- header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', true), array('mailbox' => $init_url)));
- exit;
+ $page = 'mailbox.php';
+ if ($url) {
+ return Horde_Util::addParameter(Horde::applicationUrl($page, true), array('mailbox' => $init_url));
+ }
+ $GLOBALS['imp_mbox'] = IMP::getCurrentMailboxInfo($init_url);
+ break;
}
}
/**
* Process mailbox/index information for current page load.
*
+ * @param boolean $mbox Use this mailbox, instead of form data.
+ *
* @return array Array with the following elements:
* <pre>
* 'mailbox' - The current active mailbox (may be search mailbox).
* 'index' - The IMAP message index.
* </pre>
*/
- static public function getCurrentMailboxInfo()
+ static public function getCurrentMailboxInfo($mbox = null)
{
- $mbox = Horde_Util::getFormData('mailbox');
+ if (is_null($mbox)) {
+ $mbox = Horde_Util::getFormData('mailbox');
+ return array(
+ 'mailbox' => empty($mbox) ? 'INBOX' : $mbox,
+ 'thismailbox' => Horde_Util::getFormData('thismailbox', $mbox),
+ 'index' => Horde_Util::getFormData('index')
+ );
+ }
+
return array(
- 'mailbox' => empty($mbox) ? 'INBOX' : $mbox,
- 'thismailbox' => Horde_Util::getFormData('thismailbox', $mbox),
- 'index' => Horde_Util::getFormData('index')
+ 'mailbox' => $mbox,
+ 'thismailbox' => $mbox,
+ 'index' => null
);
}
$conf['cookie']['domain']);
$_SESSION['imp']['view'] = $view;
+
+ /* Set the Horde ID, since it may have been altered by the 'realm'
+ * setting. */
+ $credentials['auth_ob']->setCredential('userId', $_SESSION['imp']['uniquser']);
}
}