summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_states_summary.php
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 /usr/local/www/diag_states_summary.php
parent0608bd3c354ea76eb6df9ed9322e2ef8686f15e7 (diff)
downloadpfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.zip
pfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.tar.gz
Code style usr-local-www diag
Diffstat (limited to 'usr/local/www/diag_states_summary.php')
-rw-r--r--usr/local/www/diag_states_summary.php20
1 files changed, 12 insertions, 8 deletions
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>
OpenPOWER on IntegriCloud