From d6bd7d2c4ad6ddc12f4cc402287b2d92a840d4ff Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 6 Mar 2019 13:24:51 +0000 Subject: [PATCH] WIP: WifiAPEnable handling --- includes/hostapd.php | 49 +++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 0ef3dd9f..2f6bfdcf 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -530,27 +530,35 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) } $good_input = true; + + // Check for WiFi client AP mode checkbox + $wifiAPEnable = 0; + if($arrHostapdConf['WifiAPEnable'] == 0) { + if(isset($_POST['wifiAPEnable'])) { + $wifiAPEnable = 1; + //exec('sudo /etc/raspap/hostapd/servicesdisable.sh'); + //exec('sudo /etc/raspap/hostapd/servicesstart.sh'); + } + } - // Check for Logging Checkbox - $logEnable = 0; - if($arrHostapdConf['LogEnable'] == 0) { - if(isset($_POST['logEnable'])) { - // Need code to enable logfile logging here - $logEnable = 1; - exec('sudo /etc/raspap/hostapd/enablelog.sh'); - } else { - exec('sudo /etc/raspap/hostapd/disablelog.sh'); - } - } else { - if(isset($_POST['logEnable'])) { - $logEnable = 1; - exec('sudo /etc/raspap/hostapd/enablelog.sh'); - } else { - exec('sudo /etc/raspap/hostapd/disablelog.sh'); - } - } - - write_php_ini(["LogEnable" => $logEnable],'/etc/raspap/hostapd.ini'); + // Check for Logfile output checkbox + $logEnable = 0; + if($arrHostapdConf['LogEnable'] == 0) { + if(isset($_POST['logEnable'])) { + $logEnable = 1; + exec('sudo /etc/raspap/hostapd/enablelog.sh'); + } else { + exec('sudo /etc/raspap/hostapd/disablelog.sh'); + } + } else { + if(isset($_POST['logEnable'])) { + $logEnable = 1; + exec('sudo /etc/raspap/hostapd/enablelog.sh'); + } else { + exec('sudo /etc/raspap/hostapd/disablelog.sh'); + } + } + write_php_ini(["LogEnable" => $logEnable],'/etc/raspap/hostapd.ini'); // Verify input if (empty($_POST['ssid']) || strlen($_POST['ssid']) > 32) { @@ -600,7 +608,6 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) fwrite($tmp_file, 'auth_algs=1'.PHP_EOL); fwrite($tmp_file, 'wpa_key_mgmt=WPA-PSK'.PHP_EOL); fwrite($tmp_file, 'beacon_int=100'.PHP_EOL); - fwrite($tmp_file, 'ssid='.$_POST['ssid'].PHP_EOL); fwrite($tmp_file, 'channel='.$_POST['channel'].PHP_EOL); if ($_POST['hw_mode'] === 'n') {