Project

General

Profile

« Previous | Next » 

Revision 5f601060

Added by Phil Davis over 10 years ago

Code style usr-local-www diag

View differences:

usr/local/www/diag_states_summary.php
62 62
}
63 63

  
64 64
$row = 0;
65
if(count($states) > 0) {
66
	foreach($states as $line) {
65
if (count($states) > 0) {
66
	foreach ($states as $line) {
67 67
		$line_split = preg_split("/\s+/", $line);
68 68
		$iface = array_shift($line_split);
69 69
		$proto = array_shift($line_split);
......
71 71
		$info  = implode(" ", $line_split);
72 72

  
73 73
		/* Handle NAT cases
74
			Replaces an external IP + NAT by the internal IP */
74
		   Replaces an external IP + NAT by the internal IP */
75 75
		if (strpos($info, ') ->') !== FALSE) {
76 76
			/* Outbound NAT */
77 77
			$info = preg_replace('/(\S+) \((\S+)\)/U', "$2", $info);
......
129 129
}
130 130

  
131 131
function build_port_info($portarr, $proto) {
132
	if (!$portarr)
132
	if (!$portarr) {
133 133
		return '';
134
	}
134 135
	$ports = array();
135 136
	asort($portarr);
136 137
	foreach (array_reverse($portarr, TRUE) as $port => $count) {
137 138
		$str = "";
138 139
		$service = getservbyport($port, strtolower($proto));
139 140
		$port = "{$proto}/{$port}";
140
		if ($service)
141
		if ($service) {
141 142
			$port = "{$port} ({$service})";
143
		}
142 144
		$ports[] = "{$port}: {$count}";
143 145
	}
144 146
	return implode($ports, ', ');
......
156 158
		<td class="listhdrr"><?=gettext("Src Ports");?></td>
157 159
		<td class="listhdrr"><?=gettext("Dst Ports");?></td>
158 160
	</tr>
159
<?php   if ($sort)
161
<?php
162
	if ($sort) {
160 163
		uksort($iparr, "sort_by_ip");
161
	foreach($iparr as $ip => $ipinfo) { ?>
164
	}
165
	foreach ($iparr as $ip => $ipinfo) { ?>
162 166
	<tr>
163 167
		<td class="vncell"><?php echo $ip; ?></td>
164 168
		<td class="vncell"><?php echo $ipinfo['seen']; ?></td>
......
167 171
		<td class="vncell">&nbsp;</td>
168 172
		<td class="vncell">&nbsp;</td>
169 173
	</tr>
170
	<?php foreach($ipinfo['protos'] as $proto => $protoinfo) { ?>
174
	<?php foreach ($ipinfo['protos'] as $proto => $protoinfo) { ?>
171 175
	<tr>
172 176
		<td class="list">&nbsp;</td>
173 177
		<td class="list">&nbsp;</td>

Also available in: Unified diff