From: Michael M Slusarz Date: Tue, 24 Nov 2009 06:35:26 +0000 (-0700) Subject: Allow timezone to be set on call to new IMP_Application() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0054c349ee64a9e29744243d25c92fb003d8f55c;p=horde.git Allow timezone to be set on call to new IMP_Application() --- diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 04615b223..3dbb9a487 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -26,7 +26,7 @@ function _removeAutoSaveDraft($uid) } require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* Determine if compose mode is disabled. */ $compose_disable = !IMP::canCompose(); @@ -49,9 +49,6 @@ if (!$prefs->isLocked('default_identity')) { } } -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Initialize the IMP_Compose:: object. */ $imp_compose = IMP_Compose::singleton(Horde_Util::getFormData('composeCache')); diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index c31dfa6e1..8fee69590 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -27,7 +27,7 @@ function _getIMPContents($uid, $mailbox) } require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* The message text and headers. */ $msg = ''; @@ -58,9 +58,6 @@ if ($imp_imap->isReadOnly($sent_mail_folder)) { /* Determine if compose mode is disabled. */ $compose_disable = !IMP::canCompose(); -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Initialize the IMP_Compose:: object. */ $imp_compose = IMP_Compose::singleton(Horde_Util::getFormData('composeCache')); diff --git a/imp/compose.php b/imp/compose.php index fea1ae2ba..7d4daced8 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -57,7 +57,7 @@ function _getIMPContents($uid, $mailbox) require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => array('session_control' => 'netscape'))); +new IMP_Application(array('init' => array('session_control' => 'netscape'), 'tz' => true)); /* The message headers and text. */ $header = array(); @@ -133,9 +133,6 @@ if ($token = Horde_Util::getFormData('compose_formToken')) { } } -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Determine if compose mode is disabled. */ $compose_disable = !IMP::canCompose(); diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 39142f6c0..aedc47c51 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -74,6 +74,7 @@ class IMP_Application extends Horde_Registry_Application *
      * 'init' - (boolean|array) If true, perform application init. If an
      *          array, perform application init and pass the array to init().
+     * 'tz' - (boolean) If true, sets the current time zone on the server.
      * 
*/ public function __construct($args = array()) @@ -82,6 +83,10 @@ class IMP_Application extends Horde_Registry_Application $this->init(is_array($args['init']) ? $args['init'] : array()); } + if (!empty($args['tz'])) { + Horde_Nls::setTimeZone(); + } + /* Only available if admin config is set for this server/login. */ $this->disabled = array('init'); if (empty($_SESSION['imp']['admin'])) { diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index b7a9f869f..1521cf8bf 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -21,14 +21,11 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* Determine if mailbox is readonly. */ $readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Need Horde_Mobile init here for autoloading purposes. */ $mimp_render = new Horde_Mobile(); diff --git a/imp/mailbox.php b/imp/mailbox.php index 31a95daca..dd792e8a2 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -39,7 +39,7 @@ function _outputSummaries($msgs) require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* Call the mailbox redirection hook, if requested. */ try { @@ -72,9 +72,6 @@ if (!is_array(($indices = Horde_Util::getFormData('indices')))) { $indices = array($indices); } -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - $do_filter = false; $imp_flags = IMP_Imap_Flags::singleton(); $open_compose_window = null; diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 551140876..cc53f9f41 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -19,7 +19,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* Make sure we have a valid index. */ $imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid']); @@ -34,9 +34,6 @@ $imp_ui = new IMP_UI_Message(); /* Determine if mailbox is readonly. */ $readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Run through action handlers */ $actionID = Horde_Util::getFormData('a'); $msg_delete = false; diff --git a/imp/message.php b/imp/message.php index 6b9dc72e6..d70997092 100644 --- a/imp/message.php +++ b/imp/message.php @@ -20,7 +20,7 @@ function _returnToMailbox($startIndex = null, $actID = null) } require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* We know we are going to be exclusively dealing with this mailbox, so * select it on the IMAP server (saves some STATUS calls). Open R/W to clear @@ -40,9 +40,6 @@ if (!$imp_mailbox->isValidIndex(false)) { /* Initialize IMP_Message object. */ $imp_message = IMP_Message::singleton(); -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Initialize the user's identities. */ $user_identity = Horde_Prefs_Identity::singleton(array('imp', 'imp')); diff --git a/imp/thread.php b/imp/thread.php index 3854c079f..20f238605 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -10,7 +10,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new IMP_Application(array('init' => true)); +new IMP_Application(array('init' => true, 'tz' => true)); /* What mode are we in? * DEFAULT/'thread' - Thread mode @@ -42,9 +42,6 @@ if ($error) { exit; } -/* Set the current time zone. */ -Horde_Nls::setTimeZone(); - /* Run through action handlers. */ $actionID = Horde_Util::getFormData('actionID'); switch ($actionID) {