From 8be24381a80bc698a6aff815b0300d5417cd6d48 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 7 Sep 2019 16:42:31 +0100 Subject: [PATCH] Processed with phpcbf for PSR-2 coding standard --- includes/about.php | 2 +- includes/configure_client.php | 3 +-- includes/csrf.php | 2 +- includes/dashboard.php | 32 ++++++++++++++++++++------------ includes/dhcp.php | 15 +++++++++++---- includes/functions.php | 18 ++++++++++-------- includes/hostapd.php | 14 +++++++++----- includes/locale.php | 4 ++-- includes/session.php | 2 +- includes/system.php | 1 - includes/wifi_functions.php | 2 +- templates/admin.php | 2 +- templates/configure_client.php | 2 +- templates/dashboard.php | 22 +++++++++++----------- templates/data_usage.php | 18 +++++++++--------- templates/dhcp.php | 24 ++++++++++++------------ templates/hostapd.php | 12 ++++++------ templates/system.php | 10 +++++----- templates/themes.php | 2 +- templates/wifi_stations.php | 6 +++--- 20 files changed, 106 insertions(+), 87 deletions(-) diff --git a/includes/about.php b/includes/about.php index d675619a..cb5d10b5 100755 --- a/includes/about.php +++ b/includes/about.php @@ -7,5 +7,5 @@ */ function DisplayAbout() { - echo renderTemplate("about"); + echo renderTemplate("about"); } diff --git a/includes/configure_client.php b/includes/configure_client.php index dbb384e2..48526439 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -46,7 +46,7 @@ function DisplayWPAConfig() fwrite($wpa_file, "network={".PHP_EOL); fwrite($wpa_file, "\tssid=\"".$ssid."\"".PHP_EOL); fwrite($wpa_file, "\tkey_mgmt=NONE".PHP_EOL); - fwrite($wpa_file, "\tscan_ssid=1".PHP_EOL); + fwrite($wpa_file, "\tscan_ssid=1".PHP_EOL); if (array_key_exists('priority', $network)) { fwrite($wpa_file, "\tpriority=".$network['priority'].PHP_EOL); } @@ -96,5 +96,4 @@ function DisplayWPAConfig() connectedWifiStations($networks); echo renderTemplate("configure_client", compact("status")); - } diff --git a/includes/csrf.php b/includes/csrf.php index 1977dca4..79c68a72 100644 --- a/includes/csrf.php +++ b/includes/csrf.php @@ -4,5 +4,5 @@ include_once('functions.php'); include_once('session.php'); if (csrfValidateRequest() && !CSRFValidate()) { - handleInvalidCSRFToken(); + handleInvalidCSRFToken(); } diff --git a/includes/dashboard.php b/includes/dashboard.php index 6a751c0d..82c93cc2 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -33,12 +33,12 @@ function DisplayDashboard() $ipv4Addrs = _('No IPv4 Address Found'); } else { foreach ($matchesIpv4AddrAndSubnet as $inet) { - $address = $inet[1]; - $suffix = (int) $inet[2]; - $netmask = long2ip(-1 << (32 - $suffix)); + $address = $inet[1]; + $suffix = (int) $inet[2]; + $netmask = long2ip(-1 << (32 - $suffix)); - $ipv4Addrs .= " $address"; - $ipv4Netmasks .= " $netmask"; + $ipv4Addrs .= " $address"; + $ipv4Netmasks .= " $netmask"; } $ipv4Addrs = trim($ipv4Addrs); $ipv4Netmasks = trim($ipv4Netmasks); @@ -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; } - diff --git a/includes/dhcp.php b/includes/dhcp.php index 7536cca0..085239c4 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -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" )); } diff --git a/includes/functions.php b/includes/functions.php index 75a6c3cd..ab1b324e 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -116,8 +116,8 @@ function CSRFValidate() */ function csrfValidateRequest() { - $request_method = strtolower($_SERVER['REQUEST_METHOD']); - return in_array($request_method, [ "post", "put", "patch", "delete" ]); + $request_method = strtolower($_SERVER['REQUEST_METHOD']); + return in_array($request_method, [ "post", "put", "patch", "delete" ]); } /** @@ -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 '' , PHP_EOL; } -?> + ?> - + ?>
@@ -535,7 +537,7 @@ function DisplayTorProxyConfig()
-= 2) $_SESSION['locale'] = $locale; } -// Note: the associated locale must be installed on the RPi -// Use: 'sudo raspi-configure' and select 'Localisation Options' +// Note: the associated locale must be installed on the RPi +// Use: 'sudo raspi-configure' and select 'Localisation Options' // activate the locale setting putenv("LANG=" . $_SESSION['locale']); diff --git a/includes/session.php b/includes/session.php index c9c36595..fe447f3d 100644 --- a/includes/session.php +++ b/includes/session.php @@ -1,5 +1,5 @@ showMessages(); ?>
- +
diff --git a/templates/configure_client.php b/templates/configure_client.php index 053dc452..ccd23b81 100644 --- a/templates/configure_client.php +++ b/templates/configure_client.php @@ -12,7 +12,7 @@
- +
diff --git a/templates/dashboard.php b/templates/dashboard.php index 12c27d73..7ba5fad4 100644 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -1,9 +1,9 @@ @@ -64,14 +64,14 @@ exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep - - + + - +
@@ -83,14 +83,14 @@ exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep
- - - + + + " name="ifup_wlan0" /> - + " name="ifdown_wlan0" /> - - + +
diff --git a/templates/data_usage.php b/templates/data_usage.php index a4c67f2b..ee4845e0 100644 --- a/templates/data_usage.php +++ b/templates/data_usage.php @@ -17,13 +17,13 @@

@@ -36,13 +36,13 @@

@@ -55,13 +55,13 @@

diff --git a/templates/dhcp.php b/templates/dhcp.php index 6e4705f6..7d1329b0 100644 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -26,9 +26,9 @@
@@ -63,11 +63,11 @@
- + " name="savedhcpdsettings" /> - + " name="stopdhcpd" /> - + " name="startdhcpd" /> @@ -93,12 +93,12 @@ - - + + - + @@ -111,8 +111,8 @@
- - + +
" class="form-control"> @@ -153,7 +153,7 @@
- + " name="savedhcpdsettings" /> /> @@ -135,7 +135,7 @@ $checkedWifiAPEnabled = ' checked="checked"'; /> @@ -149,7 +149,7 @@ $checkedLogEnabled = ' checked="checked"'; /> @@ -433,8 +433,8 @@ if(ops[i].value == country){
- - + + " /> ' , PHP_EOL; }; - endif ?> + endif ?> diff --git a/templates/system.php b/templates/system.php index 66330ca8..8a723550 100644 --- a/templates/system.php +++ b/templates/system.php @@ -66,12 +66,12 @@ if ($cpuload > 90) {
- - + + " /> - " /> + " /> - +
@@ -82,7 +82,7 @@ if ($cpuload > 90) {
- +
" /> diff --git a/templates/themes.php b/templates/themes.php index be5141ea..8c9889f5 100644 --- a/templates/themes.php +++ b/templates/themes.php @@ -14,7 +14,7 @@
- +
diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index 7d4f48fa..350934a3 100644 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -1,9 +1,9 @@ - +

- $network): ?> + $network) : ?>
@@ -89,5 +89,5 @@
- + \ No newline at end of file