mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Disable incompatible settings when bridged
This commit is contained in:
parent
8823c0602e
commit
5e44aae1c5
@ -31,10 +31,10 @@ function DisplayHostAPDConfig()
|
|||||||
SaveHostAPDConfig($arrSecurity, $arrEncType, $arr80211Standard, $interfaces, $status);
|
SaveHostAPDConfig($arrSecurity, $arrEncType, $arr80211Standard, $interfaces, $status);
|
||||||
} elseif (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) {
|
} elseif (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) {
|
||||||
$status->addMessage('Attempting to start hotspot', 'info');
|
$status->addMessage('Attempting to start hotspot', 'info');
|
||||||
if ($arrHostapdConf['WifiAPEnable'] == 1) {
|
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
||||||
exec('sudo /etc/raspap/hostapd/servicestart.sh --interface uap0 --seconds 3', $return);
|
|
||||||
} elseif ($arrHostapdConf['BridgedEnable'] == 1) {
|
|
||||||
exec('sudo /etc/raspap/hostapd/servicestart.sh --interface br0 --seconds 3', $return);
|
exec('sudo /etc/raspap/hostapd/servicestart.sh --interface br0 --seconds 3', $return);
|
||||||
|
} elseif ($arrHostapdConf['WifiAPEnable'] == 1) {
|
||||||
|
exec('sudo /etc/raspap/hostapd/servicestart.sh --interface uap0 --seconds 3', $return);
|
||||||
} else {
|
} else {
|
||||||
exec('sudo /etc/raspap/hostapd/servicestart.sh --seconds 3', $return);
|
exec('sudo /etc/raspap/hostapd/servicestart.sh --seconds 3', $return);
|
||||||
}
|
}
|
||||||
@ -110,18 +110,6 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||||||
|
|
||||||
$good_input = true;
|
$good_input = true;
|
||||||
|
|
||||||
// Check for WiFi client AP mode checkbox
|
|
||||||
$wifiAPEnable = 0;
|
|
||||||
if ($arrHostapdConf['WifiAPEnable'] == 0) {
|
|
||||||
if (isset($_POST['wifiAPEnable'])) {
|
|
||||||
$wifiAPEnable = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isset($_POST['wifiAPEnable'])) {
|
|
||||||
$wifiAPEnable = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for Bridged AP mode checkbox
|
// Check for Bridged AP mode checkbox
|
||||||
$bridgedEnable = 0;
|
$bridgedEnable = 0;
|
||||||
if ($arrHostapdConf['BridgedEnable'] == 0) {
|
if ($arrHostapdConf['BridgedEnable'] == 0) {
|
||||||
@ -134,6 +122,20 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for WiFi client AP mode checkbox
|
||||||
|
$wifiAPEnable = 0;
|
||||||
|
if ($bridgedEnable == 0) { // enable client mode actions when not bridged
|
||||||
|
if ($arrHostapdConf['WifiAPEnable'] == 0) {
|
||||||
|
if (isset($_POST['wifiAPEnable'])) {
|
||||||
|
$wifiAPEnable = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isset($_POST['wifiAPEnable'])) {
|
||||||
|
$wifiAPEnable = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for Logfile output checkbox
|
// Check for Logfile output checkbox
|
||||||
$logEnable = 0;
|
$logEnable = 0;
|
||||||
if ($arrHostapdConf['LogEnable'] == 0) {
|
if ($arrHostapdConf['LogEnable'] == 0) {
|
||||||
@ -151,9 +153,12 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||||||
exec('sudo /etc/raspap/hostapd/disablelog.sh');
|
exec('sudo /etc/raspap/hostapd/disablelog.sh');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cfg = [];
|
$cfg = [];
|
||||||
$cfg['LogEnable'] = $logEnable;
|
$cfg['LogEnable'] = $logEnable;
|
||||||
$cfg['WifiAPEnable'] = $wifiAPEnable;
|
// Save previous Client mode status when Bridged
|
||||||
|
$cfg['WifiAPEnable'] = ($bridgedEnable == 1 ?
|
||||||
|
$arrHostapdConf['WifiAPEnable'] : $wifiAPEnable);
|
||||||
$cfg['BridgedEnable'] = $bridgedEnable;
|
$cfg['BridgedEnable'] = $bridgedEnable;
|
||||||
$cfg['WifiManaged'] = RASPI_WIFI_CLIENT_INTERFACE;
|
$cfg['WifiManaged'] = RASPI_WIFI_CLIENT_INTERFACE;
|
||||||
write_php_ini($cfg, '/etc/raspap/hostapd.ini');
|
write_php_ini($cfg, '/etc/raspap/hostapd.ini');
|
||||||
|
@ -55,6 +55,11 @@ if ($_COOKIE['sidebarToggled'] == 'true' ) {
|
|||||||
$toggleState = "toggled";
|
$toggleState = "toggled";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get Bridged AP mode status
|
||||||
|
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
||||||
|
// defaults to false
|
||||||
|
$bridgedEnabled = $arrHostapdConf['BridgedEnable'];
|
||||||
|
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -124,7 +129,7 @@ if ($_COOKIE['sidebarToggled'] == 'true' ) {
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?page=wlan0_info"><i class="fas fa-tachometer-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _("Dashboard"); ?></span></a>
|
<a class="nav-link" href="index.php?page=wlan0_info"><i class="fas fa-tachometer-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _("Dashboard"); ?></span></a>
|
||||||
</li>
|
</li>
|
||||||
<?php if (RASPI_WIFICLIENT_ENABLED) : ?>
|
<?php if (RASPI_WIFICLIENT_ENABLED && !$bridgedEnabled) : ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?page=wpa_conf"><i class="fas fa-wifi fa-fw mr-2"></i><span class="nav-label"><?php echo _("WiFi client"); ?></span></a>
|
<a class="nav-link" href="index.php?page=wpa_conf"><i class="fas fa-wifi fa-fw mr-2"></i><span class="nav-label"><?php echo _("WiFi client"); ?></span></a>
|
||||||
</li>
|
</li>
|
||||||
@ -139,7 +144,7 @@ if ($_COOKIE['sidebarToggled'] == 'true' ) {
|
|||||||
<a class="nav-link" href="index.php?page=network_conf"><i class="fas fa-network-wired fa-fw mr-2"></i><span class="nav-label"><?php echo _("Networking"); ?></a>
|
<a class="nav-link" href="index.php?page=network_conf"><i class="fas fa-network-wired fa-fw mr-2"></i><span class="nav-label"><?php echo _("Networking"); ?></a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (RASPI_DHCP_ENABLED) : ?>
|
<?php if (RASPI_DHCP_ENABLED && !$bridgedEnabled) : ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?page=dhcpd_conf"><i class="fas fa-exchange-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _("DHCP Server"); ?></a>
|
<a class="nav-link" href="index.php?page=dhcpd_conf"><i class="fas fa-exchange-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _("DHCP Server"); ?></a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -127,19 +127,19 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 mb-2">
|
<div class="col-md-6 mb-2">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<?php $checked = $arrHostapdConf['WifiAPEnable'] == 1 ? 'checked="checked"' : '' ?>
|
<?php $checked = $arrHostapdConf['BridgedEnable'] == 1 ? 'checked="checked"' : '' ?>
|
||||||
<?php $disabled = $managedModeEnabled == false && $arrHostapdConf['WifiAPEnable'] != 1 ? 'disabled="disabled"' : '' ?>
|
<input class="custom-control-input" id="chxbridgedenable" name="bridgedEnable" type="checkbox" value="1" <?php echo $checked ?> />
|
||||||
<input class="custom-control-input" id="chxwificlientap" name="wifiAPEnable" type="checkbox" value="1" <?php echo $checked ?> <?php echo $disabled ?> />
|
<label class="custom-control-label" for="chxbridgedenable"><?php echo _("Bridged AP mode"); ?></label>
|
||||||
<label class="custom-control-label" for="chxwificlientap"><?php echo _("WiFi client AP mode"); ?></label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 mb-2">
|
<div class="col-md-6 mb-2">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<?php $checked = $arrHostapdConf['BridgedEnable'] == 1 ? 'checked="checked"' : '' ?>
|
<?php $checked = $arrHostapdConf['WifiAPEnable'] == 1 ? 'checked="checked"' : '' ?>
|
||||||
<input class="custom-control-input" id="chxbridgedenable" name="bridgedEnable" type="checkbox" value="1" <?php echo $checked ?> />
|
<?php $disabled = $managedModeEnabled == false && $arrHostapdConf['WifiAPEnable'] != 1 || $arrHostapdConf['BridgedEnable'] == 1 ? 'disabled="disabled"' : '' ?>
|
||||||
<label class="custom-control-label" for="chxbridgedenable"><?php echo _("Bridged AP mode"); ?></label>
|
<input class="custom-control-input" id="chxwificlientap" name="wifiAPEnable" type="checkbox" value="1" <?php echo $checked ?> <?php echo $disabled ?> />
|
||||||
|
<label class="custom-control-label" for="chxwificlientap"><?php echo _("WiFi client AP mode"); ?></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,10 +12,18 @@
|
|||||||
<div id="msgNetworking"></div>
|
<div id="msgNetworking"></div>
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li role="presentation" class="nav-item"><a class="nav-link active" href="#summary" aria-controls="summary" role="tab" data-toggle="tab"><?php echo _("Summary"); ?></a></li>
|
<li role="presentation" class="nav-item"><a class="nav-link active" href="#summary" aria-controls="summary" role="tab" data-toggle="tab"><?php echo _("Summary"); ?></a></li>
|
||||||
|
<?php
|
||||||
|
// Get Bridged AP mode status
|
||||||
|
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
||||||
|
// defaults to false
|
||||||
|
$bridgedEnabled = $arrHostapdConf['BridgedEnable'];
|
||||||
|
?>
|
||||||
|
<?php if (!$bridgedEnabled): // no interface details when bridged ?>
|
||||||
<?php foreach ($interfaces as $if): ?>
|
<?php foreach ($interfaces as $if): ?>
|
||||||
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
|
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
|
||||||
<li role="presentation" class="nav-item"><a class="nav-link" href="#<?php echo $if_quoted ?>" aria-controls="<?php echo $if_quoted ?>" role="tab" data-toggle="tab"><?php echo $if_quoted ?></a></li>
|
<li role="presentation" class="nav-item"><a class="nav-link" href="#<?php echo $if_quoted ?>" aria-controls="<?php echo $if_quoted ?>" role="tab" data-toggle="tab"><?php echo $if_quoted ?></a></li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user