mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 15:10:22 +00:00
Create function parseUserHostapdCfg()
This commit is contained in:
parent
677fe42d84
commit
5b88728ec1
1 changed files with 23 additions and 13 deletions
|
@ -511,19 +511,7 @@ function updateHostapdConfig($ignore_broadcast_ssid,$wifiAPEnable,$bridgedEnable
|
||||||
$config.= 'max_num_sta='.$_POST['max_num_sta'].PHP_EOL;
|
$config.= 'max_num_sta='.$_POST['max_num_sta'].PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse optional /etc/hostapd/hostapd.conf.users file
|
$config.= parseUserHostapdCfg();
|
||||||
if (file_exists(RASPI_HOSTAPD_CONFIG . '.users')) {
|
|
||||||
exec('cat '. RASPI_HOSTAPD_CONFIG . '.users', $hostapdconfigusers);
|
|
||||||
foreach ($hostapdconfigusers as $hostapdconfigusersline) {
|
|
||||||
if (strlen($hostapdconfigusersline) === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($hostapdconfigusersline[0] != "#") {
|
|
||||||
$arrLine = explode("=", $hostapdconfigusersline);
|
|
||||||
$config.= $arrLine[0]."=".$arrLine[1].PHP_EOL;;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents("/tmp/hostapddata", $config);
|
file_put_contents("/tmp/hostapddata", $config);
|
||||||
system("sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $result);
|
system("sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $result);
|
||||||
|
@ -545,3 +533,25 @@ function iwRegSet(string $country_code, $status)
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses optional /etc/hostapd/hostapd.conf.users file
|
||||||
|
*
|
||||||
|
* @return string $tmp
|
||||||
|
*/
|
||||||
|
function parseUserHostapdCfg()
|
||||||
|
{
|
||||||
|
if (file_exists(RASPI_HOSTAPD_CONFIG . '.users')) {
|
||||||
|
exec('cat '. RASPI_HOSTAPD_CONFIG . '.users', $hostapdconfigusers);
|
||||||
|
foreach ($hostapdconfigusers as $hostapdconfigusersline) {
|
||||||
|
if (strlen($hostapdconfigusersline) === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($hostapdconfigusersline[0] != "#") {
|
||||||
|
$arrLine = explode("=", $hostapdconfigusersline);
|
||||||
|
$tmp.= $arrLine[0]."=".$arrLine[1].PHP_EOL;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue