public $sessionHandler = null;
/**
+ * The application that called appInit().
+ *
+ * @var string
+ */
+ public $initialApp;
+
+ /**
* Application bootstrap initialization.
* Solves chicken-and-egg problem - need a way to init Horde environment
* from application without an active Horde_Registry object.
Horde_Auth::authenticateFailure($app, $e);
}
+ $GLOBALS['registry']->initialApp = $app;
+
if (!$args['nocompress']) {
Horde::compressOutput();
}
$GLOBALS['notification']->addDecorator(new IMP_Notification_Handler_Decorator_Imap());
$GLOBALS['notification']->addType('status', 'imp.*', 'IMP_Notification_Event_Status');
+ $redirect = false;
+
switch (IMP::getViewMode()) {
case 'dimp':
$GLOBALS['notification']->addType('status', 'dimp.*', 'IMP_Notification_Event_Status');
break;
case 'mimp':
- if (empty($this->initParams['impmode']) ||
- ($this->initParams['impmode'] != 'mimp')) {
- header('Location: ' . IMP_Auth::getInitialPage(true)->setRaw(true));
- exit;
- }
+ $redirect = (empty($this->initParams['impmode']) ||
+ ($this->initParams['impmode'] != 'mimp'));
break;
case 'imp':
- if (!empty($this->initParams['impmode']) &&
- ($this->initParams['impmode'] == 'dimp')) {
- header('Location: ' . IMP_Auth::getInitialPage(true)->setRaw(true));
- exit;
- }
-
+ $redirect = (!empty($this->initParams['impmode']) &&
+ ($this->initParams['impmode'] == 'dimp'));
$GLOBALS['notification']->attach('audio');
break;
}
+
+ if ($redirect && ($GLOBALS['registry']->initialApp == 'imp')) {
+ header('Location: ' . IMP_Auth::getInitialPage(true)->setRaw(true));
+ exit;
+ }
}
/* Horde permissions. */