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

@@ -7,5 +7,5 @@
*/
function DisplayAbout()
{
echo renderTemplate("about");
echo renderTemplate("about");
}

View File

@@ -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"));
}

View File

@@ -4,5 +4,5 @@ include_once('functions.php');
include_once('session.php');
if (csrfValidateRequest() && !CSRFValidate()) {
handleInvalidCSRFToken();
handleInvalidCSRFToken();
}

View File

@@ -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;
}

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

@@ -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 '<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

@@ -62,8 +62,8 @@ if (empty($_SESSION['locale']) && strlen($_SERVER['HTTP_ACCEPT_LANGUAGE']) >= 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']);

View File

@@ -1,5 +1,5 @@
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
session_start();
}

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);