summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-04-19 18:00:00 +0545
committerPhil Davis <phil.davis@inf.org>2015-04-19 18:00:00 +0545
commit5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e (patch)
treecd25c71caf551eb882f460ac6e1c32c8220fe58f
parent0608bd3c354ea76eb6df9ed9322e2ef8686f15e7 (diff)
downloadpfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.zip
pfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.tar.gz
Code style usr-local-www diag
-rw-r--r--usr/local/www/diag_arp.php72
-rw-r--r--usr/local/www/diag_authentication.php20
-rw-r--r--usr/local/www/diag_backup.php271
-rw-r--r--usr/local/www/diag_confbak.php122
-rw-r--r--usr/local/www/diag_dns.php92
-rwxr-xr-xusr/local/www/diag_dump_states.php33
-rw-r--r--usr/local/www/diag_dump_states_sources.php23
-rw-r--r--usr/local/www/diag_gmirror.php207
-rw-r--r--usr/local/www/diag_ipsec.php118
-rw-r--r--usr/local/www/diag_ipsec_leases.php2
-rw-r--r--usr/local/www/diag_ipsec_xml.php12
-rw-r--r--usr/local/www/diag_limiter_info.php60
-rwxr-xr-xusr/local/www/diag_logs.php30
-rw-r--r--usr/local/www/diag_logs_auth.php10
-rw-r--r--usr/local/www/diag_logs_dhcp.php7
-rw-r--r--usr/local/www/diag_logs_filter.php223
-rwxr-xr-xusr/local/www/diag_logs_filter_dynamic.php43
-rw-r--r--usr/local/www/diag_logs_filter_summary.php52
-rwxr-xr-xusr/local/www/diag_logs_gateways.php33
-rw-r--r--usr/local/www/diag_logs_ipsec.php22
-rw-r--r--usr/local/www/diag_logs_ntpd.php54
-rw-r--r--usr/local/www/diag_logs_openvpn.php20
-rw-r--r--usr/local/www/diag_logs_ppp.php22
-rw-r--r--usr/local/www/diag_logs_relayd.php51
-rwxr-xr-xusr/local/www/diag_logs_resolver.php38
-rw-r--r--usr/local/www/diag_logs_routing.php60
-rw-r--r--usr/local/www/diag_logs_settings.php28
-rwxr-xr-xusr/local/www/diag_logs_vpn.php47
-rw-r--r--usr/local/www/diag_logs_wireless.php60
-rw-r--r--usr/local/www/diag_nanobsd.php46
-rw-r--r--usr/local/www/diag_ndp.php41
-rw-r--r--usr/local/www/diag_packet_capture.php78
-rw-r--r--usr/local/www/diag_patterns.php9
-rw-r--r--usr/local/www/diag_pf_info.php85
-rw-r--r--usr/local/www/diag_ping.php27
-rwxr-xr-xusr/local/www/diag_pkglogs.php76
-rw-r--r--usr/local/www/diag_resetstate.php126
-rw-r--r--usr/local/www/diag_routes.php117
-rw-r--r--usr/local/www/diag_smart.php61
-rw-r--r--usr/local/www/diag_sockets.php148
-rw-r--r--usr/local/www/diag_states_summary.php20
-rw-r--r--usr/local/www/diag_system_activity.php87
-rw-r--r--usr/local/www/diag_system_pftop.php79
-rw-r--r--usr/local/www/diag_tables.php63
-rw-r--r--usr/local/www/diag_testport.php41
-rw-r--r--usr/local/www/diag_traceroute.php28
46 files changed, 1640 insertions, 1324 deletions
diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php
index 16b3303..00af12f 100644
--- a/usr/local/www/diag_arp.php
+++ b/usr/local/www/diag_arp.php
@@ -13,11 +13,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -58,11 +58,13 @@ function adjust_gmt($dt) {
}
function remove_duplicate($array, $field) {
- foreach ($array as $sub)
+ foreach ($array as $sub) {
$cmp[] = $sub[$field];
+ }
$unique = array_unique($cmp);
- foreach ($unique as $k => $rien)
+ foreach ($unique as $k => $rien) {
$new[] = $array[$k];
+ }
return $new;
}
@@ -78,7 +80,7 @@ $cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'";
/* We then split the leases file by } */
$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'";
-/* stuff the leases file in a proper format into a array by line */
+/* stuff the leases file in a proper format into an array by line */
exec("cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content);
$leases_count = count($leases_content);
@@ -88,19 +90,19 @@ $i = 0;
$l = 0;
$p = 0;
// Put everything together again
-while($i < $leases_count) {
+while ($i < $leases_count) {
/* split the line by space */
$data = explode(" ", $leases_content[$i]);
/* walk the fields */
$f = 0;
$fcount = count($data);
/* with less then 20 fields there is nothing useful */
- if($fcount < 20) {
+ if ($fcount < 20) {
$i++;
continue;
}
- while($f < $fcount) {
- switch($data[$f]) {
+ while ($f < $fcount) {
+ switch ($data[$f]) {
case "failover":
$pools[$p]['name'] = $data[$f+2];
$pools[$p]['mystate'] = $data[$f+7];
@@ -166,7 +168,7 @@ while($i < $leases_count) {
case "hardware":
$leases[$l]['mac'] = $data[$f+2];
/* check if it's online and the lease is active */
- if($leases[$l]['act'] == "active") {
+ if ($leases[$l]['act'] == "active") {
$online = exec("/usr/sbin/arp -an |/usr/bin/awk '/{$leases[$l]['ip']}/ {print}'|wc -l");
if ($online == 1) {
$leases[$l]['online'] = 'online';
@@ -177,11 +179,11 @@ while($i < $leases_count) {
$f = $f+2;
break;
case "client-hostname":
- if($data[$f+1] <> "") {
+ if ($data[$f+1] <> "") {
$leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]);
} else {
$hostname = gethostbyaddr($leases[$l]['ip']);
- if($hostname <> "") {
+ if ($hostname <> "") {
$leases[$l]['hostname'] = $hostname;
}
}
@@ -198,11 +200,11 @@ while($i < $leases_count) {
}
/* remove duplicate items by mac address */
-if(count($leases) > 0) {
+if (count($leases) > 0) {
$leases = remove_duplicate($leases,"ip");
}
-if(count($pools) > 0) {
+if (count($pools) > 0) {
$pools = remove_duplicate($pools,"name");
asort($pools);
}
@@ -225,8 +227,9 @@ $ifdescrs = get_configured_interface_with_descr();
foreach ($ifdescrs as $key => $interface) {
$thisif = convert_friendly_interface_to_real_interface_name($key);
- if (!empty($thisif))
+ if (!empty($thisif)) {
$hwif[$thisif] = $interface;
+ }
}
$data = array();
@@ -245,15 +248,16 @@ foreach ($rawdata as $line) {
function _getHostName($mac,$ip) {
global $dhcpmac, $dhcpip;
- if ($dhcpmac[$mac])
+ if ($dhcpmac[$mac]) {
return $dhcpmac[$mac];
- else if ($dhcpip[$ip])
+ } else if ($dhcpip[$ip]) {
return $dhcpip[$ip];
- else{
+ } else {
exec("host -W 1 " . escapeshellarg($ip), $output);
if (preg_match('/.*pointer ([A-Za-z_0-9.-]+)\..*/',$output[0],$matches)) {
- if ($matches[1] <> $ip)
- return $matches[1];
+ if ($matches[1] <> $ip) {
+ return $matches[1];
+ }
}
}
return "";
@@ -276,28 +280,34 @@ include("head.inc");
<?php
// Flush buffers out to client so that they see Loading, please wait....
-for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
+for ($i = 0; $i < ob_get_level(); $i++) {
+ ob_end_flush();
+}
ob_implicit_flush(1);
// Resolve hostnames and replace Z_ with "". The intention
// is to sort the list by hostnames, alpha and then the non
// resolvable addresses will appear last in the list.
$dnsavailable=1;
-$dns = trim(_getHostName("", "8.8.8.8"));
-if ($dns == ""){
- $dns = trim(_getHostName("", "8.8.4.4"));
- if ($dns == "") $dnsavailable =0;
+$dns = trim(_getHostName("", "8.8.8.8"));
+if ($dns == "") {
+ $dns = trim(_getHostName("", "8.8.4.4"));
+ if ($dns == "") {
+ $dnsavailable = 0;
+ }
}
foreach ($data as &$entry) {
- if ($dnsavailable){
+ if ($dnsavailable) {
$dns = trim(_getHostName($entry['mac'], $entry['ip']));
- }else
+ } else {
$dns="";
- if(trim($dns))
+ }
+ if (trim($dns)) {
$entry['dnsresolve'] = "$dns";
- else
+ } else {
$entry['dnsresolve'] = "Z_ ";
+ }
}
// Sort the data alpha first
@@ -325,7 +335,7 @@ $mac_man = load_mac_manufacturer_table();
$mac=trim($entry['mac']);
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
print $mac;
- if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
+ if (isset($mac_man[$mac_hi])) { print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
?>
</td>
<td class="listr">
diff --git a/usr/local/www/diag_authentication.php b/usr/local/www/diag_authentication.php
index df68560..1c02828 100644
--- a/usr/local/www/diag_authentication.php
+++ b/usr/local/www/diag_authentication.php
@@ -10,11 +10,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -48,19 +48,22 @@ if ($_POST) {
unset($input_errors);
$authcfg = auth_get_authserver($_POST['authmode']);
- if (!$authcfg)
+ if (!$authcfg) {
$input_errors[] = $_POST['authmode'] . " " . gettext("is not a valid authentication server");
+ }
- if (empty($_POST['username']) || empty($_POST['passwordfld']))
+ if (empty($_POST['username']) || empty($_POST['passwordfld'])) {
$input_errors[] = gettext("A username and password must be specified.");
+ }
if (!$input_errors) {
if (authenticate_user($_POST['username'], $_POST['passwordfld'], $authcfg)) {
$savemsg = gettext("User") . ": " . $_POST['username'] . " " . gettext("authenticated successfully.");
$groups = getUserGroups($_POST['username'], $authcfg);
$savemsg .= "<br />" . gettext("This user is a member of these groups") . ": <br />";
- foreach ($groups as $group)
+ foreach ($groups as $group) {
$savemsg .= "{$group} ";
+ }
} else {
$input_errors[] = gettext("Authentication failed.");
}
@@ -95,11 +98,12 @@ include("head.inc");
$auth_servers = auth_get_authserver_list();
foreach ($auth_servers as $auth_server):
$selected = "";
- if ($auth_server['name'] == $pconfig['authmode'])
+ if ($auth_server['name'] == $pconfig['authmode']) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
</td>
</tr>
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index a83bdab..6c25f02 100644
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -85,7 +85,7 @@ function rrd_data_xml() {
function restore_rrddata() {
global $config, $g, $rrdtool, $input_errors;
- foreach($config['rrddata']['rrddatafile'] as $rrd) {
+ foreach ($config['rrddata']['rrddatafile'] as $rrd) {
if ($rrd['xmldata']) {
$rrd_file = "{$g['vardb_path']}/rrd/{$rrd['filename']}";
$xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
@@ -101,8 +101,7 @@ function restore_rrddata() {
continue;
}
unlink($xml_file);
- }
- else if ($rrd['data']) {
+ } else if ($rrd['data']) {
$rrd_file = "{$g['vardb_path']}/rrd/{$rrd['filename']}";
$rrd_fd = fopen($rrd_file, "w");
if (!$rrd_fd) {
@@ -137,18 +136,21 @@ function add_base_packages_menu_items() {
global $g, $config;
$base_packages = explode(",", $g['base_packages']);
$modified_config = false;
- foreach($base_packages as $bp) {
+ foreach ($base_packages as $bp) {
$basepkg_path = "/usr/local/pkg/{$bp}";
$tmpinfo = pathinfo($basepkg_path, PATHINFO_EXTENSION);
- if($tmpinfo['extension'] == "xml" && file_exists($basepkg_path)) {
+ if ($tmpinfo['extension'] == "xml" && file_exists($basepkg_path)) {
$pkg_config = parse_xml_config_pkg($basepkg_path, "packagegui");
- if($pkg_config['menu'] != "") {
- if(is_array($pkg_config['menu'])) {
- foreach($pkg_config['menu'] as $menu) {
- if(is_array($config['installedpackages']['menu']))
- foreach($config['installedpackages']['menu'] as $amenu)
- if($amenu['name'] == $menu['name'])
+ if ($pkg_config['menu'] != "") {
+ if (is_array($pkg_config['menu'])) {
+ foreach ($pkg_config['menu'] as $menu) {
+ if (is_array($config['installedpackages']['menu'])) {
+ foreach ($config['installedpackages']['menu'] as $amenu) {
+ if ($amenu['name'] == $menu['name']) {
continue;
+ }
+ }
+ }
$config['installedpackages']['menu'][] = $menu;
$modified_config = true;
}
@@ -158,7 +160,7 @@ function add_base_packages_menu_items() {
}
}
}
- if($modified_config) {
+ if ($modified_config) {
write_config(gettext("Restored base_package menus after configuration restore."));
$config = parse_config(true);
}
@@ -170,8 +172,9 @@ function remove_bad_chars($string) {
function check_and_returnif_section_exists($section) {
global $config;
- if(is_array($config[$section]))
+ if (is_array($config[$section])) {
return true;
+ }
return false;
}
@@ -179,41 +182,45 @@ function spit_out_select_items($name, $showall) {
global $config;
$areas = array("aliases" => gettext("Aliases"),
- "captiveportal" => gettext("Captive Portal"),
- "voucher" => gettext("Captive Portal Vouchers"),
- "dnsmasq" => gettext("DNS Forwarder"),
- "unbound" => gettext("DNS Resolver"),
- "dhcpd" => gettext("DHCP Server"),
- "dhcpdv6" => gettext("DHCPv6 Server"),
- "filter" => gettext("Firewall Rules"),
- "interfaces" => gettext("Interfaces"),
- "ipsec" => gettext("IPSEC"),
- "nat" => gettext("NAT"),
- "openvpn" => gettext("OpenVPN"),
- "installedpackages" => gettext("Package Manager"),
- "pptpd" => gettext("PPTP Server"),
- "rrddata" => gettext("RRD Data"),
- "cron" => gettext("Scheduled Tasks"),
- "syslog" => gettext("Syslog"),
- "system" => gettext("System"),
- "staticroutes" => gettext("Static routes"),
- "sysctl" => gettext("System tunables"),
- "snmpd" => gettext("SNMP Server"),
- "shaper" => gettext("Traffic Shaper"),
- "vlans" => gettext("VLANS"),
- "wol" => gettext("Wake on LAN")
+ "captiveportal" => gettext("Captive Portal"),
+ "voucher" => gettext("Captive Portal Vouchers"),
+ "dnsmasq" => gettext("DNS Forwarder"),
+ "unbound" => gettext("DNS Resolver"),
+ "dhcpd" => gettext("DHCP Server"),
+ "dhcpdv6" => gettext("DHCPv6 Server"),
+ "filter" => gettext("Firewall Rules"),
+ "interfaces" => gettext("Interfaces"),
+ "ipsec" => gettext("IPSEC"),
+ "nat" => gettext("NAT"),
+ "openvpn" => gettext("OpenVPN"),
+ "installedpackages" => gettext("Package Manager"),
+ "pptpd" => gettext("PPTP Server"),
+ "rrddata" => gettext("RRD Data"),
+ "cron" => gettext("Scheduled Tasks"),
+ "syslog" => gettext("Syslog"),
+ "system" => gettext("System"),
+ "staticroutes" => gettext("Static routes"),
+ "sysctl" => gettext("System tunables"),
+ "snmpd" => gettext("SNMP Server"),
+ "shaper" => gettext("Traffic Shaper"),
+ "vlans" => gettext("VLANS"),
+ "wol" => gettext("Wake on LAN")
);
$select = "<select name=\"{$name}\" id=\"{$name}\">";
$select .= "<option value=\"\">" . gettext("ALL") . "</option>";
- if($showall == true)
- foreach($areas as $area => $areaname)
+ if ($showall == true) {
+ foreach ($areas as $area => $areaname) {
$select .= "<option value=\"{$area}\">{$areaname}</option>\n";
- else
- foreach($areas as $area => $areaname)
- if($area === "rrddata" || check_and_returnif_section_exists($area) == true)
+ }
+ } else {
+ foreach ($areas as $area => $areaname) {
+ if ($area === "rrddata" || check_and_returnif_section_exists($area) == true) {
$select .= "<option value=\"{$area}\">{$areaname}</option>\n";
+ }
+ }
+ }
$select .= "</select>\n";
@@ -246,32 +253,32 @@ if ($_POST['apply']) {
if ($_POST) {
unset($input_errors);
- if (stristr($_POST['Submit'], gettext("Restore configuration")))
+ if (stristr($_POST['Submit'], gettext("Restore configuration"))) {
$mode = "restore";
- else if (stristr($_POST['Submit'], gettext("Reinstall")))
+ } else if (stristr($_POST['Submit'], gettext("Reinstall"))) {
$mode = "reinstallpackages";
- else if (stristr($_POST['Submit'], gettext("Clear Package Lock")))
+ } else if (stristr($_POST['Submit'], gettext("Clear Package Lock"))) {
$mode = "clearpackagelock";
- else if (stristr($_POST['Submit'], gettext("Download")))
+ } else if (stristr($_POST['Submit'], gettext("Download"))) {
$mode = "download";
- else if (stristr($_POST['Submit'], gettext("Restore version")))
+ } else if (stristr($_POST['Submit'], gettext("Restore version"))) {
$mode = "restore_ver";
-
- if ($_POST["nopackages"] <> "")
+ }
+ if ($_POST["nopackages"] <> "") {
$options = "nopackages";
-
- if ($_POST["ver"] <> "")
+ }
+ if ($_POST["ver"] <> "") {
$ver2restore = $_POST["ver"];
-
+ }
if ($mode) {
-
if ($mode == "download") {
-
if ($_POST['encrypt']) {
- if(!$_POST['encrypt_password'] || !$_POST['encrypt_passconf'])
+ if (!$_POST['encrypt_password'] || !$_POST['encrypt_passconf']) {
$input_errors[] = gettext("You must supply and confirm the password for encryption.");
- if($_POST['encrypt_password'] != $_POST['encrypt_passconf'])
+ }
+ if ($_POST['encrypt_password'] != $_POST['encrypt_passconf']) {
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
+ }
}
if (!$input_errors) {
@@ -282,8 +289,8 @@ if ($_POST) {
$name = "config-{$host}-".date("YmdHis").".xml";
$data = "";
- if($options == "nopackages") {
- if(!$_POST['backuparea']) {
+ if ($options == "nopackages") {
+ if (!$_POST['backuparea']) {
/* backup entire configuration */
$data = file_get_contents("{$g['conf_path']}/config.xml");
} else {
@@ -296,7 +303,7 @@ if ($_POST) {
exec("sed '/<installedpackages>/,/<\/installedpackages>/d' {$sfn} > {$sfn}-new");
$data = file_get_contents($sfn . "-new");
} else {
- if(!$_POST['backuparea']) {
+ if (!$_POST['backuparea']) {
/* backup entire configuration */
$data = file_get_contents("{$g['conf_path']}/config.xml");
} else if ($_POST['backuparea'] === "rrddata") {
@@ -343,21 +350,21 @@ if ($_POST) {
}
if ($mode == "restore") {
-
if ($_POST['decrypt']) {
- if(!$_POST['decrypt_password'] || !$_POST['decrypt_passconf'])
+ if (!$_POST['decrypt_password'] || !$_POST['decrypt_passconf']) {
$input_errors[] = gettext("You must supply and confirm the password for decryption.");
- if($_POST['decrypt_password'] != $_POST['decrypt_passconf'])
+ }
+ if ($_POST['decrypt_password'] != $_POST['decrypt_passconf']) {
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
+ }
}
if (!$input_errors) {
-
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
/* read the file contents */
$data = file_get_contents($_FILES['conffile']['tmp_name']);
- if(!$data) {
+ if (!$data) {
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
return 1;
}
@@ -370,15 +377,15 @@ if ($_POST) {
$data = decrypt_data($data, $_POST['decrypt_password']);
}
- if(stristr($data, "<m0n0wall>")) {
+ if (stristr($data, "<m0n0wall>")) {
log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
/* m0n0wall was found in config. convert it. */
$data = str_replace("m0n0wall", "pfsense", $data);
$m0n0wall_upgrade = true;
}
- if($_POST['restorearea']) {
+ if ($_POST['restorearea']) {
/* restore a specific area of the configuration */
- if(!stristr($data, "<" . $_POST['restorearea'] . ">")) {
+ if (!stristr($data, "<" . $_POST['restorearea'] . ">")) {
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
} else {
if (!restore_config_section($_POST['restorearea'], $data)) {
@@ -398,7 +405,7 @@ if ($_POST) {
}
}
} else {
- if(!stristr($data, "<" . $g['xml_rootobj'] . ">")) {
+ if (!stristr($data, "<" . $g['xml_rootobj'] . ">")) {
$input_errors[] = sprintf(gettext("You have selected to restore the full configuration but we could not locate a %s tag."), $g['xml_rootobj']);
} else {
/* restore the entire configuration */
@@ -409,8 +416,9 @@ if ($_POST) {
mark_subsystem_dirty("restore");
touch("/conf/needs_package_sync");
/* remove cache, we will force a config reboot */
- if(file_exists("{$g['tmp_path']}/config.cache"))
+ if (file_exists("{$g['tmp_path']}/config.cache")) {
unlink("{$g['tmp_path']}/config.cache");
+ }
$config = parse_config(true);
if (file_exists("/boot/loader.conf")) {
$loaderconf = file_get_contents("/boot/loader.conf");
@@ -421,7 +429,7 @@ if ($_POST) {
unset($loaderconf);
}
/* extract out rrd items, unset from $config when done */
- if($config['rrddata']) {
+ if ($config['rrddata']) {
restore_rrddata();
unset($config['rrddata']);
unlink_if_exists("{$g['tmp_path']}/config.cache");
@@ -430,20 +438,23 @@ if ($_POST) {
convert_config();
conf_mount_ro();
}
- if($m0n0wall_upgrade == true) {
- if($config['system']['gateway'] <> "")
+ if ($m0n0wall_upgrade == true) {
+ if ($config['system']['gateway'] <> "") {
$config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
+ }
unset($config['shaper']);
/* optional if list */
$ifdescrs = get_configured_interface_list(true, true);
/* remove special characters from interface descriptions */
- if(is_array($ifdescrs))
- foreach($ifdescrs as $iface)
+ if (is_array($ifdescrs)) {
+ foreach ($ifdescrs as $iface) {
$config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']);
+ }
+ }
/* check for interface names with an alias */
- if(is_array($ifdescrs)) {
- foreach($ifdescrs as $iface) {
- if(is_alias($config['interfaces'][$iface]['descr'])) {
+ if (is_array($ifdescrs)) {
+ foreach ($ifdescrs as $iface) {
+ if (is_alias($config['interfaces'][$iface]['descr'])) {
// Firewall rules
$origname = $config['interfaces'][$iface]['descr'];
$newname = $config['interfaces'][$iface]['descr'] . "Alias";
@@ -465,58 +476,60 @@ if ($_POST) {
$config['system']['version'] = "1.0";
// Deal with descriptions longer than 63 characters
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
- if(count($config['filter']['rule'][$i]['descr']) > 63)
+ if (count($config['filter']['rule'][$i]['descr']) > 63) {
$config['filter']['rule'][$i]['descr'] = substr($config['filter']['rule'][$i]['descr'], 0, 63);
+ }
}
// Move interface from ipsec to enc0
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
- if($config['filter']['rule'][$i]['interface'] == "ipsec")
+ if ($config['filter']['rule'][$i]['interface'] == "ipsec") {
$config['filter']['rule'][$i]['interface'] = "enc0";
+ }
}
// Convert icmp types
// http://www.openbsd.org/cgi-bin/man.cgi?query=icmp&sektion=4&arch=i386&apropos=0&manpath=OpenBSD+Current
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
- if($config["filter"]["rule"][$i]['icmptype']) {
- switch($config["filter"]["rule"][$i]['icmptype']) {
- case "echo":
- $config["filter"]["rule"][$i]['icmptype'] = "echoreq";
- break;
- case "unreach":
- $config["filter"]["rule"][$i]['icmptype'] = "unreach";
- break;
- case "echorep":
- $config["filter"]["rule"][$i]['icmptype'] = "echorep";
- break;
- case "squench":
- $config["filter"]["rule"][$i]['icmptype'] = "squench";
- break;
- case "redir":
- $config["filter"]["rule"][$i]['icmptype'] = "redir";
- break;
- case "timex":
- $config["filter"]["rule"][$i]['icmptype'] = "timex";
- break;
- case "paramprob":
- $config["filter"]["rule"][$i]['icmptype'] = "paramprob";
- break;
- case "timest":
- $config["filter"]["rule"][$i]['icmptype'] = "timereq";
- break;
- case "timestrep":
- $config["filter"]["rule"][$i]['icmptype'] = "timerep";
- break;
- case "inforeq":
- $config["filter"]["rule"][$i]['icmptype'] = "inforeq";
- break;
- case "inforep":
- $config["filter"]["rule"][$i]['icmptype'] = "inforep";
- break;
- case "maskreq":
- $config["filter"]["rule"][$i]['icmptype'] = "maskreq";
- break;
- case "maskrep":
- $config["filter"]["rule"][$i]['icmptype'] = "maskrep";
- break;
+ if ($config["filter"]["rule"][$i]['icmptype']) {
+ switch ($config["filter"]["rule"][$i]['icmptype']) {
+ case "echo":
+ $config["filter"]["rule"][$i]['icmptype'] = "echoreq";
+ break;
+ case "unreach":
+ $config["filter"]["rule"][$i]['icmptype'] = "unreach";
+ break;
+ case "echorep":
+ $config["filter"]["rule"][$i]['icmptype'] = "echorep";
+ break;
+ case "squench":
+ $config["filter"]["rule"][$i]['icmptype'] = "squench";
+ break;
+ case "redir":
+ $config["filter"]["rule"][$i]['icmptype'] = "redir";
+ break;
+ case "timex":
+ $config["filter"]["rule"][$i]['icmptype'] = "timex";
+ break;
+ case "paramprob":
+ $config["filter"]["rule"][$i]['icmptype'] = "paramprob";
+ break;
+ case "timest":
+ $config["filter"]["rule"][$i]['icmptype'] = "timereq";
+ break;
+ case "timestrep":
+ $config["filter"]["rule"][$i]['icmptype'] = "timerep";
+ break;
+ case "inforeq":
+ $config["filter"]["rule"][$i]['icmptype'] = "inforeq";
+ break;
+ case "inforep":
+ $config["filter"]["rule"][$i]['icmptype'] = "inforep";
+ break;
+ case "maskreq":
+ $config["filter"]["rule"][$i]['icmptype'] = "maskreq";
+ break;
+ case "maskrep":
+ $config["filter"]["rule"][$i]['icmptype'] = "maskrep";
+ break;
}
}
}
@@ -528,8 +541,8 @@ if ($_POST) {
$savemsg = gettext("The m0n0wall configuration has been restored and upgraded to pfSense.");
mark_subsystem_dirty("restore");
}
- if(is_array($config['captiveportal'])) {
- foreach($config['captiveportal'] as $cp) {
+ if (is_array($config['captiveportal'])) {
+ foreach ($config['captiveportal'] as $cp) {
if (isset($cp['enable'])) {
/* for some reason ipfw doesn't init correctly except on bootup sequence */
mark_subsystem_dirty("restore");
@@ -538,7 +551,7 @@ if ($_POST) {
}
}
setup_serial_port();
- if(is_interface_mismatch() == true) {
+ if (is_interface_mismatch() == true) {
touch("/var/run/interface_mismatch_reboot_needed");
clear_subsystem_dirty("restore");
convert_config();
@@ -564,7 +577,6 @@ if ($_POST) {
}
if ($mode == "reinstallpackages") {
-
header("Location: pkg_mgr_install.php?mode=reinstallall");
exit;
} else if ($mode == "clearpackagelock") {
@@ -603,18 +615,20 @@ include("head.inc");
function encrypt_change() {
- if (!document.iform.encrypt.checked)
+ if (!document.iform.encrypt.checked) {
document.getElementById("encrypt_opts").style.display="none";
- else
+ } else {
document.getElementById("encrypt_opts").style.display="";
+ }
}
function decrypt_change() {
- if (!document.iform.decrypt.checked)
+ if (!document.iform.decrypt.checked) {
document.getElementById("decrypt_opts").style.display="none";
- else
+ } else {
document.getElementById("decrypt_opts").style.display="";
+ }
}
function backuparea_change(obj) {
@@ -797,7 +811,8 @@ decrypt_change();
</html>
<?php
-if (is_subsystem_dirty('restore'))
+if (is_subsystem_dirty('restore')) {
system_reboot();
+}
?>
diff --git a/usr/local/www/diag_confbak.php b/usr/local/www/diag_confbak.php
index bf6c3f2..babdbfe 100644
--- a/usr/local/www/diag_confbak.php
+++ b/usr/local/www/diag_confbak.php
@@ -1,32 +1,32 @@
<?php
/* $Id$ */
/*
- diag_confbak.php
- Copyright (C) 2005 Colin Smith
- Copyright (C) 2010 Jim Pingle
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
+ diag_confbak.php
+ Copyright (C) 2005 Colin Smith
+ Copyright (C) 2010 Jim Pingle
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -59,20 +59,21 @@ if (isset($_POST['backupcount'])) {
conf_mount_rw();
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
- if($_POST['newver'] != "") {
- if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0)
- $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), htmlspecialchars($confvers[$_POST['newver']]['description']));
- else
+ if ($_POST['newver'] != "") {
+ if (config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0) {
+ $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), htmlspecialchars($confvers[$_POST['newver']]['description']));
+ } else {
$savemsg = gettext("Unable to revert to the selected configuration.");
+ }
}
- if($_POST['rmver'] != "") {
+ if ($_POST['rmver'] != "") {
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_POST['rmver'] . '.xml');
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']), htmlspecialchars($confvers[$_POST['rmver']]['description']));
}
conf_mount_ro();
}
-if($_GET['getcfg'] != "") {
+if ($_GET['getcfg'] != "") {
$file = $g['conf_path'] . '/backup/config-' . $_GET['getcfg'] . '.xml';
$exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml");
@@ -86,8 +87,9 @@ if($_GET['getcfg'] != "") {
exit;
}
-if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime'])
- && is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
+if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) &&
+ (is_numeric($_GET['oldtime'])) &&
+ (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
$diff = "";
$oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml';
$oldtime = $_GET['oldtime'];
@@ -115,8 +117,9 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php
include("fbegin.inc");
- if($savemsg)
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<?php if ($diff) { ?>
<table align="center" width="100%" border="0" cellspacing="0" style="padding-top: 4px; padding-bottom: 4px; vertical-align:middle;" summary="diag confbak">
@@ -160,32 +163,32 @@ include("head.inc");
<form action="diag_confbak.php" method="post">
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
-<?PHP if ($_GET["newver"] || $_GET["rmver"]): ?>
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Confirm Action"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
+<?php if ($_GET["newver"] || $_GET["rmver"]): ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?php echo gettext("Confirm Action"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
- <strong><?PHP echo gettext("Please confirm the selected action"); ?></strong>:
- <br />
- <br /><strong><?PHP echo gettext("Action"); ?>:</strong>
- <?PHP if (!empty($_GET["newver"])) {
- echo gettext("Restore from Configuration Backup");
- $target_config = $_GET["newver"]; ?>
- <input type="hidden" name="newver" value="<?PHP echo htmlspecialchars($_GET["newver"]); ?>" />
- <?PHP } elseif (!empty($_GET["rmver"])) {
- echo gettext("Remove Configuration Backup");
- $target_config = $_GET["rmver"]; ?>
- <input type="hidden" name="rmver" value="<?PHP echo htmlspecialchars($_GET["rmver"]); ?>" />
- <?PHP } ?>
- <br /><strong><?PHP echo gettext("Target Configuration"); ?>:</strong>
- <?PHP echo sprintf(gettext('Timestamp %1$s'), date(gettext("n/j/y H:i:s"), $target_config)); ?>
- <br /><input type="submit" name="confirm" value="<?PHP echo gettext("Confirm"); ?>" />
- </td>
- </tr>
-<?PHP else: ?>
+ <strong><?php echo gettext("Please confirm the selected action"); ?></strong>:
+ <br />
+ <br /><strong><?php echo gettext("Action"); ?>:</strong>
+ <?php if (!empty($_GET["newver"])) {
+ echo gettext("Restore from Configuration Backup");
+ $target_config = $_GET["newver"]; ?>
+ <input type="hidden" name="newver" value="<?php echo htmlspecialchars($_GET["newver"]); ?>" />
+ <?php } elseif (!empty($_GET["rmver"])) {
+ echo gettext("Remove Configuration Backup");
+ $target_config = $_GET["rmver"]; ?>
+ <input type="hidden" name="rmver" value="<?php echo htmlspecialchars($_GET["rmver"]); ?>" />
+ <?php } ?>
+ <br /><strong><?php echo gettext("Target Configuration"); ?>:</strong>
+ <?php echo sprintf(gettext('Timestamp %1$s'), date(gettext("n/j/y H:i:s"), $target_config)); ?>
+ <br /><input type="submit" name="confirm" value="<?php echo gettext("Confirm"); ?>" />
+ </td>
+ </tr>
+<?php else: ?>
<tr>
<td width="10%">&nbsp;</td>
@@ -236,11 +239,12 @@ include("head.inc");
</tr>
<?php
$c = 0;
- 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
+ } else {
$date = gettext("Unknown");
+ }
?>
<tr valign="top">
<td class="list">
diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php
index cbce9aa..5ee7927 100644
--- a/usr/local/www/diag_dns.php
+++ b/usr/local/www/diag_dns.php
@@ -10,11 +10,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -38,7 +38,7 @@ require("guiconfig.inc");
$host = trim($_REQUEST['host'], " \t\n\r\0\x0B[];\"'");
$host_esc = escapeshellarg($host);
-/* If this section of config.xml has not been populated yet we need to set it up
+/* If this section of config.xml has not been populated yet we need to set it up
*/
if (!is_array($config['aliases']['alias'])) {
$config['aliases']['alias'] = array();
@@ -48,43 +48,47 @@ $a_aliases = &$config['aliases']['alias'];
$aliasname = str_replace(array(".","-"), "_", $host);
$alias_exists = false;
$counter=0;
-foreach($a_aliases as $a) {
- if($a['name'] == $aliasname) {
+foreach ($a_aliases as $a) {
+ if ($a['name'] == $aliasname) {
$alias_exists = true;
$id=$counter;
}
$counter++;
}
-if(isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
- if($_POST['override'])
+if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
+ if ($_POST['override']) {
$override = true;
+ }
$resolved = gethostbyname($host);
$type = "hostname";
- if($resolved) {
+ if ($resolved) {
$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;
}
}
$newalias = array();
- if($override)
+ if ($override) {
$alias_exists = false;
- if($alias_exists == false) {
+ }
+ if ($alias_exists == false) {
$newalias['name'] = $aliasname;
$newalias['type'] = "network";
$newalias['address'] = $addresses;
$newalias['descr'] = "Created from Diagnostics-> DNS Lookup";
- if($override)
+ if ($override) {
$a_aliases[$id] = $newalias;
- else
+ } else {
$a_aliases[] = $newalias;
+ }
write_config();
$createdalias = true;
}
@@ -98,7 +102,7 @@ if ($_POST) {
$reqdfieldsn = explode(",", "Host");
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
-
+
if (!is_hostname($host) && !is_ipaddr($host)) {
$input_errors[] = gettext("Host must be a valid hostname or IP address.");
} else {
@@ -108,8 +112,9 @@ if ($_POST) {
exec("/usr/bin/grep nameserver /etc/resolv.conf | /usr/bin/cut -f2 -d' '", $dns_servers);
foreach ($dns_servers as $dns_server) {
$query_time = exec("/usr/bin/drill {$host_esc} " . escapeshellarg("@" . trim($dns_server)) . " | /usr/bin/grep Query | /usr/bin/cut -d':' -f2");
- if($query_time == "")
+ if ($query_time == "") {
$query_time = gettext("No response");
+ }
$new_qt = array();
$new_qt['dns_server'] = $dns_server;
$new_qt['query_time'] = $query_time;
@@ -127,18 +132,20 @@ if ($_POST) {
$type = "ip";
$resolved = gethostbyaddr($host);
$ipaddr = $host;
- if ($host != $resolved)
+ if ($host != $resolved) {
$hostname = $resolved;
+ }
} elseif (is_hostname($host)) {
$type = "hostname";
$resolved = gethostbyname($host);
- if($resolved) {
+ if ($resolved) {
$resolved = array();
exec("/usr/bin/drill {$host_esc} A | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print $5 }'", $resolved);
}
$hostname = $host;
- if ($host != $resolved)
+ if ($host != $resolved) {
$ipaddr = $resolved[0];
+ }
}
if ($host == $resolved) {
@@ -147,7 +154,7 @@ if ($_POST) {
}
}
-if( ($_POST['host']) && ($_POST['dialog_output']) ) {
+if (($_POST['host']) && ($_POST['dialog_output'])) {
display_host_results ($host,$resolved,$dns_speeds);
exit;
}
@@ -175,18 +182,18 @@ include("head.inc"); ?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag dns">
- <tr>
- <td>
+ <tr>
+ <td>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="diag_dns.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
<tr>
<td colspan="2" valign="top" class="listtopic"> <?=gettext("Resolve DNS hostname or IP");?></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP");?></td>
<td width="78%" class="vtable">
- <?=$mandfldhtml;?>
+ <?=$mandfldhtml;?>
<table summary="results">
<tr><td valign="top">
<input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" />
@@ -196,28 +203,28 @@ include("head.inc"); ?>
<font size="+1">
<?php
$found = 0;
- if(is_array($resolved)) {
- foreach($resolved as $hostitem) {
- if($hostitem <> "") {
+ if (is_array($resolved)) {
+ foreach ($resolved as $hostitem) {
+ if ($hostitem <> "") {
echo $hostitem . "<br />";
$found++;
}
}
} else {
- echo $resolved;
- }
- if($found > 0) { ?>
+ echo $resolved;
+ }
+ if ($found > 0) { ?>
<br/></font><font size='-2'>
- <?PHP if($alias_exists) { ?>
+ <?php if ($alias_exists) { ?>
An alias already exists for the hostname <?= htmlspecialchars($host) ?>. <br />
<input type="hidden" name="override" value="true"/>
<input type="submit" name="create_alias" value="Overwrite Alias"/>
- <?PHP } else {
- if(!$createdalias) { ?>
+ <?php } else {
+ if (!$createdalias) { ?>
<input type="submit" name="create_alias" value="Create Alias from These Entries"/>
- <?PHP } else { ?>
+ <?php } else { ?>
Alias created with name <?= htmlspecialchars($newalias['name']) ?>
- <?PHP }
+ <?php }
}
}
?>
@@ -226,7 +233,7 @@ include("head.inc"); ?>
</font></td></tr></table>
</td>
</tr>
-<?php if($_POST): ?>
+<?php if ($_POST): ?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Resolution time per server");?></td>
<td width="78%" class="vtable">
@@ -240,8 +247,8 @@ include("head.inc"); ?>
</td>
</tr>
<?php
- if(is_array($dns_speeds))
- foreach($dns_speeds as $qt):
+ if (is_array($dns_speeds)) {
+ foreach ($dns_speeds as $qt):
?>
<tr>
<td class="listlr">
@@ -252,7 +259,8 @@ include("head.inc"); ?>
</td>
</tr>
<?php
- endforeach;
+ endforeach;
+ }
?>
</table>
</td>
@@ -276,7 +284,7 @@ include("head.inc"); ?>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<br />&nbsp;
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("DNS Lookup");?>" />
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("DNS Lookup");?>" />
</td>
</tr>
</table>
diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php
index f41a4fd..1cc844a 100755
--- a/usr/local/www/diag_dump_states.php
+++ b/usr/local/www/diag_dump_states.php
@@ -44,7 +44,7 @@ require_once("guiconfig.inc");
require_once("interfaces.inc");
/* handle AJAX operations */
-if(isset($_POST['action']) && $_POST['action'] == "remove") {
+if (isset($_POST['action']) && $_POST['action'] == "remove") {
if (isset($_POST['srcip']) && isset($_POST['dstip']) && is_ipaddr($_POST['srcip']) && is_ipaddr($_POST['dstip'])) {
$retval = pfSense_kill_states($_POST['srcip'], $_POST['dstip']);
echo htmlentities("|{$_POST['srcip']}|{$_POST['dstip']}|0|");
@@ -104,7 +104,7 @@ include("head.inc");
function removeComplete(req) {
var values = req.responseText.split("|");
- if(values[3] != "0") {
+ if (values[3] != "0") {
alert('<?=gettext("An error occurred.");?>');
return;
}
@@ -122,8 +122,9 @@ include("head.inc");
<?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);
?>
@@ -180,8 +181,9 @@ $row = 0;
$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);
@@ -202,16 +204,16 @@ while ($line = chop(fgets($fd))) {
?>
<tr valign="top" id="r:<?= $srcip ?>:<?= $dstip ?>">
- <td class="listlr"><?= $iface ?></td>
- <td class="listr"><?= $proto ?></td>
- <td class="listr"><?= $info ?></td>
- <td class="listr"><?= $state ?></td>
- <td class="list">
- <img src="/themes/<?= $g['theme'] ?>/images/icons/icon_x.gif" height="17" width="17" border="0"
- onclick="removeState('<?= $srcip ?>', '<?= $dstip ?>');" style="cursor:pointer;"
- name="i:<?= $srcip ?>:<?= $dstip ?>"
- title="<?= gettext('Remove all state entries from') ?> <?= $srcip ?> <?= gettext('to') ?> <?= $dstip ?>" alt="" />
- </td>
+ <td class="listlr"><?= $iface ?></td>
+ <td class="listr"><?= $proto ?></td>
+ <td class="listr"><?= $info ?></td>
+ <td class="listr"><?= $state ?></td>
+ <td class="list">
+ <img src="/themes/<?= $g['theme'] ?>/images/icons/icon_x.gif" height="17" width="17" border="0"
+ onclick="removeState('<?= $srcip ?>', '<?= $dstip ?>');" style="cursor:pointer;"
+ name="i:<?= $srcip ?>:<?= $dstip ?>"
+ title="<?= gettext('Remove all state entries from') ?> <?= $srcip ?> <?= gettext('to') ?> <?= $dstip ?>" alt="" />
+ </td>
</tr>
<?php
$row++;
@@ -224,7 +226,8 @@ if ($row == 0): ?>
<?= gettext("No states were found.") ?>
</td>
</tr>
-<?php endif;
+<?php
+endif;
pclose($fd);
?>
</tbody>
diff --git a/usr/local/www/diag_dump_states_sources.php b/usr/local/www/diag_dump_states_sources.php
index ca01d32..e46a316 100644
--- a/usr/local/www/diag_dump_states_sources.php
+++ b/usr/local/www/diag_dump_states_sources.php
@@ -29,7 +29,7 @@
*/
/*
- pfSense_BUILDER_BINARIES: /sbin/pfctl
+ pfSense_BUILDER_BINARIES: /sbin/pfctl
pfSense_MODULE: filter
*/
@@ -43,8 +43,8 @@
require_once("guiconfig.inc");
/* handle AJAX operations */
-if($_GET['action']) {
- if($_GET['action'] == "remove") {
+if ($_GET['action']) {
+ if ($_GET['action'] == "remove") {
if (is_ipaddr($_GET['srcip']) and is_ipaddr($_GET['dstip'])) {
$retval = mwexec("/sbin/pfctl -K " . escapeshellarg($_GET['srcip']) . " -K " . escapeshellarg($_GET['dstip']));
echo htmlentities("|{$_GET['srcip']}|{$_GET['dstip']}|{$retval}|");
@@ -56,10 +56,9 @@ if($_GET['action']) {
}
/* get our states */
-if($_GET['filter']) {
+if ($_GET['filter']) {
exec("/sbin/pfctl -s Sources | grep " . escapeshellarg(htmlspecialchars($_GET['filter'])), $sources);
-}
-else {
+} else {
exec("/sbin/pfctl -s Sources", $sources);
}
@@ -92,7 +91,7 @@ include("head.inc");
function removeComplete(req) {
var values = req.responseText.split("|");
- if(values[3] != "0") {
+ if (values[3] != "0") {
alert('<?=gettext("An error occurred.");?>');
return;
}
@@ -154,10 +153,11 @@ include("head.inc");
<tbody>
<?php
$row = 0;
-if(count($sources) > 0) {
- foreach($sources as $line) {
- if($row >= 1000)
+if (count($sources) > 0) {
+ foreach ($sources as $line) {
+ if ($row >= 1000) {
break;
+ }
// 192.168.20.2 -> 216.252.56.1 ( states 10, connections 0, rate 0.0/0s )
@@ -185,8 +185,7 @@ if(count($sources) > 0) {
<?php
$row++;
}
-}
-else {
+} else {
echo "<tr>
<td class='list' colspan='5' align='center' valign='top'>
" . gettext("No source tracking entries were found.") . "
diff --git a/usr/local/www/diag_gmirror.php b/usr/local/www/diag_gmirror.php
index adb61f5..f1ceef2 100644
--- a/usr/local/www/diag_gmirror.php
+++ b/usr/local/www/diag_gmirror.php
@@ -8,11 +8,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -53,7 +53,7 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
-<?PHP
+<?php
$action_list = array(
"forget" => gettext("Forget all formerly connected consumers"),
"clear" => gettext("Remove metadata from disk"),
@@ -77,41 +77,51 @@ if ($_POST) {
}
$input_errors = "";
- if (($_POST['action'] != "clear") && !is_valid_mirror($_POST['mirror']))
+ if (($_POST['action'] != "clear") && !is_valid_mirror($_POST['mirror'])) {
$input_errors[] = gettext("You must supply a valid mirror name.");
+ }
- if (!empty($_POST['consumer']) && !is_valid_consumer($_POST['consumer']))
+ if (!empty($_POST['consumer']) && !is_valid_consumer($_POST['consumer'])) {
$input_errors[] = gettext("You must supply a valid consumer name");
+ }
/* Additional action-specific validation that hasn't already been tested */
switch ($_POST['action']) {
case "insert":
- if (!is_consumer_unused($_POST['consumer']))
+ if (!is_consumer_unused($_POST['consumer'])) {
$input_errors[] = gettext("Consumer is already in use and cannot be inserted. Remove consumer from existing mirror first.");
- if (gmirror_consumer_has_metadata($_POST['consumer']))
+ }
+ if (gmirror_consumer_has_metadata($_POST['consumer'])) {
$input_errors[] = gettext("Consumer has metadata from an existing mirror. Clear metadata before inserting consumer.");
+ }
$mstat = gmirror_get_status_single($_POST['mirror']);
- if (strtoupper($mstat) != "COMPLETE")
+ if (strtoupper($mstat) != "COMPLETE") {
$input_errors[] = gettext("Mirror is not in a COMPLETE state, cannot insert consumer. Forget disconnected disks or wait for rebuild to finish.");
+ }
break;
case "clear":
- if (!is_consumer_unused($_POST['consumer']))
+ if (!is_consumer_unused($_POST['consumer'])) {
$input_errors[] = gettext("Consumer is in use and cannot be cleared. Deactivate disk first.");
- if (!gmirror_consumer_has_metadata($_POST['consumer']))
+ }
+ if (!gmirror_consumer_has_metadata($_POST['consumer'])) {
$input_errors[] = gettext("Consumer has no metadata to clear.");
+ }
break;
case "activate":
- if (is_consumer_in_mirror($_POST['consumer'], $_POST['mirror']))
+ if (is_consumer_in_mirror($_POST['consumer'], $_POST['mirror'])) {
$input_errors[] = gettext("Consumer is already present on specified mirror.");
- if (!gmirror_consumer_has_metadata($_POST['consumer']))
+ }
+ if (!gmirror_consumer_has_metadata($_POST['consumer'])) {
$input_errors[] = gettext("Consumer has no metadata and cannot be reactivated.");
-
+ }
+
break;
case "remove":
case "deactivate":
case "rebuild":
- if (!is_consumer_in_mirror($_POST['consumer'], $_POST['mirror']))
+ if (!is_consumer_in_mirror($_POST['consumer'], $_POST['mirror'])) {
$input_errors[] = gettext("Consumer must be present on the specified mirror.");
+ }
break;
}
@@ -156,14 +166,17 @@ $mirror_list = gmirror_get_mirrors();
$unused_disks = gmirror_get_disks();
$unused_consumers = array();
foreach ($unused_disks as $disk) {
- if (is_consumer_unused($disk))
+ if (is_consumer_unused($disk)) {
$unused_consumers = array_merge($unused_consumers, gmirror_get_all_unused_consumer_sizes_on_disk($disk));
+ }
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-if ($_GET["error"] && ($_GET["error"] != 0))
+}
+if ($_GET["error"] && ($_GET["error"] != 0)) {
print_info_box(gettext("There was an error performing the chosen mirror operation. Check the System Log for details."));
+}
?>
<form action="diag_gmirror.php" method="POST" id="gmirror_form" name="gmirror_form">
@@ -181,152 +194,152 @@ if ($_GET["error"] && ($_GET["error"] != 0))
<p/>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
-<?PHP if ($_GET["action"]): ?>
+<?php if ($_GET["action"]): ?>
<tr>
- <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Confirm Action"); ?></td>
+ <td colspan="2" valign="top" class="listtopic"><?php echo gettext("Confirm Action"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">&nbsp;</td>
<td width="78%" class="vtable">
- <strong><?PHP echo gettext("Please confirm the selected action"); ?></strong>:
+ <strong><?php echo gettext("Please confirm the selected action"); ?></strong>:
<br />
- <br /><strong><?PHP echo gettext("Action"); ?>:</strong> <?PHP echo $action_list[$_GET["action"]]; ?>
- <input type="hidden" name="action" value="<?PHP echo htmlspecialchars($_GET["action"]); ?>" />
- <?PHP if (!empty($_GET["mirror"])): ?>
- <br /><strong><?PHP echo gettext("Mirror"); ?>:</strong> <?PHP echo htmlspecialchars($_GET["mirror"]); ?>
- <input type="hidden" name="mirror" value="<?PHP echo htmlspecialchars($_GET["mirror"]); ?>" />
- <?PHP endif; ?>
- <?PHP if (!empty($_GET["consumer"])): ?>
- <br /><strong><?PHP echo gettext("Consumer"); ?>:</strong> <?PHP echo htmlspecialchars($_GET["consumer"]); ?>
- <input type="hidden" name="consumer" value="<?PHP echo htmlspecialchars($_GET["consumer"]); ?>" />
- <?PHP endif; ?>
+ <br /><strong><?php echo gettext("Action"); ?>:</strong> <?php echo $action_list[$_GET["action"]]; ?>
+ <input type="hidden" name="action" value="<?php echo htmlspecialchars($_GET["action"]); ?>" />
+ <?php if (!empty($_GET["mirror"])): ?>
+ <br /><strong><?php echo gettext("Mirror"); ?>:</strong> <?php echo htmlspecialchars($_GET["mirror"]); ?>
+ <input type="hidden" name="mirror" value="<?php echo htmlspecialchars($_GET["mirror"]); ?>" />
+ <?php endif; ?>
+ <?php if (!empty($_GET["consumer"])): ?>
+ <br /><strong><?php echo gettext("Consumer"); ?>:</strong> <?php echo htmlspecialchars($_GET["consumer"]); ?>
+ <input type="hidden" name="consumer" value="<?php echo htmlspecialchars($_GET["consumer"]); ?>" />
+ <?php endif; ?>
<br />
- <br /><input type="submit" name="confirm" value="<?PHP echo gettext("Confirm"); ?>" />
+ <br /><input type="submit" name="confirm" value="<?php echo gettext("Confirm"); ?>" />
</td>
</tr>
-<?PHP else: ?>
+<?php else: ?>
<tr>
- <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("GEOM Mirror information"); ?></td>
+ <td colspan="2" valign="top" class="listtopic"><?php echo gettext("GEOM Mirror information"); ?></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?PHP echo gettext("Mirror Status"); ?></td>
+ <td width="22%" valign="top" class="vncell"><?php echo gettext("Mirror Status"); ?></td>
<td width="78%" class="vtable">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="gmirror status">
<tbody id="gmirror_status_table">
- <?PHP if (count($mirror_status) > 0): ?>
+ <?php if (count($mirror_status) > 0): ?>
<tr>
- <td width="30%" class="vncellt"><?PHP echo gettext("Name"); ?></td>
- <td width="30%" class="vncellt"><?PHP echo gettext("Status"); ?></td>
- <td width="40%" class="vncellt"><?PHP echo gettext("Component"); ?></td>
+ <td width="30%" class="vncellt"><?php echo gettext("Name"); ?></td>
+ <td width="30%" class="vncellt"><?php echo gettext("Status"); ?></td>
+ <td width="40%" class="vncellt"><?php echo gettext("Component"); ?></td>
</tr>
- <?PHP foreach ($mirror_status as $mirror => $name):
+ <?php foreach ($mirror_status as $mirror => $name):
$components = count($name["components"]); ?>
<tr>
- <td width="30%" rowspan="<?PHP echo $components; ?>" class="listr">
- <?PHP echo htmlspecialchars($name['name']); ?>
- <br />Size: <?PHP echo gmirror_get_mirror_size($name['name']); ?>
+ <td width="30%" rowspan="<?php echo $components; ?>" class="listr">
+ <?php echo htmlspecialchars($name['name']); ?>
+ <br />Size: <?php echo gmirror_get_mirror_size($name['name']); ?>
</td>
- <td width="30%" rowspan="<?PHP echo $components; ?>" class="listr">
- <?PHP echo htmlspecialchars($name['status']); ?>
- <?PHP if (strtoupper($name['status']) == "DEGRADED"): ?>
- <br /><a href="diag_gmirror.php?action=forget&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Forget Disconnected Disks"); ?>]</a>
- <?PHP endif; ?>
+ <td width="30%" rowspan="<?php echo $components; ?>" class="listr">
+ <?php echo htmlspecialchars($name['status']); ?>
+ <?php if (strtoupper($name['status']) == "DEGRADED"): ?>
+ <br /><a href="diag_gmirror.php?action=forget&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Forget Disconnected Disks"); ?>]</a>
+ <?php endif; ?>
</td>
<td width="40%" class="listr">
- <?PHP echo $name['components'][0]; ?>
- <?PHP list($cname, $cstatus) = explode(" ", $name['components'][0], 2); ?>
+ <?php echo $name['components'][0]; ?>
+ <?php list($cname, $cstatus) = explode(" ", $name['components'][0], 2); ?>
<br />
- <?PHP if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?>
- <a href="diag_gmirror.php?action=rebuild&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Rebuild"); ?>]</a>
- <a href="diag_gmirror.php?action=deactivate&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Deactivate"); ?>]</a>
- <a href="diag_gmirror.php?action=remove&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Remove"); ?>]</a>
- <?PHP endif; ?>
+ <?php if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?>
+ <a href="diag_gmirror.php?action=rebuild&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Rebuild"); ?>]</a>
+ <a href="diag_gmirror.php?action=deactivate&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Deactivate"); ?>]</a>
+ <a href="diag_gmirror.php?action=remove&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Remove"); ?>]</a>
+ <?php endif; ?>
</td>
</tr>
- <?PHP if (count($name["components"]) > 1):
+ <?php if (count($name["components"]) > 1):
$morecomponents = array_slice($name["components"], 1); ?>
- <?PHP foreach ($morecomponents as $component): ?>
+ <?php foreach ($morecomponents as $component): ?>
<tr>
<td width="40%" class="listr">
- <?PHP echo $component; ?>
- <?PHP list($cname, $cstatus) = explode(" ", $component, 2); ?>
+ <?php echo $component; ?>
+ <?php list($cname, $cstatus) = explode(" ", $component, 2); ?>
<br />
- <?PHP if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?>
- <a href="diag_gmirror.php?action=rebuild&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Rebuild"); ?>]</a>
- <a href="diag_gmirror.php?action=deactivate&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Deactivate"); ?>]</a>
- <a href="diag_gmirror.php?action=remove&amp;consumer=<?PHP echo htmlspecialchars($cname); ?>&amp;mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Remove"); ?>]</a>
- <?PHP endif; ?>
+ <?php if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?>
+ <a href="diag_gmirror.php?action=rebuild&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Rebuild"); ?>]</a>
+ <a href="diag_gmirror.php?action=deactivate&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Deactivate"); ?>]</a>
+ <a href="diag_gmirror.php?action=remove&amp;consumer=<?php echo htmlspecialchars($cname); ?>&amp;mirror=<?php echo htmlspecialchars($name['name']); ?>">[<?php echo gettext("Remove"); ?>]</a>
+ <?php endif; ?>
</td>
</tr>
- <?PHP endforeach; ?>
- <?PHP endif; ?>
- <?PHP endforeach; ?>
- <?PHP else: ?>
- <tr><td colspan="3" class="listr"><?PHP echo gettext("No Mirrors Found"); ?></td></tr>
- <?PHP endif; ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ <?php else: ?>
+ <tr><td colspan="3" class="listr"><?php echo gettext("No Mirrors Found"); ?></td></tr>
+ <?php endif; ?>
</tbody>
</table>
- <br /><?PHP echo gettext("Some disk operations may only be performed when there are multiple consumers present in a mirror."); ?>
+ <br /><?php echo gettext("Some disk operations may only be performed when there are multiple consumers present in a mirror."); ?>
</td>
</tr>
<tr>
- <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Consumer information"); ?></td>
+ <td colspan="2" valign="top" class="listtopic"><?php echo gettext("Consumer information"); ?></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?PHP echo gettext("Available Consumers"); ?></td>
+ <td width="22%" valign="top" class="vncell"><?php echo gettext("Available Consumers"); ?></td>
<td width="78%" class="vtable">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="consumer list">
<tbody id="consumer_list">
- <?PHP if (count($unused_consumers) > 0): ?>
+ <?php if (count($unused_consumers) > 0): ?>
<tr>
- <td width="30%" class="vncellt"><?PHP echo gettext("Name"); ?></td>
- <td width="30%" class="vncellt"><?PHP echo gettext("Size"); ?></td>
- <td width="40%" class="vncellt"><?PHP echo gettext("Add to Mirror"); ?></td>
+ <td width="30%" class="vncellt"><?php echo gettext("Name"); ?></td>
+ <td width="30%" class="vncellt"><?php echo gettext("Size"); ?></td>
+ <td width="40%" class="vncellt"><?php echo gettext("Add to Mirror"); ?></td>
</tr>
- <?PHP foreach ($unused_consumers as $consumer): ?>
+ <?php foreach ($unused_consumers as $consumer): ?>
<tr>
<td width="30%" class="listr">
- <?PHP echo htmlspecialchars($consumer['name']); ?>
+ <?php echo htmlspecialchars($consumer['name']); ?>
</td>
- <td width="30%" class="listr"><?PHP echo htmlspecialchars($consumer['size']); ?> <?PHP echo htmlspecialchars($consumer['humansize']); ?></td>
+ <td width="30%" class="listr"><?php echo htmlspecialchars($consumer['size']); ?> <?php echo htmlspecialchars($consumer['humansize']); ?></td>
<td width="40%" class="listr">
- <?PHP $oldmirror = gmirror_get_consumer_metadata_mirror($consumer['name']);
+ <?php $oldmirror = gmirror_get_consumer_metadata_mirror($consumer['name']);
if ($oldmirror): ?>
- <a href="diag_gmirror.php?action=activate&amp;consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>&amp;mirror=<?PHP echo htmlspecialchars($oldmirror); ?>">[<?PHP echo gettext("Reactivate on:") . ' ' . htmlspecialchars($oldmirror); ?>]</a>
- <br /><a href="diag_gmirror.php?action=clear&amp;consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>">[<?PHP echo gettext("Remove metadata from disk"); ?>]</a>
- <?PHP else: ?>
- <?PHP foreach ($mirror_list as $mirror):
+ <a href="diag_gmirror.php?action=activate&amp;consumer=<?php echo htmlspecialchars($consumer['name']); ?>&amp;mirror=<?php echo htmlspecialchars($oldmirror); ?>">[<?php echo gettext("Reactivate on:") . ' ' . htmlspecialchars($oldmirror); ?>]</a>
+ <br /><a href="diag_gmirror.php?action=clear&amp;consumer=<?php echo htmlspecialchars($consumer['name']); ?>">[<?php echo gettext("Remove metadata from disk"); ?>]</a>
+ <?php else: ?>
+ <?php foreach ($mirror_list as $mirror):
$mirror_size = gmirror_get_mirror_size($mirror);
$consumer_size = gmirror_get_unused_consumer_size($consumer['name']);
?>
- <?PHP if ($consumer_size > $mirror_size): ?>
- <a href="diag_gmirror.php?action=insert&amp;consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>&amp;mirror=<?PHP echo htmlspecialchars($mirror); ?>"><?PHP echo htmlspecialchars($mirror); ?></a>
- <?PHP endif; ?>
- <?PHP endforeach; ?>
- <?PHP endif; ?>
+ <?php if ($consumer_size > $mirror_size): ?>
+ <a href="diag_gmirror.php?action=insert&amp;consumer=<?php echo htmlspecialchars($consumer['name']); ?>&amp;mirror=<?php echo htmlspecialchars($mirror); ?>"><?php echo htmlspecialchars($mirror); ?></a>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
</td>
</tr>
- <?PHP endforeach; ?>
- <?PHP else: ?>
- <tr><td colspan="3" class="listr"><?PHP echo gettext("No unused consumers found"); ?></td></tr>
- <?PHP endif; ?>
+ <?php endforeach; ?>
+ <?php else: ?>
+ <tr><td colspan="3" class="listr"><?php echo gettext("No unused consumers found"); ?></td></tr>
+ <?php endif; ?>
</tbody>
</table>
- <br /><?PHP echo gettext("Consumers may only be added to a mirror if they are larger than the size of the mirror."); ?>
+ <br /><?php echo gettext("Consumers may only be added to a mirror if they are larger than the size of the mirror."); ?>
</td>
</tr>
<tr>
<td colspan="2" valign="top" class="">&nbsp;</td>
</tr>
<tr>
- <td colspan="2" valign="top" class=""><?PHP echo gettext("To repair a failed mirror, first perform a 'Forget' command on the mirror, followed by an 'insert' action on the new consumer."); ?></td>
+ <td colspan="2" valign="top" class=""><?php echo gettext("To repair a failed mirror, first perform a 'Forget' command on the mirror, followed by an 'insert' action on the new consumer."); ?></td>
</tr>
-<?PHP endif;?>
+<?php endif;?>
</table>
</div>
</td>
diff --git a/usr/local/www/diag_ipsec.php b/usr/local/www/diag_ipsec.php
index 460a23d..4492b86 100644
--- a/usr/local/www/diag_ipsec.php
+++ b/usr/local/www/diag_ipsec.php
@@ -72,20 +72,23 @@ if ($_GET['act'] == 'connect') {
}
} else if ($_GET['act'] == 'ikedisconnect') {
if (ctype_digit($_GET['ikeid'])) {
- if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid']))
+ if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "[" . escapeshellarg($_GET['ikesaid']) . "]");
- else
+ } else {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
+ }
}
} else if ($_GET['act'] == 'childdisconnect') {
if (ctype_digit($_GET['ikeid'])) {
- if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid']))
+ if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "{" . escapeshellarg($_GET['ikesaid']) . "}");
+ }
}
}
-if (!is_array($config['ipsec']['phase1']))
- $config['ipsec']['phase1'] = array();
+if (!is_array($config['ipsec']['phase1'])) {
+ $config['ipsec']['phase1'] = array();
+}
$a_phase1 = &$config['ipsec']['phase1'];
@@ -141,12 +144,13 @@ $status = ipsec_smp_dump_status();
$ipsecconnected[$con_id] = $ph1idx = $con_id;
}
- if (ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ikesa['id']))
+ if (ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ikesa['id'])) {
$icon = "pass";
- elseif (!isset($config['ipsec']['enable']))
+ } elseif (!isset($config['ipsec']['enable'])) {
$icon = "block";
- else
+ } else {
$icon = "reject";
+ }
?>
<tr>
<td class="listlr">
@@ -156,71 +160,79 @@ $status = ipsec_smp_dump_status();
</td>
<td class="listr">
<?php
- if (!is_array($ikesa['local']))
+ if (!is_array($ikesa['local'])) {
echo gettext("Unknown");
- else {
+ } else {
if (!empty($ikesa['local']['identification'])) {
- if ($ikesa['local']['identification'] == '%any')
+ if ($ikesa['local']['identification'] == '%any') {
echo gettext('Any identifier');
- else
+ } else {
echo htmlspecialchars($ikesa['local']['identification']);
- } else
+ }
+ } else {
echo gettext("Unknown");
+ }
}
?>
</td>
<td class="listr">
<?php
- if (!is_array($ikesa['local']))
+ if (!is_array($ikesa['local'])) {
echo gettext("Unknown");
- else {
- if (!empty($ikesa['local']['address']))
+ } else {
+ if (!empty($ikesa['local']['address'])) {
echo htmlspecialchars($ikesa['local']['address']) . '<br/>' .
gettext('Port: ') . htmlspecialchars($ikesa['local']['port']);
- else
+ } else {
echo gettext("Unknown");
- if ($ikesa['local']['port'] == '4500')
+ }
+ if ($ikesa['local']['port'] == '4500') {
echo " NAT-T";
+ }
}
?>
</td>
<td class="listr">
<?php
- if (!is_array($ikesa['remote']))
+ if (!is_array($ikesa['remote'])) {
echo gettext("Unknown");
- else {
+ } else {
$identity = "";
if (!empty($ikesa['remote']['identification'])) {
- if ($ikesa['remote']['identification'] == '%any')
+ if ($ikesa['remote']['identification'] == '%any') {
$identity = 'Any identifier';
- else
+ } else {
$identity = htmlspecialchars($ikesa['remote']['identification']);
+ }
}
if (is_array($ikesa['remote']['auth']) && !empty($ikesa['remote']['auth'][0]['identity'])) {
echo htmlspecialchars($ikesa['remote']['auth'][0]['identity']);
echo "<br/>{$identity}";
} else {
- if (empty($identity))
+ if (empty($identity)) {
echo gettext("Unknown");
- else
+ } else {
echo $identity;
+ }
}
}
?>
</td>
<td class="listr">
<?php
- if (!is_array($ikesa['remote']))
+ if (!is_array($ikesa['remote'])) {
echo gettext("Unknown");
- else {
- if (!empty($ikesa['remote']['address']))
+ } else {
+ if (!empty($ikesa['remote']['address'])) {
echo htmlspecialchars($ikesa['remote']['address']) . '<br/>' .
gettext('Port: ') . htmlspecialchars($ikesa['remote']['port']);
- else
+ } else {
echo gettext("Unknown");
- if ($ikesa['remote']['port'] == '4500')
+ }
+ if ($ikesa['remote']['port'] == '4500') {
echo " NAT-T";
+ }
}
?>
</td>
@@ -312,30 +324,36 @@ $status = ipsec_smp_dump_status();
<?php
if (is_array($childsa['local']) &&
is_array($childsa['local']['networks']) &&
- is_array($childsa['local']['networks']['network']))
- foreach ($childsa['local']['networks']['network'] as $lnets)
+ is_array($childsa['local']['networks']['network'])) {
+ foreach ($childsa['local']['networks']['network'] as $lnets) {
echo htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />";
- else
+ }
+ } else {
echo gettext("Unknown");
+ }
?>
</td>
<td class="listr nowrap">
<?php
- if (is_array($childsa['local']))
+ if (is_array($childsa['local'])) {
echo gettext("Local: ") . htmlspecialchars($childsa['local']['spi']);
- if (is_array($childsa['remote']))
+ }
+ if (is_array($childsa['remote'])) {
echo "<br/>" . gettext("Remote: ") . htmlspecialchars($childsa['remote']['spi']);
+ }
?>
</td>
<td class="listr nowrap">
<?php
if (is_array($childsa['remote']) &&
is_array($childsa['remote']['networks']) &&
- is_array($childsa['remote']['networks']['network']))
- foreach ($childsa['remote']['networks']['network'] as $rnets)
+ is_array($childsa['remote']['networks']['network'])) {
+ foreach ($childsa['remote']['networks']['network'] as $rnets) {
echo htmlspecialchars(ipsec_fixup_network($rnets)) . "<br />";
- else
+ }
+ } else {
echo gettext("Unknown");
+ }
?>
</td>
<td class="listr nowrap">
@@ -407,11 +425,13 @@ $status = ipsec_smp_dump_status();
$rgmap = array();
foreach ($a_phase1 as $ph1ent):
- if (isset($ph1ent['disabled']))
+ if (isset($ph1ent['disabled'])) {
continue;
+ }
$rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway'];
- if ($ipsecconnected[$ph1ent['ikeid']])
+ if ($ipsecconnected[$ph1ent['ikeid']]) {
continue;
+ }
?>
<tr>
<td class="listlr">
@@ -422,37 +442,41 @@ $status = ipsec_smp_dump_status();
<td class="listr">
<?php
list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
- if (empty($myid_data))
+ if (empty($myid_data)) {
echo gettext("Unknown");
- else
+ } else {
echo htmlspecialchars($myid_data);
+ }
?>
</td>
<td class="listr">
<?php
$ph1src = ipsec_get_phase1_src($ph1ent);
- if (empty($ph1src))
+ if (empty($ph1src)) {
echo gettext("Unknown");
- else
+ } else {
echo htmlspecialchars($ph1src);
+ }
?>
</td>
<td class="listr">
<?php
list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
- if (empty($peerid_data))
+ if (empty($peerid_data)) {
echo gettext("Unknown");
- else
+ } else {
echo htmlspecialchars($peerid_data);
+ }
?>
</td>
<td class="listr">
<?php
$ph1src = ipsec_get_phase1_dst($ph1ent);
- if (empty($ph1src))
+ if (empty($ph1src)) {
echo gettext("Unknown");
- else
+ } else {
echo htmlspecialchars($ph1src);
+ }
?>
</td>
<td class="listr" >
diff --git a/usr/local/www/diag_ipsec_leases.php b/usr/local/www/diag_ipsec_leases.php
index 173d516..60e9846 100644
--- a/usr/local/www/diag_ipsec_leases.php
+++ b/usr/local/www/diag_ipsec_leases.php
@@ -71,7 +71,7 @@ $mobile = ipsec_dump_mobile();
<td>
<div id="mainarea">
<?php if (isset($mobile['pool']) && is_array($mobile['pool'])): ?>
- <?php foreach($mobile['pool'] as $pool): ?>
+ <?php foreach ($mobile['pool'] as $pool): ?>
<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
<td colspan="4" valign="top" class="listtopic">
diff --git a/usr/local/www/diag_ipsec_xml.php b/usr/local/www/diag_ipsec_xml.php
index 2c76225..a219da9 100644
--- a/usr/local/www/diag_ipsec_xml.php
+++ b/usr/local/www/diag_ipsec_xml.php
@@ -44,8 +44,9 @@ global $g;
require("guiconfig.inc");
require("ipsec.inc");
-if (!is_array($config['ipsec']['phase2']))
- $config['ipsec']['phase2'] = array();
+if (!is_array($config['ipsec']['phase2'])) {
+ $config['ipsec']['phase2'] = array();
+}
$ipsec_status = array();
@@ -58,12 +59,13 @@ if (is_array($status['query']) && $status['query']['ikesalist'] && $status['quer
ipsec_lookup_phase1($ph2ent,$ph1ent);
$tunnel = array();
if (!isset($ph2ent['disabled']) && !isset($ph1ent['disabled'])) {
- if(ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ph1ent['ikeid']))
+ if(ipsec_phase1_status($status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) {
$tunnel['state'] = "up";
- elseif(!isset($config['ipsec']['enable']))
+ } elseif(!isset($config['ipsec']['enable'])) {
$tunnel['state'] = "disabled";
- else
+ } else {
$tunnel['state'] = "down";
+ }
$tunnel['src'] = ipsec_get_phase1_src($ph1ent);
$tunnel['endpoint'] = $ph1ent['remote-gateway'];
diff --git a/usr/local/www/diag_limiter_info.php b/usr/local/www/diag_limiter_info.php
index c3f8045..66574ed 100644
--- a/usr/local/www/diag_limiter_info.php
+++ b/usr/local/www/diag_limiter_info.php
@@ -1,31 +1,31 @@
<?php
/* $Id$ */
/*
- diag_limiter_info.php
- Copyright (C) 2010 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
+ diag_limiter_info.php
+ Copyright (C) 2010 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -45,14 +45,15 @@ require("guiconfig.inc");
$pgtitle = gettext("Diagnostics: Limiter Info");
$shortcut_section = "trafficshaper-limiters";
-if($_REQUEST['getactivity']) {
+if ($_REQUEST['getactivity']) {
$text = `/sbin/ipfw pipe show`;
- if($text == "")
+ if ($text == "") {
$text = "We could not find any limiters on this system.";
+ }
echo "Limiters:\n";
echo $text;
$text = `/sbin/ipfw queue show`;
- if($text != "") {
+ if ($text != "") {
echo "\n\nQueues:\n";
echo $text;
}
@@ -86,17 +87,18 @@ include("head.inc");
</script>
<div id="maincontent">
<?php
- if($savemsg) {
+ if ($savemsg) {
echo "<div id=\"savemsg\">";
print_info_box($savemsg);
- echo "</div>";
+ echo "</div>";
}
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
+ }
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag limiter info">
<tr>
- <td>
+ <td>
<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
<tr>
<td align="center">
@@ -110,7 +112,7 @@ include("head.inc");
</td>
</tr>
</table>
- </td>
+ </td>
</tr>
</table>
</div>
diff --git a/usr/local/www/diag_logs.php b/usr/local/www/diag_logs.php
index cb76724..6520999 100755
--- a/usr/local/www/diag_logs.php
+++ b/usr/local/www/diag_logs.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: system
*/
@@ -48,20 +48,25 @@ require("guiconfig.inc");
$system_logfile = "{$g['varlog_path']}/system.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($system_logfile);
+}
-if ($_GET['filtertext'])
+if ($_GET['filtertext']) {
$filtertext = htmlspecialchars($_GET['filtertext']);
+}
-if ($_POST['filtertext'])
+if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']);
+}
-if ($filtertext)
+if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext";
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("General"));
include("head.inc");
@@ -110,26 +115,27 @@ include("head.inc");
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s system log entries"),$nentries); ?></td>
</tr>
<?php
- if($filtertext)
+ if ($filtertext) {
dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
- else
+ } else {
dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
+ }
?>
<tr>
<td align="left" valign="top">
<form id="filterform" name="filterform" action="diag_logs.php" method="post" style="margin-top: 14px;">
- <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
+ <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
</form>
</td>
<td align="right" valign="top" >
<form id="clearform" name="clearform" action="diag_logs.php" method="post" style="margin-top: 14px;">
- <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
- <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
+ <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
+ <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
</form>
</td>
</tr>
</table>
- </div>
+ </div>
</td>
</tr>
</table>
diff --git a/usr/local/www/diag_logs_auth.php b/usr/local/www/diag_logs_auth.php
index ce296bc..230fadd 100644
--- a/usr/local/www/diag_logs_auth.php
+++ b/usr/local/www/diag_logs_auth.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: captiveportal
*/
@@ -48,11 +48,13 @@ require("guiconfig.inc");
$portal_logfile = "{$g['varlog_path']}/portalauth.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($portal_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Portal Auth"));
$shortcut_section = "captiveportal";
@@ -81,7 +83,7 @@ include("head.inc");
?>
</td></tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
<tr>
diff --git a/usr/local/www/diag_logs_dhcp.php b/usr/local/www/diag_logs_dhcp.php
index 5cfa4d6..c60af86 100644
--- a/usr/local/www/diag_logs_dhcp.php
+++ b/usr/local/www/diag_logs_dhcp.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: dhcpserver
*/
@@ -48,8 +48,9 @@ require("guiconfig.inc");
$dhcpd_logfile = "{$g['varlog_path']}/dhcpd.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
if ($_POST['clear']) {
clear_log_file($dhcpd_logfile);
@@ -84,7 +85,7 @@ include("head.inc");
?>
</td></tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
<tr>
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index 7dac52b..f81b0f5 100644
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -2,7 +2,7 @@
/* $Id$ */
/*
diag_logs_filter.php
- part of pfSense
+ part of pfSense
Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
originally based on m0n0wall (http://m0n0.ch/wall)
@@ -33,7 +33,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: filter
*/
@@ -51,12 +51,13 @@ require_once("filter_log.inc");
if (isset($_POST['resolve'])) {
$ip = strtolower($_POST['resolve']);
$res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
-
- if ($res && $res != $ip)
+
+ if ($res && $res != $ip) {
$response = array('resolve_ip' => $ip, 'resolve_text' => $res);
- else
+ } else {
$response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
-
+ }
+
echo json_encode(str_replace("\\","\\\\", $response)); // single escape chars can break JSON decode
exit;
}
@@ -64,15 +65,17 @@ if (isset($_POST['resolve'])) {
function getGETPOSTsettingvalue($settingname, $default)
{
$settingvalue = $default;
- if($_GET[$settingname])
+ if ($_GET[$settingname]) {
$settingvalue = $_GET[$settingname];
- if($_POST[$settingname])
+ }
+ if ($_POST[$settingname]) {
$settingvalue = $_POST[$settingname];
+ }
return $settingvalue;
}
$rulenum = getGETPOSTsettingvalue('getrulenum', null);
-if($rulenum) {
+if ($rulenum) {
list($rulenum, $tracker, $type) = explode(',', $rulenum);
$rule = find_rule_by_number($rulenum, $tracker, $type);
echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
@@ -111,14 +114,17 @@ $filter_logfile = "{$g['varlog_path']}/filter.log";
$nentries = $config['syslog']['nentries'];
# Override Display Quantity
-if ($filterlogentries_qty)
+if ($filterlogentries_qty) {
$nentries = $filterlogentries_qty;
+}
-if (!$nentries || !is_numeric($nentries))
+if (!$nentries || !is_numeric($nentries)) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($filter_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall"));
$shortcut_section = "firewall";
@@ -145,7 +151,7 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
+ </td></tr>
<tr><td class="tabnavtbl">
<?php
$tab_array = array();
@@ -155,16 +161,16 @@ include("head.inc");
display_top_tabs($tab_array);
?>
</td>
- </tr>
+ </tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" style="sortableMultirow:<?=$config['syslog']['filterdescriptions'] === "2"?2:1?>" summary="main area">
<tr>
<td colspan="<?=(!isset($config['syslog']['rawfilter']))?7:2?>" align="left" valign="middle">
<div id="filterlogentries_show" class="widgetconfigdiv" style="<?=(!isset($config['syslog']['rawfilter']))?"":"display:none"?>">
<form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post">
- <?php
+ <?php
$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
if ($filterfieldsarray['interface'] == "All") $interface = "";
?>
@@ -238,30 +244,36 @@ include("head.inc");
<div align="center" style="vertical-align:top;">
<select name="interface" onchange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
<option value="" <?=$interfacefilter?"":"selected=\"selected\""?>>*Any interface</option>
- <?php
+ <?php
$iflist = get_configured_interface_with_descr(false, true);
//$iflist = get_interface_list();
- // Allow extending of the firewall edit interfaces
+ // Allow extending of the firewall edit interfaces
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
- foreach ($iflist as $if => $ifdesc)
+ foreach ($iflist as $if => $ifdesc) {
$interfaces[$if] = $ifdesc;
+ }
- if ($config['l2tp']['mode'] == "server")
+ if ($config['l2tp']['mode'] == "server") {
$interfaces['l2tp'] = "L2TP VPN";
+ }
- if ($config['pptpd']['mode'] == "server")
+ if ($config['pptpd']['mode'] == "server") {
$interfaces['pptp'] = "PPTP VPN";
+ }
- if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+ }
/* add ipsec interfaces */
- if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
+ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) {
$interfaces["enc0"] = "IPsec";
+ }
/* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+ }
foreach ($interfaces as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?=($iface==$interfacefilter)?"selected=\"selected\"":"";?>><?=htmlspecialchars($ifacename);?></option>
@@ -297,24 +309,29 @@ include("head.inc");
<a href="#" onclick="toggleListDescriptions()">Show/hide rule descriptions</a>
<?php endif;?>
</div>
- </td>
+ </td>
</tr>
<?php if (!isset($config['syslog']['rawfilter'])):
$iflist = get_configured_interface_with_descr(false, true);
- if ($iflist[$interfacefilter])
+ if ($iflist[$interfacefilter]) {
$interfacefilter = $iflist[$interfacefilter];
- if ($filterlogentries_submit)
+ }
+ if ($filterlogentries_submit) {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
- else
+ } else {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
+ }
?>
<tr>
<td colspan="<?=$config['syslog']['filterdescriptions']==="1"?7:6?>" class="listtopic">
- <?php if ( (!$filtertext) && (!$filterfieldsarray) )
+ <?php
+ if ((!$filtertext) && (!$filterfieldsarray)) {
printf(gettext("Last %s firewall log entries."),count($filterlog));
- else
+ } else {
echo count($filterlog). ' ' . gettext("matched log entries.") . ' ';
- printf(gettext("Max(%s)"),$nentries);?>
+ }
+ printf(gettext("Max(%s)"),$nentries);
+ ?>
</td>
</tr>
<tr class="sortableHeaderRowIdentifier">
@@ -329,88 +346,94 @@ include("head.inc");
<td width="15%" class="listhdrr"><?=gettext("Proto");?></td>
</tr>
<?php
- if ($config['syslog']['filterdescriptions'])
+ if ($config['syslog']['filterdescriptions']) {
buffer_rules_load();
+ }
$rowIndex = 0;
- foreach ($filterlog as $filterent):
- $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
- $rowIndex++;?>
+ foreach ($filterlog as $filterent):
+ $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
+ $rowIndex++;?>
<tr class="<?=$evenRowClass?>">
- <td class="listMRlr nowrap" align="center" sorttable_customkey="<?=$filterent['act']?>">
- <center>
- <a onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);">
- <img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" />
- <?php if ($filterent['count']) echo $filterent['count'];?></a></center></td>
- <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
- <td class="listMRr nowrap">
+ <td class="listMRlr nowrap" align="center" sorttable_customkey="<?=$filterent['act']?>">
+ <center>
+ <a onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);">
+ <img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" />
+ <?php if ($filterent['count']) echo $filterent['count'];?></a></center></td>
+ <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
+ <td class="listMRr nowrap">
<?php if ($filterent['direction'] == "out"): ?>
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/out.gif" alt="Direction=OUT" title="Direction=OUT"/>
<?php endif; ?>
<?php echo htmlspecialchars($filterent['interface']);?></td>
- <?php
- if ($config['syslog']['filterdescriptions'] === "1")
- echo("<td class=\"listMRr nowrap\">".find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])."</td>");
-
- $int = strtolower($filterent['interface']);
- $proto = strtolower($filterent['proto']);
- if($filterent['version'] == '6') {
- $ipproto = "inet6";
- $filterent['srcip'] = "[{$filterent['srcip']}]";
- $filterent['dstip'] = "[{$filterent['dstip']}]";
- } else {
- $ipproto = "inet";
- }
-
- $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
- $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
- $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
- $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
- ?>
- <td class="listMRr nowrap">
- <img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $src_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
- <a href="easyrule.php?<?php echo "action=block&amp;int={$int}&amp;src={$filterent['srcip']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Add to Block List");?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")?>')">
- <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_block_add.gif" alt="Icon Easy Rule: Add to Block List" /></a>
- <?php echo $srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>';?>
- </td>
- <td class="listMRr nowrap">
- <img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $dst_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
- <a href="easyrule.php?<?php echo "action=pass&amp;int={$int}&amp;proto={$proto}&amp;src={$filterent['srcip']}&amp;dst={$filterent['dstip']}&amp;dstport={$filterent['dstport']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic");?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")?>')">
- <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass_add.gif" alt="Icon Easy Rule: Pass this traffic" /></a>
- <?php echo $dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>';?>
- </td>
- <?php
- if ($filterent['proto'] == "TCP")
+ <?php
+ if ($config['syslog']['filterdescriptions'] === "1") {
+ echo("<td class=\"listMRr nowrap\">".find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])."</td>");
+ }
+
+ $int = strtolower($filterent['interface']);
+ $proto = strtolower($filterent['proto']);
+ if ($filterent['version'] == '6') {
+ $ipproto = "inet6";
+ $filterent['srcip'] = "[{$filterent['srcip']}]";
+ $filterent['dstip'] = "[{$filterent['dstip']}]";
+ } else {
+ $ipproto = "inet";
+ }
+
+ $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
+ $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
+ $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
+ $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
+ ?>
+ <td class="listMRr nowrap">
+ <img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $src_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
+ <a href="easyrule.php?<?php echo "action=block&amp;int={$int}&amp;src={$filterent['srcip']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Add to Block List");?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")?>')">
+ <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_block_add.gif" alt="Icon Easy Rule: Add to Block List" /></a>
+ <?php echo $srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>';?>
+ </td>
+ <td class="listMRr nowrap">
+ <img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $dst_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
+ <a href="easyrule.php?<?php echo "action=pass&amp;int={$int}&amp;proto={$proto}&amp;src={$filterent['srcip']}&amp;dst={$filterent['dstip']}&amp;dstport={$filterent['dstport']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic");?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")?>')">
+ <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass_add.gif" alt="Icon Easy Rule: Pass this traffic" /></a>
+ <?php echo $dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>';?>
+ </td>
+ <?php
+ if ($filterent['proto'] == "TCP") {
$filterent['proto'] .= ":{$filterent['tcpflags']}";
- ?>
- <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
+ }
+ ?>
+ <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
</tr>
<?php if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2"):?>
<tr class="<?=$evenRowClass?>">
- <td colspan="2" class="listMRDescriptionL listMRlr" />
- <td colspan="4" class="listMRDescriptionR listMRr nowrap"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act']);?></td>
+ <td colspan="2" class="listMRDescriptionL listMRlr" />
+ <td colspan="4" class="listMRDescriptionR listMRr nowrap"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act']);?></td>
</tr>
- <?php endif;
- endforeach;
- buffer_rules_clear(); ?>
+ <?php
+ endif;
+ endforeach;
+ buffer_rules_clear();
+ ?>
<?php else: ?>
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext("Last %s firewall log entries"),$nentries);?></td>
- </tr>
- <?php
- if($filtertext)
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext("Last %s firewall log entries"),$nentries);?></td>
+ </tr>
+ <?php
+ if ($filtertext) {
dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
- else
+ } else {
dump_clog($filter_logfile, $nentries);
- ?>
+ }
+ ?>
<?php endif; ?>
- <tr>
- <td align="left" valign="top" colspan="3">
- <form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
- <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
- </form>
- </td>
- </tr>
+ <tr>
+ <td align="left" valign="top" colspan="3">
+ <form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
+ <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
+ </form>
+ </td>
+ </tr>
</table>
</div>
</td>
@@ -444,18 +467,18 @@ function resolve_ip_callback(transport) {
var response = jQuery.parseJSON(transport.responseText);
var resolve_class = htmlspecialchars(response.resolve_ip.replace(/[.:]/g, '-'));
var resolve_text = '<small><br />' + htmlspecialchars(response.resolve_text) + '<\/small>';
-
+
jQuery('span.RESOLVE-' + resolve_class).html(resolve_text);
jQuery('img.ICON-' + resolve_class).removeAttr('title');
jQuery('img.ICON-' + resolve_class).removeAttr('alt');
jQuery('img.ICON-' + resolve_class).attr('src', '/themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif');
- jQuery('img.ICON-' + resolve_class).prop('onclick', null);
+ jQuery('img.ICON-' + resolve_class).prop('onclick', null);
// jQuery cautions that "removeAttr('onclick')" fails in some versions of IE
}
// From http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
function htmlspecialchars(str) {
- return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
}
//]]>
</script>
diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php
index c9fe2e3..02307a0 100755
--- a/usr/local/www/diag_logs_filter_dynamic.php
+++ b/usr/local/www/diag_logs_filter_dynamic.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: filter
*/
@@ -54,8 +54,9 @@ $nentries = 50;
/* AJAX related routines */
handle_ajax($nentries, $nentries + 20);
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($filter_logfile);
+}
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100);
@@ -76,10 +77,11 @@ include("head.inc");
var isPaused = false;
var nentries = <?php echo $nentries; ?>;
<?php
- if(isset($config['syslog']['reverse']))
+ if (isset($config['syslog']['reverse'])) {
echo "var isReverse = true;\n";
- else
+ } else {
echo "var isReverse = false;\n";
+ }
?>
/* Called by the AJAX updater */
function format_log_line(row) {
@@ -91,14 +93,16 @@ include("head.inc");
dstIP = row[5];
}
- if ( row[4] == '' )
+ if ( row[4] == '' ) {
srcPort = '';
- else
+ } else {
srcPort = ':' + row[4];
- if ( row[6] == '' )
+ }
+ if ( row[6] == '' ) {
dstPort = '';
- else
+ } else {
dstPort = ':' + row[6];
+ }
var line = '<td class="listMRlr" align="center">' + row[0] + '</td>' +
'<td class="listMRr nowrap">' + row[1] + '</td>' +
@@ -128,7 +132,7 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
+ </td></tr>
<tr><td class="tabnavtbl">
<?php
$tab_array = array();
@@ -137,10 +141,10 @@ include("head.inc");
$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
+ </td>
+ </tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
<thead>
@@ -172,15 +176,17 @@ include("head.inc");
$dstIP = htmlspecialchars($filterent['dstip']);
}
- if ($filterent['srcport'])
+ if ($filterent['srcport']) {
$srcPort = ":" . htmlspecialchars($filterent['srcport']);
- else
+ } else {
$srcPort = "";
+ }
- if ($filterent['dstport'])
+ if ($filterent['dstport']) {
$dstPort = ":" . htmlspecialchars($filterent['dstport']);
- else
+ } else {
$dstPort = "";
+ }
?>
<tr class="<?=$evenRowClass?>">
<td class="listMRlr nowrap" align="center">
@@ -193,8 +199,9 @@ include("head.inc");
<td class="listMRr nowrap"><?php echo $srcIP . $srcPort;?></td>
<td class="listMRr nowrap"><?php echo $dstIP . $dstPort;?></td>
<?php
- if ($filterent['proto'] == "TCP")
+ if ($filterent['proto'] == "TCP") {
$filterent['proto'] .= ":{$filterent['tcpflags']}";
+ }
?>
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
</tr>
@@ -202,7 +209,7 @@ include("head.inc");
</tbody>
</table>
</div>
- </td>
+ </td>
</tr>
</table>
<p><span class="vexpl"><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</span></p>
diff --git a/usr/local/www/diag_logs_filter_summary.php b/usr/local/www/diag_logs_filter_summary.php
index 0abe6d7..e4150a0 100644
--- a/usr/local/www/diag_logs_filter_summary.php
+++ b/usr/local/www/diag_logs_filter_summary.php
@@ -9,11 +9,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -27,8 +27,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- pfSense_BUILDER_BINARIES:
+/*
+ pfSense_BUILDER_BINARIES:
pfSense_MODULE: filter
*/
@@ -60,10 +60,10 @@ foreach (array_keys($fields) as $f) {
$totals = array();
function cmp($a, $b) {
- if ($a == $b) {
- return 0;
- }
- return ($a < $b) ? 1 : -1;
+ if ($a == $b) {
+ return 0;
+ }
+ return ($a < $b) ? 1 : -1;
}
function stat_block($summary, $stat, $num) {
@@ -84,8 +84,9 @@ function stat_block($summary, $stat, $num) {
} elseif (substr_count($outstr, '/') == 1) {
list($proto, $port) = explode('/', $outstr);
$service = getservbyport($port, strtolower($proto));
- if ($service)
+ if ($service) {
$outstr .= ": {$service}";
+ }
}
print "<tr><td>{$outstr}</td><td width=\"50\" align=\"right\">{$summary[$stat][$k[$i]]}</td></tr>";
}
@@ -125,14 +126,16 @@ function pie_block($summary, $stat, $num) {
for ($i=0; $i < $num; $i++) {
if ($k[$i]) {
print " { data: d{$stat}{$i}, label: \"{$k[$i]}\"}";
- if (!(($i == ($numentries - 1)) && ($leftover <= 0)))
+ if (!(($i == ($numentries - 1)) && ($leftover <= 0))) {
print ",\n";
- else
+ } else {
print "\n";
+ }
}
}
- if ($leftover > 0)
+ if ($leftover > 0) {
print " { data: d{$stat}{$i}, label: \"Other\"}\n";
+ }
print " ],\n";
print " {\n";
print " pies: {show: true, autoScale: true},\n";
@@ -150,18 +153,21 @@ function pie_block($summary, $stat, $num) {
foreach ($filterlog as $fe) {
$specialfields = array('srcport', 'dstport');
foreach (array_keys($fields) as $field) {
- if (!in_array($field, $specialfields))
+ if (!in_array($field, $specialfields)) {
$summary[$field][$fe[$field]]++;
+ }
}
/* Handle some special cases */
- if ($fe['srcport'])
+ if ($fe['srcport']) {
$summary['srcport'][$fe['proto'].'/'.$fe['srcport']]++;
- else
+ } else {
$summary['srcport'][$fe['srcport']]++;
- if ($fe['dstport'])
+ }
+ if ($fe['dstport']) {
$summary['dstport'][$fe['proto'].'/'.$fe['dstport']]++;
- else
+ } else {
$summary['dstport'][$fe['dstport']]++;
+ }
}
include("head.inc"); ?>
@@ -199,7 +205,7 @@ include("head.inc"); ?>
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
+ </td></tr>
<tr><td class="tabnavtbl">
<?php
$tab_array = array();
@@ -208,10 +214,10 @@ include("head.inc"); ?>
$tab_array[] = array(gettext("Summary View"), true, "/diag_logs_filter_summary.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
+ </td>
+ </tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" summary="main area">
<tr><td align="center">
@@ -220,7 +226,7 @@ include("head.inc"); ?>
<?=gettext("NOTE: IE8 users must enable compatibility view.")?>
<?php
-foreach(array_keys($fields) as $field) {
+foreach (array_keys($fields) as $field) {
pie_block($summary, $field , $entriesperblock);
echo "<br /><br />";
stat_block($summary, $field , $entriesperblock);
diff --git a/usr/local/www/diag_logs_gateways.php b/usr/local/www/diag_logs_gateways.php
index bd3f0a7..2991f2e 100755
--- a/usr/local/www/diag_logs_gateways.php
+++ b/usr/local/www/diag_logs_gateways.php
@@ -33,7 +33,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: system
*/
@@ -49,20 +49,25 @@ require("guiconfig.inc");
$system_logfile = "{$g['varlog_path']}/gateways.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($system_logfile);
+}
-if ($_GET['filtertext'])
+if ($_GET['filtertext']) {
$filtertext = htmlspecialchars($_GET['filtertext']);
+}
-if ($_POST['filtertext'])
+if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']);
+}
-if ($filtertext)
+if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext";
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Gateways"));
$shortcut_section = "gateways";
@@ -92,7 +97,8 @@ include("head.inc");
?>
</td>
</tr>
- <tr><td class="tabnavtbl">
+ <tr>
+ <td class="tabnavtbl">
<?php
$tab_array = array();
$tab_array[] = array(gettext("General"), false, "/diag_logs.php");
@@ -112,26 +118,27 @@ include("head.inc");
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s system log entries"),$nentries); ?></td>
</tr>
<?php
- if($filtertext)
+ if ($filtertext) {
dump_clog($system_logfile, $nentries, true, array("$filtertext"));
- else
+ } else {
dump_clog($system_logfile, $nentries, true, array());
+ }
?>
<tr>
<td align="left" valign="top">
<form id="filterform" name="filterform" action="diag_logs_gateways.php" method="post" style="margin-top: 14px;">
- <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
+ <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
</form>
</td>
<td align="right" valign="top" >
<form id="clearform" name="clearform" action="diag_logs_gateways.php" method="post" style="margin-top: 14px;">
- <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
- <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
+ <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
+ <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
</form>
</td>
</tr>
</table>
- </div>
+ </div>
</td>
</tr>
</table>
diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php
index 7966918..ee932fd 100644
--- a/usr/local/www/diag_logs_ipsec.php
+++ b/usr/local/www/diag_logs_ipsec.php
@@ -32,8 +32,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/bin/awk
+/*
+ pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/bin/awk
pfSense_MODULE: ipsec
*/
@@ -50,11 +50,13 @@ require("ipsec.inc");
$ipsec_logfile = "{$g['varlog_path']}/ipsec.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($ipsec_logfile);
+}
$ipsec_logarr = return_clog($ipsec_logfile, $nentries);
@@ -66,7 +68,7 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs ipsec">
- <tr>
+ <tr>
<td>
<?php
$tab_array = array();
@@ -83,17 +85,17 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td>
+ </td>
</tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
+ <tr>
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s IPsec log entries"),$nentries);?></td>
- </tr>
+ </tr>
<?php
- foreach($ipsec_logarr as $logent){
+ foreach ($ipsec_logarr as $logent) {
$logent = htmlspecialchars($logent);
$logent = preg_split("/\s+/", $logent, 6);
echo "<tr valign=\"top\">\n";
diff --git a/usr/local/www/diag_logs_ntpd.php b/usr/local/www/diag_logs_ntpd.php
index 0754dcb..921ec23 100644
--- a/usr/local/www/diag_logs_ntpd.php
+++ b/usr/local/www/diag_logs_ntpd.php
@@ -30,7 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: ntpd
*/
@@ -46,11 +46,13 @@ require("guiconfig.inc");
$ntpd_logfile = "{$g['varlog_path']}/ntpd.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($ntpd_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("NTP"));
$shortcut_section = "ntp";
@@ -61,7 +63,8 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs ntpd">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("System"), false, "diag_logs.php");
@@ -77,25 +80,30 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext("Last %s NTP log entries"), $nentries);?></td>
- </tr>
- <?php dump_clog($ntpd_logfile, $nentries); ?>
- <tr><td><br />
- <form action="diag_logs_ntpd.php" method="post">
- <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
-</form>
-</td></tr>
- </table>
- </div>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext("Last %s NTP log entries"), $nentries);?>
+ </td>
+ </tr>
+ <?php dump_clog($ntpd_logfile, $nentries); ?>
+ <tr>
+ <td>
+ <br />
+ <form action="diag_logs_ntpd.php" method="post">
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_logs_openvpn.php b/usr/local/www/diag_logs_openvpn.php
index feda5ca..c9e4bed 100644
--- a/usr/local/www/diag_logs_openvpn.php
+++ b/usr/local/www/diag_logs_openvpn.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: openvpn
*/
@@ -52,11 +52,13 @@ require_once("vpn.inc");
$openvpn_logfile = "{$g['varlog_path']}/openvpn.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($openvpn_logfile);
+}
include("head.inc");
@@ -64,7 +66,7 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs openvpn">
- <tr>
+ <tr>
<td>
<?php
$tab_array = array();
@@ -81,21 +83,21 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td>
+ </td>
</tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
+ <tr>
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s OpenVPN log entries"),$nentries)?></td>
- </tr>
+ </tr>
<?php dump_clog($openvpn_logfile, $nentries); ?>
<tr>
<td>
<br />
<form action="diag_logs_openvpn.php" method="post">
- <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
</form>
</td>
</tr>
diff --git a/usr/local/www/diag_logs_ppp.php b/usr/local/www/diag_logs_ppp.php
index 8a53214..c56c7e0 100644
--- a/usr/local/www/diag_logs_ppp.php
+++ b/usr/local/www/diag_logs_ppp.php
@@ -32,8 +32,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/bin/awk
+/*
+ pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/bin/awk
pfSense_MODULE:
*/
@@ -49,11 +49,13 @@ require("guiconfig.inc");
$ppp_logfile = "{$g['varlog_path']}/ppp.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($ppp_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("PPP"));
include("head.inc");
@@ -62,7 +64,7 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs ppp">
- <tr>
+ <tr>
<td>
<?php
$tab_array = array();
@@ -79,21 +81,21 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td>
+ </td>
</tr>
<tr>
- <td>
+ <td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
+ <tr>
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s PPP log entries"),$nentries);?></td>
- </tr>
+ </tr>
<?php dump_clog($ppp_logfile, $nentries); ?>
<tr>
<td>
<br />
<form action="diag_logs_ppp.php" method="post">
- <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
</form>
</td>
</tr>
diff --git a/usr/local/www/diag_logs_relayd.php b/usr/local/www/diag_logs_relayd.php
index e44b082..053dbc9 100644
--- a/usr/local/www/diag_logs_relayd.php
+++ b/usr/local/www/diag_logs_relayd.php
@@ -31,7 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: routing
*/
@@ -47,11 +47,13 @@ require("guiconfig.inc");
$relayd_logfile = "{$g['varlog_path']}/relayd.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($relayd_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Load Balancer"));
$shortcut_section = "relayd";
@@ -62,7 +64,8 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("System"), false, "diag_logs.php");
@@ -78,22 +81,30 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext("Last %s Load Balancer log entries"),$nentries);?></td>
- </tr>
- <?php dump_clog($relayd_logfile, $nentries); ?>
- <tr><td><br /><form action="diag_logs_relayd.php" method="post">
-<input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" /></form></td></tr>
- </table>
- </div>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext("Last %s Load Balancer log entries"),$nentries);?>
+ </td>
+ </tr>
+ <?php dump_clog($relayd_logfile, $nentries); ?>
+ <tr>
+ <td>
+ <br />
+ <form action="diag_logs_relayd.php" method="post">
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_logs_resolver.php b/usr/local/www/diag_logs_resolver.php
index dd8f74a..981d473 100755
--- a/usr/local/www/diag_logs_resolver.php
+++ b/usr/local/www/diag_logs_resolver.php
@@ -33,7 +33,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: system
*/
@@ -49,26 +49,32 @@ require("guiconfig.inc");
$system_logfile = "{$g['varlog_path']}/resolver.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($system_logfile);
+}
-if ($_GET['filtertext'])
+if ($_GET['filtertext']) {
$filtertext = htmlspecialchars($_GET['filtertext']);
+}
-if ($_POST['filtertext'])
+if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']);
+}
-if ($filtertext)
+if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext";
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Resolver"));
-if (isset($config['dnsmasq']['enable']))
+if (isset($config['dnsmasq']['enable'])) {
$shortcut_section = "forwarder";
-else
+} else {
$shortcut_section = "resolver";
+}
include("head.inc");
@@ -96,7 +102,8 @@ include("head.inc");
?>
</td>
</tr>
- <tr><td class="tabnavtbl">
+ <tr>
+ <td class="tabnavtbl">
<?php
$tab_array = array();
$tab_array[] = array(gettext("General"), false, "/diag_logs.php");
@@ -116,26 +123,27 @@ include("head.inc");
<td colspan="2" class="listtopic"><?php printf(gettext("Last %s system log entries"),$nentries); ?></td>
</tr>
<?php
- if($filtertext)
+ if ($filtertext) {
dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
- else
+ } else {
dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
+ }
?>
<tr>
<td align="left" valign="top">
<form id="filterform" name="filterform" action="diag_logs_resolver.php" method="post" style="margin-top: 14px;">
- <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
+ <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
</form>
</td>
<td align="right" valign="top" >
<form id="clearform" name="clearform" action="diag_logs_resolver.php" method="post" style="margin-top: 14px;">
- <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
- <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
+ <input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
+ <input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
</form>
</td>
</tr>
</table>
- </div>
+ </div>
</td>
</tr>
</table>
diff --git a/usr/local/www/diag_logs_routing.php b/usr/local/www/diag_logs_routing.php
index bb14680..0fdbc67 100644
--- a/usr/local/www/diag_logs_routing.php
+++ b/usr/local/www/diag_logs_routing.php
@@ -30,7 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: routing
*/
@@ -46,11 +46,13 @@ require("guiconfig.inc");
$routing_logfile = "{$g['varlog_path']}/routing.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($routing_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Routing"));
$shortcut_section = "routing";
@@ -61,7 +63,8 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs system routing">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("System"), true, "diag_logs.php");
@@ -77,8 +80,10 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr><td class="tabnavtbl">
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
<?php
$tab_array = array();
$tab_array[] = array(gettext("General"), false, "/diag_logs.php");
@@ -86,25 +91,32 @@ include("head.inc");
$tab_array[] = array(gettext("Routing"), true, "/diag_logs_routing.php");
$tab_array[] = array(gettext("Resolver"), false, "/diag_logs_resolver.php");
$tab_array[] = array(gettext("Wireless"), false, "/diag_logs_wireless.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext("Routing daemon log entries"),$nentries);?></td>
- </tr>
- <?php dump_clog($routing_logfile, $nentries); ?>
- <tr><td><br /><form action="diag_logs_routing.php" method="post">
-<input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" /></form></td></tr>
- </table>
- </div>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext("Routing daemon log entries"),$nentries);?>
+ </td>
+ </tr>
+ <?php dump_clog($routing_logfile, $nentries); ?>
+ <tr>
+ <td>
+ <br />
+ <form action="diag_logs_routing.php" method="post">
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php
index 5f48985..9d1ecfa 100644
--- a/usr/local/www/diag_logs_settings.php
+++ b/usr/local/www/diag_logs_settings.php
@@ -75,8 +75,9 @@ $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
$pconfig['logfilesize'] = $config['syslog']['logfilesize'];
-if (!$pconfig['nentries'])
+if (!$pconfig['nentries']) {
$pconfig['nentries'] = 50;
+}
function is_valid_syslog_server($target) {
return (is_ipaddr($target)
@@ -150,11 +151,12 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
$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)
+ if (is_numeric($_POST['filterdescriptions']) && $_POST['filterdescriptions'] > 0) {
$config['syslog']['filterdescriptions'] = $_POST['filterdescriptions'];
- else
+ } else {
unset($config['syslog']['filterdescriptions']);
- if($config['syslog']['enable'] == false) {
+ }
+ if ($config['syslog']['enable'] == false) {
unset($config['syslog']['remoteserver']);
unset($config['syslog']['remoteserver2']);
unset($config['syslog']['remoteserver3']);
@@ -164,11 +166,12 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
$retval = 0;
$retval = system_syslogd_start();
- if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
- || ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass']))
- || ($oldnologbogons !== isset($config['syslog']['nologbogons']))
- || ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets'])))
+ 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);
@@ -342,9 +345,9 @@ function check_everything() {
<td valign="top" class="vtable">Filter descriptions</td>
<td class="vtable">
<select name="filterdescriptions" id="filterdescriptions" >
- <option value="0"<?=!isset($pconfig['filterdescriptions'])?" selected=\"selected\"":""?>>Dont load descriptions</option>
- <option value="1"<?=($pconfig['filterdescriptions'])==="1"?" selected=\"selected\"":""?>>Display as column</option>
- <option value="2"<?=($pconfig['filterdescriptions'])==="2"?" selected=\"selected\"":""?>>Display as second row</option>
+ <option value="0"<?=!isset($pconfig['filterdescriptions'])?" selected=\"selected\"":""?>>Dont load descriptions</option>
+ <option value="1"<?=($pconfig['filterdescriptions'])==="1"?" selected=\"selected\"":""?>>Display as column</option>
+ <option value="2"<?=($pconfig['filterdescriptions'])==="2"?" selected=\"selected\"":""?>>Display as second row</option>
</select>
<strong><?=gettext("Show the applied rule description below or in the firewall log rows.");?></strong>
<br />
@@ -382,8 +385,9 @@ function check_everything() {
<?php $sourceips = get_possible_traffic_source_addresses(false);
foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $pconfig['sourceip']))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $pconfig['sourceip'])) {
$selected = 'selected="selected"';
+ }
?>
<option value="<?=$sipvalue;?>" <?=$selected;?>>
<?=htmlspecialchars($sipname);?>
diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php
index 6a7a7f8..be2de56 100755
--- a/usr/local/www/diag_logs_vpn.php
+++ b/usr/local/www/diag_logs_vpn.php
@@ -30,7 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_BUILDER_BINARIES: /usr/sbin/fifolog_reader /usr/local/sbin/clog
pfSense_MODULE: vpn
*/
@@ -47,23 +47,24 @@ require("guiconfig.inc");
require_once("vpn.inc");
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if (htmlspecialchars($_POST['vpntype']))
+if (htmlspecialchars($_POST['vpntype'])) {
$vpntype = htmlspecialchars($_POST['vpntype']);
-elseif (htmlspecialchars($_GET['vpntype']))
+} elseif (htmlspecialchars($_GET['vpntype'])) {
$vpntype = htmlspecialchars($_GET['vpntype']);
-else
+} else {
$vpntype = "pptp";
-
-if (htmlspecialchars($_POST['mode']))
+}
+if (htmlspecialchars($_POST['mode'])) {
$mode = htmlspecialchars($_POST['mode']);
-elseif (htmlspecialchars($_GET['mode']))
+} elseif (htmlspecialchars($_GET['mode'])) {
$mode = htmlspecialchars($_GET['mode']);
-else
+} else {
$mode = "login";
-
+}
switch ($vpntype) {
case 'pptp':
$logname = "pptps";
@@ -77,10 +78,11 @@ switch ($vpntype) {
}
if ($_POST['clear']) {
- if ($mode != "raw")
+ if ($mode != "raw") {
clear_log_file("/var/log/vpn.log");
- else
+ } else {
clear_log_file("/var/log/{$logname}.log");
+ }
}
function dump_clog_vpn($logfile, $tail) {
@@ -89,25 +91,28 @@ function dump_clog_vpn($logfile, $tail) {
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
$logarr = "";
-
- if(isset($config['system']['usefifolog']))
+
+ if (isset($config['system']['usefifolog'])) {
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr);
- else
+ } else {
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr);
+ }
foreach ($logarr as $logent) {
$logent = preg_split("/\s+/", $logent, 6);
$llent = explode(",", $logent[5]);
$iftype = substr($llent[1], 0, 4);
- if ($iftype != $vpntype)
+ if ($iftype != $vpntype) {
continue;
+ }
echo "<tr>\n";
echo "<td class=\"listlr nowrap\">" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
- if ($llent[0] == "login")
+ if ($llent[0] == "login") {
echo "<td class=\"listr\"><img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" title=\"login\" alt=\"in\" /></td>\n";
- else
+ } else {
echo "<td class=\"listr\"><img src=\"/themes/{$g['theme']}/images/icons/icon_out.gif\" width=\"11\" height=\"11\" title=\"logout\" alt=\"out\" /></td>\n";
+ }
echo "<td class=\"listr\">" . htmlspecialchars($llent[3]) . "</td>\n";
echo "<td class=\"listr\">" . htmlspecialchars($llent[2]) . "&nbsp;</td>\n";
@@ -163,7 +168,7 @@ include("head.inc");
?>
</td></tr>
<tr>
- <td class="tabcont">
+ <td class="tabcont">
<form action="diag_logs_vpn.php" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
<tr>
@@ -178,9 +183,9 @@ include("head.inc");
<td class="listhdrr"><?=gettext("IP address");?></td>
</tr>
<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?>
- <?php else:
+ <?php else:
dump_clog("/var/log/{$logname}.log", $nentries);
- endif; ?>
+ endif; ?>
</table>
<br />
<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>" />
diff --git a/usr/local/www/diag_logs_wireless.php b/usr/local/www/diag_logs_wireless.php
index 5dfbf72..49998cf 100644
--- a/usr/local/www/diag_logs_wireless.php
+++ b/usr/local/www/diag_logs_wireless.php
@@ -32,7 +32,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: routing
*/
@@ -48,11 +48,13 @@ require("guiconfig.inc");
$wireless_logfile = "{$g['varlog_path']}/wireless.log";
$nentries = $config['syslog']['nentries'];
-if (!$nentries)
+if (!$nentries) {
$nentries = 50;
+}
-if ($_POST['clear'])
+if ($_POST['clear']) {
clear_log_file($wireless_logfile);
+}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Wireless"));
$shortcut_section = "wireless";
@@ -63,7 +65,8 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs system wireless">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("System"), true, "diag_logs.php");
@@ -79,8 +82,10 @@ include("head.inc");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr><td class="tabnavtbl">
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
<?php
$tab_array = array();
$tab_array[] = array(gettext("General"), false, "/diag_logs.php");
@@ -88,25 +93,32 @@ include("head.inc");
$tab_array[] = array(gettext("Routing"), false, "/diag_logs_routing.php");
$tab_array[] = array(gettext("Resolver"), false, "/diag_logs_resolver.php");
$tab_array[] = array(gettext("Wireless"), true, "/diag_logs_wireless.php");
- display_top_tabs($tab_array);
+ display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext("Wireless (hostapd) log entries"),$nentries);?></td>
- </tr>
- <?php dump_clog($wireless_logfile, $nentries); ?>
- <tr><td><br /><form action="diag_logs_wireless.php" method="post">
-<input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" /></form></td></tr>
- </table>
- </div>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext("Wireless (hostapd) log entries"),$nentries);?>
+ </td>
+ </tr>
+ <?php dump_clog($wireless_logfile, $nentries); ?>
+ <tr>
+ <td>
+ <br />
+ <form action="diag_logs_wireless.php" method="post">
+ <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php
index 206ed66..63a4f35 100644
--- a/usr/local/www/diag_nanobsd.php
+++ b/usr/local/www/diag_nanobsd.php
@@ -27,7 +27,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_BUILDER_BINARIES: /sbin/mount /sbin/glabel /usr/bin/grep /usr/bin/cut /usr/bin/head /bin/cp
pfSense_BUILDER_BINARIES: /usr/sbin/boot0cfg /bin/mkdir /sbin/fsck_ufs /sbin/mount /bin/dd /sbin/tunefs
pfSense_MODULE: nanobsd
@@ -66,11 +66,11 @@ nanobsd_detect_slice_info();
$NANOBSD_SIZE = nanobsd_get_size();
-if($_POST['bootslice']) {
- $statusmsg = gettext("Setting slice information, please wait...");
+if ($_POST['bootslice']) {
+ $statusmsg = gettext("Setting slice information, please wait...");
echo <<<EOF
- <div id="loading">
- <img src="/themes/{$g['theme']}/images/misc/loader.gif">
+ <div id="loading">
+ <img src="/themes/{$g['theme']}/images/misc/loader.gif">
$statusmsg
<p/>&nbsp;
</div>
@@ -82,16 +82,16 @@ EOF;
}
-if($_POST['destslice']) {
+if ($_POST['destslice']) {
$statusmsg = gettext("Duplicating slice. Please wait, this will take a moment...");
-echo <<<EOF
- <div id="loading">
+ echo <<<EOF
+ <div id="loading">
<img src="/themes/{$g['theme']}/images/misc/loader.gif">
$statusmsg
<p/>&nbsp;
</div>
EOF;
- if(nanobsd_clone_slice($_POST['destslice'])) {
+ if (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.");
} else {
$savemsg = gettext("There was an error while duplicating the slice. Operation aborted.");
@@ -110,17 +110,19 @@ if ($_POST['changero']) {
if ($_POST['setrw']) {
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();
}
-if ($savemsg)
- print_info_box($savemsg)
+if ($savemsg) {
+ print_info_box($savemsg);
+}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
@@ -144,7 +146,7 @@ if ($savemsg)
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Bootup information");?></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("NanoBSD Image size");?></td>
<td width="78%" class="vtable">
<?php echo $NANOBSD_SIZE; ?>
@@ -163,7 +165,7 @@ if ($savemsg)
</tr>
<tr>
<td colspan="2" valign="top" class="">&nbsp;</td>
- </tr>
+ </tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Media Read/Write Status");?></td>
</tr>
@@ -180,12 +182,14 @@ if ($savemsg)
$refdisplay = " (reference count " . $refcount . ")";
}
echo gettext("Read/Write") . $refdisplay;
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
echo "<br /><input type='submit' name='changero' value='" . gettext("Switch to Read-Only") . "'>";
+ }
} else {
echo gettext("Read-Only");
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
echo "<br /><input type='submit' name='changero' value='" . gettext("Switch to Read/Write") . "'>";
+ }
} ?>
</form>
<br /><?php echo gettext("NOTE: This setting is only temporary, and can be switched dynamically in the background."); ?>
@@ -234,10 +238,10 @@ if ($savemsg)
<?=gettext("These options have been relocated to");?> <a href="system_advanced_misc.php"><?=gettext("System > Advanced, Miscellaneous tab")?></a>.
</td>
</tr>
-<?php if(file_exists("/conf/upgrade_log.txt")): ?>
+<?php if (file_exists("/conf/upgrade_log.txt")): ?>
<tr>
<td colspan="2" valign="top" class="">&nbsp;</td>
- </tr>
+ </tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("View upgrade log");?></td>
</tr>
@@ -265,7 +269,7 @@ if ($savemsg)
<?php endif; ?>
<tr>
<td colspan="2" valign="top" class="">&nbsp;</td>
- </tr>
+ </tr>
</table>
</div>
</td>
@@ -280,6 +284,6 @@ if ($savemsg)
// Clear the loading indicator
echo "<script type=\"text/javascript\">";
echo "jQuery('#loading').html('');";
-echo "</script>";
+echo "</script>";
?>
diff --git a/usr/local/www/diag_ndp.php b/usr/local/www/diag_ndp.php
index 03f80be..f2fcfd5 100644
--- a/usr/local/www/diag_ndp.php
+++ b/usr/local/www/diag_ndp.php
@@ -14,11 +14,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -60,8 +60,8 @@ foreach ($ifdescrs as $key =>$interface) {
$hwif[$config['interfaces'][$key]['if']] = $interface;
}
-/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address
-[3] => Netif [4] => Expire [5] => S
+/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address
+[3] => Netif [4] => Expire [5] => S
[6] => Flags ) */
$data = array();
array_shift($rawdata);
@@ -77,13 +77,14 @@ foreach ($rawdata as $line) {
/* FIXME: Not ipv6 compatible dns resolving. PHP needs fixing */
function _getHostName($mac,$ip)
-{
- if(is_ipaddr($ip)) {
+{
+ if (is_ipaddr($ip)) {
list($ip, $scope) = explode("%", $ip);
- if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip)
+ if (gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip) {
return gethostbyaddr($ip);
- else
+ } else {
return "";
+ }
}
}
@@ -92,12 +93,13 @@ function _getHostName($mac,$ip)
// resolvable addresses will appear last in the list.
foreach ($data as &$entry) {
$dns = trim(_getHostName($entry['mac'], $entry['ipv6']));
- if(trim($dns))
+ if (trim($dns)) {
$entry['dnsresolve'] = "$dns";
- else
+ } else {
$entry['dnsresolve'] = "Z_ ";
+ }
}
-
+
// Sort the data alpha first
$data = msort($data, "dnsresolve");
@@ -121,7 +123,9 @@ include("head.inc");
<?php
// Flush buffers out to client so that they see Loading, please wait....
-for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
+for ($i = 0; $i < ob_get_level(); $i++) {
+ ob_end_flush();
+}
ob_implicit_flush(1);
?>
@@ -144,7 +148,9 @@ ob_implicit_flush(1);
$mac=trim($entry['mac']);
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
print $mac;
- if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
+ if (isset($mac_man[$mac_hi])) {
+ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>";
+ }
?>
</td>
<td class="listr">
@@ -153,11 +159,12 @@ ob_implicit_flush(1);
?>
</td>
<td class="listr">
- <?php
- if(isset($hwif[$entry['interface']]))
+ <?php
+ if (isset($hwif[$entry['interface']])) {
echo $hwif[$entry['interface']];
- else
+ } else {
echo $entry['interface'];
+ }
?>
</td>
</tr>
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php
index 73fb7c4..71ed928 100644
--- a/usr/local/www/diag_packet_capture.php
+++ b/usr/local/www/diag_packet_capture.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_packet_capture.php
+ diag_packet_capture.php
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
All rights reserved
@@ -74,16 +74,18 @@ function fixup_host($value, $position) {
$host = strip_host_logic($value);
$not = has_not($value) ? "not " : "";
$andor = ($position > 0) ? get_host_boolean($value, $host) : "";
- if (is_ipaddr($host))
+ if (is_ipaddr($host)) {
return "{$andor}host {$not}" . $host;
- elseif (is_subnet($host))
+ } elseif (is_subnet($host)) {
return "{$andor}net {$not}" . $host;
- else
+ } else {
return "";
+ }
}
-if ($_POST['downloadbtn'] == gettext("Download Capture"))
+if ($_POST['downloadbtn'] == gettext("Download Capture")) {
$nocsrf = true;
+}
$pgtitle = array(gettext("Diagnostics"), gettext("Packet Capture"));
require_once("guiconfig.inc");
@@ -101,8 +103,9 @@ $protos = array('icmp', 'icmp6', 'tcp', 'udp', 'arp', 'carp', 'esp',
$input_errors = array();
$interfaces = get_configured_interface_with_descr();
-if (isset($config['ipsec']['enable']))
+if (isset($config['ipsec']['enable'])) {
$interfaces['ipsec'] = "IPsec";
+}
foreach (array('server', 'client') as $mode) {
if (is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
@@ -132,7 +135,7 @@ if ($_POST) {
if ($proto !== "" && !in_array(strip_not($proto), $protos)) {
$input_errors[] = gettext("Invalid protocol.");
}
-
+
if ($host != "") {
$host_string = str_replace(array(" ", "|", ","), array("", "#|", "#+"), $host);
if (strpos($host_string, '#') === false) {
@@ -191,8 +194,9 @@ if ($_POST) {
$action = gettext("Start");
//delete previous packet capture if it exists
- if (file_exists($fp.$fn))
+ if (file_exists($fp.$fn)) {
unlink ($fp.$fn);
+ }
} elseif ($_POST['stopbtn']!= "") {
$action = gettext("Stop");
@@ -243,8 +247,6 @@ include("fbegin.inc");
<td width="17%" valign="top" class="vncellreq"><?=gettext("Interface");?></td>
<td width="32%" class="vtable">
<select name="interface">
- <?php
- ?>
<?php foreach ($interfaces as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?php if ($selectedif == $iface) echo "selected=\"selected\""; ?>>
<?php echo $ifacename;?>
@@ -257,7 +259,7 @@ include("fbegin.inc");
<tr>
<td width="17%" valign="top" class="vncellreq"><?=gettext("Promiscuous");?></td>
<td width="51%" class="vtable">
- <input name="promiscuous" type="checkbox"<?php if($_POST['promiscuous']) echo " checked=\"checked\""; ?> />
+ <input name="promiscuous" type="checkbox"<?php if ($_POST['promiscuous']) echo " checked=\"checked\""; ?> />
<br /><?=gettext("If checked, the");?> <a target="_blank" href="http://www.freebsd.org/cgi/man.cgi?query=tcpdump&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+8.3-stable&amp;arch=default&amp;format=html"><?= gettext("packet capture")?></a> <?= gettext("will be performed using promiscuous mode.");?>
<br /><b><?=gettext("Note");?>: </b><?=gettext("Some network adapters do not support or work well in promiscuous mode.");?>
</td>
@@ -343,7 +345,7 @@ include("fbegin.inc");
<tr>
<td width="17%" valign="top" class="vncellreq"><?=gettext("Reverse DNS Lookup");?></td>
<td colspan="2" width="83%" class="vtable">
- <input name="dnsquery" type="checkbox" <?php if($_POST['dnsquery']) echo " checked=\"checked\""; ?> />
+ <input name="dnsquery" type="checkbox" <?php if ($_POST['dnsquery']) echo " checked=\"checked\""; ?> />
<br /><?=gettext("This check box will cause the packet capture to perform a reverse DNS lookup associated with all IP addresses.");?>
<br /><b><?=gettext("Note");?>: </b><?=gettext("This option can cause delays for large packet captures.");?>
</td>
@@ -356,14 +358,15 @@ include("fbegin.inc");
/* check to see if packet capture tcpdump is already running */
$processcheck = (trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'")));
- if ($processcheck != "")
+ if ($processcheck != "") {
$processisrunning = true;
- else
+ } else {
$processisrunning = false;
+ }
- if (($action == gettext("Stop") or $action == "") and $processisrunning != true)
+ if (($action == gettext("Stop") or $action == "") and $processisrunning != true) {
echo "<input type=\"submit\" name=\"startbtn\" value=\"" . gettext("Start") . "\" />&nbsp;";
- else {
+ } else {
echo "<input type=\"submit\" name=\"stopbtn\" value=\"" . gettext("Stop") . "\" />&nbsp;";
}
if (file_exists($fp.$fn) and $processisrunning != true) {
@@ -381,32 +384,37 @@ include("fbegin.inc");
<td valign="top" colspan="2">
<?php
echo "<font face=\"terminal\" size=\"2\">";
- if ($processisrunning == true)
+ if ($processisrunning == true) {
echo("<strong>" . gettext("Packet Capture is running.") . "</strong><br />");
+ }
if ($do_tcpdump) {
$matches = array();
- if (in_array($fam, $fams))
+ if (in_array($fam, $fams)) {
$matches[] = $fam;
+ }
if (in_array($proto, $protos)) {
$matches[] = fixup_not($proto);
}
- if ($port != "")
+ if ($port != "") {
$matches[] = "port ".fixup_not($port);
+ }
if ($host != "") {
$hostmatch = "";
$hostcount = 0;
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" ) {
@@ -430,7 +438,7 @@ include("fbegin.inc");
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("packetsCaptured").wrap='off';
}
//]]>
@@ -439,19 +447,19 @@ include("fbegin.inc");
<?php
$detail_args = "";
switch ($detail) {
- case "full":
- $detail_args = "-vv -e";
- break;
- case "high":
- $detail_args = "-vv";
- break;
- case "medium":
- $detail_args = "-v";
- break;
- case "normal":
- default:
- $detail_args = "-q";
- break;
+ case "full":
+ $detail_args = "-vv -e";
+ break;
+ case "high":
+ $detail_args = "-vv";
+ break;
+ case "medium":
+ $detail_args = "-v";
+ break;
+ case "normal":
+ default:
+ $detail_args = "-q";
+ break;
}
system("/usr/sbin/tcpdump {$disabledns} {$detail_args} -r {$fp}{$fn}");
diff --git a/usr/local/www/diag_patterns.php b/usr/local/www/diag_patterns.php
index 680f76f..1c3528d 100644
--- a/usr/local/www/diag_patterns.php
+++ b/usr/local/www/diag_patterns.php
@@ -41,17 +41,18 @@ require("guiconfig.inc");
//Move the upload file to /usr/local/share/protocols (is_uploaded_file must use tmp_name as argument)
if (($_POST['submit'] == gettext("Upload Pattern file")) && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
- if(fileExtension($_FILES['ulfile']['name'])) {
- if (!is_array($config['l7shaper']['custom_pat']))
+ if (fileExtension($_FILES['ulfile']['name'])) {
+ if (!is_array($config['l7shaper']['custom_pat'])) {
$config['l7shaper']['custom_pat'] = array();
+ }
$config['l7shaper']['custom_pat'][$_FILES['ulfile']['name']] = base64_encode(file_get_contents($_FILES['ulfile']['tmp_name']));
write_config(sprintf(gettext("Added custom l7 pattern %s"), $_FILES['ulfile']['name']));
move_uploaded_file($_FILES['ulfile']['tmp_name'], "/usr/local/share/protocols/" . $_FILES['ulfile']['name']);
$ulmsg = gettext("Uploaded file to") . " /usr/local/share/protocols/" . htmlentities($_FILES['ulfile']['name']);
- }
- else
+ } else {
$ulmsg = gettext("Warning: You must upload a file with .pat extension.");
+ }
}
//Check if file has correct extension (.pat)
diff --git a/usr/local/www/diag_pf_info.php b/usr/local/www/diag_pf_info.php
index 560ed7c..1c454a8 100644
--- a/usr/local/www/diag_pf_info.php
+++ b/usr/local/www/diag_pf_info.php
@@ -1,31 +1,31 @@
<?php
/* $Id$ */
/*
- diag_pf_info.php
- Copyright (C) 2010 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
+ diag_pf_info.php
+ Copyright (C) 2010 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -44,7 +44,7 @@ require("guiconfig.inc");
$pgtitle = gettext("Diagnostics: pfInfo");
-if($_REQUEST['getactivity']) {
+if ($_REQUEST['getactivity']) {
$text = `/sbin/pfctl -vvsi`;
$text .= "<p/>";
$text .= `/sbin/pfctl -vvsm`;
@@ -81,32 +81,33 @@ jQuery(document).ready(function() {setTimeout('getpfinfo()', 5000);});
</script>
<div id="maincontent">
<?php
- if($savemsg) {
+ if ($savemsg) {
echo "<div id=\"savemsg\">";
print_info_box($savemsg);
- echo "</div>";
+ echo "</div>";
}
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
+ }
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag pf info">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr><td>
- <div id="pfactivitydiv">
- <?=gettext("Gathering PF information, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
+ <tr>
+ <td>
+ <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
+ <tr>
+ <td align="center">
+ <table summary="results">
+ <tr><td>
+ <div id="pfactivitydiv">
+ <?=gettext("Gathering PF information, please wait...");?>
+ </div>
+ </td></tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
</table>
</div>
<?php include("fend.inc"); ?>
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index 0c289cf..954d9f2 100644
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -13,11 +13,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -47,7 +47,6 @@ $allowautocomplete = true;
$pgtitle = array(gettext("Diagnostics"), gettext("Ping"));
require_once("guiconfig.inc");
-
define('MAX_COUNT', 10);
define('DEFAULT_COUNT', 3);
@@ -66,17 +65,20 @@ if ($_POST || $_REQUEST['host']) {
$host = trim($_REQUEST['host']);
$ipproto = $_REQUEST['ipproto'];
- if (($ipproto == "ipv4") && is_ipaddrv6($host))
+ if (($ipproto == "ipv4") && is_ipaddrv6($host)) {
$input_errors[] = gettext("When using IPv4, the target host must be an IPv4 address or hostname.");
- if (($ipproto == "ipv6") && is_ipaddrv4($host))
+ }
+ if (($ipproto == "ipv6") && is_ipaddrv4($host)) {
$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
+ }
if (!$input_errors) {
$do_ping = true;
$sourceip = $_REQUEST['sourceip'];
$count = $_POST['count'];
- if (preg_match('/[^0-9]/', $count) )
+ if (preg_match('/[^0-9]/', $count) ) {
$count = DEFAULT_COUNT;
+ }
}
}
if (!isset($do_ping)) {
@@ -118,8 +120,9 @@ include("head.inc"); ?>
<?php $sourceips = get_possible_traffic_source_addresses(true);
foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip)) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$sipvalue;?>" <?=$selected;?>>
<?=htmlspecialchars($sipname);?>
@@ -152,7 +155,7 @@ include("head.inc"); ?>
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("pingCaptured").wrap='off';
}
//]]>
@@ -164,15 +167,17 @@ include("head.inc"); ?>
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);
diff --git a/usr/local/www/diag_pkglogs.php b/usr/local/www/diag_pkglogs.php
index cd1b833..c88bb87 100755
--- a/usr/local/www/diag_pkglogs.php
+++ b/usr/local/www/diag_pkglogs.php
@@ -41,7 +41,7 @@
*/
/*
- pfSense_BUILDER_BINARIES: /usr/bin/netstat
+ pfSense_BUILDER_BINARIES: /usr/bin/netstat
pfSense_MODULE: pkgs
*/
@@ -55,18 +55,20 @@
require("guiconfig.inc");
require("pkg-utils.inc");
-if(!($nentries = $config['syslog']['nentries'])) $nentries = 50;
+if (!($nentries = $config['syslog']['nentries'])) {
+ $nentries = 50;
+}
-//if ($_POST['clear'])
+//if ($_POST['clear'])
// clear_log_file($logfile);
$i = 0;
$pkgwithlogging = false;
$apkg = $_GET['pkg'];
-if(!$apkg) { // If we aren't looking for a specific package, locate the first package that handles logging.
- if($config['installedpackages']['package'] <> "") {
- foreach($config['installedpackages']['package'] as $package) {
- if(is_array($package['logging'])) {
+if (!$apkg) { // If we aren't looking for a specific package, locate the first package that handles logging.
+ if ($config['installedpackages']['package'] <> "") {
+ foreach ($config['installedpackages']['package'] as $package) {
+ if (is_array($package['logging'])) {
$pkgwithlogging = true;
$apkg = $package['name'];
$apkgid = $i;
@@ -75,7 +77,7 @@ if(!$apkg) { // If we aren't looking for a specific package, locate the first pa
$i++;
}
}
-} elseif($apkg) {
+} elseif ($apkg) {
$apkgid = get_pkg_id($apkg);
if ($apkgid != -1) {
$pkgwithlogging = true;
@@ -90,51 +92,55 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <?php
- if($pkgwithlogging == false) {
+ <tr>
+ <td>
+ <?php
+ if ($pkgwithlogging == false) {
print_info_box(gettext("No packages with logging facilities are currently installed."));
echo '</ul></td></tr></table>';
include("fend.inc");
exit;
}
$tab_array = array();
- foreach($config['installedpackages']['package'] as $package) {
- if(is_array($package['logging'])) {
- if(!($logtab = $package['logging']['logtab'])) $logtab = $package['name'];
- if($apkg == $package['name']) {
+ foreach ($config['installedpackages']['package'] as $package) {
+ if (is_array($package['logging'])) {
+ if (!($logtab = $package['logging']['logtab'])) {
+ $logtab = $package['name'];
+ }
+ if ($apkg == $package['name']) {
$curtab = $logtab;
$tab_array[] = array(sprintf(gettext("%s"),$logtab), true, "diag_pkglogs.php?pkg=".$package['name']);
} else {
$tab_array[] = array(sprintf(gettext("%s"),$logtab), false, "diag_pkglogs.php?pkg=".$package['name']);
}
}
- }
+ }
display_top_tabs($tab_array);
- ?>
- </td></tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="2" class="listtopic">
- <?php printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab); ?></td>
- </tr>
- <?php
- $package =& $config['installedpackages']['package'][$apkgid];
- dump_clog($g['varlog_path'] . '/' . $package['logging']['logfilename'], $nentries);
- ?>
- </table>
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td colspan="2" class="listtopic">
+ <?php printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab); ?>
+ </td>
+ </tr>
+ <?php
+ $package =& $config['installedpackages']['package'][$apkgid];
+ dump_clog($g['varlog_path'] . '/' . $package['logging']['logfilename'], $nentries);
+ ?>
+ </table>
<!--
<form action="diag_pkglogs.php" method="post">
<input name="clear" type="submit" class="formbtn" value="Clear log">
</form>
-->
- </div>
- </td>
- </tr>
+ </div>
+ </td>
+ </tr>
</table>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_resetstate.php b/usr/local/www/diag_resetstate.php
index 88da499..07d3575 100644
--- a/usr/local/www/diag_resetstate.php
+++ b/usr/local/www/diag_resetstate.php
@@ -50,14 +50,16 @@ if ($_POST) {
$savemsg = "";
if ($_POST['statetable']) {
filter_flush_state_table();
- if ($savemsg)
+ if ($savemsg) {
$savemsg .= " ";
+ }
$savemsg .= gettext("The state table has been flushed successfully.");
}
if ($_POST['sourcetracking']) {
mwexec("/sbin/pfctl -F Sources");
- if ($savemsg)
+ if ($savemsg) {
$savemsg .= " <br />";
+ }
$savemsg .= gettext("The source tracking table has been flushed successfully.");
}
}
@@ -70,67 +72,71 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
- <form action="diag_resetstate.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="reset states">
- <tr><td>
- <?php
- $tab_array = array();
- $tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
- 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);
- ?>
- </td></tr>
- <tr><td class="tabcont">
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <p>
- <input name="statetable" type="checkbox" id="statetable" value="yes" checked="checked" />
- <strong><?= gettext("Firewall state table"); ?></strong><br />
- <span class="vexpl"><br />
- <?=gettext("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 />
- </span><span class="vexpl"><?=gettext("The firewall will normally leave " .
- "the state tables intact when changing rules."); ?><br />
- <br />
- <?=gettext("NOTE: If you reset the firewall state table, the browser " .
- "session may appear to be hung after clicking &quot;Reset&quot;. " .
- "Simply refresh the page to continue."); ?></span></p>
- </td>
+<form action="diag_resetstate.php" method="post" name="iform" id="iform">
+<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="reset states">
+ <tr>
+ <td>
+ <?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
+ 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);
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <p>
+ <input name="statetable" type="checkbox" id="statetable" value="yes" checked="checked" />
+ <strong><?= gettext("Firewall state table"); ?></strong><br />
+ <span class="vexpl"><br />
+ <?=gettext("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 />
+ </span><span class="vexpl"><?=gettext("The firewall will normally leave " .
+ "the state tables intact when changing rules."); ?><br />
+ <br />
+ <?=gettext("NOTE: If you reset the firewall state table, the browser " .
+ "session may appear to be hung after clicking &quot;Reset&quot;. " .
+ "Simply refresh the page to continue."); ?></span></p>
+ </td>
</tr>
<?php if (isset($config['system']['lb_use_sticky'])): ?>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"><p>
- <input name="sourcetracking" type="checkbox" id="sourcetracking" value="yes" checked="checked" />
- <strong><?= gettext("Firewall Source Tracking"); ?></strong><br />
- <span class="vexpl"><br />
- <?=gettext("Resetting the source tracking table will remove all source/destination associations. " .
- "This means that the \"sticky\" source/destination association " .
- "will be cleared for all clients."); ?><br />
- <br />
- </span><span class="vexpl"><?=gettext("This does not clear active connection states, only source tracking."); ?><br />
- </p>
- </td>
- </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"><p>
+ <input name="sourcetracking" type="checkbox" id="sourcetracking" value="yes" checked="checked" />
+ <strong><?= gettext("Firewall Source Tracking"); ?></strong><br />
+ <span class="vexpl"><br />
+ <?=gettext("Resetting the source tracking table will remove all source/destination associations. " .
+ "This means that the \"sticky\" source/destination association " .
+ "will be cleared for all clients."); ?><br />
+ <br />
+ </span><span class="vexpl"><?=gettext("This does not clear active connection states, only source tracking."); ?><br />
+ </p>
+ </td>
+ </tr>
<?php endif; ?>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Reset"); ?>" />
- </td>
- </tr>
- </table>
- </td></tr>
- </table>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Reset"); ?>" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
</form>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_routes.php b/usr/local/www/diag_routes.php
index 14196f4..7204560 100644
--- a/usr/local/www/diag_routes.php
+++ b/usr/local/www/diag_routes.php
@@ -31,7 +31,7 @@
*/
/*
- pfSense_BUILDER_BINARIES: /usr/bin/netstat
+ pfSense_BUILDER_BINARIES: /usr/bin/netstat
pfSense_MODULE: routing
*/
##|+PRIV
@@ -52,16 +52,19 @@ if (isset($_REQUEST['isAjax'])) {
$netstat .= " -f inet";
echo "IPv4\n";
}
- if (!isset($_REQUEST['resolve']))
+ if (!isset($_REQUEST['resolve'])) {
$netstat .= " -n";
+ }
- if (!empty($_REQUEST['filter']))
+ if (!empty($_REQUEST['filter'])) {
$netstat .= " | /usr/bin/sed -e '1,3d; 5,\$ { /" . escapeshellarg(htmlspecialchars($_REQUEST['filter'])) . "/!d; };'";
- else
+ } else {
$netstat .= " | /usr/bin/sed -e '1,3d'";
+ }
- if (is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0)
+ if (is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0) {
$netstat .= " | /usr/bin/head -n {$_REQUEST['limit']}";
+ }
echo htmlspecialchars_decode(shell_exec($netstat));
@@ -86,10 +89,12 @@ include('head.inc');
var limit = jQuery('#limit option:selected').text();
var filter = jQuery('#filter').val();
var params = "isAjax=true&limit=" + limit + "&filter=" + filter;
- if (jQuery('#resolve').is(':checked'))
+ if (jQuery('#resolve').is(':checked')) {
params += "&resolve=true";
- if (section == "IPv6")
+ }
+ if (section == "IPv6") {
params += "&IPv6=true";
+ }
var myAjax = new Ajax.Request(
url,
{
@@ -110,8 +115,9 @@ include('head.inc');
var thead = '<tr><td class="listtopic" colspan="' + elements + '"><strong>' + section + '<\/strong><\/td><\/tr>' + "\n";
for (var i = 0; i < responseTextArr.length; i++) {
- if (responseTextArr[i] == "")
+ if (responseTextArr[i] == "") {
continue;
+ }
var tmp = '';
if (i == 0) {
tr_class = 'listhdrr';
@@ -123,23 +129,28 @@ include('head.inc');
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 && j == (elements - 1))
+ }
+ if (i == 0 && j == (elements - 1)) {
tr_class = 'listhdr';
+ }
tmp += '<td class="' + tr_class + '">' + entry[k] + '<\/td>' + "\n";
- if (i > 0)
+ if (i > 0) {
tr_class = 'listr';
+ }
j++;
}
// The 'Expire' field might be blank
- if (j == (elements - 1))
+ if (j == (elements - 1)) {
tmp += '<td class="listr">&nbsp;<\/td>' + "\n";
+ }
tmp += '<\/tr>' + "\n";
- if (i == 0)
+ if (i == 0) {
thead += tmp;
- else
+ } else {
tbody += tmp;
+ }
}
jQuery('#' + section + ' > thead').html(thead);
jQuery('#' + section + ' > tbody').html(tbody);
@@ -156,7 +167,7 @@ include('head.inc');
update_routes("IPv6");
}
- jQuery(document).ready(function(){setTimeout('update_all_routes()', 5000);});
+ jQuery(document).ready(function() {setTimeout('update_all_routes()', 5000);});
//]]>
</script>
@@ -164,50 +175,48 @@ include('head.inc');
<div id="mainarea">
<form action="diag_routes.php" method="post">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="diag routes">
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Name resolution");?></td>
-<td class="vtable" width="78%">
-<input type="checkbox" class="formfld" id="resolve" name="resolve" value="yes" <?php if ($_POST['resolve'] == 'yes') echo "checked=\"checked\""; ?> /><?=gettext("Enable");?>
-<br />
-<span class="expl"><?=gettext("Enable this to attempt to resolve names when displaying the tables.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Number of rows");?></td>
-<td class="vtable" width="78%">
-<select id="limit" name="limit">
+ <tr>
+ <td class="vncellreq" width="22%"><?=gettext("Name resolution");?></td>
+ <td class="vtable" width="78%">
+ <input type="checkbox" class="formfld" id="resolve" name="resolve" value="yes" <?php if ($_POST['resolve'] == 'yes') echo "checked=\"checked\""; ?> /><?=gettext("Enable");?>
+ <br />
+ <span class="expl"><?=gettext("Enable this to attempt to resolve names when displaying the tables.");?></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="vncellreq" width="22%"><?=gettext("Number of rows");?></td>
+ <td class="vtable" width="78%">
+ <select id="limit" name="limit">
<?php
foreach (array("10", "50", "100", "200", "500", "1000", gettext("all")) as $item) {
echo "<option value=\"{$item}\" " . ($item == "100" ? "selected=\"selected\"" : "") . ">{$item}</option>\n";
}
?>
-</select>
-<br />
-<span class="expl"><?=gettext("Select how many rows to display.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Filter expression");?></td>
-<td class="vtable" width="78%">
-<input type="text" class="formfld search" name="filter" id="filter" />
-<br />
-<span class="expl"><?=gettext("Use a regular expression to filter IP address or hostnames.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%">&nbsp;</td>
-<td class="vtable" width="78%">
-<input type="button" class="formbtn" name="update" onclick="update_all_routes();" value="<?=gettext("Update"); ?>" />
-<br />
-<br />
-<span class="vexpl"><span class="red"><strong><?=gettext("Note:")?></strong></span> <?=gettext("By enabling name resolution, the query should take a bit longer. You can stop it at any time by clicking the Stop button in your browser.");?></span>
-</td>
-</tr>
-
+ </select>
+ <br />
+ <span class="expl"><?=gettext("Select how many rows to display.");?></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="vncellreq" width="22%"><?=gettext("Filter expression");?></td>
+ <td class="vtable" width="78%">
+ <input type="text" class="formfld search" name="filter" id="filter" />
+ <br />
+ <span class="expl"><?=gettext("Use a regular expression to filter IP address or hostnames.");?></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="vncellreq" width="22%">&nbsp;</td>
+ <td class="vtable" width="78%">
+ <input type="button" class="formbtn" name="update" onclick="update_all_routes();" value="<?=gettext("Update"); ?>" />
+ <br />
+ <br />
+ <span class="vexpl"><span class="red"><strong><?=gettext("Note:")?></strong></span> <?=gettext("By enabling name resolution, the query should take a bit longer. You can stop it at any time by clicking the Stop button in your browser.");?></span>
+ </td>
+ </tr>
</table>
</form>
diff --git a/usr/local/www/diag_smart.php b/usr/local/www/diag_smart.php
index d85c4e6..0c9a057 100644
--- a/usr/local/www/diag_smart.php
+++ b/usr/local/www/diag_smart.php
@@ -65,8 +65,8 @@ pre {
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
+<?php
+include("fbegin.inc");
// Highlights the words "PASSED", "FAILED", and "WARNING".
function add_colors($string)
@@ -87,14 +87,10 @@ function add_colors($string)
function update_email($email)
{
// Did they pass an email?
- if(!empty($email))
- {
+ if (!empty($email)) {
// Put it in the smartd.conf file
shell_exec("/usr/bin/sed -i old 's/^DEVICESCAN.*/DEVICESCAN -H -m " . escapeshellarg($email) . "/' /usr/local/etc/smartd.conf");
- }
- // Nope
- else
- {
+ } else {
// Remove email flags in smartd.conf
shell_exec("/usr/bin/sed -i old 's/^DEVICESCAN.*/DEVICESCAN/' /usr/local/etc/smartd.conf");
}
@@ -114,7 +110,7 @@ if (!file_exists('/dev/' . $targetdev)) {
echo "Device does not exist, bailing.";
return;
}
-switch($action) {
+switch ($action) {
// Testing devices
case 'test':
{
@@ -171,32 +167,28 @@ switch($action) {
// Config changes, users email in xml config and write changes to smartd.conf
case 'config':
{
- if(isset($_POST['submit']))
- {
+ if (isset($_POST['submit'])) {
// DOES NOT WORK YET...
- if($_POST['testemail'])
- {
+ if ($_POST['testemail']) {
// FIXME shell_exec($smartd . " -M test -m " . $config['system']['smartmonemail']);
$savemsg = sprintf(gettext("Email sent to %s"), $config['system']['smartmonemail']);
smartmonctl("stop");
smartmonctl("start");
- }
- else
- {
+ } else {
$config['system']['smartmonemail'] = $_POST['smartmonemail'];
write_config();
// 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);
- else
+ } else {
$savemsg = $retval;
+ }
config_unlock();
- if($_POST['email'])
- {
+ if ($_POST['email']) {
// Write the changes to the smartd.conf file
update_email($_POST['smartmonemail']);
}
@@ -206,7 +198,9 @@ switch($action) {
}
}
// Was the config changed? if so , print the message
- if ($savemsg) print_info_box($savemsg);
+ if ($savemsg) {
+ print_info_box($savemsg);
+ }
// Get users email from the xml file
$pconfig['smartmonemail'] = $config['system']['smartmonemail'];
@@ -220,7 +214,7 @@ switch($action) {
$tab_array[0] = array(gettext("Information/Tests"), false, $_SERVER['PHP_SELF'] . "?action=default");
$tab_array[1] = array(gettext("Config"), true, $_SERVER['PHP_SELF'] . "?action=config");
display_top_tabs($tab_array);
- ?>
+ ?>
</td>
</tr>
</table>
@@ -291,7 +285,7 @@ switch($action) {
$tab_array[0] = array(gettext("Information/Tests"), true, $_SERVER['PHP_SELF']);
//$tab_array[1] = array("Config", false, $_SERVER['PHP_SELF'] . "?action=config");
display_top_tabs($tab_array);
- ?>
+ ?>
</td>
</tr>
</table>
@@ -317,8 +311,7 @@ switch($action) {
<td width="78%" class="vtable">
<select name="device">
<?php
- foreach($devs as $dev)
- {
+ foreach ($devs as $dev) {
echo "<option value=\"" . $dev . "\">" . $dev . "</option>";
}
?>
@@ -356,8 +349,7 @@ switch($action) {
<td width="78%" class="vtable">
<select name="device">
<?php
- foreach($devs as $dev)
- {
+ foreach ($devs as $dev) {
echo "<option value=\"" . $dev . "\">" . $dev . "</option>";
}
?>
@@ -393,8 +385,7 @@ switch($action) {
<td width="78%" class="vtable">
<select name="device">
<?php
- foreach($devs as $dev)
- {
+ foreach ($devs as $dev) {
echo "<option value=\"" . $dev . "\">" . $dev . "</option>";
}
?>
@@ -423,8 +414,7 @@ switch($action) {
<td width="78%" class="vtable">
<select name="device">
<?php
- foreach($devs as $dev)
- {
+ foreach ($devs as $dev) {
echo "<option value=\"" . $dev . "\">" . $dev . "</option>";
}
?>
@@ -448,15 +438,18 @@ switch($action) {
}
// print back button on pages
-if(isset($_POST['submit']) && $_POST['submit'] != "Save")
-{
+if (isset($_POST['submit']) && $_POST['submit'] != "Save") {
?>
<input type="button" class="formbtn" value="<?=gettext("Back");?>" onclick="window.location.href='<?=$_SERVER['PHP_SELF'];?>'" />
<?php
}
?>
<br />
-<?php if ($ulmsg) echo "<p><strong>" . $ulmsg . "</strong></p>\n"; ?>
+<?php
+if ($ulmsg) {
+ echo "<p><strong>" . $ulmsg . "</strong></p>\n";
+}
+?>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/diag_sockets.php b/usr/local/www/diag_sockets.php
index 53daa3f..1c960bd 100644
--- a/usr/local/www/diag_sockets.php
+++ b/usr/local/www/diag_sockets.php
@@ -11,11 +11,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -31,7 +31,7 @@
*/
/*
- pfSense_BUILDER_BINARIES: /usr/bin/sockstat
+ pfSense_BUILDER_BINARIES: /usr/bin/sockstat
*/
##|+PRIV
##|*IDENT=page-diagnostics-sockets
@@ -57,20 +57,19 @@ $showAllOption = $showAll ? "" : "?showAll";
?>
<div id="mainarea">
<table class="tabcont" width="100%" summary="diag sockets">
-<tr>
-<td>Information about listening sockets for both <a href="#IPv4">IPv4</a> and <a href="#IPv6">IPv6</a>.</td>
-</tr>
-<tr>
-<td>For explanation about the meaning of the information listed for each socket click <a href="#about">here</a>.</td>
-</tr>
-<tr>
-<td><input type="button" value="<?=$showAllText?>" onclick="window.location.href='diag_sockets.php<?=$showAllOption?>'"/>To show information about both listening and connected sockets click this.</td>
-</tr>
+ <tr>
+ <td>Information about listening sockets for both <a href="#IPv4">IPv4</a> and <a href="#IPv6">IPv6</a>.</td>
+ </tr>
+ <tr>
+ <td>For explanation about the meaning of the information listed for each socket click <a href="#about">here</a>.</td>
+ </tr>
+ <tr>
+ <td><input type="button" value="<?=$showAllText?>" onclick="window.location.href='diag_sockets.php<?=$showAllOption?>'"/>To show information about both listening and connected sockets click this.</td>
+ </tr>
</table>
<?php
- if (isset($_GET['showAll']))
- {
+ if (isset($_GET['showAll'])) {
$internet4 = shell_exec('sockstat -4');
$internet6 = shell_exec('sockstat -6');
} else {
@@ -83,55 +82,96 @@ $showAllOption = $showAll ? "" : "?showAll";
?>
<a name="<?=$name;?>"></a>
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab">
-<tr><td class="listtopic" colspan="<?=$elements?>"><strong><?=$name;?></strong></td></tr>
-<tr><td>
-<table class="tabcont sortable" id="sortabletable" width="100%" cellspacing="0" cellpadding="6" border="0" summary="results">
-<?php
- foreach (explode("\n", $table) as $i => $line) {
- if ($i == 0)
- $class = 'listhdrr';
- else
- $class = 'listlr';
-
- if (trim($line) == "")
- continue;
- print("<tr id=\"$name$i\">\n");
- $j = 0;
- foreach (explode(' ', $line) as $entry) {
- if ($entry == '' || $entry == "ADDRESS") continue;
- if ($i == 0)
- print("<th class=\"$class\">$entry</th>\n");
- else
- print("<td class=\"$class\">$entry</td>\n");
- if ($i > 0)
- $class = 'listr';
- $j++;
- }
- print("</tr>\n");
- }?>
+ <tr>
+ <td class="listtopic" colspan="<?=$elements?>"><strong><?=$name;?></strong></td>
+ </tr>
+ <tr>
+ <td>
+ <table class="tabcont sortable" id="sortabletable" width="100%" cellspacing="0" cellpadding="6" border="0" summary="results">
+ <?php
+ foreach (explode("\n", $table) as $i => $line) {
+ if ($i == 0) {
+ $class = 'listhdrr';
+ } else {
+ $class = 'listlr';
+ }
+
+ if (trim($line) == "") {
+ continue;
+ }
+ print("<tr id=\"$name$i\">\n");
+ $j = 0;
+ foreach (explode(' ', $line) as $entry) {
+ if ($entry == '' || $entry == "ADDRESS") {
+ continue;
+ }
+ if ($i == 0) {
+ print("<th class=\"$class\">$entry</th>\n");
+ } else {
+ print("<td class=\"$class\">$entry</td>\n");
+ }
+ if ($i > 0) {
+ $class = 'listr';
+ }
+ $j++;
+ }
+ print("</tr>\n");
+ }
+ ?>
+ </table>
+ </td>
+ </tr>
</table>
-</td></tr></table>
<?php
- }
+ }
?>
<br />
<a name="about"></a>
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="info">
- <tr><td colspan="2" class="listtopic" >Socket information explanation</td></tr>
-<tr><td colspan="2" class="listhdrr">
+ <tr>
+ <td colspan="2" class="listtopic" >Socket information explanation</td>
+ </tr>
+ <tr>
+ <td colspan="2" class="listhdrr">
This page show 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:</td></tr>
- <tr><td class="listlr">USER </td><td class="listr">The user who owns the socket.</td></tr>
- <tr><td class="listlr">COMMAND </td><td class="listr">The command which holds the socket.</td></tr>
- <tr><td class="listlr">PID </td><td class="listr">The process ID of the command which holds the socket.</td></tr>
- <tr><td class="listlr">FD </td><td class="listr">The file descriptor number of the socket.</td></tr>
- <tr><td class="listlr">PROTO </td><td class="listr">The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or data-gram) for UNIX sockets.</td></tr>
- <tr><td class="listlr">ADDRESS </td><td class="listr">(UNIX sockets only) For bound sockets, this is the file-name of the socket. For other sockets, it is the name, PID and file descriptor number of the peer, or ``(none)'' if the socket is neither bound nor connected.</td></tr>
- <tr><td class="listlr">LOCAL ADDRESS </td><td class="listr">(Internet sockets only) The address the local end of the socket is bound to (see getsockname(2)).</td></tr>
- <tr><td class="listlr">FOREIGN ADDRESS </td><td class="listr">(Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)).</td></tr>
+The information listed for each socket is:
+ </td>
+ </tr>
+ <tr>
+ <td class="listlr">USER </td>
+ <td class="listr">The user who owns the socket.</td>
+ </tr>
+ <tr>
+ <td class="listlr">COMMAND</td>
+ <td class="listr">The command which holds the socket.</td>
+ </tr>
+ <tr>
+ <td class="listlr">PID</td>
+ <td class="listr">The process ID of the command which holds the socket.</td>
+ </tr>
+ <tr>
+ <td class="listlr">FD</td>
+ <td class="listr">The file descriptor number of the socket.</td>
+ </tr>
+ <tr>
+ <td class="listlr">PROTO</td>
+ <td class="listr">The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or data-gram) for UNIX sockets.</td>
+ </tr>
+ <tr>
+ <td class="listlr">ADDRESS</td>
+ <td class="listr">(UNIX sockets only) For bound sockets, this is the file-name of the socket. For other sockets, it is the name, PID and file descriptor number of the peer, or ``(none)'' if the socket is neither bound nor connected.</td>
+ </tr>
+ <tr>
+ <td class="listlr">LOCAL ADDRESS</td>
+ <td class="listr">(Internet sockets only) The address the local end of the socket is bound to (see getsockname(2)).</td>
+ </tr>
+ <tr>
+ <td class="listlr">FOREIGN ADDRESS</td>
+ <td class="listr">(Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)).</td>
+ </tr>
</table>
</div>
<?php
diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php
index e54061b..5133a2f 100644
--- a/usr/local/www/diag_states_summary.php
+++ b/usr/local/www/diag_states_summary.php
@@ -62,8 +62,8 @@ function addipinfo(&$iparr, $ip, $proto, $srcport, $dstport) {
}
$row = 0;
-if(count($states) > 0) {
- foreach($states as $line) {
+if (count($states) > 0) {
+ foreach ($states as $line) {
$line_split = preg_split("/\s+/", $line);
$iface = array_shift($line_split);
$proto = array_shift($line_split);
@@ -71,7 +71,7 @@ if(count($states) > 0) {
$info = implode(" ", $line_split);
/* Handle NAT cases
- Replaces an external IP + NAT by the internal IP */
+ Replaces an external IP + NAT by the internal IP */
if (strpos($info, ') ->') !== FALSE) {
/* Outbound NAT */
$info = preg_replace('/(\S+) \((\S+)\)/U', "$2", $info);
@@ -129,16 +129,18 @@ function sort_by_ip($a, $b) {
}
function build_port_info($portarr, $proto) {
- if (!$portarr)
+ if (!$portarr) {
return '';
+ }
$ports = array();
asort($portarr);
foreach (array_reverse($portarr, TRUE) as $port => $count) {
$str = "";
$service = getservbyport($port, strtolower($proto));
$port = "{$proto}/{$port}";
- if ($service)
+ if ($service) {
$port = "{$port} ({$service})";
+ }
$ports[] = "{$port}: {$count}";
}
return implode($ports, ', ');
@@ -156,9 +158,11 @@ function print_summary_table($label, $iparr, $sort = TRUE) { ?>
<td class="listhdrr"><?=gettext("Src Ports");?></td>
<td class="listhdrr"><?=gettext("Dst Ports");?></td>
</tr>
-<?php if ($sort)
+<?php
+ if ($sort) {
uksort($iparr, "sort_by_ip");
- foreach($iparr as $ip => $ipinfo) { ?>
+ }
+ foreach ($iparr as $ip => $ipinfo) { ?>
<tr>
<td class="vncell"><?php echo $ip; ?></td>
<td class="vncell"><?php echo $ipinfo['seen']; ?></td>
@@ -167,7 +171,7 @@ function print_summary_table($label, $iparr, $sort = TRUE) { ?>
<td class="vncell">&nbsp;</td>
<td class="vncell">&nbsp;</td>
</tr>
- <?php foreach($ipinfo['protos'] as $proto => $protoinfo) { ?>
+ <?php foreach ($ipinfo['protos'] as $proto => $protoinfo) { ?>
<tr>
<td class="list">&nbsp;</td>
<td class="list">&nbsp;</td>
diff --git a/usr/local/www/diag_system_activity.php b/usr/local/www/diag_system_activity.php
index cc2c41e..4426184 100644
--- a/usr/local/www/diag_system_activity.php
+++ b/usr/local/www/diag_system_activity.php
@@ -1,32 +1,32 @@
<?php
/* $Id$ */
/*
- diag_system_activity.php
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ diag_system_activity.php
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- Copyright (C) 2008-2009 Scott Ullrich
- All rights reserved.
+ Copyright (C) 2008-2009 Scott Ullrich
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -45,7 +45,7 @@ require("guiconfig.inc");
$pgtitle = gettext("Diagnostics: System Activity");
-if($_REQUEST['getactivity']) {
+if ($_REQUEST['getactivity']) {
$text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
echo $text;
exit;
@@ -79,32 +79,35 @@ include("head.inc");
</script>
<div id="maincontent">
<?php
- if($savemsg) {
+ if ($savemsg) {
echo "<div id=\"savemsg\">";
print_info_box($savemsg);
- echo "</div>";
+ echo "</div>";
}
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
+ }
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag system activity">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr><td>
- <div id="cpuactivitydiv">
- <?=gettext("Gathering CPU activity, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
+ <tr>
+ <td>
+ <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
+ <tr>
+ <td align="center">
+ <table summary="results">
+ <tr>
+ <td>
+ <div id="cpuactivitydiv">
+ <?=gettext("Gathering CPU activity, please wait...");?>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
</table>
</div>
<?php include("fend.inc"); ?>
diff --git a/usr/local/www/diag_system_pftop.php b/usr/local/www/diag_system_pftop.php
index f5cc443..c959e00 100644
--- a/usr/local/www/diag_system_pftop.php
+++ b/usr/local/www/diag_system_pftop.php
@@ -1,31 +1,31 @@
<?php
/* $Id$ */
/*
- diag_system_pftop.php
- Copyright (C) 2008-2009 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
+ diag_system_pftop.php
+ Copyright (C) 2008-2009 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -48,10 +48,10 @@ $viewtypes = array('default', 'label', 'long', 'queue', 'rules', 'size', 'speed'
$viewall = array('queue', 'label', 'rules');
$numstates = array('50', '100', '200', '500', '1000', 'all');
-if($_REQUEST['getactivity']) {
- if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
- && $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes)
- && $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
+if ($_REQUEST['getactivity']) {
+ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) &&
+ $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes) &&
+ $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
$viewtype = escapeshellarg($_REQUEST['viewtype']);
if (in_array($_REQUEST['viewtype'], $viewall)) {
$sorttype = "";
@@ -73,9 +73,9 @@ if($_REQUEST['getactivity']) {
include("head.inc");
-if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
- && $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes)
- && $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
+if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) &&
+ $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes) &&
+ $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
$viewtype = escapeshellarg($_REQUEST['viewtype']);
if (in_array($_REQUEST['viewtype'], $viewall)) {
$sorttype = "";
@@ -116,13 +116,14 @@ if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
</script>
<div id="maincontent">
<?php
- if($savemsg) {
+ if ($savemsg) {
echo "<div id=\"savemsg\">";
print_info_box($savemsg);
- echo "</div>";
+ echo "</div>";
}
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
+ }
?>
<div id="mainarea" style="padding-bottom: 0px;">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="diag system pftop">
@@ -178,18 +179,18 @@ if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
<tr>
<td align="center">
- <table summary="results">
- <tr>
- <td>
- <div id="pftopactivitydiv"><?=gettext("Gathering pfTOP activity, please wait...");?></div>
- </td>
- </tr>
- </table>
+ <table summary="results">
+ <tr>
+ <td>
+ <div id="pftopactivitydiv"><?=gettext("Gathering pfTOP activity, please wait...");?></div>
+ </td>
+ </tr>
+ </table>
</td>
</tr>
</table>
</td>
- </tr>
+ </tr>
</table>
</div>
</div>
diff --git a/usr/local/www/diag_tables.php b/usr/local/www/diag_tables.php
index 09237e3..289d39f 100644
--- a/usr/local/www/diag_tables.php
+++ b/usr/local/www/diag_tables.php
@@ -50,42 +50,46 @@ require_once("guiconfig.inc");
// Set default table
$tablename = "sshlockout";
-if($_REQUEST['type'])
+if ($_REQUEST['type']) {
$tablename = $_REQUEST['type'];
+}
-if($_REQUEST['delete']) {
- if(is_ipaddr($_REQUEST['delete']) || is_subnet($_REQUEST['delete'])) {
+if ($_REQUEST['delete']) {
+ if (is_ipaddr($_REQUEST['delete']) || is_subnet($_REQUEST['delete'])) {
exec("/sbin/pfctl -t " . escapeshellarg($_REQUEST['type']) . " -T delete " . escapeshellarg($_REQUEST['delete']), $delete);
echo htmlentities($_REQUEST['delete']);
}
exit;
}
-if($_REQUEST['deleteall']) {
+if ($_REQUEST['deleteall']) {
exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T show", $entries);
- if(is_array($entries)) {
- foreach($entries as $entryA) {
+ if (is_array($entries)) {
+ foreach ($entries as $entryA) {
$entry = trim($entryA);
exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T delete " . escapeshellarg($entry), $delete);
}
}
}
-if((($tablename == "bogons") || ($tablename == "bogonsv6")) && ($_POST['Download'])) {
+if ((($tablename == "bogons") || ($tablename == "bogonsv6")) && ($_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.");
+ }
}
exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T show", $entries);
@@ -121,12 +125,14 @@ include("head.inc");
<?=gettext("Table:");?>
<select id="type" onchange="method_change(jQuery('#type').val());" name="type">
- <?php foreach ($tables as $table) {
+ <?php
+ foreach ($tables as $table) {
echo "<option value=\"{$table}\"";
- if ($tablename == $table)
+ if ($tablename == $table) {
echo " selected=\"selected\"";
- echo ">{$table}</option>\n";
}
+ echo ">{$table}</option>\n";
+ }
?>
</select>
@@ -136,37 +142,44 @@ include("head.inc");
<tr>
<td class="listhdrr"><?=gettext("IP Address");?></td>
</tr>
-<?php $count = 0; foreach($entries as $entryA): ?>
- <?php $entry = trim($entryA); ?>
+<?php
+ $count = 0;
+ foreach ($entries as $entryA):
+ $entry = trim($entryA);
+?>
<tr id="<?=$entry?>">
<td>
<?php echo $entry; ?>
</td>
<td>
- <?php if ( ($tablename != "bogons") && ($tablename != "bogonsv6") ) { ?>
+ <?php if (($tablename != "bogons") && ($tablename != "bogonsv6")) { ?>
<a onclick="del_entry('<?=htmlspecialchars($entry)?>');">
<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="delete" />
</a>
<?php } ?>
</td>
</tr>
-<?php $count++; endforeach; ?>
<?php
- if($count == 0)
- if( ($tablename == "bogons") || ($tablename == "bogonsv6") )
+ $count++;
+ endforeach;
+ if ($count == 0) {
+ if (($tablename == "bogons") || ($tablename == "bogonsv6")) {
echo "<tr><td>" . gettext("No entries exist in this table.") . "&nbsp;&nbsp;" . "<input name=\"Download\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Download") . "\" /> " . gettext(" the latest bogon data.");
- else
+ } else {
echo "<tr><td>" . gettext("No entries exist in this table.");
+ }
+ }
?>
<?php
- if($count > 0)
- if( ($tablename == "bogons") || ($tablename == "bogonsv6") ) {
+ if ($count > 0) {
+ if (($tablename == "bogons") || ($tablename == "bogonsv6")) {
$last_updated = exec('/usr/bin/grep -i -m 1 -E "^# last updated" /etc/' . escapeshellarg($tablename));
echo "<tr><td>&nbsp;<b>$count</b> " . gettext("entries in this table.") . "&nbsp;&nbsp;" . "<input name=\"Download\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Download") . "\" /> " . gettext(" the latest bogon data.") . "<br />" . "$last_updated";
- }
- else
+ } else {
echo "<tr><td>" . gettext("Delete") . " <a href=\"diag_tables.php?deleteall=true&amp;type=" . htmlspecialchars($tablename) . "\">" . gettext("all") . "</a> " . "<b>$count</b> " . gettext("entries in this table.");
+ }
+ }
?>
</td></tr>
</table>
diff --git a/usr/local/www/diag_testport.php b/usr/local/www/diag_testport.php
index 393c757..7054a95 100644
--- a/usr/local/www/diag_testport.php
+++ b/usr/local/www/diag_testport.php
@@ -14,11 +14,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -83,7 +83,7 @@ if ($_POST || $_REQUEST['host']) {
$do_testport = true;
$timeout = NC_TIMEOUT;
}
-
+
/* Save these request vars even if there were input errors. Then the fields are refilled for the user to correct. */
$host = $_REQUEST['host'];
$sourceip = $_REQUEST['sourceip'];
@@ -111,8 +111,9 @@ include("head.inc"); ?>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Host"); ?></td>
<td width="78%" class="vtable">
- <?=$mandfldhtml;?>
- <input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" /></td>
+ <?=$mandfldhtml;?>
+ <input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" />
+ </td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?= gettext("Port"); ?></td>
@@ -142,13 +143,14 @@ include("head.inc"); ?>
<?php $sourceips = get_possible_traffic_source_addresses(true);
foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip)) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$sipvalue;?>" <?=$selected;?>>
<?=htmlspecialchars($sipname);?>
</option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
</td>
</tr>
@@ -184,7 +186,7 @@ include("head.inc"); ?>
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("testportCaptured").wrap='off';
}
//]]>
@@ -194,22 +196,25 @@ include("head.inc"); ?>
$result = "";
$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)) {
$ifaddr = ($sourceip == "any") ? "" : get_interface_ip($sourceip);
$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) {
@@ -249,18 +254,20 @@ include("head.inc"); ?>
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";
exec($nc_cmd, $result, $retval);
//echo "NC CMD: {$nc_cmd}\n\n";
if (empty($result)) {
- if ($showtext)
+ if ($showtext) {
echo gettext("No output received, or connection failed. Try with \"Show Remote Text\" unchecked first.");
- else
+ } else {
echo gettext("Connection failed (Refused/Timeout)");
+ }
} else {
if (is_array($result)) {
foreach ($result as $resline) {
diff --git a/usr/local/www/diag_traceroute.php b/usr/local/www/diag_traceroute.php
index 7878ebe..e3a062b 100644
--- a/usr/local/www/diag_traceroute.php
+++ b/usr/local/www/diag_traceroute.php
@@ -11,11 +11,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -69,10 +69,12 @@ if ($_POST || $_REQUEST['host']) {
}
$host = trim($_REQUEST['host']);
$ipproto = $_REQUEST['ipproto'];
- if (($ipproto == "ipv4") && is_ipaddrv6($host))
+ if (($ipproto == "ipv4") && is_ipaddrv6($host)) {
$input_errors[] = gettext("When using IPv4, the target host must be an IPv4 address or hostname.");
- if (($ipproto == "ipv6") && is_ipaddrv4($host))
+ }
+ if (($ipproto == "ipv6") && is_ipaddrv4($host)) {
$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
+ }
if (!$input_errors) {
$sourceip = $_REQUEST['sourceip'];
@@ -80,8 +82,9 @@ if ($_POST || $_REQUEST['host']) {
$ttl = $_REQUEST['ttl'];
$resolve = $_REQUEST['resolve'];
}
-} else
+} else {
$resolve = true;
+}
if (!isset($do_traceroute)) {
$do_traceroute = false;
@@ -99,7 +102,8 @@ if (!isset($do_traceroute)) {
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Host");?></td>
<td width="78%" class="vtable">
- <?=$mandfldhtml;?><input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" /></td>
+ <?=$mandfldhtml;?><input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" />
+ </td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("IP Protocol"); ?></td>
@@ -118,8 +122,9 @@ if (!isset($do_traceroute)) {
<?php $sourceips = get_possible_traffic_source_addresses(true);
foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip)) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$sipvalue;?>" <?=$selected;?>>
<?=htmlspecialchars($sipname);?>
@@ -147,7 +152,7 @@ if (!isset($do_traceroute)) {
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Use ICMP");?></td>
<td width="78%" class="vtable">
- <input name="useicmp" type="checkbox"<?php if($_REQUEST['useicmp']) echo " checked=\"checked\""; ?> />
+ <input name="useicmp" type="checkbox"<?php if ($_REQUEST['useicmp']) echo " checked=\"checked\""; ?> />
</td>
</tr>
<tr>
@@ -176,7 +181,7 @@ if ($do_traceroute) {
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("tracerouteCaptured").wrap='off';
}
//]]>
@@ -194,8 +199,9 @@ if ($do_traceroute) {
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
}
- if ($ifaddr && (is_ipaddr($host) || is_hostname($host)))
+ if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
$srcip = "-s " . escapeshellarg($ifaddr);
+ }
$cmd = "{$command} {$n} {$srcip} -w 2 {$useicmp} -m " . escapeshellarg($ttl) . " " . escapeshellarg($host);
OpenPOWER on IntegriCloud