Code

Do not remove invalid user accounts.
[gosa.git] / include / accept-to-gettext.inc
index 621863cb1a9e9c956643d783a5b352dc36baaf97..ff8e2425e3ac7cae29d47c7ed925f31d6de61906 100644 (file)
@@ -97,11 +97,14 @@ function al2gt($gettextlangs, $mime)
   /* default to "everything is acceptable", as RFC2616 specifies */
   $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
     $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
-  $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
+  /* Commented out due to problems with IE7, defaulting to the one below... */
+  #$acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
+  #  $_SERVER["HTTP_ACCEPT_CHARSET"]);
+  $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' :
     $_SERVER["HTTP_ACCEPT_CHARSET"]);
   $alparts=@preg_split("/,/",$acceptLang);
   $acparts=@preg_split("/,/",$acceptChar);
-  
+
   /* Parse the contents of the Accept-Language header.*/
   foreach($alparts as $part) {
     $part=trim($part);
@@ -197,10 +200,12 @@ function al2gt($gettextlangs, $mime)
   $gtparts=@preg_split("/\./",$curgtlang);
   $tmp=strtolower($gtparts[0]);
   $lang=preg_replace("/\_/", "-", $tmp);
-  header("Content-Language: $lang");
-  if(isset($gtparts[1])){
-    $charset=$gtparts[1];
-    header("Content-Type: $mime; charset=$charset");
+  if (!headers_sent()){
+    header("Content-Language: $lang");
+    if(isset($gtparts[1])){
+      $charset=$gtparts[1];
+      header("Content-Type: $mime; charset=$charset");
+    }
   }
   return $curgtlang;
 }