X-Git-Url: https://dev.renevier.net/gitweb.cgi?p=syp.git;a=blobdiff_plain;f=inc%2Flangutils.php;h=758fef65f0141f5366821cb317047bced616a483;hp=8d458fa53e08c21be76a89803d845c14ca30ab81;hb=HEAD;hpb=19730f2e2bbf61f389882c646f58349df3bcd848 diff --git a/inc/langutils.php b/inc/langutils.php index 8d458fa..758fef6 100644 --- a/inc/langutils.php +++ b/inc/langutils.php @@ -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);