mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 17:44:07 +02:00
Simplify language detection
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@964 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -51,9 +51,9 @@ if (isset($langs[$_COOKIE["adminer_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.]+))?~', str_replace("_", "-", strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])), $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
$accept_language[str_replace("_", "-", $match[1])] = (isset($match[3]) ? $match[3] : 1);
|
||||
$accept_language[$match[1]] = (isset($match[3]) ? $match[3] : 1);
|
||||
}
|
||||
arsort($accept_language);
|
||||
foreach ($accept_language as $key => $q) {
|
||||
|
Reference in New Issue
Block a user