Move template logic to includes + code cleanup

This commit is contained in:
billz
2023-03-20 20:14:01 +01:00
parent 24abe9c53c
commit 7b3a7dba1d
4 changed files with 33 additions and 36 deletions

View File

@@ -109,6 +109,30 @@ function DisplayHostAPDConfig()
$txpower = $_POST['txpower'];
}
$countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2;
$selectedHwMode = $arrConfig['hw_mode'];
if (isset($arrConfig['ieee80211n'])) {
if (strval($arrConfig['ieee80211n']) === '1') {
$selectedHwMode = 'n';
}
}
if (isset($arrConfig['ieee80211ac'])) {
if (strval($arrConfig['ieee80211ac']) === '1') {
$selectedHwMode = 'ac';
}
}
if (isset($arrConfig['ieee80211w'])) {
if (strval($arrConfig['ieee80211w']) === '2') {
$selectedHwMode = 'w';
}
}
if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) {
$hwModeDisabled = 'ac';
if ($selectedHwMode === $hwModeDisabled) {
unset($selectedHwMode);
}
}
echo renderTemplate(
"hostapd", compact(
"status",
@@ -124,7 +148,9 @@ function DisplayHostAPDConfig()
"arrTxPower",
"txpower",
"arrHostapdConf",
"operatingSystem"
"operatingSystem",
"selectedHwMode",
"hwModeDisabled"
)
);
}