]> dev.renevier.net Git - syp.git/blobdiff - inc/langutils.php
fixes notices
[syp.git] / inc / langutils.php
index 8d458fa53e08c21be76a89803d845c14ca30ab81..758fef65f0141f5366821cb317047bced616a483 100644 (file)
@@ -11,7 +11,9 @@ function ptrans ($str) {
 function trans ($str) {
     global $translations, $lang;
 
-    $res = $translations[$lang][$str];
+    if (isset ($translations[$lang]) and isset($translations[$lang][$str])) {
+        $res = $translations[$lang][$str];
+    }
     if (!isset ($res) || strlen ($res) == 0) {
         return $str;
     } else {
@@ -36,7 +38,8 @@ function parse_accept_language () {
                 if ($val > 1.0) {
                     $val = 1.0;
                 }
-                $possibilities [$matches [1]] = max ($val, $possibilities [$matches [1]]);
+                $ceil = (isset ($possibilities[$matches[1]]))? $possibilities[$matches[1]]: 0;
+                $possibilities [$matches [1]] = max ($val, $ceil);
             }
         }
         arsort ($possibilities);