Code

Fixed warnings with not set $_SERVER values in accept_get_text
[gosa.git] / include / accept-to-gettext.inc
index a108cc21c044f5968e87f32f042dde8ec372efc5..7d39ecf934ca6253037335eb8bf4d51835e8c96f 100644 (file)
@@ -86,13 +86,12 @@ function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
 
 function al2gt($gettextlangs, $mime) 
 {
-
-  /* Try to use users primary language */
-  $ui= get_userinfo();
-  if ($ui != NULL){
-    if ($ui->language != ""){
-      return ($ui->language.".UTF-8");
-    }
+  /* Check if ACCEPT_LANGUAGE isset */
+  if(!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])){
+    $_SERVER["HTTP_ACCEPT_LANGUAGE"] = "";
+  }
+  if(!isset($_SERVER["HTTP_ACCEPT_CHARSET"])){
+    $_SERVER["HTTP_ACCEPT_CHARSET"] = "";
   }
 
   /* default to "everything is acceptable", as RFC2616 specifies */
@@ -169,6 +168,9 @@ function al2gt($gettextlangs, $mime)
       $alscores[$noct[0]] = "";
     }
   
+    if(!isset($acscores[$gtcs])){
+      $acscores[$gtcs] = "";
+    }
     $testvals=array(
         array($alscores[$allang], $acscores[$gtcs]),
         array($alscores[$noct[0]], $acscores[$gtcs]),