diff --git a/includes/functions.php b/includes/functions.php
index ef48dc04..d8ba6f18 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -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;
+}
+
diff --git a/includes/hostapd.php b/includes/hostapd.php
index bc3f3c8b..1cce5bf4 100755
--- a/includes/hostapd.php
+++ b/includes/hostapd.php
@@ -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"
)
);
}
diff --git a/installers/common.sh b/installers/common.sh
index 3e124d04..a329d32c 100755
--- a/installers/common.sh
+++ b/installers/common.sh
@@ -241,7 +241,7 @@ function _install_dependencies() {
# Set dconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
- sudo apt-get install -y lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package $iw_package vnstat qrencode jq || _install_status 1 "Unable to install dependencies"
+ sudo apt-get install -y lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package $iw_package vnstat qrencode jq isoquery || _install_status 1 "Unable to install dependencies"
_install_status 0
}
diff --git a/templates/hostapd/advanced.php b/templates/hostapd/advanced.php
index d765d34c..b8ca3469 100644
--- a/templates/hostapd/advanced.php
+++ b/templates/hostapd/advanced.php
@@ -73,257 +73,7 @@
-
+