Allow _ in Accept-Language
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@309 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
2ee863a9ab
commit
b60a7c8530
|
@ -44,9 +44,9 @@ if (isset($langs[$_COOKIE["lang"]])) {
|
|||
$LANG = $_SESSION["lang"];
|
||||
} else {
|
||||
$accept_language = array();
|
||||
preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~', strtolower($_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) {
|
||||
$accept_language[$match[1]] = (isset($match[3]) ? $match[3] : 1);
|
||||
$accept_language[str_replace("_", "-", $match[1])] = (isset($match[3]) ? $match[3] : 1);
|
||||
}
|
||||
arsort($accept_language);
|
||||
$LANG = "en";
|
||||
|
|
Loading…
Reference in a new issue