summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-14 20:20:16 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-14 20:20:16 +0545
commit947141fd21b4496d8963d1598d6ca6a2e000702c (patch)
treec4f39f94d05059417f3e5743fc7c826ea52657fc
parent9ba351c17e4c85e01832e38b6ba7b6a7898a290d (diff)
downloadpfsense-947141fd21b4496d8963d1598d6ca6a2e000702c.zip
pfsense-947141fd21b4496d8963d1598d6ca6a2e000702c.tar.gz
Code style usr local www a-e
-rw-r--r--src/usr/local/www/diag_arp.php4
-rw-r--r--src/usr/local/www/diag_authentication.php12
-rw-r--r--src/usr/local/www/diag_backup.php10
-rwxr-xr-xsrc/usr/local/www/diag_dns.php11
-rwxr-xr-xsrc/usr/local/www/diag_dump_states.php19
-rw-r--r--src/usr/local/www/diag_dump_states_sources.php6
-rwxr-xr-xsrc/usr/local/www/diag_halt.php3
-rw-r--r--src/usr/local/www/diag_limiter_info.php5
-rw-r--r--src/usr/local/www/diag_nanobsd.php22
-rw-r--r--src/usr/local/www/diag_ndp.php5
-rw-r--r--src/usr/local/www/diag_packet_capture.php27
-rw-r--r--src/usr/local/www/diag_pf_info.php8
-rw-r--r--src/usr/local/www/diag_pftop.php14
-rw-r--r--src/usr/local/www/diag_ping.php16
-rwxr-xr-xsrc/usr/local/www/diag_reboot.php13
-rw-r--r--src/usr/local/www/diag_resetstate.php9
-rw-r--r--src/usr/local/www/diag_routes.php24
-rw-r--r--src/usr/local/www/diag_smart.php13
-rw-r--r--src/usr/local/www/diag_sockets.php11
-rw-r--r--src/usr/local/www/diag_states_summary.php9
-rw-r--r--src/usr/local/www/diag_system_activity.php5
-rw-r--r--src/usr/local/www/diag_tables.php18
-rw-r--r--src/usr/local/www/diag_testport.php35
-rw-r--r--src/usr/local/www/diag_traceroute.php11
-rw-r--r--src/usr/local/www/easyrule.php7
-rw-r--r--src/usr/local/www/edit.php19
-rw-r--r--src/usr/local/www/exec.php14
27 files changed, 201 insertions, 149 deletions
diff --git a/src/usr/local/www/diag_arp.php b/src/usr/local/www/diag_arp.php
index 9f36fd0..ad58a70 100644
--- a/src/usr/local/www/diag_arp.php
+++ b/src/usr/local/www/diag_arp.php
@@ -349,7 +349,7 @@ $mac_man = load_mac_manufacturer_table();
</tr>
</thead>
<tbody>
-
+
<?php
foreach ($data as $entry): ?>
<tr>
@@ -376,7 +376,7 @@ $mac_man = load_mac_manufacturer_table();
<script type="text/javascript">
//<![CDATA[
// Clear the "loading" div once the page has loaded"
-events.push(function(){
+events.push(function() {
$('#loading').empty();
});
//]]>
diff --git a/src/usr/local/www/diag_authentication.php b/src/usr/local/www/diag_authentication.php
index 5dea23d..d665fc6 100644
--- a/src/usr/local/www/diag_authentication.php
+++ b/src/usr/local/www/diag_authentication.php
@@ -87,8 +87,9 @@ if ($_POST) {
$groups = getUserGroups($_POST['username'], $authcfg, $attributes);
$savemsg .= "&nbsp;" . gettext("This user is a member of groups") . ": <br />";
$savemsg .= "<ul>";
- foreach ($groups as $group)
+ foreach ($groups as $group) {
$savemsg .= "<li>" . "{$group} " . "</li>";
+ }
$savemsg .= "</ul>";
} else {
@@ -109,18 +110,21 @@ include("head.inc");
?>
<?php
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>');
+}
$form = new Form('Test');
$section = new Form_Section('Authentication Test');
-foreach (auth_get_authserver_list() as $auth_server)
+foreach (auth_get_authserver_list() as $auth_server) {
$serverlist[$auth_server['name']] = $auth_server['name'];
+}
$section->addInput(new Form_Select(
'authmode',
diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php
index 98d5ff8..4b5f453 100644
--- a/src/usr/local/www/diag_backup.php
+++ b/src/usr/local/www/diag_backup.php
@@ -608,11 +608,13 @@ function build_area_list($showall) {
$pgtitle = array(gettext("Diagnostics"), gettext("Backup/Restore"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
if (is_subsystem_dirty('restore')):
?>
@@ -772,7 +774,7 @@ print($form);
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// ------- Show/hide sections based on checkbox settings --------------------------------------
@@ -801,7 +803,7 @@ events.push(function(){
hidePasswords();
});
- $('#conffile').change(function (){
+ $('#conffile').change(function () {
$('.restore').prop('disabled', false);
});
// ---------- On initial page load ------------------------------------------------------------
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php
index 679370d..1ac0d17 100755
--- a/src/usr/local/www/diag_dns.php
+++ b/src/usr/local/www/diag_dns.php
@@ -99,8 +99,9 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
$isfirst = true;
foreach ($resolved as $re) {
if ($re != "") {
- if (!$isfirst)
+ if (!$isfirst) {
$addresses .= " ";
+ }
$addresses .= rtrim($re) . "/32";
$isfirst = false;
}
@@ -211,13 +212,15 @@ function display_host_results ($address, $hostname, $dns_speeds) {
include("head.inc");
/* Display any error messages resulting from user input */
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else if (!$resolved && $type)
+} else if (!$resolved && $type) {
print('<div class="alert alert-warning" role="alert">' . gettext("Host") .' "'. $host .'" '. gettext("could not be resolved") . '</div>');
+}
-if ($createdalias)
+if ($createdalias) {
print('<div class="alert alert-success" role="alert">'.gettext("Alias was created/updated successfully").'</div>');
+}
$form = new Form('Lookup');
$section = new Form_Section('DNS Lookup');
diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php
index c4c93d6..f5cd437 100755
--- a/src/usr/local/www/diag_dump_states.php
+++ b/src/usr/local/www/diag_dump_states.php
@@ -100,8 +100,8 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
var data = $(this).data('entry').split('|');
@@ -114,7 +114,7 @@ events.push(function(){
srcip: data[0],
dstip: data[1]
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
@@ -126,8 +126,9 @@ events.push(function(){
<?php
$tab_array = array();
$tab_array[] = array(gettext("States"), true, "diag_dump_states.php");
-if (isset($config['system']['lb_use_sticky']))
+if (isset($config['system']['lb_use_sticky'])) {
$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
+}
$tab_array[] = array(gettext("Reset States"), false, "diag_resetstate.php");
display_top_tabs($tab_array);
@@ -182,8 +183,9 @@ print $form;
$grepline = (isset($_POST['filter'])) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : "";
$fd = popen("/sbin/pfctl -s state {$grepline}", "r");
while ($line = chop(fgets($fd))) {
- if ($row >= 10000)
+ if ($row >= 10000) {
break;
+ }
$line_split = preg_split("/\s+/", $line);
@@ -213,17 +215,18 @@ print $form;
title="<?=sprintf(gettext('Remove all state entries from %s to %s'), $srcip, $dstip);?>"></a>
</td>
</tr>
-<?php $row++; }
+<?php $row++; }
?>
</tbody>
</table>
<?php
if ($row == 0) {
- if (isset($_POST['filter']) && !empty($_POST['filter']))
+ if (isset($_POST['filter']) && !empty($_POST['filter'])) {
$errmsg = gettext('No states were found that match the current filter');
- else
+ } else {
$errmsg = gettext('No states were found');
+ }
print('<p class="alert alert-warning">' . $errmsg . '</p>');
}
diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php
index b0c216f..da8cb35 100644
--- a/src/usr/local/www/diag_dump_states_sources.php
+++ b/src/usr/local/www/diag_dump_states_sources.php
@@ -102,8 +102,8 @@ display_top_tabs($tab_array);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
var data = $(this).data('entry').split('|');
@@ -116,7 +116,7 @@ events.push(function(){
srcip: data[0],
dstip: data[1]
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
diff --git a/src/usr/local/www/diag_halt.php b/src/usr/local/www/diag_halt.php
index b2a0e21..20658e1 100755
--- a/src/usr/local/www/diag_halt.php
+++ b/src/usr/local/www/diag_halt.php
@@ -91,8 +91,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<?php
if (DEBUG) {
print("Not actually halting (DEBUG is set true)<br>");
- }
- else {
+ } else {
print('<pre>');
system_halt();
print('</pre>');
diff --git a/src/usr/local/www/diag_limiter_info.php b/src/usr/local/www/diag_limiter_info.php
index 5425e6c..0c703b6 100644
--- a/src/usr/local/www/diag_limiter_info.php
+++ b/src/usr/local/www/diag_limiter_info.php
@@ -87,8 +87,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
?>
<script type="text/javascript">
@@ -107,7 +108,7 @@ if ($input_errors)
});
}
- events.push(function(){
+ events.push(function() {
setInterval('getlimiteractivity()', 2500);
getlimiteractivity();
});
diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php
index b09258c..7a06ebd 100644
--- a/src/usr/local/www/diag_nanobsd.php
+++ b/src/usr/local/www/diag_nanobsd.php
@@ -90,10 +90,11 @@ $NANOBSD_SIZE = nanobsd_get_size();
$class='alert-warning';
if ($_POST['bootslice']) {
- if (!DEBUG)
+ if (!DEBUG) {
nanobsd_switch_boot_slice();
- else
+ } else {
sleep(4);
+ }
$savemsg = gettext("The boot slice has been set to") . " " . nanobsd_get_active_slice();
$class='alert-success';
@@ -126,15 +127,15 @@ if ($_POST['changero']) {
if ($_POST['setrw']) {
if (!DEBUG) {
conf_mount_rw();
- if (isset($_POST['nanobsd_force_rw']))
+ if (isset($_POST['nanobsd_force_rw'])) {
$config['system']['nanobsd_force_rw'] = true;
- else
+ } else {
unset($config['system']['nanobsd_force_rw']);
+ }
write_config("Changed Permanent Read/Write Setting");
conf_mount_ro();
- }
- else {
+ } else {
$savemsg = 'Saved r/w permanently';
$class = 'alert-success';
}
@@ -142,8 +143,9 @@ if ($_POST['setrw']) {
print_info_box("The options on this page are intended for use by advanced users only.");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, $class);
+}
$form = new Form(false);
@@ -173,12 +175,14 @@ if (is_writable("/")) {
$refdisplay = " (Reference count " . $refcount . ")";
}
$lbl = gettext("Read/Write") . $refdisplay;
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
$btnlbl = gettext("Switch to Read-Only");
+ }
} else {
$lbl = gettext("Read-Only");
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
$btnlbl = gettext("Switch to Read/Write");
+ }
}
$robtn = new Form_Button('changero', $btnlbl);
diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php
index 461d397..f87b43f 100644
--- a/src/usr/local/www/diag_ndp.php
+++ b/src/usr/local/www/diag_ndp.php
@@ -165,10 +165,11 @@ include("head.inc");
</td>
<td>
<?php
- if (isset($hwif[$entry['interface']]))
+ if (isset($hwif[$entry['interface']])) {
echo $hwif[$entry['interface']];
- else
+ } else {
echo $entry['interface'];
+ }
?>
</td>
</tr>
diff --git a/src/usr/local/www/diag_packet_capture.php b/src/usr/local/www/diag_packet_capture.php
index 3bb8094..6016e90 100644
--- a/src/usr/local/www/diag_packet_capture.php
+++ b/src/usr/local/www/diag_packet_capture.php
@@ -137,8 +137,10 @@ $protos = array('icmp', 'icmp6', 'tcp', 'udp', 'arp', 'carp', 'esp',
$input_errors = array();
$interfaces = get_configured_interface_with_descr();
-if (ipsec_enabled())
+if (ipsec_enabled()) {
$interfaces['enc0'] = "IPsec";
+}
+
foreach (array('server', 'client') as $mode) {
if (is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
@@ -285,8 +287,9 @@ $protocollist = array(
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false); // No button yet. We add those later depending on the required action
@@ -391,8 +394,7 @@ if (($action == gettext("Stop") or $action == "") and $processisrunning != true)
'startbtn',
'Start'
))->removeClass('btn-primary')->addClass('btn-success');
-}
-else {
+} else {
$form->addGlobal(new Form_Button(
'stopbtn',
'Stop'
@@ -421,14 +423,17 @@ print($form);
if ($do_tcpdump) :
$matches = array();
- if (in_array($fam, $fams))
+ if (in_array($fam, $fams)) {
$matches[] = $fam;
+ }
- if (in_array($proto, $protos))
+ if (in_array($proto, $protos)) {
$matches[] = fixup_not($proto);
+ }
- if ($port != "")
+ if ($port != "") {
$matches[] = "port ".fixup_not($port);
+ }
if ($host != "") {
$hostmatch = "";
@@ -437,15 +442,17 @@ if ($do_tcpdump) :
foreach ($hosts as $h) {
$h = fixup_host($h, $hostcount++);
- if (!empty($h))
+ if (!empty($h)) {
$hostmatch .= " " . $h;
+ }
}
- if (!empty($hostmatch))
+ if (!empty($hostmatch)) {
$matches[] = "({$hostmatch})";
+ }
}
- if ($count != "0" ) {
+ if ($count != "0") {
$searchcount = "-c " . $count;
} else {
$searchcount = "";
diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php
index c553b34..bd0d3f0 100644
--- a/src/usr/local/www/diag_pf_info.php
+++ b/src/usr/local/www/diag_pf_info.php
@@ -88,8 +88,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false);
$form->addGlobal(new Form_Input(
@@ -114,8 +115,9 @@ print $form;
<script type="text/javascript">
//<![CDATA[
function getpfinfo() {
- if (!$('#refresh').is(':checked'))
+ if (!$('#refresh').is(':checked')) {
return;
+ }
$.ajax(
'/diag_pf_info.php',
@@ -128,7 +130,7 @@ print $form;
});
}
- events.push(function(){
+ events.push(function() {
setInterval('getpfinfo()', 2500);
getpfinfo();
});
diff --git a/src/usr/local/www/diag_pftop.php b/src/usr/local/www/diag_pftop.php
index 8537f91..dd57e9c 100644
--- a/src/usr/local/www/diag_pftop.php
+++ b/src/usr/local/www/diag_pftop.php
@@ -115,8 +115,9 @@ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) &&
$numstate = "100";
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false);
$form->addGlobal(new Form_Input(
@@ -187,7 +188,7 @@ print $form;
);
}
- events.push(function(){
+ events.push(function() {
setInterval('getpftopactivity()', 2500);
getpftopactivity();
});
@@ -204,12 +205,13 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('#viewtype').on('change', function(){
- if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1)
+events.push(function() {
+ $('#viewtype').on('change', function() {
+ if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1) {
$("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').hide();
- else
+ } else {
$("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').show();
+ }
});
});
//]]>
diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php
index 140513e..cc5c442 100644
--- a/src/usr/local/www/diag_ping.php
+++ b/src/usr/local/www/diag_ping.php
@@ -117,7 +117,7 @@ if ($_POST || $_REQUEST['host']) {
if ($_POST) {
$do_ping = true;
}
- if(isset($_REQUEST['sourceip'])) {
+ if (isset($_REQUEST['sourceip'])) {
$sourceip = $_REQUEST['sourceip'];
}
$count = $_REQUEST['count'];
@@ -131,7 +131,7 @@ if ($do_ping) {
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("pingCaptured").wrap='off';
}
//]]>
@@ -142,31 +142,35 @@ if ($do_ping) {
if ($ipproto == "ipv6") {
$command .= "6";
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
- if (is_linklocal($ifaddr))
+ if (is_linklocal($ifaddr)) {
$ifscope = get_ll_scope($ifaddr);
+ }
} else {
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
}
if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
$srcip = "-S" . escapeshellarg($ifaddr);
- if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope))
+ if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) {
$host .= "%{$ifscope}";
+ }
}
$cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host);
//echo "Ping command: {$cmd}\n";
$result = shell_exec($cmd);
- if (empty($result))
+ if (empty($result)) {
$input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved.";
+ }
}
include('head.inc');
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form('Ping');
diff --git a/src/usr/local/www/diag_reboot.php b/src/usr/local/www/diag_reboot.php
index d011a56..f8f3a4e 100755
--- a/src/usr/local/www/diag_reboot.php
+++ b/src/usr/local/www/diag_reboot.php
@@ -73,15 +73,14 @@ require("captiveportal.inc");
$guitimeout = 90; // Seconds to wait before reloading the page after reboot
$guiretry = 20; // Seconds to try again if $guitimeout was not long enough
-$pgtitle = array(gettext("Diagnostics"),gettext("Reboot System"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Reboot System"));
include("head.inc");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- if(DEBUG) {
+ if (DEBUG) {
print_info_box("Not actually rebooting (DEBUG is set true)", success);
- }
- else {
+ } else {
print('<div><pre>');
system_reboot();
print('</pre></div>');
@@ -93,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
var timeoutmsg = '<h4>Rebooting<br />Page will automatically reload in ';
var time = 0;
@@ -109,8 +108,8 @@ events.push(function(){
}
function startCountdown() {
- setInterval(function(){
- if(time > 0) {
+ setInterval(function() {
+ if (time > 0) {
$('#countdown').html(timeoutmsg + time + ' seconds.</h4>');
time--;
} else {
diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php
index 494e842..a5edd4d 100644
--- a/src/usr/local/www/diag_resetstate.php
+++ b/src/usr/local/www/diag_resetstate.php
@@ -93,11 +93,13 @@ if ($_POST) {
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'alert-success');
+}
$statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' .
'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' .
@@ -117,8 +119,9 @@ $sourcetablehelp = 'Resetting the source tracking table will remove all source/d
$tab_array = array();
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
-if (isset($config['system']['lb_use_sticky']))
+if (isset($config['system']['lb_use_sticky'])) {
$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
+}
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php
index 58c4924..e02bafa 100644
--- a/src/usr/local/www/diag_routes.php
+++ b/src/usr/local/www/diag_routes.php
@@ -161,29 +161,33 @@ function update_routes_callback(html) {
for (var i = 0; i < responseTextArr.length; i++) {
- if (responseTextArr[i] == "")
+ if (responseTextArr[i] == "") {
continue;
+ }
- if (i == 0)
+ if (i == 0) {
var tmp = '';
- else
+ } else {
var tmp = '<tr>';
+ }
var j = 0;
var entry = responseTextArr[i].split(" ");
for (var k = 0; k < entry.length; k++) {
- if (entry[k] == "")
+ if (entry[k] == "") {
continue;
- if (i == 0)
+ }
+ if (i == 0) {
tmp += '<th>' + entry[k] + '<\/th>';
- else
+ } else {
tmp += '<td>' + entry[k] + '<\/td>';
+ }
j++;
}
- if (i == 0)
+ if (i == 0) {
thead += tmp;
- else {
+ } else {
tmp += '<td><\/td>'
tbody += tmp;
}
@@ -198,11 +202,11 @@ function update_all_routes() {
update_routes("IPv6");
}
-events.push(function(){
+events.push(function() {
setInterval('update_all_routes()', 5000);
update_all_routes();
- $(document.forms[0]).on('submit', function(e){
+ $(document.forms[0]).on('submit', function(e) {
update_all_routes();
e.preventDefault();
diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php
index f4ca880..7793c35 100644
--- a/src/usr/local/www/diag_smart.php
+++ b/src/usr/local/www/diag_smart.php
@@ -76,8 +76,7 @@ $closehead = false;
include("head.inc");
// Highlights the words "PASSED", "FAILED", and "WARNING".
-function add_colors($string)
-{
+function add_colors($string) {
// To add words keep arrays matched by numbers
$patterns[0] = '/PASSED/';
$patterns[1] = '/FAILED/';
@@ -230,9 +229,7 @@ switch ($action) {
smartmonctl("stop");
smartmonctl("start");
$style = 'warning';
- }
- else if (isset($_POST['save']))
- {
+ } else if (isset($_POST['save'])) {
$config['system']['smartmonemail'] = $_POST['smartmonemail'];
write_config();
@@ -242,8 +239,7 @@ switch ($action) {
if (stristr($retval, "error") != true) {
$savemsg = get_std_save_message($retval);
$style = 'success';
- }
- else {
+ } else {
$savemsg = $retval;
$style='danger';
}
@@ -258,8 +254,9 @@ switch ($action) {
}
// Was the config changed? if so, print the message
- if ($savemsg)
+ if ($savemsg) {
print_info_box($savemsg, $style);
+ }
// Get users email from the xml file
$pconfig['smartmonemail'] = $config['system']['smartmonemail'];
diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php
index 3a7d6e1..5cad1ac 100644
--- a/src/usr/local/www/diag_sockets.php
+++ b/src/usr/local/www/diag_sockets.php
@@ -100,26 +100,27 @@ $showAllOption = $showAll ? "" : "?showAll";
<thead>
<?php
foreach (explode("\n", $table) as $i => $line) {
- if (trim($line) == "")
+ if (trim($line) == "") {
continue;
+ }
$j = 0;
print("<tr>\n");
foreach (explode(' ', $line) as $entry) {
- if ($entry == '' || $entry == "ADDRESS")
+ if ($entry == '' || $entry == "ADDRESS") {
continue;
+ }
if ($i == 0) {
print("<th class=\"$class\">$entry</th>\n");
- }
- else {
+ } else {
print("<td class=\"$class\">$entry</td>\n");
}
$j++;
}
print("</tr>\n");
- if($i == 0) {
+ if ($i == 0) {
print("</thead>\n");
print("<tbody>\n");
}
diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php
index 47142b5..ef6b612 100644
--- a/src/usr/local/www/diag_states_summary.php
+++ b/src/usr/local/www/diag_states_summary.php
@@ -167,10 +167,10 @@ function build_port_info($portarr, $proto) {
return implode($ports, ', ');
}
-function print_summary_table($label, $iparr, $sort = TRUE)
-{
- if ($sort)
+function print_summary_table($label, $iparr, $sort = TRUE) {
+ if ($sort) {
uksort($iparr, "sort_by_ip");
+ }
?>
<div class="panel panel-default">
@@ -196,8 +196,9 @@ function print_summary_table($label, $iparr, $sort = TRUE)
$rowSpan = '';
$i = 0;
- if ($protocolCount > 1)
+ if ($protocolCount > 1) {
$rowSpan = ' rowspan="' . $protocolCount . '"';
+ }
?>
<tr>
<td<?= $rowSpan ?>><?php echo $ip; ?></td>
diff --git a/src/usr/local/www/diag_system_activity.php b/src/usr/local/www/diag_system_activity.php
index 810c39a..76c5c17 100644
--- a/src/usr/local/www/diag_system_activity.php
+++ b/src/usr/local/www/diag_system_activity.php
@@ -77,8 +77,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
?>
<script type="text/javascript">
@@ -99,7 +100,7 @@ function getcpuactivity() {
);
}
-events.push(function(){
+events.push(function() {
setInterval('getcpuactivity()', 2500);
getcpuactivity();
});
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php
index 5fb0eba..c351701 100644
--- a/src/usr/local/www/diag_tables.php
+++ b/src/usr/local/www/diag_tables.php
@@ -105,15 +105,18 @@ if (($tablename == "bogons") || ($tablename == "bogonsv6")) {
$loading = true;
while ($loading == true) {
$isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`;
- if ($isrunning == "")
+ if ($isrunning == "") {
$loading = false;
+ }
$maxtimetowait++;
- if ($maxtimetowait > 89)
+ if ($maxtimetowait > 89) {
$loading = false;
+ }
sleep(1);
}
- if ($maxtimetowait < 90)
+ if ($maxtimetowait < 90) {
$savemsg = gettext("The bogons database has been updated.");
+ }
}
}
@@ -122,8 +125,9 @@ exec("/sbin/pfctl -sT", $tables);
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
$form = new Form('Show');
@@ -142,8 +146,8 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
$.ajax(
@@ -154,7 +158,7 @@ events.push(function(){
type: '<?=htmlspecialchars($tablename)?>',
delete: $(this).data('entry')
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php
index c009929..3b495e3 100644
--- a/src/usr/local/www/diag_testport.php
+++ b/src/usr/local/www/diag_testport.php
@@ -124,7 +124,7 @@ if ($_POST || $_REQUEST['host']) {
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("testportCaptured").wrap='off';
}
//]]>
@@ -134,10 +134,12 @@ if ($_POST || $_REQUEST['host']) {
$ncoutput = "";
$nc_base_cmd = '/usr/bin/nc';
$nc_args = "-w " . escapeshellarg($timeout);
- if (!$showtext)
+ if (!$showtext) {
$nc_args .= ' -z ';
- if (!empty($srcport))
+ }
+ if (!empty($srcport)) {
$nc_args .= ' -p ' . escapeshellarg($srcport) . ' ';
+ }
/* Attempt to determine the interface address, if possible. Else try both. */
if (is_ipaddrv4($host)) {
@@ -152,12 +154,13 @@ if ($_POST || $_REQUEST['host']) {
}
$nc_args .= ' -4';
} elseif (is_ipaddrv6($host)) {
- if ($sourceip == "any")
+ if ($sourceip == "any") {
$ifaddr = '';
- else if (is_linklocal($sourceip))
+ } else if (is_linklocal($sourceip)) {
$ifaddr = $sourceip;
- else
+ } else {
$ifaddr = get_interface_ipv6($sourceip);
+ }
$nc_args .= ' -6';
} else {
switch ($ipprotocol) {
@@ -197,8 +200,9 @@ if ($_POST || $_REQUEST['host']) {
if (!empty($ifaddr)) {
$nc_args .= ' -s ' . escapeshellarg($ifaddr) . ' ';
$scope = get_ll_scope($ifaddr);
- if (!empty($scope) && !strstr($host, "%"))
+ if (!empty($scope) && !strstr($host, "%")) {
$host .= "%{$scope}";
+ }
}
$nc_cmd = "{$nc_base_cmd} {$nc_args} " . escapeshellarg($host) . ' ' . escapeshellarg($port) . ' 2>&1';
@@ -220,9 +224,9 @@ if ($_POST || $_REQUEST['host']) {
include("head.inc");
// Handle the display of all messages here where the user can readily see them
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else {
+} else {
// New page
if (empty($result) && $retval != 0 && !$showtext) {
print('<div class="alert alert-warning" role="alert">This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.' .
@@ -231,18 +235,21 @@ else {
// Good host & port
if ($retval == 0 && $do_testport == 1) {
- if (!$showtext)
+ if (!$showtext) {
print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful").'</div>');
- else
+ } else {
print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful") . '. Any text received from the host will be shown below the form.</div>');
+ }
}
// netcat exit value != 0
- if ($retval != 0 && !empty($result))
- if ($showtext)
+ if ($retval != 0 && !empty($result)) {
+ if ($showtext) {
print('<div class="alert alert-danger" role="alert">'.gettext('No output received, or connection failed. Try with "Show Remote Text" unchecked first.').'</div>');
- else
+ } else {
print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>');
+ }
+ }
}
$form = new Form('Test');
diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php
index ad614a9..10a6a4b 100644
--- a/src/usr/local/www/diag_traceroute.php
+++ b/src/usr/local/www/diag_traceroute.php
@@ -90,8 +90,9 @@ function create_sourceaddresslist() {
$sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sipvalue => $sipname)
+ foreach ($sourceips as $sipvalue => $sipname) {
$list[$sipvalue] = $sipname;
+ }
return($list);
}
@@ -135,8 +136,9 @@ if ($_POST || $_REQUEST['host']) {
$useicmp = false;
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form('Traceroute');
@@ -212,10 +214,11 @@ if (!$input_errors && $do_traceroute) {
<div class="panel-heading"><h2 class="panel-title">Results</h2></div>
<div class="panel-body">
<?php
- if ($result = shell_exec($cmd))
+ if ($result = shell_exec($cmd)) {
print(nl2br($result));
- else
+ } else {
print('Error: ' . $host . ' ' . gettext("could not be traced/resolved"));
+ }
?>
</div>
</div>
diff --git a/src/usr/local/www/easyrule.php b/src/usr/local/www/easyrule.php
index 7a73bab..575ddf8 100644
--- a/src/usr/local/www/easyrule.php
+++ b/src/usr/local/www/easyrule.php
@@ -92,14 +92,15 @@ if (stristr($retval, "error") == true) {
include("head.inc"); ?>
-include("fbegin.inc");
+include("fbegin.inc");
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
-<?php
-if ($input_errors)
+<?php
+if ($input_errors) {
print_input_errors($input_errors);
+}
if ($message) { ?>
<br />
diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php
index f4ecde7..29e073b 100644
--- a/src/usr/local/www/edit.php
+++ b/src/usr/local/www/edit.php
@@ -138,7 +138,7 @@ require("head.inc");
<div style="background:#eeeeee;" id="fileOutput">
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("fileContent").wrap='off';
}
//]]>
@@ -173,8 +173,7 @@ require("head.inc");
var fileContent = window.atob(values.join("|"));
jQuery("#fileContent").val(fileContent);
- }
- else {
+ } else {
jQuery("#fileStatus").html(values[0]);
jQuery("#fileContent").val("");
}
@@ -296,12 +295,10 @@ var Base64 = {
if (c < 128) {
utftext += String.fromCharCode(c);
- }
- else if((c > 127) && (c < 2048)) {
+ } else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
- }
- else {
+ } else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
@@ -318,20 +315,18 @@ var Base64 = {
var i = 0;
var c = c1 = c2 = 0;
- while ( i < utftext.length ) {
+ while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
- }
- else if((c > 191) && (c < 224)) {
+ } else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
- }
- else {
+ } else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php
index 3205da3..a36053c 100644
--- a/src/usr/local/www/exec.php
+++ b/src/usr/local/www/exec.php
@@ -221,8 +221,9 @@ if (isBlank($_POST['txtRecallBuffer'])) {
</script>
<?php
-if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg))
+if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) {
print('<div class="alert alert-warning" role="alert">'.gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!").'</div>');
+}
if (!isBlank($_POST['txtCommand'])):?>
<div class="panel panel-success responsive">
@@ -235,8 +236,9 @@ if (!isBlank($_POST['txtCommand'])):?>
putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " "));
$output = array();
exec($_POST['txtCommand'] . ' 2>&1', $output);
- foreach($output as $line)
+ foreach ($output as $line) {
print(htmlspecialchars($line) . "\r\n");
+ }
?>
</pre>
</div>
@@ -272,8 +274,9 @@ if (!isBlank($_POST['txtCommand'])):?>
</div>
<?php
- if ($ulmsg)
+ if ($ulmsg) {
print('<div class="alert alert-success" role="alert">' . $ulmsg .'</div>');
+ }
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Upload file')?></h2></div>
@@ -314,7 +317,7 @@ if (!isBlank($_POST['txtCommand'])):?>
?>
<script type="text/javascript">
//<![CDATA[
- events.push(function(){
+ events.push(function() {
// Scroll to the bottom of the page to more easily see the results of a PHP exec command
$("html, body").animate({ scrollTop: $(document).height() }, 1000);
});
@@ -339,5 +342,6 @@ if (!isBlank($_POST['txtCommand'])):?>
<?php
include("foot.inc");
-if($_POST)
+if ($_POST) {
conf_mount_ro();
+}
OpenPOWER on IntegriCloud