Reintroduce default charset feature.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 16 Dec 2008 20:04:06 +0000 (13:04 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 16 Dec 2008 20:04:06 +0000 (13:04 -0700)
imp/lib/base.php

index 0373aec..e058888 100644 (file)
@@ -152,6 +152,24 @@ if ($authentication !== 'none') {
     } else {
         IMP::checkAuthentication(false, ($authentication === 'horde'));
     }
+
+    /* Some stuff that only needs to be initialized if we are
+     * authenticated. */
+    // Initialize some message parsing variables.
+    if (!empty($GLOBALS['conf']['mailformat']['brokenrfc2231'])) {
+        Horde_Mime::$brokenRFC2231 = true;
+    }
+
+    // Set default message character set, if necessary
+    if ($def_charset = $prefs->getValue('default_msg_charset')) {
+        Horde_Mime_Part::$defaultCharset = $def_charset;
+        Horde_Mime_Headers::$defaultCharset = $def_charset;
+    }
+}
+
+// Handle logout requests
+if (($viewmode == 'dimp') && Util::nonInputVar('dimp_logout')) {
+    Horde::redirect(str_replace('&amp;', '&', IMP::getLogoutUrl()));
 }
 
 // Notification system.
@@ -170,9 +188,10 @@ if (($viewmode == 'mimp') ||
     $notification->attach('audio');
 }
 
-// Handle logout requests
-if (($viewmode == 'dimp') && Util::nonInputVar('dimp_logout')) {
-    Horde::redirect(str_replace('&amp;', '&', IMP::getLogoutUrl()));
+if ((IMP::loginTasksFlag() === 2) &&
+    !defined('AUTH_HANDLER') &&
+    !strstr($_SERVER['PHP_SELF'], 'maintenance.php')) {
+    IMP_Session::loginTasks();
 }
 
 // Initialize global $imp_mbox array.
@@ -183,12 +202,6 @@ $GLOBALS['imp_search'] = (isset($_SESSION['imp']) && strpos($GLOBALS['imp_mbox']
     ? new IMP_Search(array('id' => $GLOBALS['imp_mbox']['mailbox']))
     : new IMP_Search();
 
-if ((IMP::loginTasksFlag() === 2) &&
-    !defined('AUTH_HANDLER') &&
-    !strstr($_SERVER['PHP_SELF'], 'maintenance.php')) {
-    IMP_Session::loginTasks();
-}
-
 if ($viewmode == 'mimp') {
     // Need to explicitly load MIMP.php
     require_once IMP_BASE . '/lib/MIMP.php';
@@ -201,8 +214,3 @@ if ($viewmode == 'mimp') {
     // Need to explicitly load DIMP.php
     require_once IMP_BASE . '/lib/DIMP.php';
 }
-
-// TODO - Move somewhere else?
-if (!empty($GLOBALS['conf']['mailformat']['brokenrfc2231'])) {
-    Horde_Mime::$brokenRFC2231 = true;
-}