Case insensitive Accept-Language
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@279 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
ab15b60635
commit
f12f302e65
|
@ -43,9 +43,9 @@ if (isset($translations[$_COOKIE["lang"]])) {
|
||||||
$LANG = $_SESSION["lang"];
|
$LANG = $_SESSION["lang"];
|
||||||
} else {
|
} else {
|
||||||
$accept_language = array();
|
$accept_language = array();
|
||||||
preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~', $_SERVER["HTTP_ACCEPT_LANGUAGE"], $matches, PREG_SET_ORDER);
|
preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]), $matches, PREG_SET_ORDER);
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$accept_language[$match[1]] = ($match[3] ? $match[3] : 1);
|
$accept_language[$match[1]] = (isset($match[3]) ? $match[3] : 1);
|
||||||
}
|
}
|
||||||
arsort($accept_language);
|
arsort($accept_language);
|
||||||
$LANG = "en";
|
$LANG = "en";
|
||||||
|
|
Loading…
Reference in a new issue