1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Processed with phpcbf for PSR-2 coding standard

This commit is contained in:
billz 2019-09-07 16:42:31 +01:00
parent ef406edc61
commit 8be24381a8
20 changed files with 106 additions and 87 deletions

View File

@ -96,5 +96,4 @@ function DisplayWPAConfig()
connectedWifiStations($networks);
echo renderTemplate("configure_client", compact("status"));
}

View File

@ -173,12 +173,21 @@ function DisplayDashboard()
echo renderTemplate("dashboard", compact(
"status",
"ipv4Addrs", "ipv4Netmasks",
"ipv6Addrs", "macAddr",
"strRxPackets", "strRxBytes",
"strTxPackets", "strTxBytes",
"connectedSSID", "connectedBSSID",
"bitrate", "signalLevel", "txPower", "frequency", "strLinkQuality",
"ipv4Addrs",
"ipv4Netmasks",
"ipv6Addrs",
"macAddr",
"strRxPackets",
"strRxBytes",
"strTxPackets",
"strTxBytes",
"connectedSSID",
"connectedBSSID",
"bitrate",
"signalLevel",
"txPower",
"frequency",
"strLinkQuality",
"wlan0up"
));
}
@ -213,4 +222,3 @@ function getHumanReadableDatasize($numbytes, $precision = 2)
return $humanDatasize;
}

View File

@ -138,10 +138,17 @@ function DisplayDHCPConfig()
echo renderTemplate("dhcp", compact(
"status",
"serviceStatus",
"RangeStart", "RangeEnd",
"RangeStart",
"RangeEnd",
"arrRangeLeaseTime",
"mselected", "hselected", "dselected", "infiniteselected",
"dnsmasq_state", "conf", "dhcpHost",
"interfaces", "leases"
"mselected",
"hselected",
"dselected",
"infiniteselected",
"dnsmasq_state",
"conf",
"dhcpHost",
"interfaces",
"leases"
));
}

View File

