summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-08-31 22:23:15 +0545
committerPhil Davis <phil.davis@inf.org>2015-08-31 22:23:15 +0545
commit288a2a0f294f992a9536dfbb5c54dd528badbad5 (patch)
tree8d1c6be8a2cf5848f6df06b631ce2614485648fe /src/usr/local/www
parent683ba309d50913828decb5fe3f6ade059c1dfab2 (diff)
downloadpfsense-288a2a0f294f992a9536dfbb5c54dd528badbad5.zip
pfsense-288a2a0f294f992a9536dfbb5c54dd528badbad5.tar.gz
bootstrap usr/local/www a to e minor edits
Diffstat (limited to 'src/usr/local/www')
-rw-r--r--src/usr/local/www/carp_status.php20
-rw-r--r--src/usr/local/www/crash_reporter.php14
-rw-r--r--src/usr/local/www/diag_backup.php4
-rw-r--r--src/usr/local/www/diag_confbak.php8
-rwxr-xr-xsrc/usr/local/www/diag_dns.php6
-rwxr-xr-xsrc/usr/local/www/diag_dump_states.php4
-rw-r--r--src/usr/local/www/diag_dump_states_sources.php11
-rw-r--r--src/usr/local/www/diag_ipsec.php10
-rw-r--r--src/usr/local/www/diag_ipsec_leases.php6
-rw-r--r--src/usr/local/www/diag_ipsec_sad.php2
-rw-r--r--src/usr/local/www/diag_ipsec_spd.php8
-rwxr-xr-xsrc/usr/local/www/diag_logs.php8
-rw-r--r--src/usr/local/www/diag_logs_filter.php16
-rwxr-xr-xsrc/usr/local/www/diag_logs_filter_dynamic.php2
-rw-r--r--src/usr/local/www/diag_logs_filter_summary.php8
-rw-r--r--src/usr/local/www/diag_logs_settings.php542
-rwxr-xr-xsrc/usr/local/www/diag_logs_vpn.php4
-rw-r--r--src/usr/local/www/diag_nanobsd.php14
-rw-r--r--src/usr/local/www/diag_ndp.php4
-rw-r--r--src/usr/local/www/diag_patterns.php4
-rw-r--r--src/usr/local/www/diag_pf_info.php2
-rw-r--r--src/usr/local/www/diag_ping.php6
-rwxr-xr-xsrc/usr/local/www/diag_pkglogs.php12
-rw-r--r--src/usr/local/www/diag_resetstate.php6
-rw-r--r--src/usr/local/www/diag_routes.php6
-rw-r--r--src/usr/local/www/diag_smart.php12
-rw-r--r--src/usr/local/www/diag_sockets.php2
-rw-r--r--src/usr/local/www/diag_states_summary.php4
-rw-r--r--src/usr/local/www/diag_system_activity.php2
-rw-r--r--src/usr/local/www/diag_tables.php14
-rw-r--r--src/usr/local/www/diag_testport.php20
-rw-r--r--src/usr/local/www/diag_traceroute.php24
-rw-r--r--src/usr/local/www/edit.php16
-rw-r--r--src/usr/local/www/exec.php2
34 files changed, 412 insertions, 411 deletions
diff --git a/src/usr/local/www/carp_status.php b/src/usr/local/www/carp_status.php
index 6ba07fa..09d9873 100644
--- a/src/usr/local/www/carp_status.php
+++ b/src/usr/local/www/carp_status.php
@@ -175,8 +175,8 @@ include("head.inc");
<?php
$carpcount = 0;
-if(is_array($config['virtualip']['vip'])) {
- foreach($config['virtualip']['vip'] as $carp) {
+if (is_array($config['virtualip']['vip'])) {
+ foreach ($config['virtualip']['vip'] as $carp) {
if ($carp['mode'] == "carp") {
$carpcount++;
break;
@@ -203,21 +203,22 @@ if ($carpcount > 0):
<td><?=gettext("Status")?></td>
</tr>
<?php
- foreach($config['virtualip']['vip'] as $carp) {
- if ($carp['mode'] != "carp")
+ foreach ($config['virtualip']['vip'] as $carp) {
+ if ($carp['mode'] != "carp") {
continue;
+ }
$ipaddress = $carp['subnet'];
$vhid = $carp['vhid'];
$status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
- if($carp_enabled == false) {
+ if ($carp_enabled == false) {
$icon = 'remove-sign';
$status = "DISABLED";
} else {
- if($status == "MASTER") {
+ if ($status == "MASTER") {
$icon = 'ok-sign';
- } else if($status == "BACKUP") {
+ } else if ($status == "BACKUP") {
$icon = 'ok-circle';
- } else if($status == "INIT") {
+ } else if ($status == "INIT") {
$icon = 'question-sign';
}
}
@@ -236,8 +237,9 @@ if ($carpcount > 0):
<h4><?=gettext("pfSync nodes")?></h4>
<ul>
<?php
- foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node)
+ foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node) {
echo '<li>'. $node .'</li>';
+ }
?>
</ul>
diff --git a/src/usr/local/www/crash_reporter.php b/src/usr/local/www/crash_reporter.php
index dc0a7c9..50e105f 100644
--- a/src/usr/local/www/crash_reporter.php
+++ b/src/usr/local/www/crash_reporter.php
@@ -75,7 +75,7 @@ function upload_crash_report($files) {
global $g;
$post = array();
$counter = 0;
- foreach($files as $file) {
+ foreach ($files as $file) {
$post["file{$counter}"] = "@{$file}";
$counter++;
}
@@ -91,7 +91,7 @@ function upload_crash_report($files) {
return $response;
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Crash reporter"));
include('head.inc');
$crash_report_header = "Crash report begins. Anonymous machine information:\n\n";
@@ -119,7 +119,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
echo gettext("Uploading...");
ob_flush();
flush();
- if(is_array($files_to_upload)) {
+ if (is_array($files_to_upload)) {
$resp = upload_crash_report($files_to_upload);
array_map('unlink', glob("/var/crash/*"));
// Erase the contents of the PHP error log
@@ -130,7 +130,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
} else {
echo "Could not find any crash files.";
}
- } else if(gettext($_POST['Submit']) == "No") {
+ } else if (gettext($_POST['Submit']) == "No") {
array_map('unlink', glob("/var/crash/*"));
// Erase the contents of the PHP error log
fclose(fopen("/tmp/PHP_errors.log", 'w'));
@@ -143,9 +143,9 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
$crash_reports .= "\nPHP Errors:\n";
$crash_reports .= implode("\n", $php_errors) . "\n\n";
}
- if(is_array($crash_files)) {
- foreach($crash_files as $cf) {
- if(filesize($cf) < FILE_SIZE) {
+ if (is_array($crash_files)) {
+ foreach ($crash_files as $cf) {
+ if (filesize($cf) < FILE_SIZE) {
$crash_reports .= "\nFilename: {$cf}\n";
$crash_reports .= file_get_contents($cf);
}
diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php
index 39bcc70..12e5ccc 100644
--- a/src/usr/local/www/diag_backup.php
+++ b/src/usr/local/www/diag_backup.php
@@ -594,9 +594,9 @@ function build_area_list($showall) {
$list = array("" => gettext("All"));
- if($showall)
+ if ($showall) {
return($list + $areas);
- else {
+ } else {
foreach ($areas as $area => $areaname) {
if ($area === "rrddata" || check_and_returnif_section_exists($area) == true) {
$list[$area] = $areaname;
diff --git a/src/usr/local/www/diag_confbak.php b/src/usr/local/www/diag_confbak.php
index bc9cc51..7116f2e 100644
--- a/src/usr/local/www/diag_confbak.php
+++ b/src/usr/local/www/diag_confbak.php
@@ -89,7 +89,7 @@ if ($_GET['getcfg'] != "") {
if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) &&
(is_numeric($_GET['oldtime'])) &&
- (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
+ (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
$diff = "";
$oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml';
$oldtime = $_GET['oldtime'];
@@ -112,7 +112,7 @@ unset($confvers['versions']);
$pgtitle = array(gettext("Diagnostics"), gettext("Configuration History"));
include("head.inc");
-if($savemsg)
+if ($savemsg)
print_info_box($savemsg);
?>
<?php if ($diff):?>
@@ -212,8 +212,8 @@ if($savemsg)
<td><i><?=gettext("Current")?></i></td>
</tr>
<?php
- foreach($confvers as $version):
- if($version['time'] != 0)
+ foreach ($confvers as $version):
+ if ($version['time'] != 0)
$date = date(gettext("n/j/y H:i:s"), $version['time']);
else
$date = gettext("Unknown");
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php
index a1267e2..45c4a91 100755
--- a/src/usr/local/www/diag_dns.php
+++ b/src/usr/local/www/diag_dns.php
@@ -91,9 +91,9 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
$resolved = array();
exec("/usr/bin/drill {$host_esc} A | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print $5 }'", $resolved);
$isfirst = true;
- foreach($resolved as $re) {
- if($re != "") {
- if(!$isfirst)
+ foreach ($resolved as $re) {
+ if ($re != "") {
+ if (!$isfirst)
$addresses .= " ";
$addresses .= rtrim($re) . "/32";
$isfirst = false;
diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php
index 9bd63f1..68c8bf6 100755
--- a/src/usr/local/www/diag_dump_states.php
+++ b/src/usr/local/www/diag_dump_states.php
@@ -180,9 +180,9 @@ print $form;
$row = 0;
/* get our states */
$grepline = (isset($_POST['filter'])) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : "";
- $fd = popen("/sbin/pfctl -s state {$grepline}", "r" );
+ $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);
diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php
index 04c8c03..6a62aee 100644
--- a/src/usr/local/www/diag_dump_states_sources.php
+++ b/src/usr/local/www/diag_dump_states_sources.php
@@ -69,8 +69,8 @@
require_once("guiconfig.inc");
/* handle AJAX operations */
-if($_POST['action']) {
- if($_POST['action'] == "remove") {
+if ($_POST['action']) {
+ if ($_POST['action'] == "remove") {
if (is_ipaddr($_POST['srcip']) && is_ipaddr($_POST['dstip'])) {
$retval = mwexec("/sbin/pfctl -K " . escapeshellarg($_POST['srcip']) . " -K " . escapeshellarg($_POST['dstip']));
echo htmlentities("|{$_GET['srcip']}|{$_POST['dstip']}|{$retval}|");
@@ -82,15 +82,14 @@ if($_POST['action']) {
}
/* get our states */
-if($_POST['filter']) {
+if ($_POST['filter']) {
exec("/sbin/pfctl -s Sources | grep " . escapeshellarg(htmlspecialchars($_GET['filter'])), $sources);
-}
-else {
+} else {
exec("/sbin/pfctl -s Sources", $sources);
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Show Source Tracking"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Show Source Tracking"));
include("head.inc");
$tab_array = array();
diff --git a/src/usr/local/www/diag_ipsec.php b/src/usr/local/www/diag_ipsec.php
index f5a83c8..6d4fd3f 100644
--- a/src/usr/local/www/diag_ipsec.php
+++ b/src/usr/local/www/diag_ipsec.php
@@ -265,7 +265,7 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_
</td>
<td>
<?php
- if($ikesa['status'] == 'established')
+ if ($ikesa['status'] == 'established')
print('<span style="color:green">');
else
print('<span>');
@@ -327,8 +327,8 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_
<td>
<?php
if (is_array($childsa['local']) &&
- is_array($childsa['local']['networks']) &&
- is_array($childsa['local']['networks']['network']))
+ is_array($childsa['local']['networks']) &&
+ is_array($childsa['local']['networks']['network']))
foreach ($childsa['local']['networks']['network'] as $lnets)
print(htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />");
else
@@ -347,8 +347,8 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_
<td>
<?php
if (is_array($childsa['remote']) &&
- is_array($childsa['remote']['networks']) &&
- is_array($childsa['remote']['networks']['network']))
+ is_array($childsa['remote']['networks']) &&
+ is_array($childsa['remote']['networks']['network']))
foreach ($childsa['remote']['networks']['network'] as $rnets)
print(htmlspecialchars(ipsec_fixup_network($rnets)) . '<br />');
else
diff --git a/src/usr/local/www/diag_ipsec_leases.php b/src/usr/local/www/diag_ipsec_leases.php
index 0bf5012..1331ebe 100644
--- a/src/usr/local/www/diag_ipsec_leases.php
+++ b/src/usr/local/www/diag_ipsec_leases.php
@@ -72,7 +72,7 @@ define(DEBUG, true); // Force dummy data for testing. Setting up a pFSense box t
require("guiconfig.inc");
require("ipsec.inc");
-$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("Leases"));
+$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("Leases"));
$shortcut_section = "ipsec";
include("head.inc");
@@ -102,7 +102,7 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) {
</thead>
<tbody>
<?php
- foreach($mobile['pool'] as $pool) {
+ foreach ($mobile['pool'] as $pool) {
// The first row of each pool includes the pool information
?>
<tr>
@@ -120,7 +120,7 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) {
$leaserow = true;
if (is_array($pool['lease']) && count($pool['lease']) > 0) {
foreach ($pool['lease'] as $lease) {
- if(!$leaserow) {
+ if (!$leaserow) {
// On subsequent rows the first three columns are blank
?>
<tr>
diff --git a/src/usr/local/www/diag_ipsec_sad.php b/src/usr/local/www/diag_ipsec_sad.php
index 2a9579f..288c509 100644
--- a/src/usr/local/www/diag_ipsec_sad.php
+++ b/src/usr/local/www/diag_ipsec_sad.php
@@ -70,7 +70,7 @@
require("guiconfig.inc");
require("ipsec.inc");
-$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SAD"));
+$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("SAD"));
$shortcut_section = "ipsec";
include("head.inc");
diff --git a/src/usr/local/www/diag_ipsec_spd.php b/src/usr/local/www/diag_ipsec_spd.php
index c952188..ef14523 100644
--- a/src/usr/local/www/diag_ipsec_spd.php
+++ b/src/usr/local/www/diag_ipsec_spd.php
@@ -74,11 +74,11 @@ define(LEFTARROW, '&#x25c0;');
require("guiconfig.inc");
require("ipsec.inc");
-$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SPD"));
+$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("SPD"));
$shortcut_section = "ipsec";
include("head.inc");
-if(DEBUG) { // Dummy data for testing. REMOVE for production
+if (DEBUG) { // Dummy data for testing. REMOVE for production
$spd = array ( 0 => array ( 'srcid' => '172.27.0.0/16', 'dstid' => '172.21.2.0/24', 'dir' => 'in' , 'proto' => 'esp', 'dst' => '184.57.8.247', 'src' => '208.123.73.7', 'reqid' => 'nique:1' ),
1 => array ( 'srcid' => '172.21.2.0/24', 'dstid' => '172.27.0.0/16', 'dir' => 'out', 'proto' => 'esp', 'dst' => '208.123.73.7', 'src' => '184.57.8.247', 'reqid' => 'nique:1' ) );
}
@@ -93,7 +93,7 @@ $tab_array[3] = array(gettext("SPD"), true, "diag_ipsec_spd.php");
$tab_array[4] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec");
display_top_tabs($tab_array);
-if (count($spd)){
+if (count($spd)) {
?>
<div class="table-responsive">
<table class="table table-striped table-hover table-condensed">
@@ -110,7 +110,7 @@ if (count($spd)){
<tbody>
<?php
foreach ($spd as $sp) {
- if($sp['dir'] == 'in')
+ if ($sp['dir'] == 'in')
$dirstr = LEFTARROW . ' Inbound';
else
$dirstr = RIGHTARROW . ' Outbound';
diff --git a/src/usr/local/www/diag_logs.php b/src/usr/local/www/diag_logs.php
index 69422cc..aca3873 100755
--- a/src/usr/local/www/diag_logs.php
+++ b/src/usr/local/www/diag_logs.php
@@ -69,7 +69,7 @@
require("guiconfig.inc");
// The logs to display are specified in a GET argument. Default to 'system' logs
-if(!$_GET['logfile'])
+if (!$_GET['logfile'])
$logfile = 'system';
else
$logfile = $_GET['logfile'];
@@ -151,7 +151,7 @@ $form->addGlobal(new Form_Button(
$form->add($section);
print $form;
-if($logfile == 'dhcpd')
+if ($logfile == 'dhcpd')
print_info_box('Warning: Clearing the log file will restart the DHCP daemon.');
?>
@@ -159,12 +159,12 @@ if($logfile == 'dhcpd')
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=$logfile?><?=gettext(" log entries")?></h2></div>
<pre>
<?php
- if(($logfile == 'resolver') || ($logfile == 'system'))
+ if (($logfile == 'resolver') || ($logfile == 'system'))
$inverse = array("ppp");
else
$inverse = null;
- if($filtertext)
+ if ($filtertext)
dump_clog_no_table($system_logfile, $nentries, true, array("$filtertext"), $inverse);
else
dump_clog_no_table($system_logfile, $nentries, true, array(), $inverse);
diff --git a/src/usr/local/www/diag_logs_filter.php b/src/usr/local/www/diag_logs_filter.php
index c8e47a2..69fe622 100644
--- a/src/usr/local/www/diag_logs_filter.php
+++ b/src/usr/local/www/diag_logs_filter.php
@@ -218,7 +218,7 @@ if ($filterfieldsarray['interface'] == "All")
require('classes/Form.class.php');
-if(!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
+if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
$form = new Form(new Form_Button(
'filterlogentries_submit',
'Filter'
@@ -365,8 +365,8 @@ if (!isset($config['syslog']['rawfilter'])) {
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ( (!$filtertext) && (!$filterfieldsarray) )
- printf(gettext("Last %s firewall log entries."),count($filterlog));
+ if ((!$filtertext) && (!$filterfieldsarray))
+ printf(gettext("Last %s firewall log entries."), count($filterlog));
else
print(count($filterlog). ' ' . gettext('matched log entries.') . ' ');
@@ -431,7 +431,7 @@ if (!isset($config['syslog']['rawfilter'])) {
$int = strtolower($filterent['interface']);
$proto = strtolower($filterent['proto']);
- if($filterent['version'] == '6') {
+ if ($filterent['version'] == '6') {
$ipproto = "inet6";
$filterent['srcip'] = "[{$filterent['srcip']}]";
$filterent['dstip'] = "[{$filterent['dstip']}]";
@@ -461,7 +461,7 @@ if (!isset($config['syslog']['rawfilter'])) {
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
- ?>
+?>
<td><?=htmlspecialchars($filterent['proto'])?></td>
</tr>
<?php
@@ -474,10 +474,10 @@ if (!isset($config['syslog']['rawfilter'])) {
<?php
}
} // e-o-foreach
- buffer_rules_clear();
+ buffer_rules_clear();
}
else
- {
+{
?>
<tr>
<td colspan="2">
@@ -485,7 +485,7 @@ else
</td>
</tr>
<?php
- if($filtertext)
+ if ($filtertext)
dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
else
dump_clog($filter_logfile, $nentries);
diff --git a/src/usr/local/www/diag_logs_filter_dynamic.php b/src/usr/local/www/diag_logs_filter_dynamic.php
index ca32b46..478d229 100755
--- a/src/usr/local/www/diag_logs_filter_dynamic.php
+++ b/src/usr/local/www/diag_logs_filter_dynamic.php
@@ -235,7 +235,7 @@ 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');
?>
diff --git a/src/usr/local/www/diag_logs_filter_summary.php b/src/usr/local/www/diag_logs_filter_summary.php
index 8d88310..7a83b95 100644
--- a/src/usr/local/www/diag_logs_filter_summary.php
+++ b/src/usr/local/www/diag_logs_filter_summary.php
@@ -121,7 +121,7 @@ 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>');
}
}
@@ -173,11 +173,11 @@ var pie = new d3pie("pieChart<?=$chartnum?>", {
$total = 0;
$numentries = 0;
- for ($i=0; $i < $num; $i++) {
+ for ($i = 0; $i < $num; $i++) {
if ($k[$i]) {
$total += $summary[$stat][$k[$i]];
$numentries++;
- if($i > 0)
+ if ($i > 0)
print(",\r\n");
print("{");
@@ -298,7 +298,7 @@ print_info_box($infomsg);
<?php
$chartnum=0;
-foreach(array_keys($fields) as $field) {
+foreach (array_keys($fields) as $field) {
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=$fields[$field]?></h2></div>
diff --git a/src/usr/local/www/diag_logs_settings.php b/src/usr/local/www/diag_logs_settings.php
index fedb34a..ed2d141 100644
--- a/src/usr/local/www/diag_logs_settings.php
+++ b/src/usr/local/www/diag_logs_settings.php
@@ -1,7 +1,7 @@
<?php
/* $Id$ */
/*
- diag_logs_settings.php
+ diag_logs_settings.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -56,7 +56,7 @@
*/
/*
- pfSense_MODULE: system
+ pfSense_MODULE: system
*/
##|+PRIV
@@ -99,134 +99,134 @@ $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']
$pconfig['logfilesize'] = $config['syslog']['logfilesize'];
if (!$pconfig['nentries']) {
- $pconfig['nentries'] = 50;
+ $pconfig['nentries'] = 50;
}
function is_valid_syslog_server($target) {
- return (is_ipaddr($target)
- || is_ipaddrwithport($target)
- || is_hostname($target)
- || is_hostnamewithport($target));
+ return (is_ipaddr($target)
+ || is_ipaddrwithport($target)
+ || is_hostname($target)
+ || is_hostnamewithport($target));
}
if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
- clear_all_log_files();
- $savemsg .= gettext("The log files have been reset.");
+ clear_all_log_files();
+ $savemsg .= gettext("The log files have been reset.");
} elseif ($_POST) {
- unset($input_errors);
- $pconfig = $_POST;
-
- /* input validation */
- if ($_POST['enable'] && !is_valid_syslog_server($_POST['remoteserver'])) {
- $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
- }
- if ($_POST['enable'] && $_POST['remoteserver2'] && !is_valid_syslog_server($_POST['remoteserver2'])) {
- $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
- }
- if ($_POST['enable'] && $_POST['remoteserver3'] && !is_valid_syslog_server($_POST['remoteserver3'])) {
- $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
- }
-
- if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
- $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
- }
-
- if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
- if (!is_numeric($_POST['logfilesize']) || ($_POST['logfilesize'] < 100000)) {
- $input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
- }
- }
- if (!$input_errors) {
- $config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
- $config['syslog']['nentries'] = (int)$_POST['nentries'];
- $pconfig['nentries'] = $config['syslog']['nentries'];
- if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
- $config['syslog']['logfilesize'] = (int)$_POST['logfilesize'];
- $pconfig['logfilesize'] = $config['syslog']['logfilesize'];
- } else {
- unset($config['syslog']['logfilesize']);
- }
- $config['syslog']['remoteserver'] = $_POST['remoteserver'];
- $config['syslog']['remoteserver2'] = $_POST['remoteserver2'];
- $config['syslog']['remoteserver3'] = $_POST['remoteserver3'];
- $config['syslog']['sourceip'] = $_POST['sourceip'];
- $config['syslog']['ipproto'] = $_POST['ipproto'];
- $config['syslog']['filter'] = $_POST['filter'] ? true : false;
- $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
- $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
- $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
- $config['syslog']['apinger'] = $_POST['apinger'] ? true : false;
- $config['syslog']['relayd'] = $_POST['relayd'] ? true : false;
- $config['syslog']['hostapd'] = $_POST['hostapd'] ? true : false;
- $config['syslog']['logall'] = $_POST['logall'] ? true : false;
- $config['syslog']['system'] = $_POST['system'] ? true : false;
- $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
- $config['syslog']['enable'] = $_POST['enable'] ? true : false;
- $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
- $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']);
- $oldnologbogons = isset($config['syslog']['nologbogons']);
- $oldnologprivatenets = isset($config['syslog']['nologprivatenets']);
- $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
- $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
- $config['syslog']['nologdefaultpass'] = $_POST['logdefaultpass'] ? true : false;
- $config['syslog']['nologbogons'] = $_POST['logbogons'] ? false : true;
- $config['syslog']['nologprivatenets'] = $_POST['logprivatenets'] ? false : true;
- $config['syslog']['nologlighttpd'] = $_POST['loglighttpd'] ? false : true;
- $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
- if (is_numeric($_POST['filterdescriptions']) && $_POST['filterdescriptions'] > 0) {
- $config['syslog']['filterdescriptions'] = $_POST['filterdescriptions'];
- } else {
- unset($config['syslog']['filterdescriptions']);
- }
- if ($config['syslog']['enable'] == false) {
- unset($config['syslog']['remoteserver']);
- unset($config['syslog']['remoteserver2']);
- unset($config['syslog']['remoteserver3']);
- }
-
- write_config();
-
- $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']))) {
- $retval |= filter_configure();
- }
-
- $savemsg = get_std_save_message($retval);
-
- if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
- ob_flush();
- flush();
- log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
- send_event("service restart webgui");
- $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
- }
-
- filter_pflog_start(true);
- }
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable'] && !is_valid_syslog_server($_POST['remoteserver'])) {
+ $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
+ }
+ if ($_POST['enable'] && $_POST['remoteserver2'] && !is_valid_syslog_server($_POST['remoteserver2'])) {
+ $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
+ }
+ if ($_POST['enable'] && $_POST['remoteserver3'] && !is_valid_syslog_server($_POST['remoteserver3'])) {
+ $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
+ }
+
+ if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
+ $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
+ }
+
+ if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
+ if (!is_numeric($_POST['logfilesize']) || ($_POST['logfilesize'] < 100000)) {
+ $input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
+ }
+ }
+ if (!$input_errors) {
+ $config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
+ $config['syslog']['nentries'] = (int)$_POST['nentries'];
+ $pconfig['nentries'] = $config['syslog']['nentries'];
+ if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
+ $config['syslog']['logfilesize'] = (int)$_POST['logfilesize'];
+ $pconfig['logfilesize'] = $config['syslog']['logfilesize'];
+ } else {
+ unset($config['syslog']['logfilesize']);
+ }
+ $config['syslog']['remoteserver'] = $_POST['remoteserver'];
+ $config['syslog']['remoteserver2'] = $_POST['remoteserver2'];
+ $config['syslog']['remoteserver3'] = $_POST['remoteserver3'];
+ $config['syslog']['sourceip'] = $_POST['sourceip'];
+ $config['syslog']['ipproto'] = $_POST['ipproto'];
+ $config['syslog']['filter'] = $_POST['filter'] ? true : false;
+ $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
+ $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
+ $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
+ $config['syslog']['apinger'] = $_POST['apinger'] ? true : false;
+ $config['syslog']['relayd'] = $_POST['relayd'] ? true : false;
+ $config['syslog']['hostapd'] = $_POST['hostapd'] ? true : false;
+ $config['syslog']['logall'] = $_POST['logall'] ? true : false;
+ $config['syslog']['system'] = $_POST['system'] ? true : false;
+ $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
+ $config['syslog']['enable'] = $_POST['enable'] ? true : false;
+ $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
+ $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']);
+ $oldnologbogons = isset($config['syslog']['nologbogons']);
+ $oldnologprivatenets = isset($config['syslog']['nologprivatenets']);
+ $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
+ $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
+ $config['syslog']['nologdefaultpass'] = $_POST['logdefaultpass'] ? true : false;
+ $config['syslog']['nologbogons'] = $_POST['logbogons'] ? false : true;
+ $config['syslog']['nologprivatenets'] = $_POST['logprivatenets'] ? false : true;
+ $config['syslog']['nologlighttpd'] = $_POST['loglighttpd'] ? false : true;
+ $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
+ if (is_numeric($_POST['filterdescriptions']) && $_POST['filterdescriptions'] > 0) {
+ $config['syslog']['filterdescriptions'] = $_POST['filterdescriptions'];
+ } else {
+ unset($config['syslog']['filterdescriptions']);
+ }
+ if ($config['syslog']['enable'] == false) {
+ unset($config['syslog']['remoteserver']);
+ unset($config['syslog']['remoteserver2']);
+ unset($config['syslog']['remoteserver3']);
+ }
+
+ write_config();
+
+ $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']))) {
+ $retval |= filter_configure();
+ }
+
+ $savemsg = get_std_save_message($retval);
+
+ if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
+ ob_flush();
+ flush();
+ log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
+ send_event("service restart webgui");
+ $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
+ }
+
+ filter_pflog_start(true);
+ }
}
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Settings"));
include("head.inc");
$logfilesizeHelp = gettext("Logs are held in constant-size circular log files. This field controls how large each log file is, and thus how many entries may exist inside the log. By default this is approximately 500KB per log file, and there are nearly 20 such log files.") .
- '<br /><br />' .
- gettext("NOTE: Log sizes are changed the next time a log file is cleared or deleted. To immediately increase the size of the log files, you must first save the options to set the size, then clear all logs using the \"Reset Log Files\" option farther down this page. ") .
- gettext("Be aware that increasing this value increases every log file size, so disk usage will increase significantly.") . '<br /><br />' .
- gettext("Disk space currently used by log files is: ") . exec("/usr/bin/du -sh /var/log | /usr/bin/awk '{print $1;}'") .
- gettext(" Remaining disk space for log files: ") . exec("/bin/df -h /var/log | /usr/bin/awk '{print $4;}'");
+ '<br /><br />' .
+ gettext("NOTE: Log sizes are changed the next time a log file is cleared or deleted. To immediately increase the size of the log files, you must first save the options to set the size, then clear all logs using the \"Reset Log Files\" option farther down this page. ") .
+ gettext("Be aware that increasing this value increases every log file size, so disk usage will increase significantly.") . '<br /><br />' .
+ gettext("Disk space currently used by log files is: ") . exec("/usr/bin/du -sh /var/log | /usr/bin/awk '{print $1;}'") .
+ gettext(" Remaining disk space for log files: ") . exec("/bin/df -h /var/log | /usr/bin/awk '{print $4;}'");
$remoteloghelp = gettext("This option will allow the logging daemon to bind to a single IP address, rather than all IP addresses.") .
- gettext("If you pick a single IP, remote syslog severs 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.");
+ gettext("If you pick a single IP, remote syslog severs 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)
- print_input_errors($input_errors);
+ print_input_errors($input_errors);
else if ($savemsg)
- print_info_box($savemsg);
+ print_info_box($savemsg);
$tab_array = array();
$tab_array[] = array(gettext("System"), false, "diag_logs.php");
@@ -245,99 +245,99 @@ display_top_tabs($tab_array);
require('classes/Form.class.php');
$form = new Form(new Form_Button(
- 'Submit',
- gettext("Save")
+ 'Submit',
+ gettext("Save")
));
$section = new Form_Section('General Logging Options');
$section->addInput(new Form_Checkbox(
- 'reverse',
- 'Forward/Reverse Display',
- 'Show log entries in reverse order (newest entries on top)',
- $pconfig['reverse']
+ 'reverse',
+ 'Forward/Reverse Display',
+ 'Show log entries in reverse order (newest entries on top)',
+ $pconfig['reverse']
));
$section->addInput(new Form_Input(
- 'nentries',
- 'GUI Log Entries',
- 'text',
- $pconfig['nentries'],
- ['placeholder' => '']
+ 'nentries',
+ 'GUI Log Entries',
+ 'text',
+ $pconfig['nentries'],
+ ['placeholder' => '']
))->setHelp('This is only the number of log entries displayed in the GUI. It does not affect how many entries are contained in the actual log files.');
$section->addInput(new Form_Input(
- 'logfilesize',
- 'Log file size (Bytes)',
- 'text',
- $pconfig['logfilesize'],
- ['placeholder' => 'Bytes']
+ 'logfilesize',
+ 'Log file size (Bytes)',
+ 'text',
+ $pconfig['logfilesize'],
+ ['placeholder' => 'Bytes']
))->setHelp($logfilesizeHelp);
$section->addInput(new Form_Checkbox(
- 'logdefaultblock',
- 'Log firewall default blocks',
- 'Log packets matched from the default block rules in the ruleset',
- $pconfig['logdefaultblock']
+ 'logdefaultblock',
+ 'Log firewall default blocks',
+ 'Log packets matched from the default block rules in the ruleset',
+ $pconfig['logdefaultblock']
))->setHelp('Packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.');
$section->addInput(new Form_Checkbox(
- 'logdefaultpass',
- null,
- 'Log packets matched from the default pass rules put in the ruleset',
- $pconfig['logdefaultpass']
+ 'logdefaultpass',
+ null,
+ 'Log packets matched from the default pass rules put in the ruleset',
+ $pconfig['logdefaultpass']
))->setHelp('Packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected. ');
$section->addInput(new Form_Checkbox(
- 'logbogons',
- null,
- 'Log packets blocked by \'Block Bogon Networks\' rules',
- $pconfig['logbogons']
+ 'logbogons',
+ null,
+ 'Log packets blocked by \'Block Bogon Networks\' rules',
+ $pconfig['logbogons']
));
$section->addInput(new Form_Checkbox(
- 'logprivatenets',
- null,
- 'Log packets blocked by \'Block Private Networks\' rules',
- $pconfig['logprivatenets']
+ 'logprivatenets',
+ null,
+ 'Log packets blocked by \'Block Private Networks\' rules',
+ $pconfig['logprivatenets']
));
$section->addInput(new Form_Checkbox(
- 'loglighttpd',
- 'Web Server Log',
- 'Log errors from the web server process',
- $pconfig['loglighttpd']
+ 'loglighttpd',
+ 'Web Server Log',
+ 'Log errors from the web server process',
+ $pconfig['loglighttpd']
))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the main system log');
$section->addInput(new Form_Checkbox(
- 'rawfilter',
- 'Raw Logs',
- 'Show raw filter logs)',
- $pconfig['rawfilter']
+ 'rawfilter',
+ 'Raw Logs',
+ 'Show raw filter logs)',
+ $pconfig['rawfilter']
))->setHelp(gettext('If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information, but it is more difficult to read'));
$section->addInput(new Form_Select(
- 'filterdescriptions',
- 'Where to show rule descriptions',
- !isset($pconfig['filterdescriptions']) ? '0':$pconfig['filterdescriptions'],
- array(
- '0' => 'Dont load descriptions',
- '1' => 'Display as column',
- '2' => 'Display as second row'
- )
+ 'filterdescriptions',
+ 'Where to show rule descriptions',
+ !isset($pconfig['filterdescriptions']) ? '0':$pconfig['filterdescriptions'],
+ array(
+ '0' => 'Dont load descriptions',
+ '1' => 'Display as column',
+ '2' => 'Display as second row'
+ )
))->setHelp('Show the applied rule description below or in the firewall log rows' . '<br />' .
- 'Displaying rule descriptions for all lines in the log might affect performance with large rule sets');
+ 'Displaying rule descriptions for all lines in the log might affect performance with large rule sets');
$section->addInput(new Form_Checkbox(
- 'disablelocallogging',
- 'Local Logging',
- $g['platform'] == 'pfSense' ? "Disable writing log files to the local disk" : "Disable writing log files to the local RAM disk",
- $pconfig['disablelocallogging']
+ 'disablelocallogging',
+ 'Local Logging',
+ $g['platform'] == 'pfSense' ? "Disable writing log files to the local disk" : "Disable writing log files to the local RAM disk",
+ $pconfig['disablelocallogging']
));
$section->addInput(new Form_Button(
- 'resetlogs',
- 'Reset Log Files'
+ 'resetlogs',
+ 'Reset Log Files'
))->addClass('btn-danger btn-xs')->setHelp('Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes.');
$form->add($section);
@@ -345,130 +345,130 @@ $section = new Form_Section('Remote Logging Options');
$section->addClass('toggle-remote');
$section->addInput(new Form_Checkbox(
- 'enable',
- 'Enable Remote Logging',
- 'Send log messages to remote syslog server',
- $pconfig['enable']
+ 'enable',
+ 'Enable Remote Logging',
+ 'Send log messages to remote syslog server',
+ $pconfig['enable']
))->toggles('.toggle-remote .panel-body .form-group:not(:first-child)');
$section->addInput(new Form_Select(
- 'sourceip',
- 'Source Address',
- link_interface_to_bridge($pconfig['sourceip']) ? null : $pconfig['sourceip'],
- ["" => gettext("Default (any)")] + get_possible_traffic_source_addresses(false)
+ 'sourceip',
+ 'Source Address',
+ link_interface_to_bridge($pconfig['sourceip']) ? null : $pconfig['sourceip'],
+ ["" => gettext("Default (any)")] + get_possible_traffic_source_addresses(false)
))->setHelp($remoteloghelp);
$section->addInput(new Form_Select(
- 'ipproto',
- 'IP Protocol',
- $ipproto,
- array('ipv4' => 'IPv4', 'ipv6' => 'IPv6')
+ 'ipproto',
+ 'IP Protocol',
+ $ipproto,
+ array('ipv4' => 'IPv4', 'ipv6' => 'IPv6')
))->setHelp('This option is only used when a non-default address is chosen as the source above. This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried.');
-// Group colapses/appears based on 'enable' checkbox above
+// Group collapses/appears based on 'enable' checkbox above
$group = new Form_Group('Remote log servers');
$group->add(new Form_Input(
- 'remoteserver',
- 'Server 1',
- 'text',
- $pconfig['remoteserver'],
- ['placeholder' => 'IP[:port]']
+ 'remoteserver',
+ 'Server 1',
+ 'text',
+ $pconfig['remoteserver'],
+ ['placeholder' => 'IP[:port]']
));
$group->add(new Form_Input(
- 'remoteserver2',
- 'Server 2',
- 'text',
- $pconfig['remoteserver2'],
- ['placeholder' => 'IP[:port]']
+ 'remoteserver2',
+ 'Server 2',
+ 'text',
+ $pconfig['remoteserver2'],
+ ['placeholder' => 'IP[:port]']
));
$group->add(new Form_Input(
- 'remoteserver3',
- 'Server 3',
- 'text',
- $pconfig['remoteserver3'],
- ['placeholder' => 'IP[:port]']
+ 'remoteserver3',
+ 'Server 3',
+ 'text',
+ $pconfig['remoteserver3'],
+ ['placeholder' => 'IP[:port]']
));
$section->add($group);
$group = new Form_MultiCheckboxGroup('Remote Syslog Contents');
$group->add(new Form_MultiCheckbox(
- 'logall',
- null,
- 'Everything',
- $pconfig['logall']
+ 'logall',
+ null,
+ 'Everything',
+ $pconfig['logall']
));
$group->add(new Form_MultiCheckbox(
- 'system',
- null,
- 'System Events',
- $pconfig['system']
+ 'system',
+ null,
+ 'System Events',
+ $pconfig['system']
));
$group->add(new Form_MultiCheckbox(
- 'filter',
- null,
- 'Firewall Events',
- $pconfig['filter']
+ 'filter',
+ null,
+ 'Firewall Events',
+ $pconfig['filter']
));
$group->add(new Form_MultiCheckbox(
- 'dhcp',
- null,
- 'DHCP service events',
- $pconfig['dhcp']
+ 'dhcp',
+ null,
+ 'DHCP service events',
+ $pconfig['dhcp']
));
$group->add(new Form_MultiCheckbox(
- 'portalauth',
- null,
- 'Portal Auth events',
- $pconfig['portalauth']
+ 'portalauth',
+ null,
+ 'Portal Auth events',
+ $pconfig['portalauth']
));
$group->add(new Form_MultiCheckbox(
- 'vpn',
- null,
- 'VPN (PPTP, IPsec, OpenVPN) events',
- $pconfig['vpn']
+ 'vpn',
+ null,
+ 'VPN (PPTP, IPsec, OpenVPN) events',
+ $pconfig['vpn']
));
$group->add(new Form_MultiCheckbox(
- 'apinger',
- null,
- 'Gateway Monitor events',
- $pconfig['apinger']
+ 'apinger',
+ null,
+ 'Gateway Monitor events',
+ $pconfig['apinger']
));
$group->add(new Form_MultiCheckbox(
- 'relayd',
- null,
- 'Server Load Balancer events',
- $pconfig['relayd']
+ 'relayd',
+ null,
+ 'Server Load Balancer events',
+ $pconfig['relayd']
));
$group->add(new Form_MultiCheckbox(
- 'hostapd',
- null,
- 'Wireless events',
- $pconfig['hostapd']
+ 'hostapd',
+ null,
+ 'Wireless events',
+ $pconfig['hostapd']
));
// Ugly hack to prevent the "Toggle all" button from being automatically
$group->add(new Form_MultiCheckbox(
- 'notoggleall',
- null,
- 'No toggle all',
- $pconfig['hostapd']
+ 'notoggleall',
+ null,
+ 'No toggle all',
+ $pconfig['hostapd']
))->displayAsRadio();
$group->setHelp('Syslog sends UDP datagrams to port 514 on the specified remote '.
- 'syslog server, unless another port is specified. Be sure to set syslogd on '.
- 'the remote server to accept syslog messages from pfSense.');
+ 'syslog server, unless another port is specified. Be sure to set syslogd on '.
+ 'the remote server to accept syslog messages from pfSense.');
$section->add($group);
@@ -478,39 +478,39 @@ print $form;
<script>
//<![CDATA[
events.push(function(){
- function hideInput(id, hide) {
- if(hide)
- $('#' + id).parent().addClass('hidden');
- else
- $('#' + id).parent().removeClass('hidden');
- }
-
- function disableInput(id, disable) {
- $('#' + id).prop("disabled", disable);
- }
-
- hideInput('notoggleall', true);
-
- function disableEverything() {
- var hide = $('#logall').prop('checked');
-
- disableInput('system', hide);
- disableInput('filter', hide);
- disableInput('dhcp', hide);
- disableInput('portalauth', hide);
- disableInput('vpn', hide);
- disableInput('apinger', hide);
- disableInput('relayd', hide);
- disableInput('hostapd', hide);
- }
-
- // On click . .
- $('#logall').click(function () {
- disableEverything();
- });
-
- // On page load . .
- disableEverything();
+ function hideInput(id, hide) {
+ if(hide)
+ $('#' + id).parent().addClass('hidden');
+ else
+ $('#' + id).parent().removeClass('hidden');
+ }
+
+ function disableInput(id, disable) {
+ $('#' + id).prop("disabled", disable);
+ }
+
+ hideInput('notoggleall', true);
+
+ function disableEverything() {
+ var hide = $('#logall').prop('checked');
+
+ disableInput('system', hide);
+ disableInput('filter', hide);
+ disableInput('dhcp', hide);
+ disableInput('portalauth', hide);
+ disableInput('vpn', hide);
+ disableInput('apinger', hide);
+ disableInput('relayd', hide);
+ disableInput('hostapd', hide);
+ }
+
+ // On click . .
+ $('#logall').click(function () {
+ disableEverything();
+ });
+
+ // On page load . .
+ disableEverything();
});
//]]>
</script>
diff --git a/src/usr/local/www/diag_logs_vpn.php b/src/usr/local/www/diag_logs_vpn.php
index e5ce76b..6429a0c 100755
--- a/src/usr/local/www/diag_logs_vpn.php
+++ b/src/usr/local/www/diag_logs_vpn.php
@@ -213,7 +213,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
</tbody>
</table>
<?php
- if($rows == 0)
+ if ($rows == 0)
print_info_box('No logs to display');
?>
</div>
@@ -223,7 +223,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
?>
<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>
diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php
index 7479693..b7efa88 100644
--- a/src/usr/local/www/diag_nanobsd.php
+++ b/src/usr/local/www/diag_nanobsd.php
@@ -90,8 +90,8 @@ nanobsd_detect_slice_info();
$NANOBSD_SIZE = nanobsd_get_size();
$class='alert-warning';
-if($_POST['bootslice']) {
- if(!DEBUG)
+if ($_POST['bootslice']) {
+ if (!DEBUG)
nanobsd_switch_boot_slice();
else
sleep(4);
@@ -102,10 +102,10 @@ if($_POST['bootslice']) {
nanobsd_detect_slice_info();
}
-if($_POST['destslice'] && $_POST['duplicateslice']) {
+if ($_POST['destslice'] && $_POST['duplicateslice']) {
$statusmsg = gettext("Duplicating slice. Please wait, this will take a moment...");
- if(!DEBUG && nanobsd_clone_slice($_POST['destslice'])) {
+ if (!DEBUG && nanobsd_clone_slice($_POST['destslice'])) {
$savemsg = gettext("The slice has been duplicated.") . "<p/>" . gettext("If you would like to boot from this newly duplicated slice please set it using the bootup information area.");
$class='alert-success';
} else {
@@ -125,7 +125,7 @@ if ($_POST['changero']) {
}
if ($_POST['setrw']) {
- if(!DEBUG) {
+ if (!DEBUG) {
conf_mount_rw();
if (isset($_POST['nanobsd_force_rw']))
$config['system']['nanobsd_force_rw'] = true;
@@ -225,7 +225,7 @@ $section->addInput(new Form_StaticText(
'These options have been relocated to the ' . '<a href="system_advanced_misc.php">' . 'System > Advanced, Miscellaneous</a> tab.'
));
-if(file_exists("/conf/upgrade_log.txt")) {
+if (file_exists("/conf/upgrade_log.txt")) {
$viewbtn = new Form_Button('viewupgradelog', 'View log');
$viewbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
@@ -237,7 +237,7 @@ if(file_exists("/conf/upgrade_log.txt")) {
$form->add($section);
print($form);
-if(file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) {
+if (file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) {
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Previous upgrade log")?></h2></div>
diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php
index 1fe0b24..cb6c889 100644
--- a/src/usr/local/www/diag_ndp.php
+++ b/src/usr/local/www/diag_ndp.php
@@ -154,7 +154,7 @@ include("head.inc");
?>
<?=$mac?>
- <? if(isset($mac_man[$mac_hi])):?>
+ <? if (isset($mac_man[$mac_hi])):?>
(<?=$mac_man[$mac_hi]?>)
<?endif?>
@@ -164,7 +164,7 @@ include("head.inc");
</td>
<td>
<?php
- if(isset($hwif[$entry['interface']]))
+ if (isset($hwif[$entry['interface']]))
echo $hwif[$entry['interface']];
else
echo $entry['interface'];
diff --git a/src/usr/local/www/diag_patterns.php b/src/usr/local/www/diag_patterns.php
index 8386f25..2ca6f3a 100644
--- a/src/usr/local/www/diag_patterns.php
+++ b/src/usr/local/www/diag_patterns.php
@@ -73,7 +73,7 @@ $buttonlabel = gettext("Upload Pattern file");
//Move the upload file to /usr/local/share/protocols (is_uploaded_file must use tmp_name as argument)
if (($_POST['submit'] == $buttonlabel) && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
- if(fileExtension($_FILES['ulfile']['name'])) {
+ if (fileExtension($_FILES['ulfile']['name'])) {
if (!is_array($config['l7shaper']['custom_pat']))
$config['l7shaper']['custom_pat'] = array();
@@ -98,7 +98,7 @@ function fileExtension($nameFile) {
$pgtitle = array(gettext("Diagnostics"), gettext("Add layer7 pattern"));
include("head.inc");
-if($ulmsg)
+if ($ulmsg)
print_info_box($ulmsg, $class);
require('classes/Form.class.php');
diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php
index 881da29..1d1cc89 100644
--- a/src/usr/local/www/diag_pf_info.php
+++ b/src/usr/local/www/diag_pf_info.php
@@ -76,7 +76,7 @@ if (stristr($_POST['Submit'], gettext("No"))) {
exit;
}
-if($_REQUEST['getactivity']) {
+if ($_REQUEST['getactivity']) {
$text = `/sbin/pfctl -vvsi`;
$text .= "<p/>";
$text .= `/sbin/pfctl -vvsm`;
diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php
index cb4bf2e..f491b9a 100644
--- a/src/usr/local/www/diag_ping.php
+++ b/src/usr/local/www/diag_ping.php
@@ -121,7 +121,7 @@ if (!isset($do_ping)) {
$count = DEFAULT_COUNT;
}
-if($do_ping) {
+if ($do_ping) {
?>
<script type="text/javascript">
//<![CDATA[
@@ -152,7 +152,7 @@ if($do_ping) {
//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.";
}
@@ -211,7 +211,7 @@ $section->addInput(new Form_Select(
$form->add($section);
print $form;
-if($do_ping && !empty($result) && !$input_errors) {
+if ($do_ping && !empty($result) && !$input_errors) {
?>
<div class="panel panel-default">
<div class="panel-heading">
diff --git a/src/usr/local/www/diag_pkglogs.php b/src/usr/local/www/diag_pkglogs.php
index e02cfff..4bafa87 100755
--- a/src/usr/local/www/diag_pkglogs.php
+++ b/src/usr/local/www/diag_pkglogs.php
@@ -111,16 +111,16 @@ if (!$apkg) { // If we aren't looking for a specific package, locate the first p
$pgtitle = array(gettext("Status"), gettext("Package logs"));
include("head.inc");
-if($pkgwithlogging == false) {
+if ($pkgwithlogging == false) {
print_info_box(gettext("No packages with logging facilities are currently installed."));
} else {
$tab_array = array();
- foreach($config['installedpackages']['package'] as $package) {
- if(is_array($package['logging'])) {
- if(!($logtab = $package['logging']['logtab']))
+ foreach ($config['installedpackages']['package'] as $package) {
+ if (is_array($package['logging'])) {
+ if (!($logtab = $package['logging']['logtab']))
$logtab = $package['name'];
- if($apkg == $package['name']) {
+ if ($apkg == $package['name']) {
$curtab = $logtab;
$tab_array[] = array(sprintf(gettext("%s"), $logtab), true, "diag_pkglogs.php?pkg=".$package['name']);
} else {
@@ -132,7 +132,7 @@ if($pkgwithlogging == false) {
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab)?></h2></div>
+ <div class="panel-heading"><h2 class="panel-title"><?=printf(gettext('Last %1$s %2$s log entries'), $nentries, $curtab)?></h2></div>
<div>class="panel-body">
<pre>
<?php
diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php
index 7dff11c..17f89bd 100644
--- a/src/usr/local/www/diag_resetstate.php
+++ b/src/usr/local/www/diag_resetstate.php
@@ -98,7 +98,7 @@ if ($input_errors)
if ($savemsg)
print_info_box($savemsg, 'alert-success');
-$statetabelhelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' .
+$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 ' .
'firewall and/or NAT rules, especially if there are IP protocol mappings (e.g. for PPTP or IPv6) with open connections.' .
'<br /><br />' .
@@ -140,9 +140,9 @@ $section->addInput(new Form_Checkbox(
'State Table',
'Reset the firewall state table',
true
-))->setHelp($statetabelhelp);
+))->setHelp($statetablehelp);
-if(isset($config['system']['lb_use_sticky'])) {
+if (isset($config['system']['lb_use_sticky'])) {
$section->addInput(new Form_Checkbox(
'sourcetracking',
'Source Tracking',
diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php
index 3b8e3ab..a866b0b 100644
--- a/src/usr/local/www/diag_routes.php
+++ b/src/usr/local/www/diag_routes.php
@@ -68,8 +68,8 @@
include('guiconfig.inc');
-$limit='100';
-$filter='';
+$limit = '100';
+$filter = '';
if (isset($_REQUEST['isAjax'])) {
$netstat = "/usr/bin/netstat -rW";
@@ -121,7 +121,7 @@ $section->addInput(new Form_Checkbox(
'Resolve names',
'Enable',
$resolve
-))->setHelp('Enabling name resolution may cause the query should take longer.'.
+))->setHelp('Enabling name resolution may cause the query to take longer.'.
' You can stop it at any time by clicking the Stop button in your browser.');
$validLimits = array('10', '50', '100', '200', '500', '1000', 'all');
diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php
index d09a891..4022e29 100644
--- a/src/usr/local/www/diag_smart.php
+++ b/src/usr/local/www/diag_smart.php
@@ -118,7 +118,7 @@ $tab_array[0] = array(gettext("Information/Tests"), ($action != 'config'), $_SER
$tab_array[1] = array(gettext("Config"), ($action == 'config'), $_SERVER['PHP_SELF'] . "?action=config");
display_top_tabs($tab_array);
-switch($action) {
+switch ($action) {
// Testing devices
case 'test':
{
@@ -219,7 +219,7 @@ switch($action) {
// Config changes, users email in xml config and write changes to smartd.conf
case 'config':
{
- if(isset($_POST['test'])) {
+ if (isset($_POST['test'])) {
// FIXME shell_exec($smartd . " -M test -m " . $config['system']['smartmonemail']);
$savemsg = sprintf(gettext("Email sent to %s"), $config['system']['smartmonemail']);
@@ -227,7 +227,7 @@ switch($action) {
smartmonctl("start");
$style = 'warning';
}
- else if(isset($_POST['save']))
+ else if (isset($_POST['save']))
{
$config['system']['smartmonemail'] = $_POST['smartmonemail'];
write_config();
@@ -235,7 +235,7 @@ switch($action) {
// Don't know what all this means, but it adds the config changed header when config is saved
$retval = 0;
config_lock();
- if(stristr($retval, "error") != true) {
+ if (stristr($retval, "error") != true) {
$savemsg = get_std_save_message($retval);
$style = 'success';
}
@@ -253,7 +253,7 @@ switch($action) {
shell_exec("/usr/bin/killall -HUP smartd");
}
- // Was the config changed? if so , print the message
+ // Was the config changed? if so, print the message
if ($savemsg)
print_info_box($savemsg, $style);
@@ -273,7 +273,7 @@ switch($action) {
$form->add($section);
- if(!empty($pconfig['smartmonemail'])) {
+ if (!empty($pconfig['smartmonemail'])) {
$form->addGlobal(new Form_Button(
'test',
'Send test email'
diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php
index 84c9642..5701640 100644
--- a/src/usr/local/www/diag_sockets.php
+++ b/src/usr/local/www/diag_sockets.php
@@ -148,7 +148,7 @@ $showAllOption = $showAll ? "" : "?showAll";
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title">Socket information - explanation</h2></div>
<div class="panel-body">
- This page show the output for the commands: "sockstat -4lL" and "sockstat -6lL".<br />
+ This page shows the output for the commands: "sockstat -4lL" and "sockstat -6lL".<br />
Or in case of showing all sockets the output for: "sockstat -4" and "sockstat -6".<br />
<br />
The information listed for each socket is:
diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php
index 587ddcd..502c53c 100644
--- a/src/usr/local/www/diag_states_summary.php
+++ b/src/usr/local/www/diag_states_summary.php
@@ -192,7 +192,7 @@ function print_summary_table($label, $iparr, $sort = TRUE)
</tr>
</thead>
<tbody>
-<?php foreach($iparr as $ip => $ipinfo):
+<?php foreach ($iparr as $ip => $ipinfo):
$protocolCount = count($ipinfo['protos']);
$rowSpan = '';
$i = 0;
@@ -204,7 +204,7 @@ function print_summary_table($label, $iparr, $sort = TRUE)
<td<?= $rowSpan ?>><?php echo $ip; ?></td>
<td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td>
-<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?>
+<?php foreach ($ipinfo['protos'] as $proto => $protoinfo): ?>
<?php if ($protocolCount > 1 && $i > 0): ?>
</tr><tr>
<?php endif; ?>
diff --git a/src/usr/local/www/diag_system_activity.php b/src/usr/local/www/diag_system_activity.php
index 488f69f..22f19f1 100644
--- a/src/usr/local/www/diag_system_activity.php
+++ b/src/usr/local/www/diag_system_activity.php
@@ -69,7 +69,7 @@
require("guiconfig.inc");
-$pgtitle = array(gettext("Diagnostics"),gettext("System Activity"));
+$pgtitle = array(gettext("Diagnostics"), gettext("System Activity"));
if ($_REQUEST['getactivity']) {
$text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php
index 762b83e..5de3029 100644
--- a/src/usr/local/www/diag_tables.php
+++ b/src/usr/local/www/diag_tables.php
@@ -88,7 +88,7 @@ if ($_REQUEST['delete']) {
exit;
}
-if($_POST['deleteall']) {
+if ($_POST['deleteall']) {
exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T show", $entries);
if (is_array($entries)) {
foreach ($entries as $entryA) {
@@ -98,23 +98,23 @@ if($_POST['deleteall']) {
}
}
-if(($tablename == "bogons") || ($tablename == "bogonsv6")) {
+if (($tablename == "bogons") || ($tablename == "bogonsv6")) {
$bogons = true;
- if($_POST['Download']) {
+ if ($_POST['Download']) {
mwexec_bg("/etc/rc.update_bogons.sh now");
$maxtimetowait = 0;
$loading = true;
- while($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.");
}
}
diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php
index 5ff0140..e0515fa 100644
--- a/src/usr/local/www/diag_testport.php
+++ b/src/usr/local/www/diag_testport.php
@@ -66,8 +66,8 @@
##|*MATCH=diag_testport.php*
##|-PRIV
-// Calling netcat and parsing hte results has been moved to the if ($_POST) section so that the results are known
-// before we draw the form and any resulting error messages will allear in the correct place
+// Calling netcat and parsing the results has been moved to the if ($_POST) section so that the results are known
+// before we draw the form and any resulting error messages will appear in the correct place
$allowautocomplete = true;
@@ -118,7 +118,7 @@ if ($_POST || $_REQUEST['host']) {
$showtext = isset($_REQUEST['showtext']);
$ipprotocol = $_REQUEST['ipprotocol'];
- if ( $do_testport ) {
+ if ($do_testport) {
?>
<script type="text/javascript">
//<![CDATA[
@@ -209,27 +209,27 @@ if ($_POST || $_REQUEST['host']) {
include("head.inc");
-// Handle the display of all messages here wher the user can readily see them
+// Handle the display of all messages here where the user can readily see them
if ($input_errors)
print_input_errors($input_errors);
else {
// New page
- if(empty($result) && $retval != 0 && !$showtext) {
+ 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.' .
' This test does not function for UDP since there is no way to reliably determine if a UDP port accepts connections in this manner.</div>');
}
// Good host & port
- if($retval == 0 && $do_testport == 1) {
- if(!$showtext)
+ if ($retval == 0 && $do_testport == 1) {
+ if (!$showtext)
print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful").'</div>');
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
print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>');
@@ -290,7 +290,7 @@ $section->addInput(new Form_Select(
$form->add($section);
print $form;
-if($ncoutput && !empty($result) && $showtext && $retval == 0): ?>
+if ($ncoutput && !empty($result) && $showtext && $retval == 0): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Received Remote Text</h2>
diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php
index f82b963..6792a9d 100644
--- a/src/usr/local/www/diag_traceroute.php
+++ b/src/usr/local/www/diag_traceroute.php
@@ -175,7 +175,7 @@ $section->addInput(new Form_Checkbox(
'Reverse Address Lookup',
'',
$resolve
-))->setHelp('When checked, traceroute will attempt to perform a PTR lookup to locate hostnames for hops along the path. Will slow down the process as it has to wait for DNS replies.');
+))->setHelp('When checked, traceroute will attempt to perform a PTR lookup to locate hostnames for hops along the path. This will slow down the process as it has to wait for DNS replies.');
$section->addInput(new Form_Checkbox(
'useicmp',
@@ -193,17 +193,17 @@ if (!$input_errors && $do_traceroute) {
$useicmp = isset($_REQUEST['useicmp']) ? "-I" : "";
$n = isset($resolve) ? "" : "-n";
- $command = "/usr/sbin/traceroute";
- if ($ipproto == "ipv6") {
- $command .= "6";
- $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
- } else {
- $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
- }
-
- if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
- $srcip = "-s " . escapeshellarg($ifaddr);
- }
+ $command = "/usr/sbin/traceroute";
+ if ($ipproto == "ipv6") {
+ $command .= "6";
+ $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
+ } else {
+ $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
+ }
+
+ if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
+ $srcip = "-s " . escapeshellarg($ifaddr);
+ }
$cmd = "{$command} {$n} {$srcip} -w 2 {$useicmp} -m " . escapeshellarg($ttl) . " " . escapeshellarg($host);
?>
diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php
index aedf9ed..a00069c 100644
--- a/src/usr/local/www/edit.php
+++ b/src/usr/local/www/edit.php
@@ -72,15 +72,15 @@ require("guiconfig.inc");
if ($_POST['action']) {
switch ($_POST['action']) {
case 'load':
- if(strlen($_POST['file']) < 1) {
+ if (strlen($_POST['file']) < 1) {
print('|5|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|');
- } elseif(is_dir($_POST['file'])) {
+ } elseif (is_dir($_POST['file'])) {
print('|4|' . '<div class="alert alert-danger" role="alert">' . gettext("Loading a directory is not supported") .'</div>' . '|');
- } elseif(! is_file($_POST['file'])) {
+ } elseif (!is_file($_POST['file'])) {
print('|3|' . '<div class="alert alert-danger" role="alert">' . gettext("File does not exist or is not a regular file") . '</div>' . '|');
} else {
$data = file_get_contents(urldecode($_POST['file']));
- if($data === false) {
+ if ($data === false) {
print('|1|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to read file") . '</div>' . '|');
} else {
$data = base64_encode($data);
@@ -90,7 +90,7 @@ if ($_POST['action']) {
exit;
case 'save':
- if(strlen($_POST['file']) < 1) {
+ if (strlen($_POST['file']) < 1) {
print('|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|');
} else {
conf_mount_rw();
@@ -103,9 +103,9 @@ if ($_POST['action']) {
}
disable_security_checks();
}
- if($ret === false) {
+ if ($ret === false) {
print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to write file") . '</div>' . '|');
- } elseif($ret != strlen($_POST['data'])) {
+ } elseif ($ret != strlen($_POST['data'])) {
print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Error while writing file") . '</div>' . '|');
} else {
print('|' . '<div class="alert alert-success" role="alert">' . gettext("File saved successfully") . '</div>' . '|');
@@ -201,7 +201,7 @@ require("head.inc");
);
}
- <?php if($_GET['action'] == "load"): ?>
+ <?php if ($_GET['action'] == "load"): ?>
events.push(function() {
jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path'])?>");
loadFile();
diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php
index a7d9cfd..2ceef95 100644
--- a/src/usr/local/www/exec.php
+++ b/src/usr/local/www/exec.php
@@ -298,5 +298,5 @@ if (!isBlank($_POST['txtCommand'])):?>
<?php
include("foot.inc");
-if($_POST)
+if ($_POST)
conf_mount_ro(); \ No newline at end of file
OpenPOWER on IntegriCloud