summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-15 10:38:12 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-15 10:38:12 +0545
commitabe98adb911f9ff76af12034646a4c64e26d6390 (patch)
tree49c09b6bdf22f6afb54eb99e6d2287a8c65283d7 /src/usr/local/www
parent7895a8802317a8477929bea6428bf8dfe214306f (diff)
downloadpfsense-abe98adb911f9ff76af12034646a4c64e26d6390.zip
pfsense-abe98adb911f9ff76af12034646a4c64e26d6390.tar.gz
Code style status*
Diffstat (limited to 'src/usr/local/www')
-rwxr-xr-xsrc/usr/local/www/status.php145
-rw-r--r--src/usr/local/www/status_captiveportal.php12
-rw-r--r--src/usr/local/www/status_captiveportal_expire.php5
-rw-r--r--src/usr/local/www/status_captiveportal_voucher_rolls.php4
-rw-r--r--src/usr/local/www/status_carp.php13
-rw-r--r--src/usr/local/www/status_dhcp_leases.php17
-rw-r--r--src/usr/local/www/status_dhcpv6_leases.php41
-rwxr-xr-xsrc/usr/local/www/status_gateway_groups.php19
-rw-r--r--src/usr/local/www/status_gateways.php30
-rw-r--r--src/usr/local/www/status_graph.php19
-rw-r--r--src/usr/local/www/status_interfaces.php34
-rw-r--r--src/usr/local/www/status_ipsec.php24
-rw-r--r--src/usr/local/www/status_ipsec_leases.php7
-rw-r--r--src/usr/local/www/status_ipsec_sad.php4
-rw-r--r--src/usr/local/www/status_ipsec_spd.php8
-rw-r--r--src/usr/local/www/status_lb_pool.php15
-rw-r--r--src/usr/local/www/status_lb_vs.php7
-rwxr-xr-xsrc/usr/local/www/status_logs.php49
-rw-r--r--src/usr/local/www/status_logs_filter.php89
-rwxr-xr-xsrc/usr/local/www/status_logs_filter_dynamic.php51
-rw-r--r--src/usr/local/www/status_logs_filter_summary.php6
-rw-r--r--src/usr/local/www/status_logs_settings.php13
-rw-r--r--src/usr/local/www/status_logs_vpn.php23
-rw-r--r--src/usr/local/www/status_openvpn.php6
-rwxr-xr-xsrc/usr/local/www/status_pkglogs.php3
-rw-r--r--src/usr/local/www/status_rrd_graph.php117
-rw-r--r--src/usr/local/www/status_rrd_graph_img.php2
-rw-r--r--src/usr/local/www/status_rrd_graph_settings.php20
-rwxr-xr-xsrc/usr/local/www/status_services.php5
-rw-r--r--src/usr/local/www/status_upnp.php10
-rw-r--r--src/usr/local/www/status_wireless.php20
31 files changed, 449 insertions, 369 deletions
diff --git a/src/usr/local/www/status.php b/src/usr/local/www/status.php
index b4bbd44..c4a5ac0 100755
--- a/src/usr/local/www/status.php
+++ b/src/usr/local/www/status.php
@@ -100,9 +100,9 @@ function doCmdT($title, $command) {
echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
print('<div class="panel panel-default">');
- print( '<div class="panel-heading">' . $title . '</div>');
- print( '<div class="panel-body">');
- print( '<pre>');
+ print('<div class="panel-heading">' . $title . '</div>');
+ print('<div class="panel-body">');
+ print('<pre>');
if ($command == "dumpconfigxml") {
$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
@@ -148,8 +148,8 @@ function doCmdT($title, $command) {
fclose($ofd);
}
- print( '</pre>');
- print( '</div>');
+ print('</pre>');
+ print('</div>');
print('</div>');
}
@@ -168,13 +168,13 @@ function listCmds() {
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
print('<div class="panel panel-default">');
- print( '<div class="panel-heading">' . gettext("System status on ") . $currentDate . '</div>');
- print( '<div class="panel-body">');
- print( ' <div class="content">');
+ print('<div class="panel-heading">' . gettext("System status on ") . $currentDate . '</div>');
+ print('<div class="panel-body">');
+ print(' <div class="content">');
print("\n<p>" . gettext("This status page includes the following information") . ":\n");
print("<ul>\n");
- for ($i = 0; isset($commands[$i]); $i++ ) {
- print("\t<li><strong><a href=\"#" . str_replace($rubbish,'',$commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
+ for ($i = 0; isset($commands[$i]); $i++) {
+ print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
}
print("</ul>\n");
@@ -196,56 +196,57 @@ global $g, $config;
/* Set up all of the commands we want to execute. */
/* System stats/info */
-defCmdT("System uptime","/usr/bin/uptime");
-defCmdT("Interfaces","/sbin/ifconfig -a");
-defCmdT("Interface Statistics","/usr/bin/netstat -nWi");
+defCmdT("System uptime", "/usr/bin/uptime");
+defCmdT("Interfaces", "/sbin/ifconfig -a");
+defCmdT("Interface Statistics", "/usr/bin/netstat -nWi");
defCmdT("Top Process Info", "/usr/bin/top | /usr/bin/head -n5");
-defCmdT("Processes","/bin/ps xauww");
+defCmdT("Processes", "/bin/ps xauww");
defCmdT("Mounted Filesystems", "/sbin/mount");
-defCmdT("Free Disk Space","/bin/df -hi");
-defCmdT("Routing tables","/usr/bin/netstat -nWr");
-defCmdT("Mbuf Usage","/usr/bin/netstat -mb");
+defCmdT("Free Disk Space", "/bin/df -hi");
+defCmdT("Routing tables", "/usr/bin/netstat -nWr");
+defCmdT("Mbuf Usage", "/usr/bin/netstat -mb");
defCmdT("VMStat", "/usr/bin/vmstat -afimsz");
defCmdT("Sockets", "/usr/bin/sockstat");
/* Firewall rules and info */
-defCmdT("Generated Ruleset","/bin/cat {$g['tmp_path']}/rules.debug");
-defCmdT("Generated Ruleset Limiters","/bin/cat {$g['tmp_path']}/rules.limiter");
-defCmdT("Generated Ruleset Limits","/bin/cat {$g['tmp_path']}/rules.limits");
+defCmdT("Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
+defCmdT("Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
+defCmdT("Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
defCmdT("pf NAT Rules", "/sbin/pfctl -vvsn");
defCmdT("pf Firewall Rules", "/sbin/pfctl -vvsr");
-defCmdT("pf Tables","/sbin/pfctl -vs Tables");
+defCmdT("pf Tables", "/sbin/pfctl -vs Tables");
defCmdT("pf State Table Contents", "/sbin/pfctl -ss");
defCmdT("pf Info", "/sbin/pfctl -si");
defCmdT("pf Show All", "/sbin/pfctl -sa");
-defCmdT("pf Queues","/sbin/pfctl -s queue -v");
-defCmdT("pf OSFP","/sbin/pfctl -s osfp");
-defCmdT("pfsync stats","/usr/bin/netstat -s -ppfsync");
-defCmdT("pftop Default","/usr/local/sbin/pftop -a -b");
-defCmdT("pftop Long","/usr/local/sbin/pftop -w 150 -a -b -v long");
-defCmdT("pftop Queue","/usr/local/sbin/pftop -w 150 -a -b -v queue");
-defCmdT("pftop Rules","/usr/local/sbin/pftop -w 150 -a -b -v rules");
-defCmdT("pftop Size","/usr/local/sbin/pftop -w 150 -a -b -v size");
-defCmdT("pftop Speed","/usr/local/sbin/pftop -w 150 -a -b -v speed");
+defCmdT("pf Queues", "/sbin/pfctl -s queue -v");
+defCmdT("pf OSFP", "/sbin/pfctl -s osfp");
+defCmdT("pfsync stats", "/usr/bin/netstat -s -ppfsync");
+defCmdT("pftop Default", "/usr/local/sbin/pftop -a -b");
+defCmdT("pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
+defCmdT("pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
+defCmdT("pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
+defCmdT("pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
+defCmdT("pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpZone => $cpdata) {
- if (isset($cpdata['enable']))
+ if (isset($cpdata['enable'])) {
defCmdT("IPFW rules for {$cpdata['zone']}", "/sbin/ipfw -x " . escapeshellarg($cpdata['zoneid']) . " show");
+ }
}
}
/* Configuration Files */
defCmdT("Contents of var run", "/bin/ls /var/run");
defCmdT("Contents of conf", "/bin/ls /conf");
-defCmdT("config.xml","dumpconfigxml");
-defCmdT("resolv.conf","/bin/cat /etc/resolv.conf");
-defCmdT("DHCP Configuration","/bin/cat /var/dhcpd/etc/dhcpd.conf");
-defCmdT("DHCPv6 Configuration","/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
-defCmdT("strongSwan config","/bin/cat /var/etc/ipsec/strongswan.conf");
-defCmdT("IPsec config","/bin/cat /var/etc/ipsec/ipsec.conf");
-defCmdT("IPsec Status","/usr/local/sbin/ipsec statusall");
-defCmdT("SPD","/sbin/setkey -DP");
-defCmdT("SAD","/sbin/setkey -D");
+defCmdT("config.xml", "dumpconfigxml");
+defCmdT("resolv.conf", "/bin/cat /etc/resolv.conf");
+defCmdT("DHCP Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
+defCmdT("DHCPv6 Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
+defCmdT("strongSwan config", "/bin/cat /var/etc/ipsec/strongswan.conf");
+defCmdT("IPsec config", "/bin/cat /var/etc/ipsec/ipsec.conf");
+defCmdT("IPsec Status", "/usr/local/sbin/ipsec statusall");
+defCmdT("SPD", "/sbin/setkey -DP");
+defCmdT("SAD", "/sbin/setkey -D");
if (file_exists("/cf/conf/upgrade_log.txt")) {
defCmdT("Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
}
@@ -258,43 +259,43 @@ if (file_exists("/boot/loader.conf.local")) {
if (file_exists("/var/etc/filterdns.conf")) {
defCmdT("Filter DNS Daemon Config", "/bin/cat /var/etc/filterdns.conf");
}
-if(isset($config['system']['usefifolog'])) {
- defCmdT("last 1000 system log entries","/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 DHCP log entries","/usr/sbin/fifolog_reader /var/log/dhcpd.log 2>&1 | tail -n 1000");
- defCmdT("last 500 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 500");
- defCmdT("last 1000 gateways log entries","/usr/sbin/fifolog_reader /var/log/gateways.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 IPsec log entries","/usr/sbin/fifolog_reader /var/log/ipsec.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 L2TP log entries","/usr/sbin/fifolog_reader /var/log/l2tps.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 NTP log entries","/usr/sbin/fifolog_reader /var/log/ntpd.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 OpenVPN log entries","/usr/sbin/fifolog_reader /var/log/openvpn.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 Captive Portal auth log entries","/usr/sbin/fifolog_reader /var/log/portalauth.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 PPP log entries","/usr/sbin/fifolog_reader /var/log/poes.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 relayd log entries","/usr/sbin/fifolog_reader /var/log/relayd.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 resolver log entries","/usr/sbin/fifolog_reader /var/log/resolver.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 routing log entries","/usr/sbin/fifolog_reader /var/log/routing.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 wireless log entries","/usr/sbin/fifolog_reader /var/log/wireless.log 2>&1 | tail -n 1000");
+if (isset($config['system']['usefifolog'])) {
+ defCmdT("last 1000 system log entries", "/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 DHCP log entries", "/usr/sbin/fifolog_reader /var/log/dhcpd.log 2>&1 | tail -n 1000");
+ defCmdT("last 500 filter log entries", "/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 500");
+ defCmdT("last 1000 gateways log entries", "/usr/sbin/fifolog_reader /var/log/gateways.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 IPsec log entries", "/usr/sbin/fifolog_reader /var/log/ipsec.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 L2TP log entries", "/usr/sbin/fifolog_reader /var/log/l2tps.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 NTP log entries", "/usr/sbin/fifolog_reader /var/log/ntpd.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 OpenVPN log entries", "/usr/sbin/fifolog_reader /var/log/openvpn.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 Captive Portal auth log entries", "/usr/sbin/fifolog_reader /var/log/portalauth.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 PPP log entries", "/usr/sbin/fifolog_reader /var/log/poes.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 relayd log entries", "/usr/sbin/fifolog_reader /var/log/relayd.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 resolver log entries", "/usr/sbin/fifolog_reader /var/log/resolver.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 routing log entries", "/usr/sbin/fifolog_reader /var/log/routing.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 wireless log entries", "/usr/sbin/fifolog_reader /var/log/wireless.log 2>&1 | tail -n 1000");
} else {
- defCmdT("last 1000 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 DHCP log entries","/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
- defCmdT("last 500 filter log entries","/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
- defCmdT("last 1000 gateways log entries","/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 IPsec log entries","/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 L2TP log entries","/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 NTP log entries","/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 OpenVPN log entries","/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 Captive Portal auth log entries","/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 PPP log entries","/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 relayd log entries","/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 resolver log entries","/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 routing log entries","/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
- defCmdT("last 1000 wireless log entries","/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 system log entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 DHCP log entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
+ defCmdT("last 500 filter log entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
+ defCmdT("last 1000 gateways log entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 IPsec log entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 L2TP log entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 NTP log entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 OpenVPN log entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 Captive Portal auth log entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 PPP log entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 relayd log entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 resolver log entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 routing log entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
+ defCmdT("last 1000 wireless log entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
}
if (file_exists("/tmp/PHP_errors.log")) {
defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
}
-defCmdT("System Message Buffer","/sbin/dmesg -a");
-defCmdT("System Message Buffer (Boot)","/bin/cat /var/log/dmesg.boot");
-defCmdT("sysctl values","/sbin/sysctl -a");
+defCmdT("System Message Buffer", "/sbin/dmesg -a");
+defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
+defCmdT("sysctl values", "/sbin/sysctl -a");
exec("/bin/date", $dateOutput, $dateStatus);
$currentDate = $dateOutput[0];
diff --git a/src/usr/local/www/status_captiveportal.php b/src/usr/local/www/status_captiveportal.php
index a310847..fc7ee73 100644
--- a/src/usr/local/www/status_captiveportal.php
+++ b/src/usr/local/www/status_captiveportal.php
@@ -151,8 +151,9 @@ if (count($a_cp) > 1) {
$zonelist = array("" => 'None');
- foreach ($a_cp as $cpkey => $cp)
+ foreach ($a_cp as $cpkey => $cp) {
$zonelist[$cpkey] = $cp['zone'];
+ }
$section->addInput(new Form_Select(
'zone',
@@ -211,7 +212,7 @@ if (!empty($cpzone)): ?>
if (!empty($mac)) {
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
print htmlentities($mac);
- if(isset($mac_man[$mac_hi])) {
+ if (isset($mac_man[$mac_hi])) {
print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>";
}
}
@@ -228,8 +229,11 @@ if (!empty($cpzone)): ?>
</td>
<td>
<?php
- if ($last_act != 0)
- echo htmlspecialchars(date("m/d/Y H:i:s", $last_act))?>
+ if ($last_act != 0) {
+ echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));
+ }
+?>
+
</td>
<?php
else:
diff --git a/src/usr/local/www/status_captiveportal_expire.php b/src/usr/local/www/status_captiveportal_expire.php
index efb08ea..e441e81 100644
--- a/src/usr/local/www/status_captiveportal_expire.php
+++ b/src/usr/local/www/status_captiveportal_expire.php
@@ -120,10 +120,11 @@ print($form);
if ($_POST) {
if ($_POST['vouchers']) {
- if(voucher_expire($_POST['vouchers']))
+ if (voucher_expire($_POST['vouchers'])) {
print_info_box(gettext('Voucher successfully marked'), 'success');
- else
+ } else {
print_info_box(gettext('Error: Voucher could not be processed'), 'danger');
+ }
}
}
diff --git a/src/usr/local/www/status_captiveportal_voucher_rolls.php b/src/usr/local/www/status_captiveportal_voucher_rolls.php
index 01ac36a..cc01e06 100644
--- a/src/usr/local/www/status_captiveportal_voucher_rolls.php
+++ b/src/usr/local/www/status_captiveportal_voucher_rolls.php
@@ -122,9 +122,9 @@ display_top_tabs($tab_array);
<?php
$voucherlck = lock("vouche{$cpzone}r");
$i = 0;
- foreach($a_roll as $rollent):
+ foreach ($a_roll as $rollent):
$used = voucher_used_count($rollent['number']);
- $active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']);
+ $active = count(voucher_read_active_db($rollent['number']), $rollent['minutes']);
$ready = $rollent['count'] - $used;
/* used also count active vouchers, remove them */
$used = $used - $active;
diff --git a/src/usr/local/www/status_carp.php b/src/usr/local/www/status_carp.php
index b6a3d93..c1516ad 100644
--- a/src/usr/local/www/status_carp.php
+++ b/src/usr/local/www/status_carp.php
@@ -152,8 +152,9 @@ $pgtitle = array(gettext("Status"), gettext("CARP"));
$shortcut_section = "carp";
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$carpcount = 0;
if (is_array($config['virtualip']['vip'])) {
@@ -177,15 +178,15 @@ if ($carpcount == 0) {
'<a href="system_hasync.php" class="alert-link">' .
gettext("You can configure high availability sync settings here") .
'</a>');
-} else
-{
+} else {
?>
<form action="status_carp.php" method="post">
<?php
- if($status > 0)
+ if ($status > 0) {
$carp_enabled = true;
- else
+ } else {
$carp_enabled = false;
+ }
// Sadly this needs to be here so that it is inside the form
if ($carp_detected_problems > 0) {
@@ -231,7 +232,7 @@ if ($carpcount == 0) {
$vhid = $carp['vhid'];
$status = get_carp_interface_status("_vip{$carp['uniqid']}");
- if($carp_enabled == false) {
+ if ($carp_enabled == false) {
$icon = 'times-circle';
$status = "DISABLED";
} else {
diff --git a/src/usr/local/www/status_dhcp_leases.php b/src/usr/local/www/status_dhcp_leases.php
index adbdae9..22aef12 100644
--- a/src/usr/local/www/status_dhcp_leases.php
+++ b/src/usr/local/www/status_dhcp_leases.php
@@ -305,7 +305,7 @@ if (count($pools) > 0) {
foreach ($config['interfaces'] as $ifname => $ifarr) {
if (is_array($config['dhcpd'][$ifname]) &&
- is_array($config['dhcpd'][$ifname]['staticmap'])) {
+ is_array($config['dhcpd'][$ifname]['staticmap'])) {
$staticmap_array_index = 0;
foreach ($config['dhcpd'][$ifname]['staticmap'] as $static) {
$slease = array();
@@ -385,23 +385,26 @@ $dhcp_leases_subnet_counter = array(); //array to sum up # of leases / subnet
$iflist = get_configured_interface_with_descr(); //get interface descr for # of leases
foreach ($leases as $data):
- if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
+ if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
continue;
+ }
- if ($data['act'] == 'active')
+ if ($data['act'] == 'active') {
$icon = 'fa-check-circle-o';
- elseif ($data['act'] == 'expired')
+ } elseif ($data['act'] == 'expired') {
$icon = 'fa-ban';
- else
+ } else {
$icon = 'fa-times-circle-o';
+ }
$lip = ip2ulong($data['ip']);
if ($data['act'] != "static") {
$dlsc=0;
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
- if (!is_array($dhcpifconf['range']))
+ if (!is_array($dhcpifconf['range'])) {
continue;
+ }
if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) {
$data['if'] = $dhcpif;
$dhcp_leases_subnet_counter[$dlsc]['dhcpif'] = $dhcpif;
@@ -424,7 +427,7 @@ foreach ($leases as $data):
<td>
<?=$mac?>
- <? if(isset($mac_man[$mac_hi])):?>
+ <? if (isset($mac_man[$mac_hi])):?>
(<?=$mac_man[$mac_hi]?>)
<?endif?>
</td>
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index 9620679..cb7a2ea 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -332,11 +332,11 @@ while ($i < $leases_count) {
$f = $f+2;
break;
case "client-hostname":
- if($data[$f+1] != "") {
- $entry['hostname'] = preg_replace('/"/','',$data[$f+1]);
+ if ($data[$f+1] != "") {
+ $entry['hostname'] = preg_replace('/"/', '', $data[$f+1]);
} else {
$hostname = gethostbyaddr($entry['ip']);
- if($hostname != "") {
+ if ($hostname != "") {
$entry['hostname'] = $hostname;
}
}
@@ -433,8 +433,9 @@ if (count($pools) > 0) {
/* only print pool status when we have one */
}
-if (empty($leases))
+if (empty($leases)) {
print '<div class="alert alert-warning" role="alert">'. gettext("No leases file found. Is the DHCP server active?") .'</div>';
+}
?>
<div class="panel panel-default">
@@ -458,19 +459,21 @@ if (empty($leases))
<tbody>
<?php
foreach ($leases as $data):
- if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
+ if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
continue;
+ }
- if ($data['act'] == 'active')
+ if ($data['act'] == 'active') {
$icon = 'fa-check-circle-o';
- elseif ($data['act'] == 'expired')
+ } elseif ($data['act'] == 'expired') {
$icon = 'fa-ban';
- else
+ } else {
$icon = 'fa-times-circle-o';
+ }
if ($data['act'] == "static") {
foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
- if(is_array($dhcpifconf['staticmap'])) {
+ if (is_array($dhcpifconf['staticmap'])) {
foreach ($dhcpifconf['staticmap'] as $staticent) {
if ($data['ip'] == $staticent['ipaddr']) {
$data['if'] = $dhcpif;
@@ -479,8 +482,9 @@ foreach ($leases as $data):
}
}
/* exit as soon as we have an interface */
- if ($data['if'] != "")
+ if ($data['if'] != "") {
break;
+ }
}
} else {
$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
@@ -497,7 +501,7 @@ foreach ($leases as $data):
<td>
<?=$mac?>
- <? if(isset($mac_man[$mac_hi])):?>
+ <? if (isset($mac_man[$mac_hi])):?>
(<?=$mac_man[$mac_hi]?>)
<?endif?>
</td>
@@ -544,19 +548,21 @@ foreach ($leases as $data):
<tbody>
<?php
foreach ($prefixes as $data):
- if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
+ if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
continue;
+ }
- if ($data['act'] == 'active')
+ if ($data['act'] == 'active') {
$icon = 'fa-check-circle-o';
- elseif ($data['act'] == 'expired')
+ } elseif ($data['act'] == 'expired') {
$icon = 'fa-ban';
- else
+ } else {
$icon = 'fa-times-circle-o';
+ }
if ($data['act'] == "static") {
foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
- if(is_array($dhcpifconf['staticmap'])) {
+ if (is_array($dhcpifconf['staticmap'])) {
foreach ($dhcpifconf['staticmap'] as $staticent) {
if ($data['ip'] == $staticent['ipaddr']) {
$data['if'] = $dhcpif;
@@ -565,8 +571,9 @@ foreach ($prefixes as $data):
}
}
/* exit as soon as we have an interface */
- if ($data['if'] != "")
+ if ($data['if'] != "") {
break;
+ }
}
} else {
$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
diff --git a/src/usr/local/www/status_gateway_groups.php b/src/usr/local/www/status_gateway_groups.php
index 68c29cc..acbce69 100755
--- a/src/usr/local/www/status_gateway_groups.php
+++ b/src/usr/local/www/status_gateway_groups.php
@@ -116,7 +116,7 @@ display_top_tabs($tab_array);
<?php
/* process which priorities we have */
$priorities = array();
- foreach($gateway_group['item'] as $item) {
+ foreach ($gateway_group['item'] as $item) {
$itemsplit = explode("|", $item);
$priorities[$itemsplit[1]] = true;
}
@@ -127,7 +127,7 @@ display_top_tabs($tab_array);
<tr>
<?php
// Make a column for each tier
- foreach($priorities as $number => $tier) {
+ foreach ($priorities as $number => $tier) {
echo "<th>" . sprintf(gettext("Tier %s"), $number) . "</th>";
}
?>
@@ -137,23 +137,23 @@ display_top_tabs($tab_array);
<?php
/* inverse gateway group to gateway priority */
$priority_arr = array();
- foreach($gateway_group['item'] as $item) {
+ foreach ($gateway_group['item'] as $item) {
$itemsplit = explode("|", $item);
$priority_arr[$itemsplit[1]][] = $itemsplit[0];
}
ksort($priority_arr);
$p = 1;
- foreach($priority_arr as $number => $tier) {
+ foreach ($priority_arr as $number => $tier) {
/* for each priority process the gateways */
- foreach($tier as $member) {
+ foreach ($tier as $member) {
/* we always have $priority_count fields */
?>
<tr>
<?php
$c = 1;
- while($c <= $priority_count) {
+ while ($c <= $priority_count) {
$monitor = lookup_gateway_monitor_ip_by_name($member);
- if($p == $c) {
+ if ($p == $c) {
$status = $gateways_status[$monitor]['status'];
if (stristr($status, "down")) {
$online = gettext("Offline");
@@ -172,11 +172,12 @@ display_top_tabs($tab_array);
$bgcolor = LIGHTBLUE;
}
- if(!COLOR)
+ if (!COLOR) {
$bgcolor = WHITE;
+ }
?>
<td bgcolor="<?=$bgcolor?>">
- <?=htmlspecialchars($member);?>,<br /><?=$online?>
+ <?=htmlspecialchars($member);?>,<br/><?=$online?>
</td>
<?php
diff --git a/src/usr/local/www/status_gateways.php b/src/usr/local/www/status_gateways.php
index 82da516..8e3215a 100644
--- a/src/usr/local/www/status_gateways.php
+++ b/src/usr/local/www/status_gateways.php
@@ -115,27 +115,30 @@ display_top_tabs($tab_array);
<?php echo lookup_gateway_ip_by_name($gname);?>
</td>
<td>
-<?php if ($gateways_status[$gname])
+<?php
+ if ($gateways_status[$gname]) {
echo $gateways_status[$gname]['monitorip'];
- else
+ } else {
echo $gateway['monitorip'];
+ }
?>
</td>
<td>
-<?php if ($gateways_status[$gname])
- echo $gateways_status[$gname]['delay'];
- else
- echo gettext("Pending");
+<?php
+ if ($gateways_status[$gname]) {
+ echo $gateways_status[$gname]['delay'];
+ } else {
+ echo gettext("Pending");
+ }
?>
- <?php $counter++; ?>
</td>
<td>
-<?php if ($gateways_status[$gname])
+<?php
+ if ($gateways_status[$gname]) {
echo $gateways_status[$gname]['loss'];
- else
+ } else {
echo gettext("Pending");
-
- $counter++;
+ }
?>
</td>
<?php
@@ -167,13 +170,14 @@ display_top_tabs($tab_array);
$lastchange = $gateways_status[$gname]['lastcheck'];
- if(!COLOR)
+ if (!COLOR) {
$bgcolor = WHITE;
+ }
?>
<td bgcolor="<?=$bgcolor?>">
<strong><?=$online?></strong> <?php
- if(!empty($lastchange)) { ?>
+ if (!empty($lastchange)) { ?>
<br /><i>Last checked <?=$lastchange?></i>
<?php } ?>
</td>
diff --git a/src/usr/local/www/status_graph.php b/src/usr/local/www/status_graph.php
index afe0933..a685adf 100644
--- a/src/usr/local/www/status_graph.php
+++ b/src/usr/local/www/status_graph.php
@@ -86,8 +86,10 @@ if ($_POST['height']) {
// Get configured interface list
$ifdescrs = get_configured_interface_with_descr();
-if (ipsec_enabled())
+if (ipsec_enabled()) {
$ifdescrs['enc0'] = "IPsec";
+}
+
foreach (array('server', 'client') as $mode) {
if (is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
@@ -148,7 +150,7 @@ function iflist() {
return($iflist);
}
-$pgtitle = array(gettext("Status"),gettext("Traffic Graph"));
+$pgtitle = array(gettext("Status"), gettext("Traffic Graph"));
include("head.inc");
@@ -207,7 +209,7 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-function updateBandwidth(){
+function updateBandwidth() {
$.ajax(
'/bandwidth_by_ip.php',
{
@@ -219,7 +221,7 @@ function updateBandwidth(){
$('#top10-hosts').empty();
//parse top ten bandwidth abuser hosts
- for (var y=0; y<10; y++){
+ for (var y=0; y<10; y++) {
if ((y < hosts_split.length) && (hosts_split[y] != "") && (hosts_split[y] != "no info")) {
hostinfo = hosts_split[y].split(";");
@@ -234,8 +236,8 @@ function updateBandwidth(){
});
}
-events.push(function(){
- $('form.auto-submit').on('change', function(){
+events.push(function() {
+ $('form.auto-submit').on('change', function() {
$(this).submit();
});
@@ -248,8 +250,9 @@ events.push(function(){
<?php
/* link the ipsec interface magically */
-if (ipsec_enabled())
+if (ipsec_enabled()) {
$ifdescrs['enc0'] = "IPsec";
+}
?>
<div class="panel panel-default">
@@ -270,7 +273,7 @@ if (ipsec_enabled())
<table class="table table-striped table-condensed">
<thead>
<tr>
- <th><?=(($curhostipformat=="") ? gettext("Host IP") : gettext("Host Name or IP")); ?></th>
+ <th><?=(($curhostipformat == "") ? gettext("Host IP") : gettext("Host Name or IP")); ?></th>
<th><?=gettext("Bandwidth In"); ?></th>
<th><?=gettext("Bandwidth Out"); ?></th>
</tr>
diff --git a/src/usr/local/www/status_interfaces.php b/src/usr/local/www/status_interfaces.php
index 4d0fe5a..7c12c2b 100644
--- a/src/usr/local/www/status_interfaces.php
+++ b/src/usr/local/www/status_interfaces.php
@@ -90,7 +90,7 @@ $formtemplate = '<form name="%s" action="status_interfaces.php" method="post">'
// Display a term/definition pair
function showDef($show, $term, $def) {
- if($show) {
+ if ($show) {
print('<dt>' . $term . '</dt>');
print('<dd>' . htmlspecialchars($def) . '</dd>');
}
@@ -100,7 +100,7 @@ function showDef($show, $term, $def) {
function showDefBtn($show, $term, $def, $ifval, $btnlbl) {
global $formtemplate;
- if($show) {
+ if ($show) {
print('<dt>' . $term . '</dt>');
print('<dd>');
printf($formtemplate, $term, $ifval, $show, htmlspecialchars($def) . ' ', $btnlbl);
@@ -108,7 +108,7 @@ function showDefBtn($show, $term, $def, $ifval, $btnlbl) {
}
}
-$pgtitle = array(gettext("Status"),gettext("Interfaces"));
+$pgtitle = array(gettext("Status"), gettext("Interfaces"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -160,7 +160,7 @@ foreach ($ifdescrs as $ifdescr => $ifname):
if ($ifdescr == "wan" && file_exists("{$g['varetc_path']}/resolv.conf")) {
$dns_servers = get_dns_servers();
$dnscnt = 0;
- foreach($dns_servers as $dns) {
+ foreach ($dns_servers as $dns) {
showDef(true, $dnscnt == 0 ? gettext('ISP DNS servers'):'', $dns);
$dnscnt++;
}
@@ -170,22 +170,22 @@ foreach ($ifdescrs as $ifdescr => $ifname):
showDef($ifinfo['mtu'], gettext("MTU"), $ifinfo['mtu']);
showDef($ifinfo['media'], gettext("Media"), $ifinfo['media']);
showDef($ifinfo['laggproto'], gettext("LAGG Protocol"), $ifinfo['laggproto']);
- showDef($ifinfo['laggport'],gettext("LAGG Ports"),$laggport);
- showDef($ifinfo['channel'],gettext("Channel"),$ifinfo['channel']);
- showDef($ifinfo['ssid'],gettext("SSID"),$ifinfo['ssid']);
- showDef($ifinfo['bssid'],gettext("BSSID"),$ifinfo['bssid']);
- showDef($ifinfo['rate'],gettext("Rate"),$ifinfo['rate']);
- showDef($ifinfo['rssi'],gettext("RSSI"),$ifinfo['rssi']);
- showDef(true,gettext("In/out packets"),$ifinfo['inpkts'] . '/' . $ifinfo['outpkts']);
- showDef(true,gettext("In/out packets (pass)"),$ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass']);
- showDef(true,gettext("In/out packets (block)"),$ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock']);
- showDef(isset($ifinfo['inerrs']),gettext("In/out errors"),$ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);
- showDef(isset($ifinfo['collisions']),gettext("Collisions"),$ifinfo['collisions']);
+ showDef($ifinfo['laggport'], gettext("LAGG Ports"), $laggport);
+ showDef($ifinfo['channel'], gettext("Channel"), $ifinfo['channel']);
+ showDef($ifinfo['ssid'], gettext("SSID"), $ifinfo['ssid']);
+ showDef($ifinfo['bssid'], gettext("BSSID"), $ifinfo['bssid']);
+ showDef($ifinfo['rate'], gettext("Rate"), $ifinfo['rate']);
+ showDef($ifinfo['rssi'], gettext("RSSI"), $ifinfo['rssi']);
+ showDef(true, gettext("In/out packets"), $ifinfo['inpkts'] . '/' . $ifinfo['outpkts']);
+ showDef(true, gettext("In/out packets (pass)"), $ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass']);
+ showDef(true, gettext("In/out packets (block)"), $ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock']);
+ showDef(isset($ifinfo['inerrs']), gettext("In/out errors"), $ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);
+ showDef(isset($ifinfo['collisions']), gettext("Collisions"), $ifinfo['collisions']);
} // e-o-if ($ifinfo['status'] != "down")
showDef($ifinfo['bridge'], gettext('Bridge (') . $ifinfo['bridgeint'] . ')', $ifinfo['bridge']);
- if(file_exists("/usr/bin/vmstat")) {
+ if (file_exists("/usr/bin/vmstat")) {
$real_interface = "";
$interrupt_total = "";
$interrupt_sec = "";
@@ -193,7 +193,7 @@ foreach ($ifdescrs as $ifdescr => $ifname):
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $3 }'`;
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
- if(strstr($interrupt_total, "hci")) {
+ if (strstr($interrupt_total, "hci")) {
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $5 }'`;
}
diff --git a/src/usr/local/www/status_ipsec.php b/src/usr/local/www/status_ipsec.php
index c78d3fb..f9b8461 100644
--- a/src/usr/local/www/status_ipsec.php
+++ b/src/usr/local/www/status_ipsec.php
@@ -356,8 +356,8 @@ if (is_array($status)) {
<td>
<?php
print(gettext("Rekey: ") . htmlspecialchars($childsa['rekey-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['rekey-time']) . ")");
- print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")" );
- print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")" );
+ print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")");
+ print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")");
?>
</td>
@@ -435,38 +435,42 @@ foreach ($a_phase1 as $ph1ent) {
<td>
<?php
list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
- if (empty($myid_data))
+ if (empty($myid_data)) {
print(gettext("Unknown"));
- else
+ } else {
print(htmlspecialchars($myid_data));
+ }
?>
</td>
<td>
<?php
$ph1src = ipsec_get_phase1_src($ph1ent);
- if (empty($ph1src))
+ if (empty($ph1src)) {
print(gettext("Unknown"));
- else
+ } else {
print(htmlspecialchars($ph1src));
+ }
?>
</td>
<td>
<?php
list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
- if (empty($peerid_data))
+ if (empty($peerid_data)) {
print(gettext("Unknown"));
- else
+ } else {
print(htmlspecialchars($peerid_data));
+ }
?>
</td>
<td>
<?php
$ph1src = ipsec_get_phase1_dst($ph1ent);
- if (empty($ph1src))
+ if (empty($ph1src)) {
print(gettext("Unknown"));
- else
+ } else {
print(htmlspecialchars($ph1src));
+ }
?>
</td>
<td>
diff --git a/src/usr/local/www/status_ipsec_leases.php b/src/usr/local/www/status_ipsec_leases.php
index 7fee324..fea56a5 100644
--- a/src/usr/local/www/status_ipsec_leases.php
+++ b/src/usr/local/www/status_ipsec_leases.php
@@ -141,8 +141,7 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) {
<?php
}
- }
- else {
+ } else {
?>
<td colspan="3" class="warning"><?=gettext('No leases from this pool yet.')?></td>
</tr>
@@ -154,9 +153,9 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) {
</table>
</div>
<?php
-}
-else
+} else {
print_info_box(gettext('No IPsec pools.'));
+}
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
diff --git a/src/usr/local/www/status_ipsec_sad.php b/src/usr/local/www/status_ipsec_sad.php
index fa2b8d6..b856ce5 100644
--- a/src/usr/local/www/status_ipsec_sad.php
+++ b/src/usr/local/www/status_ipsec_sad.php
@@ -150,9 +150,9 @@ if (count($sad)) {
</table>
</div>
<?php
- }
-else
+} else {
print_info_box(gettext('No IPsec security associations.'));
+}
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
diff --git a/src/usr/local/www/status_ipsec_spd.php b/src/usr/local/www/status_ipsec_spd.php
index 464408b..613b2c3 100644
--- a/src/usr/local/www/status_ipsec_spd.php
+++ b/src/usr/local/www/status_ipsec_spd.php
@@ -104,10 +104,11 @@ if (count($spd)) {
<tbody>
<?php
foreach ($spd as $sp) {
- if ($sp['dir'] == 'in')
+ if ($sp['dir'] == 'in') {
$dirstr = LEFTARROW . ' Inbound';
- else
+ } else {
$dirstr = RIGHTARROW . ' Outbound';
+ }
?>
<tr>
<td>
@@ -133,8 +134,7 @@ if (count($spd)) {
</table>
</div>
<?php
- } // e-o-if (count($spd))
-else {
+} else {
print_info_box(gettext('No IPsec security policies configured.'));
}
diff --git a/src/usr/local/www/status_lb_pool.php b/src/usr/local/www/status_lb_pool.php
index c14d6eb..f117343 100644
--- a/src/usr/local/www/status_lb_pool.php
+++ b/src/usr/local/www/status_lb_pool.php
@@ -90,8 +90,9 @@ $lb_logfile = "{$g['varlog_path']}/relayd.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
$now = time();
$year = date("Y");
@@ -146,8 +147,9 @@ if ($_POST) {
}
}
-if (is_subsystem_dirty('loadbalancer'))
+if (is_subsystem_dirty('loadbalancer')) {
print_info_box_np('The load balancer configuration has been changed You must apply the changes in order for them to take effect.');
+}
/* active tabs */
$tab_array = array();
@@ -183,7 +185,7 @@ foreach ($a_pool as $pool):
</td>
<td>
<?php
- switch($pool['mode']) {
+ switch ($pool['mode']) {
case "loadbalance":
echo "Load balancing";
break;
@@ -217,7 +219,7 @@ foreach ($a_pool as $pool):
asort($pool_hosts);
foreach ((array) $pool_hosts as $server) {
- if($server['ip']['addr']!="") {
+ if ($server['ip']['addr'] != "") {
switch ($server['ip']['state']) {
case 'up':
$bgcolor = LIGHTGREEN; // lightgreen
@@ -245,8 +247,9 @@ foreach ($a_pool as $pool):
print("<td bgcolor=\"{$bgcolor}\">&nbsp;{$server['ip']['addr']}:{$pool['port']}&nbsp;</td><td bgcolor=\"{$bgcolor}\">&nbsp;");
- if($server['ip']['avail'])
+ if ($server['ip']['avail']) {
print(" ({$server['ip']['avail']}) ");
+ }
?>
</td>
</tr>
@@ -273,7 +276,7 @@ endforeach;
</form>
<?php
-if($rowsprinted > 0) {
+if ($rowsprinted > 0) {
?>
<nav class="action-buttons">
<button name="Submit" type="submit" class="btn btn-primary btn-sm" value="<?= gettext("Save"); ?>" >
diff --git a/src/usr/local/www/status_lb_vs.php b/src/usr/local/www/status_lb_vs.php
index 4f1ab0d..7a25bea 100644
--- a/src/usr/local/www/status_lb_vs.php
+++ b/src/usr/local/www/status_lb_vs.php
@@ -94,9 +94,9 @@ $tab_array[] = array(gettext("Pools"), false, "status_lb_pool.php");
$tab_array[] = array(gettext("Virtual Servers"), true, "status_lb_vs.php");
display_top_tabs($tab_array);
-if(empty($a_vs))
+if (empty($a_vs)) {
print('<div class="alert alert-danger">No load balancers have been configured!</div>');
-else {
+} else {
?>
<div class="table-responsive"></div>
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
@@ -148,8 +148,9 @@ else {
$rdr_a[$vsent['name']]['status'] = 'Unknown - relayd not running?';
}
- if(!COLOR)
+ if (!COLOR) {
$bgcolor = WHITE;
+ }
?>
<td bgcolor="<?=$bgcolor?>">
<?=$rdr_a[$vsent['name']]['status']?>
diff --git a/src/usr/local/www/status_logs.php b/src/usr/local/www/status_logs.php
index 58cbe34..5e52393 100755
--- a/src/usr/local/www/status_logs.php
+++ b/src/usr/local/www/status_logs.php
@@ -243,11 +243,9 @@ if ($save_settings) {
# Formatted/Raw Display
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
$rawfilter = false;
-}
-else if ($config['syslog'][$specific_log]['format'] == 'raw') {
+} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
$rawfilter = true;
-}
-else { # Use the general logging options setting (global).
+} else { # Use the general logging options setting (global).
$rawfilter = isset($config['syslog']['rawfilter']);
}
@@ -309,10 +307,11 @@ if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wirel
display_top_tabs($tab_array, false, 'nav nav-tabs');
}
-if ($filter_active)
+if ($filter_active) {
$filter_state = SEC_OPEN;
-else
+} else {
$filter_state = SEC_CLOSED;
+}
if (!$rawfilter) { // Advanced log filter form
$form = new Form(false);
@@ -367,8 +366,7 @@ if (!$rawfilter) { // Advanced log filter form
null,
'fa-filter'
);
-}
-else { // Simple log filter form
+} else { // Simple log filter form
$form = new Form(false);
$section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
@@ -412,20 +410,22 @@ print $form;
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
- if ($filterlogentries_submit)
+ if ($filterlogentries_submit) {
$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filterfieldsarray);
- else
+ } else {
$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filtertext);
+ }
?>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ((!$filtertext) && (!$filterfieldsarray))
+ if ((!$filtertext) && (!$filterfieldsarray)) {
printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- else
+ } else {
printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+ }
printf(" (" . gettext("Maximum %d") . ")", $nentries);
?>
@@ -466,16 +466,15 @@ if (!$rawfilter) {
</tbody>
</table>
<?php
- if (count($filterlog) == 0)
+ if (count($filterlog) == 0) {
print_info_box(gettext('No logs to display'));
+ }
?>
</div>
</div>
</div>
<?php
-}
-else
-{
+} else {
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
@@ -489,21 +488,24 @@ else
</thead>
<tbody>
<?php
- if (($logfile == 'resolver') || ($logfile == 'system'))
+ if (($logfile == 'resolver') || ($logfile == 'system')) {
$inverse = array("ppp");
- else
+ } else {
$inverse = null;
+ }
- if ($filtertext)
+ if ($filtertext) {
$rows = dump_clog($system_logfile, $nentries, true, array("$filtertext"), $inverse);
- else
+ } else {
$rows = dump_clog($system_logfile, $nentries, true, array(), $inverse);
+ }
?>
</tbody>
</table>
<?php
- if ($rows == 0)
+ if ($rows == 0) {
print_info_box(gettext('No logs to display'));
+ }
?>
</div>
</div>
@@ -519,10 +521,11 @@ if ($input_errors) {
$manage_log_active = true;
}
-if ($manage_log_active)
+if ($manage_log_active) {
$manage_log_state = SEC_OPEN;
-else
+} else {
$manage_log_state = SEC_CLOSED;
+}
$form = new Form(false);
diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php
index 3600e25..9194c10 100644
--- a/src/usr/local/www/status_logs_filter.php
+++ b/src/usr/local/www/status_logs_filter.php
@@ -281,9 +281,9 @@ if ($save_settings) {
# Firewall Specific
if ($logfile == 'filter') {
if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) ||
- ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
- ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
- ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
+ ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
+ ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
+ ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
require_once("filter.inc");
$retval |= filter_configure();
@@ -297,11 +297,9 @@ if ($save_settings) {
# Formatted/Raw Display
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
$rawfilter = false;
-}
-else if ($config['syslog'][$specific_log]['format'] == 'raw') {
+} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
$rawfilter = true;
-}
-else { # Use the general logging options setting (global).
+} else { # Use the general logging options setting (global).
$rawfilter = isset($config['syslog']['rawfilter']);
}
@@ -341,30 +339,36 @@ function build_if_list() {
//$iflist = get_interface_list();
// Allow extending of the firewall edit interfaces
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
- foreach ($iflist as $if => $ifdesc)
+ foreach ($iflist as $if => $ifdesc) {
$interfaces[$if] = $ifdesc;
+ }
- if ($config['l2tp']['mode'] == "server")
+ if ($config['l2tp']['mode'] == "server") {
$interfaces['l2tp'] = "L2TP VPN";
+ }
- if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+ }
/* add ipsec interfaces */
- if (ipsec_enabled())
+ if (ipsec_enabled()) {
$interfaces["enc0"] = "IPsec";
+ }
/* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+ }
return($interfaces);
}
$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
-if ($filterfieldsarray['interface'] == "All")
- $interface = "";
+if ($filterfieldsarray['interface'] == "All") {
+ $interface = "";
+}
$tab_array = array();
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
@@ -386,10 +390,11 @@ $tab_array[] = array(gettext("Dynamic View"), false, "/status_logs_filter_dynami
$tab_array[] = array(gettext("Summary View"), false, "/status_logs_filter_summary.php");
display_top_tabs($tab_array, false, 'nav nav-tabs');
-if ($filter_active)
+if ($filter_active) {
$filter_state = SEC_OPEN;
-else
+} else {
$filter_state = SEC_CLOSED;
+}
if (!$rawfilter) { // Advanced log filter form
$form = new Form(false);
@@ -491,8 +496,7 @@ if (!$rawfilter) { // Advanced log filter form
null,
'fa-filter'
);
-}
-else { // Simple log filter form
+} else { // Simple log filter form
$form = new Form(false);
$section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
@@ -549,23 +553,26 @@ print($form);
if (!$rawfilter) {
$iflist = get_configured_interface_with_descr(false, true);
- if ($iflist[$interfacefilter])
+ if ($iflist[$interfacefilter]) {
$interfacefilter = $iflist[$interfacefilter];
+ }
- if ($filterlogentries_submit)
+ if ($filterlogentries_submit) {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
- else
+ } else {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
+ }
?>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ((!$filtertext) && (!$filterfieldsarray))
+ if ((!$filtertext) && (!$filterfieldsarray)) {
printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- else
+ } else {
printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+ }
printf(" (" . gettext("Maximum %d") . ")", $nentries);
?>
@@ -595,8 +602,9 @@ if (!$rawfilter) {
</thead>
<tbody>
<?php
- if ($config['syslog']['filterdescriptions'])
+ if ($config['syslog']['filterdescriptions']) {
buffer_rules_load();
+ }
foreach ($filterlog as $filterent) {
?>
@@ -611,8 +619,9 @@ if (!$rawfilter) {
?>
<i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
<?php
- if ($filterent['count'])
+ if ($filterent['count']) {
echo $filterent['count'];
+ }
?>
</td>
<td style="white-space:nowrap;">
@@ -620,8 +629,9 @@ if (!$rawfilter) {
</td>
<td style="white-space:nowrap;">
<?php
- if ($filterent['direction'] == "out")
+ if ($filterent['direction'] == "out") {
print('&#x25ba;' . ' ');
+ }
?>
<?=htmlspecialchars($filterent['interface'])?>
</td>
@@ -668,8 +678,9 @@ if (!$rawfilter) {
<?=$dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>'?>
</td>
<?php
- if ($filterent['proto'] == "TCP")
+ if ($filterent['proto'] == "TCP") {
$filterent['proto'] .= ":{$filterent['tcpflags']}";
+ }
?>
<td style="white-space:nowrap;">
<?=htmlspecialchars($filterent['proto'])?>
@@ -680,7 +691,7 @@ if (!$rawfilter) {
?>
<tr>
<td colspan="2" />
- <td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])?></td>
+ <td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?></td>
</tr>
<?php
}
@@ -690,17 +701,16 @@ if (!$rawfilter) {
</tbody>
</table>
<?php
- if (count($filterlog) == 0)
+ if (count($filterlog) == 0) {
print_info_box(gettext('No logs to display'));
+ }
?>
</div>
</div>
</div>
<?php
-}
-else
-{
+} else {
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
@@ -714,16 +724,18 @@ else
</thead>
<tbody>
<?php
- if ($filtertext)
+ if ($filtertext) {
$rows = dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
- else
+ } else {
$rows = dump_clog($filter_logfile, $nentries, true, array());
+ }
?>
</tbody>
</table>
<?php
- if ($rows == 0)
+ if ($rows == 0) {
print_info_box(gettext('No logs to display'));
+ }
?>
</div>
</div>
@@ -750,10 +762,11 @@ if ($input_errors) {
$manage_log_active = true;
}
-if ($manage_log_active)
+if ($manage_log_active) {
$manage_log_state = SEC_OPEN;
-else
+} else {
$manage_log_state = SEC_CLOSED;
+}
$form = new Form(false);
@@ -1018,7 +1031,7 @@ if (typeof getURL == 'undefined') {
};
}
-events.push(function(){
+events.push(function() {
$('.fa').tooltip();
});
//]]>
diff --git a/src/usr/local/www/status_logs_filter_dynamic.php b/src/usr/local/www/status_logs_filter_dynamic.php
index 63771f5..10d54b1 100755
--- a/src/usr/local/www/status_logs_filter_dynamic.php
+++ b/src/usr/local/www/status_logs_filter_dynamic.php
@@ -180,17 +180,20 @@ function outputrule(req) {
}
function fetch_new_rules() {
- if(isPaused)
+ if (isPaused) {
return;
- if(isBusy)
+ }
+ if (isBusy) {
return;
+ }
isBusy = true;
getURL('status_logs_filter_dynamic.php?lastsawtime=' + lastsawtime, fetch_new_rules_callback);
}
function fetch_new_rules_callback(callback_data) {
- if(isPaused)
+ if (isPaused) {
return;
+ }
var data_split;
var new_data_to_add = Array();
@@ -198,15 +201,16 @@ function fetch_new_rules_callback(callback_data) {
data_split = data.split("\n");
- for(var x=0; x<data_split.length-1; x++) {
+ for (var x=0; x<data_split.length-1; x++) {
/* loop through rows */
row_split = data_split[x].split("||");
lastsawtime = row_split[9];
var tmp = format_log_line(row_split);
- if ( !(tmp) )
+ if (!(tmp)) {
continue;
+ }
new_data_to_add[new_data_to_add.length] = tmp;
}
@@ -226,8 +230,9 @@ function in_arrayi(needle, haystack) {
}
function update_table_rows(data) {
- if(isPaused)
+ if (isPaused) {
return;
+ }
var isIE = navigator.appName.indexOf('Microsoft') != -1;
var isSafari = navigator.userAgent.indexOf('Safari') != -1;
@@ -251,8 +256,9 @@ function update_table_rows(data) {
// Number of rows to move by
var move = rows.length + data.length - nentries;
- if (move < 0)
+ if (move < 0) {
move = 0;
+ }
if (isReverse == false) {
for (var i = move; i < rows.length; i++) {
@@ -296,7 +302,7 @@ function update_table_rows(data) {
}
function toggle_pause() {
- if(isPaused) {
+ if (isPaused) {
isPaused = false;
fetch_new_rules();
} else {
@@ -308,7 +314,7 @@ if (typeof updateDelay != 'undefined') {
timer = setInterval('fetch_new_rules()', updateDelay);
}
-function toggleListDescriptions(){
+function toggleListDescriptions() {
var ss = document.styleSheets;
for (var i=0; i<ss.length; i++) {
var rules = ss[i].cssRules || ss[i].rules;
@@ -380,24 +386,26 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
$dstIP = htmlspecialchars($filterent['dstip']);
}
- if ($filterent['srcport'])
+ if ($filterent['srcport']) {
$srcPort = ":" . htmlspecialchars($filterent['srcport']);
- else
+ } else {
$srcPort = "";
+ }
- if ($filterent['dstport'])
+ if ($filterent['dstport']) {
$dstPort = ":" . htmlspecialchars($filterent['dstport']);
- else
+ } else {
$dstPort = "";
+ }
?>
<tr>
<td>
<?php
- if ($filterent['act'] == "block") {
- $icon_act = "fa-times text-danger";
- } else {
- $icon_act = "fa-check text-success";
- }
+ if ($filterent['act'] == "block") {
+ $icon_act = "fa-times text-danger";
+ } else {
+ $icon_act = "fa-check text-success";
+ }
?>
<i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
</td>
@@ -423,15 +431,16 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
</div>
<?php
-if ($tcpcnt > 0)
+if ($tcpcnt > 0) {
print_info_box('<a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">' .
gettext("TCP Flags") . '</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR');
+}
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $(document).ready(function(){
+events.push(function() {
+ $(document).ready(function() {
$('.fa').tooltip();
});
});
diff --git a/src/usr/local/www/status_logs_filter_summary.php b/src/usr/local/www/status_logs_filter_summary.php
index a460577..2b8f42d 100644
--- a/src/usr/local/www/status_logs_filter_summary.php
+++ b/src/usr/local/www/status_logs_filter_summary.php
@@ -125,8 +125,9 @@ function stat_block($summary, $stat, $num) {
}
}
- if (!is_ipaddr($outstr))
+ if (!is_ipaddr($outstr)) {
print('<tr><td>' . $outstr . '</td><td>' . $summary[$stat][$k[$i]] . '</td><td></td></tr>');
+ }
}
}
$leftover = $gotlines - $total;
@@ -182,8 +183,9 @@ var pie = new d3pie("pieChart<?=$chartnum?>", {
if ($k[$i]) {
$total += $summary[$stat][$k[$i]];
$numentries++;
- if ($i > 0)
+ if ($i > 0) {
print(",\r\n");
+ }
print("{");
print('"label": "' . $k[$i] . '", "value": ');
diff --git a/src/usr/local/www/status_logs_settings.php b/src/usr/local/www/status_logs_settings.php
index 0152471..95ba3b1 100644
--- a/src/usr/local/www/status_logs_settings.php
+++ b/src/usr/local/www/status_logs_settings.php
@@ -190,9 +190,9 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
$retval = 0;
$retval = system_syslogd_start();
if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) ||
- ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
- ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
- ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
+ ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
+ ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
+ ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
$retval |= filter_configure();
}
@@ -224,10 +224,11 @@ $remoteloghelp = gettext("This option will allow the logging daemon to bind to a
gettext("If you pick a single IP, remote syslog servers must all be of that IP type. If you wish to mix IPv4 and IPv6 remote syslog servers, you must bind to all interfaces.") .
"<br /><br />" .
gettext("NOTE: If an IP address cannot be located on the chosen interface, the daemon will bind to all addresses.");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else if ($savemsg)
+} else if ($savemsg) {
print_info_box($savemsg);
+}
$tab_array = array();
$tab_array[] = array(gettext("System"), false, "status_logs.php");
@@ -481,7 +482,7 @@ print $form;
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
hideMultiCheckbox('notoggleall', true);
diff --git a/src/usr/local/www/status_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php
index 8a9ada0..648fccc 100644
--- a/src/usr/local/www/status_logs_vpn.php
+++ b/src/usr/local/www/status_logs_vpn.php
@@ -202,31 +202,32 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
<?php
$rows = dump_clog_vpn("/var/log/vpn.log", $nentries); // dump_clog_vpn provides all the need <td></td>/<tr></tr> tags
?>
- </tbody>
- </table>
+ </tbody>
+ </table>
<?php
- if ($rows == 0)
+ if ($rows == 0) {
print_info_box('No logs to display');
+ }
?>
</div>
<?php
- }
- else {
+ } else {
?>
<pre>
<?php
- if (dump_clog_no_table("/var/log/{$logname}.log", $nentries) == 0)
+ if (dump_clog_no_table("/var/log/{$logname}.log", $nentries) == 0) {
print('No logs to display');
+ }
?>
</pre>
<?php
}
?>
- <form action="status_logs_vpn.php" method="post">
- <input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype?>" />
- <input type="hidden" name="mode" id="mode" value="<?=$mode?>" />
- <input name="clear" type="submit" class="btn btn-danger" value="<?=gettext("Clear log")?>" />
- </form>
+ <form action="status_logs_vpn.php" method="post">
+ <input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype?>" />
+ <input type="hidden" name="mode" id="mode" value="<?=$mode?>" />
+ <input name="clear" type="submit" class="btn btn-danger" value="<?=gettext("Clear log")?>" />
+ </form>
<p>
</p>
</div>
diff --git a/src/usr/local/www/status_openvpn.php b/src/usr/local/www/status_openvpn.php
index 6cd30b7..36f1008 100644
--- a/src/usr/local/www/status_openvpn.php
+++ b/src/usr/local/www/status_openvpn.php
@@ -73,8 +73,8 @@ require_once("shortcuts.inc");
require_once("service-utils.inc");
/* Handle AJAX */
-if($_GET['action']) {
- if($_GET['action'] == "kill") {
+if ($_GET['action']) {
+ if ($_GET['action'] == "kill") {
$port = $_GET['port'];
$remipp = $_GET['remipp'];
if (!empty($port) and !empty($remipp)) {
@@ -152,7 +152,7 @@ include("head.inc"); ?>
function killComplete(req) {
var values = req.responseText.split("|");
- if(values[3] != "0") {
+ if (values[3] != "0") {
alert('<?=gettext("An error occurred.");?>' + ' (' + values[3] + ')');
return;
}
diff --git a/src/usr/local/www/status_pkglogs.php b/src/usr/local/www/status_pkglogs.php
index 23385d2..cdff974 100755
--- a/src/usr/local/www/status_pkglogs.php
+++ b/src/usr/local/www/status_pkglogs.php
@@ -114,8 +114,9 @@ if ($pkgwithlogging == false) {
$tab_array = array();
foreach ($config['installedpackages']['package'] as $package) {
if (is_array($package['logging'])) {
- if (!($logtab = $package['logging']['logtab']))
+ if (!($logtab = $package['logging']['logtab'])) {
$logtab = $package['name'];
+ }
if ($apkg == $package['name']) {
$curtab = $logtab;
diff --git a/src/usr/local/www/status_rrd_graph.php b/src/usr/local/www/status_rrd_graph.php
index 666c70b..ae4fccc 100644
--- a/src/usr/local/www/status_rrd_graph.php
+++ b/src/usr/local/www/status_rrd_graph.php
@@ -96,10 +96,11 @@ if ($_POST['cat']) {
$curcat = htmlspecialchars($_POST['cat']);
}
-if ($_GET['zone'])
+if ($_GET['zone']) {
$curzone = $_GET['zone'];
-else
+} else {
$curzone = '';
+}
if ($_POST['period']) {
$curperiod = $_POST['period'];
@@ -114,7 +115,7 @@ if ($_POST['period']) {
if ($_POST['style']) {
$curstyle = $_POST['style'];
} else {
- if(! empty($config['rrd']['style'])) {
+ if (!empty($config['rrd']['style'])) {
$curstyle = $config['rrd']['style'];
} else {
$curstyle = "absolute";
@@ -124,7 +125,7 @@ if ($_POST['style']) {
if ($_POST['option']) {
$curoption = $_POST['option'];
} else {
- switch($curcat) {
+ switch ($curcat) {
case "system":
$curoption = "processor";
break;
@@ -425,7 +426,7 @@ function get_dates($curperiod, $graph) {
}
function make_tabs() {
- global $curcat, $queues,$wireless,$cellular,$vpnusers, $captiveportal,$dhcpd, $ntpd;
+ global $curcat, $queues, $wireless, $cellular, $vpnusers, $captiveportal, $dhcpd, $ntpd;
$tab_array = array();
$tab_array[] = array(gettext("System"), ($curcat == "system"), "status_rrd_graph.php?cat=system");
@@ -434,32 +435,32 @@ function make_tabs() {
$tab_array[] = array(gettext("Quality"), ($curcat == "quality"), "status_rrd_graph.php?cat=quality");
- if($queues) {
+ if ($queues) {
$tab_array[] = array(gettext("Queues"), ($curcat == "queues"), "status_rrd_graph.php?cat=queues");
$tab_array[] = array(gettext("QueueDrops"), ($curcat == "queuedrops"), "status_rrd_graph.php?cat=queuedrops");
}
- if($wireless) {
+ if ($wireless) {
$tab_array[] = array(gettext("Wireless"), ($curcat == "wireless"), "status_rrd_graph.php?cat=wireless");
}
- if($cellular) {
+ if ($cellular) {
$tab_array[] = array(gettext("Cellular"), ($curcat == "cellular"), "status_rrd_graph.php?cat=cellular");
}
- if($vpnusers) {
+ if ($vpnusers) {
$tab_array[] = array(gettext("VPN"), ($curcat == "vpnusers"), "status_rrd_graph.php?cat=vpnusers");
}
- if($captiveportal) {
+ if ($captiveportal) {
$tab_array[] = array(gettext("Captive Portal"), ($curcat == "captiveportal"), "status_rrd_graph.php?cat=captiveportal");
}
- if($ntpd) {
+ if ($ntpd) {
$tab_array[] = array("NTPD", ($curcat == "ntpd"), "status_rrd_graph.php?cat=ntpd");
}
- if($dhcpd) {
+ if ($dhcpd) {
$tab_array[] = array(gettext("DHCP Server"), ($curcat == "dhcpd"), "status_rrd_graph.php?cat=dhcpd");
}
@@ -475,7 +476,7 @@ function build_options() {
$optionslist = array();
- if($curcat == "custom") {
+ if ($curcat == "custom") {
foreach ($custom_databases as $db => $database) {
$optionc = explode("-", $database);
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc[0]));
@@ -491,17 +492,19 @@ function build_options() {
}
foreach ($ui_databases as $db => $database) {
- if(! preg_match("/($curcat)/i", $database))
+ if (!preg_match("/($curcat)/i", $database)) {
continue;
+ }
- if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database))
+ if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database)) {
continue;
+ }
$optionc = explode("-", $database);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
- switch($curcat) {
+ switch ($curcat) {
case "captiveportal":
$optionc = str_replace($search, $replace, $optionc[2]);
$prettyprint = ucwords(str_replace($search, $replace, $optionc));
@@ -516,7 +519,7 @@ function build_options() {
/* Deduce an interface if possible and use the description */
$optionc = "$optionc[0]";
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc));
- if(empty($friendly)) {
+ if (empty($friendly)) {
$friendly = $optionc;
}
$search = array("-", ".rrd", $optionc);
@@ -533,8 +536,9 @@ include("head.inc");
display_top_tabs(make_tabs());
-if ($input_errors && count($input_errors))
+if ($input_errors && count($input_errors)) {
print_input_errors($input_errors);
+}
$form = new Form(false);
@@ -563,12 +567,13 @@ $group->add(new Form_Select(
$periods
))->setHelp('Period');
-if($curcat == 'custom')
+if ($curcat == 'custom') {
$group->setHelp('Any changes to these option may not take affect until the next auto-refresh.');
+}
$section->add($group);
-if($curcat == 'custom') {
+if ($curcat == 'custom') {
$section->addInput(new Form_Input(
'cat',
null,
@@ -597,8 +602,9 @@ if($curcat == 'custom') {
$end_fmt
))->setHelp('End');
- if($curcat != 'custom')
+ if ($curcat != 'custom') {
$group->setHelp('Any changes to these option may not take affect until the next auto-refresh');
+ }
$section->add($group);
@@ -607,7 +613,7 @@ if($curcat == 'custom') {
$curdatabase = $curoption;
$graph = "custom-$curdatabase";
- if(in_array($curdatabase, $custom_databases)) {
+ if (in_array($curdatabase, $custom_databases)) {
$id = "{$graph}-{$curoption}-{$curdatabase}";
$id = preg_replace('/\./', '_', $id);
?>
@@ -621,33 +627,36 @@ if($curcat == 'custom') {
$form->add($section);
print($form);
- foreach($graphs as $graph) {
+ foreach ($graphs as $graph) {
/* check which databases are valid for our category */
- foreach($ui_databases as $curdatabase) {
- if(! preg_match("/($curcat)/i", $curdatabase))
+ foreach ($ui_databases as $curdatabase) {
+ if (!preg_match("/($curcat)/i", $curdatabase)) {
continue;
+ }
- if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase))
+ if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase)) {
continue;
+ }
$optionc = explode("-", $curdatabase);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
- switch($curoption) {
+ switch ($curoption) {
case "outbound":
/* make sure we do not show the placeholder databases in the outbound view */
- if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
/* only show interfaces with a gateway */
$optionc = "$optionc[0]";
- if(!interface_has_gateway($optionc)) {
- if(!isset($gateways_arr)) {
- if(preg_match("/quality/i", $curdatabase))
+ if (!interface_has_gateway($optionc)) {
+ if (!isset($gateways_arr)) {
+ if (preg_match("/quality/i", $curdatabase)) {
$gateways_arr = return_gateways_array();
- else
+ } else {
$gateways_arr = array();
+ }
}
$found_gateway = false;
foreach ($gateways_arr as $gw) {
@@ -656,29 +665,29 @@ if($curcat == 'custom') {
break;
}
}
- if(!$found_gateway) {
+ if (!$found_gateway) {
continue 2;
}
}
- if(! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
case "allgraphs":
/* make sure we do not show the placeholder databases in the all view */
- if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
break;
default:
/* just use the name here */
- if(! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
- if(in_array($curdatabase, $ui_databases)) {
+ if (in_array($curdatabase, $ui_databases)) {
$id = "{$graph}-{$curoption}-{$curdatabase}";
$id = preg_replace('/\./', '_', $id);
@@ -703,29 +712,31 @@ if($curcat == 'custom') {
//alert('updating');
var randomid = Math.floor(Math.random()*11);
<?php
- foreach($graphs as $graph) {
+ foreach ($graphs as $graph) {
/* check which databases are valid for our category */
- foreach($ui_databases as $curdatabase) {
- if(! stristr($curdatabase, $curcat)) {
+ foreach ($ui_databases as $curdatabase) {
+ if (!stristr($curdatabase, $curcat)) {
continue;
}
$optionc = explode("-", $curdatabase);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
- switch($curoption) {
+ switch ($curoption) {
case "outbound":
/* make sure we do not show the placeholder databases in the outbound view */
- if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
/* only show interfaces with a gateway */
$optionc = "$optionc[0]";
- if(!interface_has_gateway($optionc)) {
- if(!isset($gateways_arr))
- if(preg_match("/quality/i", $curdatabase))
+ if (!interface_has_gateway($optionc)) {
+ if (!isset($gateways_arr)) {
+ if (preg_match("/quality/i", $curdatabase)) {
$gateways_arr = return_gateways_array();
- else
+ } else {
$gateways_arr = array();
+ }
+ }
$found_gateway = false;
foreach ($gateways_arr as $gw) {
if ($gw['name'] == $optionc) {
@@ -733,29 +744,29 @@ if($curcat == 'custom') {
break;
}
}
- if(!$found_gateway) {
+ if (!$found_gateway) {
continue 2;
}
}
- if(! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
case "allgraphs":
/* make sure we do not show the placeholder databases in the all view */
- if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
break;
default:
/* just use the name here */
- if(! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
$dates = get_dates($curperiod, $graph);
$start = $dates['start'];
- if($curperiod == "current") {
+ if ($curperiod == "current") {
$end = $dates['end'];
}
/* generate update events utilizing jQuery('') feature */
@@ -775,8 +786,8 @@ if($curcat == 'custom') {
<script>
//<![CDATA[
-events.push(function(){
- $('#option, #style, #period').on('change', function(){
+events.push(function() {
+ $('#option, #style, #period').on('change', function() {
$(this).parents('form').submit();
});
});
diff --git a/src/usr/local/www/status_rrd_graph_img.php b/src/usr/local/www/status_rrd_graph_img.php
index b5995ae..772c289 100644
--- a/src/usr/local/www/status_rrd_graph_img.php
+++ b/src/usr/local/www/status_rrd_graph_img.php
@@ -1270,7 +1270,7 @@ if ((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdataba
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
} else {
$data = false;
- log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase));
+ log_error(sprintf(gettext("Sorry we do not have data to graph for %s"), $curdatabase));
}
/* check modification time to see if we need to generate image */
diff --git a/src/usr/local/www/status_rrd_graph_settings.php b/src/usr/local/www/status_rrd_graph_settings.php
index 6eaf9dc..04b05b0 100644
--- a/src/usr/local/www/status_rrd_graph_settings.php
+++ b/src/usr/local/www/status_rrd_graph_settings.php
@@ -153,32 +153,32 @@ $tab_array[] = array(gettext("Traffic"), ($curcat == "traffic"), "status_rrd_gra
$tab_array[] = array(gettext("Packets"), ($curcat == "packets"), "status_rrd_graph.php?cat=packets");
$tab_array[] = array(gettext("Quality"), ($curcat == "quality"), "status_rrd_graph.php?cat=quality");
-if($queues) {
+if ($queues) {
$tab_array[] = array(gettext("Queues"), ($curcat == "queues"), "status_rrd_graph.php?cat=queues");
$tab_array[] = array(gettext("QueueDrops"), ($curcat == "queuedrops"), "status_rrd_graph.php?cat=queuedrops");
}
-if($wireless) {
+if ($wireless) {
$tab_array[] = array(gettext("Wireless"), ($curcat == "wireless"), "status_rrd_graph.php?cat=wireless");
}
-if($cellular) {
+if ($cellular) {
$tab_array[] = array(gettext("Cellular"), ($curcat == "cellular"), "status_rrd_graph.php?cat=cellular");
}
-if($vpnusers) {
+if ($vpnusers) {
$tab_array[] = array(gettext("VPN"), ($curcat == "vpnusers"), "status_rrd_graph.php?cat=vpnusers");
}
-if($captiveportal) {
+if ($captiveportal) {
$tab_array[] = array(gettext("Captive Portal"), ($curcat == "captiveportal"), "status_rrd_graph.php?cat=captiveportal");
}
-if($ntpd) {
+if ($ntpd) {
$tab_array[] = array(gettext("NTPD"), ($curcat == "ntpd"), "status_rrd_graph.php?cat=ntpd");
}
-if($dhcpd) {
+if ($dhcpd) {
$tab_array[] = array(gettext("DHCP Server"), ($curcat == "dhcpd"), "status_rrd_graph.php?cat=dhcpd");
}
@@ -187,11 +187,13 @@ $tab_array[] = array(gettext("Settings"), ($curcat == "settings"), "status_rrd_g
display_top_tabs($tab_array);
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$form = new Form;
diff --git a/src/usr/local/www/status_services.php b/src/usr/local/www/status_services.php
index 0d07695..a2a805d 100755
--- a/src/usr/local/www/status_services.php
+++ b/src/usr/local/www/status_services.php
@@ -104,8 +104,9 @@ if ($_GET['batch']) {
$pgtitle = array(gettext("Status"), gettext("Services"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
$services = get_services();
@@ -195,7 +196,7 @@ if (count($services) > 0) {
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// If a restart button is clicked, populate the hidden inputs and submit the form (via POST)
$('[id^=restartservice-]').click(function(event) {
$('#mode').val('restartservice');
diff --git a/src/usr/local/www/status_upnp.php b/src/usr/local/www/status_upnp.php
index f5af632..c3d897c 100644
--- a/src/usr/local/www/status_upnp.php
+++ b/src/usr/local/www/status_upnp.php
@@ -77,16 +77,18 @@ if ($_POST) {
$rdr_entries = array();
exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
-$pgtitle = array(gettext("Status"),gettext("UPnP &amp; NAT-PMP"));
+$pgtitle = array(gettext("Status"), gettext("UPnP &amp; NAT-PMP"));
$shortcut_section = "upnp";
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if(!$config['installedpackages'] || !$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] ||
- !$config['installedpackages']['miniupnpd']['config'][0]['enable']) {
+if (!$config['installedpackages'] ||
+ !$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] ||
+ !$config['installedpackages']['miniupnpd']['config'][0]['enable']) {
print_info_box('UPnP is currently disabled.', 'danger');
include("foot.inc");
diff --git a/src/usr/local/www/status_wireless.php b/src/usr/local/www/status_wireless.php
index 5e13e4f..014f2af 100644
--- a/src/usr/local/www/status_wireless.php
+++ b/src/usr/local/www/status_wireless.php
@@ -72,13 +72,13 @@ include("head.inc");
$if = $_POST['if'];
-if($_GET['if'] != "")
+if ($_GET['if'] != "") {
$if = $_GET['if'];
+}
$ciflist = get_configured_interface_with_descr();
if (empty($if)) {
- /* Find the first interface
- that is wireless */
+ /* Find the first interface that is wireless */
foreach ($ciflist as $interface => $ifdescr) {
if (is_interface_wireless(get_real_interface($interface))) {
$if = $interface;
@@ -89,11 +89,12 @@ if (empty($if)) {
$tab_array = array();
-foreach($ciflist as $interface => $ifdescr) {
+foreach ($ciflist as $interface => $ifdescr) {
if (is_interface_wireless(get_real_interface($interface))) {
$enabled = false;
- if($if == $interface)
+ if ($if == $interface) {
$enabled = true;
+ }
$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
}
@@ -101,13 +102,14 @@ foreach($ciflist as $interface => $ifdescr) {
$rwlif = get_real_interface($if);
-if($_POST['rescanwifi'] != "") {
+if ($_POST['rescanwifi'] != "") {
mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
display_top_tabs($tab_array);
?>
@@ -209,13 +211,13 @@ display_top_tabs($tab_array);
$counter=0;
- foreach($states as $state) {
+ foreach ($states as $state) {
$split = preg_split("/[ ]+/i", $state);
?>
<tr>
<?php
/* Split the rest by using spaces for this line using the 2nd part */
- for($idx=0; $idx<10; $idx++) {
+ for ($idx=0; $idx<10; $idx++) {
?>
<td>
<?=$split[$idx]?>
OpenPOWER on IntegriCloud