mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Replace ISO 2-letter country code literals w/ isoquery (localized)
This commit is contained in:
@@ -862,3 +862,33 @@ function loadFooterScripts($extraFooterScripts)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ISO standard 2-letter country codes
|
||||
*
|
||||
* @param string $locale
|
||||
* @param boolean $flag
|
||||
*/
|
||||
function getCountryCodes($locale = 'en', $flag = true) {
|
||||
$output = [];
|
||||
if ($flag) {
|
||||
$opt = '--flag';
|
||||
}
|
||||
exec("isoquery $opt --locale $locale", $output);
|
||||
|
||||
$countryData = [];
|
||||
foreach ($output as $line) {
|
||||
$parts = explode("\t", $line);
|
||||
if (count($parts) >= 2) {
|
||||
$countryCode = $parts[0];
|
||||
if ($flag) {
|
||||
$countryFlag = $parts[3] . ' ';
|
||||
$countryName = $parts[4];
|
||||
} else {
|
||||
$countryName = $parts[3];
|
||||
}
|
||||
$countryData[$countryCode] = $countryFlag .$countryName;
|
||||
}
|
||||
}
|
||||
return $countryData;
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,9 @@ function DisplayHostAPDConfig()
|
||||
'n' => '802.11n - 2.4 GHz',
|
||||
'ac' => '802.11ac - 5 GHz'
|
||||
];
|
||||
$languageCode = strtok($_SESSION['locale'], '_');
|
||||
$countryCodes = getCountryCodes($languageCode);
|
||||
|
||||
$arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None"));
|
||||
$arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP');
|
||||
$arrTxPower = getDefaultNetOpts('txpower','dbm');
|
||||
@@ -157,7 +160,8 @@ function DisplayHostAPDConfig()
|
||||
"arrHostapdConf",
|
||||
"operatingSystem",
|
||||
"selectedHwMode",
|
||||
"hwModeDisabled"
|
||||
"hwModeDisabled",
|
||||
"countryCodes"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user