fixed color problems with error messagees in compose.
[squirrelmail.git] / functions / page_header.php
index 783ed6c204335510574051c5d0c061da3d452335..849dd81f324fa592a279f3573cac085563496149 100644 (file)
 
    if (!isset($prefs_php))
       include ("../functions/prefs.php");
+   if (!isset($i18n_php))
+      include ("../functions/i18n.php");
 
-   // This is done to ensure that the character set is correct when
-   // receiving input from HTTP forms
-   header ("Content-Type: text/html; charset=iso-8859-1");
-
-   // Setting the language to use for gettext if it is not English
-   // (the default language) or empty.
-   $squirrelmail_language = getPref ($data_dir, $username, "language");
-   if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
-      putenv("LANG=$squirrelmail_language");
-      bindtextdomain("squirrelmail", "../locale/");
-      textdomain("squirrelmail");
-
-      // Setting cookie to use on the login screen the next time the
-      // same user logs in.
-      setcookie("squirrelmail_language", $squirrelmail_language, 
-                time()+2592000);
+   // Check to see if gettext is installed
+   if (function_exists("_")) {
+      // Setting the language to use for gettext if it is not English
+      // (the default language) or empty.
+      $squirrelmail_language = getPref ($data_dir, $username, "language");
+      if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
+         putenv("LANG=$squirrelmail_language");
+         bindtextdomain("squirrelmail", "../locale/");
+         textdomain("squirrelmail");
+         $default_charset = $languages[$squirrelmail_language]["CHARSET"];
+         
+         // Setting cookie to use on the login screen the next time the
+         // same user logs in.
+         setcookie("squirrelmail_language", $squirrelmail_language, 
+                   time()+2592000);
+      }
+   } else {
+      function _($string) {
+         return $string;
+      }
    }
 
+   // This is done to ensure that the character set is correct.
+   if ($default_charset != "")
+      header ("Content-Type: text/html; charset=$default_charset");
+
    function displayPageHeader($color, $mailbox) {
       /** Here is the header and wrapping table **/
       $shortBoxName = readShortMailboxName($mailbox, ".");