@ -194,7 +194,9 @@ function ParseConfig($arrConfig)
$config = array();
foreach ($arrConfig as $line) {
$line = trim($line);
if ($line == "" || $line[0] == "#") { continue; }
if ($line == "" || $line[0] == "#") {
continue;
}
list($option, $value) = array_map("trim", explode("=", $line, 2));
@ -384,14 +386,14 @@ function DisplayOpenVPNConfig()
} else {
echo '<input type="submit" class="btn btn-warning" name="StopOpenVPN" value="Stop OpenVPN" />' , PHP_EOL;
}
?>
?>
</form>
</div><!-- /.panel-body -->
</div><!-- /.panel-primary -->
<div class="panel-footer"> Information provided by openvpn</div>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
<?php
}
/**
@ -420,7 +422,7 @@ function DisplayTorProxyConfig()
}
}
?>
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
@ -535,7 +537,7 @@ function DisplayTorProxyConfig()
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
<?php
}
/**
@ -585,7 +587,7 @@ function renderTemplate($name, $data = [])
return "template $name ($file) not found";
}
if (is_array($data)){
if (is_array($data)) {
extract($data);
}

View File

@ -59,10 +59,15 @@ function DisplayHostAPDConfig()
echo renderTemplate("hostapd", compact(
"status",
"serviceStatus", "hostapdstatus",
"interfaces", "arrConfig",
"arr80211Standard", "selectedHwMode",
"arrSecurity", "arrEncType", "arrHostapdConf"
"serviceStatus",
"hostapdstatus",
"interfaces",
"arrConfig",
"arr80211Standard",
"selectedHwMode",
"arrSecurity",
"arrEncType",
"arrHostapdConf"
));
}
@ -260,4 +265,3 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
return true;
}

View File

@ -102,4 +102,3 @@ function DisplaySystem()
echo renderTemplate("system", compact("arrLocales", "status", "system"));
}

View File

@ -51,7 +51,7 @@ function nearbyWifiStations(&$networks, $cached = true)
deleteCache($cacheKey);
}
$scan_results = cache($cacheKey, function() {
$scan_results = cache($cacheKey, function () {
exec('sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' scan');
sleep(3);

View File

@ -64,7 +64,7 @@ exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep
</tr>
</thead>
<tbody>
<?php foreach ($clients as $client): ?>
<?php foreach ($clients as $client) : ?>
<?php $props = explode(' ', $client) ?>
<tr>
<td><?php echo htmlspecialchars($props[3], ENT_QUOTES) ?></td>
@ -84,10 +84,10 @@ exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep
<div class="row">
<form action="?page=wlan0_info" method="POST">
<?php echo CSRFTokenFieldTag() ?>
<?php if (!RASPI_MONITOR_ENABLED): ?>
<?php if (!$wlan0up): ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<?php if (!$wlan0up) : ?>
<input type="submit" class="btn btn-success" value="<?php echo _("Start ").RASPI_WIFI_CLIENT_INTERFACE ?>" name="ifup_wlan0" />
<?php else: ?>
<?php else : ?>
<input type="submit" class="btn btn-warning" value="<?php echo _("Stop ").RASPI_WIFI_CLIENT_INTERFACE ?>" name="ifdown_wlan0" />
<?php endif ?>
<?php endif ?>

View File

@ -17,7 +17,7 @@
<h4><?php echo _('Hourly traffic amount'); ?></h4>
<label for="cbxInterfacehourly"><?php echo _('interface'); ?></label>
<select id="cbxInterfacehourly" class="form-control" name="interfacehourly">
<?php foreach ($interfaces as $if): ?>
<?php foreach ($interfaces as $if) : ?>
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
<option value="<?php echo $if_quoted ?>"><?php echo $if_quoted ?></option>
<?php endforeach ?>
@ -36,7 +36,7 @@
<h4><?php echo _('Daily traffic amount'); ?></h4>
<label for="cbxInterfacedaily"><?php echo _('interface'); ?></label>
<select id="cbxInterfacedaily" class="form-control" name="interfacedaily">
<?php foreach ($interfaces as $if): ?>
<?php foreach ($interfaces as $if) : ?>
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
<option value="<?php echo $if_quoted ?>"><?php echo $if_quoted ?></option>
<?php endforeach ?>
@ -55,7 +55,7 @@
<h4><?php echo _("Monthly traffic amount"); ?></h4>
<label for="cbxInterfacemonthly"><?php echo _('interface'); ?></label>
<select id="cbxInterfacemonthly" class="form-control" name="interfacemonthly">
<?php foreach ($interfaces as $if): ?>
<?php foreach ($interfaces as $if) : ?>
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
<option value="<?php echo $if_quoted ?>"><?php echo $if_quoted ?></option>
<?php endforeach ?>

View File

@ -26,7 +26,7 @@
<div class="form-group col-md-4">
<label for="code">Interface</label>
<select class="form-control" name="interface">
<?php foreach ($interfaces as $if): ?>
<?php foreach ($interfaces as $if) : ?>
<?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
<?php $selected = $if === $conf['interface'] ? ' selected="selected"' : '' ?>
<option value="<?php echo $if_quoted ?>"<?php echo $selected ?>><?php echo $if_quoted ?></option>
@ -63,11 +63,11 @@
</select>
</div>
</div>
<?php if (!RASPI_MONITOR_ENABLED): ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<input type="submit" class="btn btn-outline btn-primary" value="<?php echo _("Save settings"); ?>" name="savedhcpdsettings" />
<?php if ($dnsmasq_state): ?>
<?php if ($dnsmasq_state) : ?>
<input type="submit" class="btn btn-warning" value="<?php echo _("Stop dnsmasq") ?>" name="stopdhcpd" />
<?php else: ?>
<?php else : ?>
<input type="submit" class="btn btn-success" value="<?php echo _("Start dnsmasq") ?>" name="startdhcpd" />
<?php endif ?>
<?php endif ?>
@ -93,8 +93,8 @@
</tr>
</thead>
<tbody>
<?php foreach ($leases as $lease): ?>
<?php foreach (explode(' ', $lease) as $prop): ?>
<?php foreach ($leases as $lease) : ?>
<?php foreach (explode(' ', $lease) as $prop) : ?>
<tr>
<td><?php echo htmlspecialchars($prop, ENT_QUOTES) ?></td>
</tr>
@ -111,7 +111,7 @@
<div class="tab-pane fade in" id="static-leases">
<div class="dhcp-static-leases js-dhcp-static-lease-container">
<?php foreach ($dhcpHost as $host): ?>
<?php foreach ($dhcpHost as $host) : ?>
<?php list($mac, $ip) = array_map("trim", explode(",", $host)); ?>
<div class="row dhcp-static-lease-row js-dhcp-static-lease-row">
<div class="col-md-5 col-xs-5">
@ -153,7 +153,7 @@
</div>
</div>
</template>
<?php if (!RASPI_MONITOR_ENABLED): ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<input type="submit" class="btn btn-outline btn-primary" value="<?php echo _("Save settings"); ?>" name="savedhcpdsettings" />
<?php
if ($dnsmasq_state) {

View File

@ -121,7 +121,7 @@
<?php
$checkedWifiAPEnabled = '';
if ($arrHostapdConf['WifiAPEnable'] == 1) {
$checkedWifiAPEnabled = ' checked="checked"';
$checkedWifiAPEnabled = ' checked="checked"';
}
?>
<input id="chxwificlientap" name="wifiAPEnable" type="checkbox" class="form-check-input" data-toggle="toggle" data-on="Enabled" data-off="Disabled" data-width="100" value="1"<?php echo $checkedWifiAPEnabled; ?> />
@ -135,7 +135,7 @@ $checkedWifiAPEnabled = ' checked="checked"';
<?php
$checkedLogEnabled = '';
if ($arrHostapdConf['LogEnable'] == 1) {
$checkedLogEnabled = ' checked="checked"';
$checkedLogEnabled = ' checked="checked"';
}
?>
<input id="chxlogenable" name="logEnable" type="checkbox" class="form-check-input" data-toggle="toggle" data-on="Enabled" data-off="Disabled" data-width="100" value="1"<?php echo $checkedLogEnabled; ?> />
@ -149,7 +149,7 @@ $checkedLogEnabled = ' checked="checked"';
<?php
$checkedHiddenSSID = '';
if ($arrConfig['ignore_broadcast_ssid'] == 1 || $arrConfig['ignore_broadcast_ssid'] == 2) {
$checkedHiddenSSID = ' checked="checked"';
$checkedHiddenSSID = ' checked="checked"';
}
?>
<input id="chxhiddenssid" name="hiddenSSID" type="checkbox" class="form-check-input" data-toggle="toggle" data-on="Enabled" data-off="Disabled" data-width="100" value="1"<?php echo $checkedHiddenSSID; ?> />
@ -434,7 +434,7 @@ if(ops[i].value == country){
</div>
</div><!-- /.panel-body -->
</div><!-- /.panel-primary -->
<?php if (!RASPI_MONITOR_ENABLED): ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<input type="submit" class="btn btn-outline btn-primary" name="SaveHostAPDSettings" value="<?php echo _("Save settings"); ?>" />
<?php
if ($hostapdstatus[0] == 0) {

View File

@ -67,7 +67,7 @@ if ($cpuload > 90) {
<form action="?page=system_info" method="POST">
<?php echo CSRFTokenFieldTag() ?>
<?php if (!RASPI_MONITOR_ENABLED): ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<input type="submit" class="btn btn-warning" name="system_reboot" value="<?php echo _("Reboot"); ?>" />
<input type="submit" class="btn btn-warning" name="system_shutdown" value="<?php echo _("Shutdown"); ?>" />
<?php endif ?>

View File

@ -1,9 +1,9 @@
<?php if (empty($networks)): ?>
<?php if (empty($networks)) : ?>
<p class="lead text-center"><?php echo _('No Wifi stations found') ?></p>
<p class="text-center"><?php echo _('Click "Rescan" to search for nearby Wifi stations.') ?></p>
<?php endif ?>
<?php $index = 0; ?>
<?php foreach ($networks as $ssid => $network): ?>
<?php foreach ($networks as $ssid => $network) : ?>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
@ -89,5 +89,5 @@
</div><!-- /.panel-default -->
</div><!-- /.col-md-6 -->
<?php $index += 1; ?>
<?php $index += 1; ?>
<?php endforeach ?>