Project

General

Profile

« Previous | Next » 

Revision abe98adb

Added by Phil Davis over 9 years ago

Code style status*

View differences:

src/usr/local/www/status.php
100 100
	echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
101 101

  
102 102
	print('<div class="panel panel-default">');
103
	print(	  '<div class="panel-heading">' . $title . '</div>');
104
	print(	  '<div class="panel-body">');
105
	print(		  '<pre>');
103
	print('<div class="panel-heading">' . $title . '</div>');
104
	print('<div class="panel-body">');
105
	print('<pre>');
106 106

  
107 107
	if ($command == "dumpconfigxml") {
108 108
		$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
......
148 148
		fclose($ofd);
149 149
	}
150 150

  
151
	print(		  '</pre>');
152
	print(	  '</div>');
151
	print('</pre>');
152
	print('</div>');
153 153
	print('</div>');
154 154
}
155 155

  
......
168 168
	$rubbish = array('|', '-', '/', '.', ' ');	/* fixes the <a> tag to be W3C compliant */
169 169

  
170 170
	print('<div class="panel panel-default">');
171
	print(	  '<div class="panel-heading">' . gettext("System status on ") . $currentDate . '</div>');
172
	print(	  '<div class="panel-body">');
173
	print(	  '    <div class="content">');
171
	print('<div class="panel-heading">' . gettext("System status on ") . $currentDate . '</div>');
172
	print('<div class="panel-body">');
173
	print('    <div class="content">');
174 174
	print("\n<p>" . gettext("This status page includes the following information") . ":\n");
175 175
	print("<ul>\n");
176
	for ($i = 0; isset($commands[$i]); $i++ ) {
177
		print("\t<li><strong><a href=\"#" . str_replace($rubbish,'',$commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
176
	for ($i = 0; isset($commands[$i]); $i++) {
177
		print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
178 178
	}
179 179

  
180 180
	print("</ul>\n");
......
196 196
/* Set up all of the commands we want to execute. */
197 197

  
198 198
/* System stats/info */
199
defCmdT("System uptime","/usr/bin/uptime");
200
defCmdT("Interfaces","/sbin/ifconfig -a");
201
defCmdT("Interface Statistics","/usr/bin/netstat -nWi");
199
defCmdT("System uptime", "/usr/bin/uptime");
200
defCmdT("Interfaces", "/sbin/ifconfig -a");
201
defCmdT("Interface Statistics", "/usr/bin/netstat -nWi");
202 202
defCmdT("Top Process Info", "/usr/bin/top | /usr/bin/head -n5");
203
defCmdT("Processes","/bin/ps xauww");
203
defCmdT("Processes", "/bin/ps xauww");
204 204
defCmdT("Mounted Filesystems", "/sbin/mount");
205
defCmdT("Free Disk Space","/bin/df -hi");
206
defCmdT("Routing tables","/usr/bin/netstat -nWr");
207
defCmdT("Mbuf Usage","/usr/bin/netstat -mb");
205
defCmdT("Free Disk Space", "/bin/df -hi");
206
defCmdT("Routing tables", "/usr/bin/netstat -nWr");
207
defCmdT("Mbuf Usage", "/usr/bin/netstat -mb");
208 208
defCmdT("VMStat", "/usr/bin/vmstat -afimsz");
209 209
defCmdT("Sockets", "/usr/bin/sockstat");
210 210

  
211 211
/* Firewall rules and info */
212
defCmdT("Generated Ruleset","/bin/cat {$g['tmp_path']}/rules.debug");
213
defCmdT("Generated Ruleset Limiters","/bin/cat {$g['tmp_path']}/rules.limiter");
214
defCmdT("Generated Ruleset Limits","/bin/cat {$g['tmp_path']}/rules.limits");
212
defCmdT("Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
213
defCmdT("Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
214
defCmdT("Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
215 215
defCmdT("pf NAT Rules", "/sbin/pfctl -vvsn");
216 216
defCmdT("pf Firewall Rules", "/sbin/pfctl -vvsr");
217
defCmdT("pf Tables","/sbin/pfctl -vs Tables");
217
defCmdT("pf Tables", "/sbin/pfctl -vs Tables");
218 218
defCmdT("pf State Table Contents", "/sbin/pfctl -ss");
219 219
defCmdT("pf Info", "/sbin/pfctl -si");
220 220
defCmdT("pf Show All", "/sbin/pfctl -sa");
221
defCmdT("pf Queues","/sbin/pfctl -s queue -v");
222
defCmdT("pf OSFP","/sbin/pfctl -s osfp");
223
defCmdT("pfsync stats","/usr/bin/netstat -s -ppfsync");
224
defCmdT("pftop Default","/usr/local/sbin/pftop -a -b");
225
defCmdT("pftop Long","/usr/local/sbin/pftop -w 150 -a -b -v long");
226
defCmdT("pftop Queue","/usr/local/sbin/pftop -w 150 -a -b -v queue");
227
defCmdT("pftop Rules","/usr/local/sbin/pftop -w 150 -a -b -v rules");
228
defCmdT("pftop Size","/usr/local/sbin/pftop -w 150 -a -b -v size");
229
defCmdT("pftop Speed","/usr/local/sbin/pftop -w 150 -a -b -v speed");
221
defCmdT("pf Queues", "/sbin/pfctl -s queue -v");
222
defCmdT("pf OSFP", "/sbin/pfctl -s osfp");
223
defCmdT("pfsync stats", "/usr/bin/netstat -s -ppfsync");
224
defCmdT("pftop Default", "/usr/local/sbin/pftop -a -b");
225
defCmdT("pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
226
defCmdT("pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
227
defCmdT("pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
228
defCmdT("pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
229
defCmdT("pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
230 230
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
231 231
	foreach ($config['captiveportal'] as $cpZone => $cpdata) {
232
		if (isset($cpdata['enable']))
232
		if (isset($cpdata['enable'])) {
233 233
			defCmdT("IPFW rules for {$cpdata['zone']}", "/sbin/ipfw -x " . escapeshellarg($cpdata['zoneid']) . " show");
234
		}
234 235
	}
235 236
}
236 237

  
237 238
/* Configuration Files */
238 239
defCmdT("Contents of var run", "/bin/ls /var/run");
239 240
defCmdT("Contents of conf", "/bin/ls /conf");
240
defCmdT("config.xml","dumpconfigxml");
241
defCmdT("resolv.conf","/bin/cat /etc/resolv.conf");
242
defCmdT("DHCP Configuration","/bin/cat /var/dhcpd/etc/dhcpd.conf");
243
defCmdT("DHCPv6 Configuration","/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
244
defCmdT("strongSwan config","/bin/cat /var/etc/ipsec/strongswan.conf");
245
defCmdT("IPsec config","/bin/cat /var/etc/ipsec/ipsec.conf");
246
defCmdT("IPsec Status","/usr/local/sbin/ipsec statusall");
247
defCmdT("SPD","/sbin/setkey -DP");
248
defCmdT("SAD","/sbin/setkey -D");
241
defCmdT("config.xml", "dumpconfigxml");
242
defCmdT("resolv.conf", "/bin/cat /etc/resolv.conf");
243
defCmdT("DHCP Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
244
defCmdT("DHCPv6 Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
245
defCmdT("strongSwan config", "/bin/cat /var/etc/ipsec/strongswan.conf");
246
defCmdT("IPsec config", "/bin/cat /var/etc/ipsec/ipsec.conf");
247
defCmdT("IPsec Status", "/usr/local/sbin/ipsec statusall");
248
defCmdT("SPD", "/sbin/setkey -DP");
249
defCmdT("SAD", "/sbin/setkey -D");
249 250
if (file_exists("/cf/conf/upgrade_log.txt")) {
250 251
	defCmdT("Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
251 252
}
......
258 259
if (file_exists("/var/etc/filterdns.conf")) {
259 260
	defCmdT("Filter DNS Daemon Config", "/bin/cat /var/etc/filterdns.conf");
260 261
}
261
if(isset($config['system']['usefifolog']))  {
262
	defCmdT("last 1000 system log entries","/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 1000");
263
	defCmdT("last 1000 DHCP log entries","/usr/sbin/fifolog_reader /var/log/dhcpd.log 2>&1 | tail -n 1000");
264
	defCmdT("last 500 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 500");
265
	defCmdT("last 1000 gateways log entries","/usr/sbin/fifolog_reader /var/log/gateways.log 2>&1 | tail -n 1000");
266
	defCmdT("last 1000 IPsec log entries","/usr/sbin/fifolog_reader /var/log/ipsec.log 2>&1 | tail -n 1000");
267
	defCmdT("last 1000 L2TP log entries","/usr/sbin/fifolog_reader /var/log/l2tps.log 2>&1 | tail -n 1000");
268
	defCmdT("last 1000 NTP log entries","/usr/sbin/fifolog_reader /var/log/ntpd.log 2>&1 | tail -n 1000");
269
	defCmdT("last 1000 OpenVPN log entries","/usr/sbin/fifolog_reader /var/log/openvpn.log 2>&1 | tail -n 1000");
270
	defCmdT("last 1000 Captive Portal auth log entries","/usr/sbin/fifolog_reader /var/log/portalauth.log 2>&1 | tail -n 1000");
271
	defCmdT("last 1000 PPP log entries","/usr/sbin/fifolog_reader /var/log/poes.log 2>&1 | tail -n 1000");
272
	defCmdT("last 1000 relayd log entries","/usr/sbin/fifolog_reader /var/log/relayd.log 2>&1 | tail -n 1000");
273
	defCmdT("last 1000 resolver log entries","/usr/sbin/fifolog_reader /var/log/resolver.log 2>&1 | tail -n 1000");
274
	defCmdT("last 1000 routing log entries","/usr/sbin/fifolog_reader /var/log/routing.log 2>&1 | tail -n 1000");
275
	defCmdT("last 1000 wireless log entries","/usr/sbin/fifolog_reader /var/log/wireless.log 2>&1 | tail -n 1000");
262
if (isset($config['system']['usefifolog']))  {
263
	defCmdT("last 1000 system log entries", "/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 1000");
264
	defCmdT("last 1000 DHCP log entries", "/usr/sbin/fifolog_reader /var/log/dhcpd.log 2>&1 | tail -n 1000");
265
	defCmdT("last 500 filter log entries", "/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 500");
266
	defCmdT("last 1000 gateways log entries", "/usr/sbin/fifolog_reader /var/log/gateways.log 2>&1 | tail -n 1000");
267
	defCmdT("last 1000 IPsec log entries", "/usr/sbin/fifolog_reader /var/log/ipsec.log 2>&1 | tail -n 1000");
268
	defCmdT("last 1000 L2TP log entries", "/usr/sbin/fifolog_reader /var/log/l2tps.log 2>&1 | tail -n 1000");
269
	defCmdT("last 1000 NTP log entries", "/usr/sbin/fifolog_reader /var/log/ntpd.log 2>&1 | tail -n 1000");
270
	defCmdT("last 1000 OpenVPN log entries", "/usr/sbin/fifolog_reader /var/log/openvpn.log 2>&1 | tail -n 1000");
271
	defCmdT("last 1000 Captive Portal auth log entries", "/usr/sbin/fifolog_reader /var/log/portalauth.log 2>&1 | tail -n 1000");
272
	defCmdT("last 1000 PPP log entries", "/usr/sbin/fifolog_reader /var/log/poes.log 2>&1 | tail -n 1000");
273
	defCmdT("last 1000 relayd log entries", "/usr/sbin/fifolog_reader /var/log/relayd.log 2>&1 | tail -n 1000");
274
	defCmdT("last 1000 resolver log entries", "/usr/sbin/fifolog_reader /var/log/resolver.log 2>&1 | tail -n 1000");
275
	defCmdT("last 1000 routing log entries", "/usr/sbin/fifolog_reader /var/log/routing.log 2>&1 | tail -n 1000");
276
	defCmdT("last 1000 wireless log entries", "/usr/sbin/fifolog_reader /var/log/wireless.log 2>&1 | tail -n 1000");
276 277
} else {
277
	defCmdT("last 1000 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
278
	defCmdT("last 1000 DHCP log entries","/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
279
	defCmdT("last 500 filter log entries","/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
280
	defCmdT("last 1000 gateways log entries","/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
281
	defCmdT("last 1000 IPsec log entries","/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
282
	defCmdT("last 1000 L2TP log entries","/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
283
	defCmdT("last 1000 NTP log entries","/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
284
	defCmdT("last 1000 OpenVPN log entries","/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
285
	defCmdT("last 1000 Captive Portal auth log entries","/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
286
	defCmdT("last 1000 PPP log entries","/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
287
	defCmdT("last 1000 relayd log entries","/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
288
	defCmdT("last 1000 resolver log entries","/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
289
	defCmdT("last 1000 routing log entries","/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
290
	defCmdT("last 1000 wireless log entries","/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
278
	defCmdT("last 1000 system log entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
279
	defCmdT("last 1000 DHCP log entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
280
	defCmdT("last 500 filter log entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
281
	defCmdT("last 1000 gateways log entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
282
	defCmdT("last 1000 IPsec log entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
283
	defCmdT("last 1000 L2TP log entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
284
	defCmdT("last 1000 NTP log entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
285
	defCmdT("last 1000 OpenVPN log entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
286
	defCmdT("last 1000 Captive Portal auth log entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
287
	defCmdT("last 1000 PPP log entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
288
	defCmdT("last 1000 relayd log entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
289
	defCmdT("last 1000 resolver log entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
290
	defCmdT("last 1000 routing log entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
291
	defCmdT("last 1000 wireless log entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
291 292
}
292 293
if (file_exists("/tmp/PHP_errors.log")) {
293 294
	defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
294 295
}
295
defCmdT("System Message Buffer","/sbin/dmesg -a");
296
defCmdT("System Message Buffer (Boot)","/bin/cat /var/log/dmesg.boot");
297
defCmdT("sysctl values","/sbin/sysctl -a");
296
defCmdT("System Message Buffer", "/sbin/dmesg -a");
297
defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
298
defCmdT("sysctl values", "/sbin/sysctl -a");
298 299

  
299 300
exec("/bin/date", $dateOutput, $dateStatus);
300 301
$currentDate = $dateOutput[0];
src/usr/local/www/status_captiveportal.php
151 151

  
152 152
	$zonelist = array("" => 'None');
153 153

  
154
	foreach ($a_cp as $cpkey => $cp)
154
	foreach ($a_cp as $cpkey => $cp) {
155 155
		$zonelist[$cpkey] = $cp['zone'];
156
	}
156 157

  
157 158
	$section->addInput(new Form_Select(
158 159
		'zone',
......
211 212
		if (!empty($mac)) {
212 213
			$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
213 214
			print htmlentities($mac);
214
			if(isset($mac_man[$mac_hi])) {
215
			if (isset($mac_man[$mac_hi])) {
215 216
				print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>";
216 217
			}
217 218
		}
......
228 229
				</td>
229 230
				<td>
230 231
<?php
231
		if ($last_act != 0)
232
			echo htmlspecialchars(date("m/d/Y H:i:s", $last_act))?>
232
			if ($last_act != 0) {
233
				echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));
234
			}
235
?>
236

  
233 237
				</td>
234 238
<?php
235 239
	   else:
src/usr/local/www/status_captiveportal_expire.php
120 120

  
121 121
if ($_POST) {
122 122
	if ($_POST['vouchers']) {
123
		if(voucher_expire($_POST['vouchers']))
123
		if (voucher_expire($_POST['vouchers'])) {
124 124
			print_info_box(gettext('Voucher successfully marked'), 'success');
125
		else
125
		} else {
126 126
			print_info_box(gettext('Error: Voucher could not be processed'), 'danger');
127
		}
127 128
	}
128 129
}
129 130

  
src/usr/local/www/status_captiveportal_voucher_rolls.php
122 122
<?php
123 123
			$voucherlck = lock("vouche{$cpzone}r");
124 124
			$i = 0;
125
			foreach($a_roll as $rollent):
125
			foreach ($a_roll as $rollent):
126 126
				$used = voucher_used_count($rollent['number']);
127
				$active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']);
127
				$active = count(voucher_read_active_db($rollent['number']), $rollent['minutes']);
128 128
				$ready = $rollent['count'] - $used;
129 129
				/* used also count active vouchers, remove them */
130 130
				$used = $used - $active;
src/usr/local/www/status_carp.php
152 152
$shortcut_section = "carp";
153 153

  
154 154
include("head.inc");
155
if ($savemsg)
155
if ($savemsg) {
156 156
	print_info_box($savemsg, 'success');
157
}
157 158

  
158 159
$carpcount = 0;
159 160
if (is_array($config['virtualip']['vip'])) {
......
177 178
				   '<a href="system_hasync.php" class="alert-link">' .
178 179
				   gettext("You can configure high availability sync settings here") .
179 180
				   '</a>');
180
} else
181
{
181
} else {
182 182
?>
183 183
<form action="status_carp.php" method="post">
184 184
<?php
185
	if($status > 0)
185
	if ($status > 0) {
186 186
		$carp_enabled = true;
187
	else
187
	} else {
188 188
		$carp_enabled = false;
189
	}
189 190

  
190 191
	// Sadly this needs to be here so that it is inside the form
191 192
	if ($carp_detected_problems > 0) {
......
231 232
		$vhid = $carp['vhid'];
232 233
		$status = get_carp_interface_status("_vip{$carp['uniqid']}");
233 234

  
234
		if($carp_enabled == false) {
235
		if ($carp_enabled == false) {
235 236
			$icon = 'times-circle';
236 237
			$status = "DISABLED";
237 238
		} else {
src/usr/local/www/status_dhcp_leases.php
305 305

  
306 306
foreach ($config['interfaces'] as $ifname => $ifarr) {
307 307
	if (is_array($config['dhcpd'][$ifname]) &&
308
		is_array($config['dhcpd'][$ifname]['staticmap'])) {
308
	    is_array($config['dhcpd'][$ifname]['staticmap'])) {
309 309
		$staticmap_array_index = 0;
310 310
		foreach ($config['dhcpd'][$ifname]['staticmap'] as $static) {
311 311
			$slease = array();
......
385 385
$iflist = get_configured_interface_with_descr(); //get interface descr for # of leases
386 386

  
387 387
foreach ($leases as $data):
388
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
388
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
389 389
		continue;
390
	}
390 391

  
391
	if ($data['act'] == 'active')
392
	if ($data['act'] == 'active') {
392 393
		$icon = 'fa-check-circle-o';
393
	elseif ($data['act'] == 'expired')
394
	} elseif ($data['act'] == 'expired') {
394 395
		$icon = 'fa-ban';
395
	else
396
	} else {
396 397
		$icon = 'fa-times-circle-o';
398
	}
397 399

  
398 400
	$lip = ip2ulong($data['ip']);
399 401

  
400 402
	if ($data['act'] != "static") {
401 403
		$dlsc=0;
402 404
		foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
403
			if (!is_array($dhcpifconf['range']))
405
			if (!is_array($dhcpifconf['range'])) {
404 406
				continue;
407
			}
405 408
			if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) {
406 409
				$data['if'] = $dhcpif;
407 410
				$dhcp_leases_subnet_counter[$dlsc]['dhcpif'] = $dhcpif;
......
424 427
					<td>
425 428
						<?=$mac?>
426 429

  
427
						<? if(isset($mac_man[$mac_hi])):?>
430
						<? if (isset($mac_man[$mac_hi])):?>
428 431
							(<?=$mac_man[$mac_hi]?>)
429 432
						<?endif?>
430 433
					</td>
src/usr/local/www/status_dhcpv6_leases.php
332 332
				$f = $f+2;
333 333
				break;
334 334
			case "client-hostname":
335
				if($data[$f+1] != "") {
336
					$entry['hostname'] = preg_replace('/"/','',$data[$f+1]);
335
				if ($data[$f+1] != "") {
336
					$entry['hostname'] = preg_replace('/"/', '', $data[$f+1]);
337 337
				} else {
338 338
					$hostname = gethostbyaddr($entry['ip']);
339
					if($hostname != "") {
339
					if ($hostname != "") {
340 340
						$entry['hostname'] = $hostname;
341 341
					}
342 342
				}
......
433 433
/* only print pool status when we have one */
434 434
}
435 435

  
436
if (empty($leases))
436
if (empty($leases)) {
437 437
	print '<div class="alert alert-warning" role="alert">'. gettext("No leases file found. Is the DHCP server active?") .'</div>';
438
}
438 439

  
439 440
?>
440 441
<div class="panel panel-default">
......
458 459
		<tbody>
459 460
<?php
460 461
foreach ($leases as $data):
461
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
462
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
462 463
		continue;
464
	}
463 465

  
464
	if ($data['act'] == 'active')
466
	if ($data['act'] == 'active') {
465 467
		$icon = 'fa-check-circle-o';
466
	elseif ($data['act'] == 'expired')
468
	} elseif ($data['act'] == 'expired') {
467 469
		$icon = 'fa-ban';
468
	else
470
	} else {
469 471
		$icon = 'fa-times-circle-o';
472
	}
470 473

  
471 474
	if ($data['act'] == "static") {
472 475
		foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
473
			if(is_array($dhcpifconf['staticmap'])) {
476
			if (is_array($dhcpifconf['staticmap'])) {
474 477
				foreach ($dhcpifconf['staticmap'] as $staticent) {
475 478
					if ($data['ip'] == $staticent['ipaddr']) {
476 479
						$data['if'] = $dhcpif;
......
479 482
				}
480 483
			}
481 484
			/* exit as soon as we have an interface */
482
			if ($data['if'] != "")
485
			if ($data['if'] != "") {
483 486
				break;
487
			}
484 488
		}
485 489
	} else {
486 490
		$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
......
497 501
				<td>
498 502
					<?=$mac?>
499 503

  
500
					<? if(isset($mac_man[$mac_hi])):?>
504
					<? if (isset($mac_man[$mac_hi])):?>
501 505
						(<?=$mac_man[$mac_hi]?>)
502 506
					<?endif?>
503 507
				</td>
......
544 548
		<tbody>
545 549
<?php
546 550
foreach ($prefixes as $data):
547
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
551
	if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1) {
548 552
		continue;
553
	}
549 554

  
550
	if ($data['act'] == 'active')
555
	if ($data['act'] == 'active') {
551 556
		$icon = 'fa-check-circle-o';
552
	elseif ($data['act'] == 'expired')
557
	} elseif ($data['act'] == 'expired') {
553 558
		$icon = 'fa-ban';
554
	else
559
	} else {
555 560
		$icon = 'fa-times-circle-o';
561
	}
556 562

  
557 563
	if ($data['act'] == "static") {
558 564
		foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
559
			if(is_array($dhcpifconf['staticmap'])) {
565
			if (is_array($dhcpifconf['staticmap'])) {
560 566
				foreach ($dhcpifconf['staticmap'] as $staticent) {
561 567
					if ($data['ip'] == $staticent['ipaddr']) {
562 568
						$data['if'] = $dhcpif;
......
565 571
				}
566 572
			}
567 573
			/* exit as soon as we have an interface */
568
			if ($data['if'] != "")
574
			if ($data['if'] != "") {
569 575
				break;
576
			}
570 577
		}
571 578
	} else {
572 579
		$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
src/usr/local/www/status_gateway_groups.php
116 116
<?php
117 117
						/* process which priorities we have */
118 118
						$priorities = array();
119
						foreach($gateway_group['item'] as $item) {
119
						foreach ($gateway_group['item'] as $item) {
120 120
							$itemsplit = explode("|", $item);
121 121
							$priorities[$itemsplit[1]] = true;
122 122
						}
......
127 127
							<tr>
128 128
<?php
129 129
							// Make a column for each tier
130
							foreach($priorities as $number => $tier) {
130
							foreach ($priorities as $number => $tier) {
131 131
								echo "<th>" . sprintf(gettext("Tier %s"), $number) . "</th>";
132 132
							}
133 133
?>
......
137 137
<?php
138 138
							/* inverse gateway group to gateway priority */
139 139
							$priority_arr = array();
140
							foreach($gateway_group['item'] as $item) {
140
							foreach ($gateway_group['item'] as $item) {
141 141
								$itemsplit = explode("|", $item);
142 142
								$priority_arr[$itemsplit[1]][] = $itemsplit[0];
143 143
							}
144 144
							ksort($priority_arr);
145 145
							$p = 1;
146
							foreach($priority_arr as $number => $tier) {
146
							foreach ($priority_arr as $number => $tier) {
147 147
								/* for each priority process the gateways */
148
								foreach($tier as $member) {
148
								foreach ($tier as $member) {
149 149
									/* we always have $priority_count fields */
150 150
?>
151 151
							<tr>
152 152
<?php
153 153
									$c = 1;
154
									while($c <= $priority_count) {
154
									while ($c <= $priority_count) {
155 155
										$monitor = lookup_gateway_monitor_ip_by_name($member);
156
										if($p == $c) {
156
										if ($p == $c) {
157 157
											$status = $gateways_status[$monitor]['status'];
158 158
											if (stristr($status, "down")) {
159 159
													$online = gettext("Offline");
......
172 172
												$bgcolor = LIGHTBLUE;
173 173
											}
174 174

  
175
											if(!COLOR)
175
											if (!COLOR) {
176 176
												$bgcolor = WHITE;
177
											}
177 178
?>
178 179
								<td bgcolor="<?=$bgcolor?>">
179
									<?=htmlspecialchars($member);?>,<br /><?=$online?>
180
									<?=htmlspecialchars($member);?>,<br/><?=$online?>
180 181
								</td>
181 182

  
182 183
<?php
src/usr/local/www/status_gateways.php
115 115
					<?php echo lookup_gateway_ip_by_name($gname);?>
116 116
				</td>
117 117
				<td>
118
<?php				if ($gateways_status[$gname])
118
<?php
119
					if ($gateways_status[$gname]) {
119 120
						echo $gateways_status[$gname]['monitorip'];
120
					else
121
					} else {
121 122
						echo $gateway['monitorip'];
123
					}
122 124
?>
123 125
				</td>
124 126
				<td>
125
<?php			if ($gateways_status[$gname])
126
					echo $gateways_status[$gname]['delay'];
127
				else
128
					echo gettext("Pending");
127
<?php
128
					if ($gateways_status[$gname]) {
129
						echo $gateways_status[$gname]['delay'];
130
					} else {
131
						echo gettext("Pending");
132
					}
129 133
?>
130
				<?php $counter++; ?>
131 134
				</td>
132 135
				<td>
133
<?php				if ($gateways_status[$gname])
136
<?php
137
					if ($gateways_status[$gname]) {
134 138
						echo $gateways_status[$gname]['loss'];
135
					else
139
					} else {
136 140
						echo gettext("Pending");
137

  
138
					$counter++;
141
					}
139 142
?>
140 143
				</td>
141 144
<?php
......
167 170

  
168 171
				$lastchange = $gateways_status[$gname]['lastcheck'];
169 172

  
170
				if(!COLOR)
173
				if (!COLOR) {
171 174
				   $bgcolor = WHITE;
175
				}
172 176
?>
173 177

  
174 178
				<td bgcolor="<?=$bgcolor?>">
175 179
					<strong><?=$online?></strong> <?php
176
					if(!empty($lastchange)) { ?>
180
					if (!empty($lastchange)) { ?>
177 181
						<br /><i>Last checked <?=$lastchange?></i>
178 182
<?php				} ?>
179 183
				</td>
src/usr/local/www/status_graph.php
86 86

  
87 87
// Get configured interface list
88 88
$ifdescrs = get_configured_interface_with_descr();
89
if (ipsec_enabled())
89
if (ipsec_enabled()) {
90 90
	$ifdescrs['enc0'] = "IPsec";
91
}
92

  
91 93
foreach (array('server', 'client') as $mode) {
92 94
	if (is_array($config['openvpn']["openvpn-{$mode}"])) {
93 95
		foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
......
148 150
	return($iflist);
149 151
}
150 152

  
151
$pgtitle = array(gettext("Status"),gettext("Traffic Graph"));
153
$pgtitle = array(gettext("Status"), gettext("Traffic Graph"));
152 154

  
153 155
include("head.inc");
154 156

  
......
207 209
<script type="text/javascript">
208 210
//<![CDATA[
209 211

  
210
function updateBandwidth(){
212
function updateBandwidth() {
211 213
	$.ajax(
212 214
		'/bandwidth_by_ip.php',
213 215
		{
......
219 221
				$('#top10-hosts').empty();
220 222

  
221 223
				//parse top ten bandwidth abuser hosts
222
				for (var y=0; y<10; y++){
224
				for (var y=0; y<10; y++) {
223 225
					if ((y < hosts_split.length) && (hosts_split[y] != "") && (hosts_split[y] != "no info")) {
224 226
						hostinfo = hosts_split[y].split(";");
225 227

  
......
234 236
	});
235 237
}
236 238

  
237
events.push(function(){
238
	$('form.auto-submit').on('change', function(){
239
events.push(function() {
240
	$('form.auto-submit').on('change', function() {
239 241
		$(this).submit();
240 242
	});
241 243

  
......
248 250
<?php
249 251

  
250 252
/* link the ipsec interface magically */
251
if (ipsec_enabled())
253
if (ipsec_enabled()) {
252 254
	$ifdescrs['enc0'] = "IPsec";
255
}
253 256

  
254 257
?>
255 258
<div class="panel panel-default">
......
270 273
			<table class="table table-striped table-condensed">
271 274
				<thead>
272 275
					<tr>
273
						<th><?=(($curhostipformat=="") ? gettext("Host IP") : gettext("Host Name or IP")); ?></th>
276
						<th><?=(($curhostipformat == "") ? gettext("Host IP") : gettext("Host Name or IP")); ?></th>
274 277
						<th><?=gettext("Bandwidth In"); ?></th>
275 278
						<th><?=gettext("Bandwidth Out"); ?></th>
276 279
					</tr>
src/usr/local/www/status_interfaces.php
90 90

  
91 91
// Display a term/definition pair
92 92
function showDef($show, $term, $def) {
93
	if($show) {
93
	if ($show) {
94 94
		print('<dt>' . $term . '</dt>');
95 95
		print('<dd>' . htmlspecialchars($def) . '</dd>');
96 96
	}
......
100 100
function showDefBtn($show, $term, $def, $ifval, $btnlbl) {
101 101
	global $formtemplate;
102 102

  
103
	if($show) {
103
	if ($show) {
104 104
		print('<dt>' . $term . '</dt>');
105 105
		print('<dd>');
106 106
		printf($formtemplate, $term, $ifval, $show, htmlspecialchars($def)	. ' ', $btnlbl);
......
108 108
	}
109 109
}
110 110

  
111
$pgtitle = array(gettext("Status"),gettext("Interfaces"));
111
$pgtitle = array(gettext("Status"), gettext("Interfaces"));
112 112
$shortcut_section = "interfaces";
113 113
include("head.inc");
114 114

  
......
160 160
				if ($ifdescr == "wan" && file_exists("{$g['varetc_path']}/resolv.conf")) {
161 161
					$dns_servers = get_dns_servers();
162 162
					$dnscnt = 0;
163
					foreach($dns_servers as $dns) {
163
					foreach ($dns_servers as $dns) {
164 164
						showDef(true, $dnscnt == 0 ? gettext('ISP DNS servers'):'', $dns);
165 165
						$dnscnt++;
166 166
					}
......
170 170
			showDef($ifinfo['mtu'], gettext("MTU"), $ifinfo['mtu']);
171 171
			showDef($ifinfo['media'], gettext("Media"), $ifinfo['media']);
172 172
			showDef($ifinfo['laggproto'], gettext("LAGG Protocol"), $ifinfo['laggproto']);
173
			showDef($ifinfo['laggport'],gettext("LAGG Ports"),$laggport);
174
			showDef($ifinfo['channel'],gettext("Channel"),$ifinfo['channel']);
175
			showDef($ifinfo['ssid'],gettext("SSID"),$ifinfo['ssid']);
176
			showDef($ifinfo['bssid'],gettext("BSSID"),$ifinfo['bssid']);
177
			showDef($ifinfo['rate'],gettext("Rate"),$ifinfo['rate']);
178
			showDef($ifinfo['rssi'],gettext("RSSI"),$ifinfo['rssi']);
179
			showDef(true,gettext("In/out packets"),$ifinfo['inpkts'] . '/' . $ifinfo['outpkts']);
180
			showDef(true,gettext("In/out packets (pass)"),$ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass']);
181
			showDef(true,gettext("In/out packets (block)"),$ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock']);
182
			showDef(isset($ifinfo['inerrs']),gettext("In/out errors"),$ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);
183
			showDef(isset($ifinfo['collisions']),gettext("Collisions"),$ifinfo['collisions']);
173
			showDef($ifinfo['laggport'], gettext("LAGG Ports"), $laggport);
174
			showDef($ifinfo['channel'], gettext("Channel"), $ifinfo['channel']);
175
			showDef($ifinfo['ssid'], gettext("SSID"), $ifinfo['ssid']);
176
			showDef($ifinfo['bssid'], gettext("BSSID"), $ifinfo['bssid']);
177
			showDef($ifinfo['rate'], gettext("Rate"), $ifinfo['rate']);
178
			showDef($ifinfo['rssi'], gettext("RSSI"), $ifinfo['rssi']);
179
			showDef(true, gettext("In/out packets"), $ifinfo['inpkts'] . '/' . $ifinfo['outpkts']);
180
			showDef(true, gettext("In/out packets (pass)"), $ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass']);
181
			showDef(true, gettext("In/out packets (block)"), $ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock']);
182
			showDef(isset($ifinfo['inerrs']), gettext("In/out errors"), $ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);
183
			showDef(isset($ifinfo['collisions']), gettext("Collisions"), $ifinfo['collisions']);
184 184
		} // e-o-if ($ifinfo['status'] != "down")
185 185

  
186 186
		showDef($ifinfo['bridge'], gettext('Bridge (') . $ifinfo['bridgeint'] . ')', $ifinfo['bridge']);
187 187

  
188
		if(file_exists("/usr/bin/vmstat")) {
188
		if (file_exists("/usr/bin/vmstat")) {
189 189
			$real_interface = "";
190 190
			$interrupt_total = "";
191 191
			$interrupt_sec = "";
......
193 193
			$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $3 }'`;
194 194
			$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
195 195

  
196
			if(strstr($interrupt_total, "hci")) {
196
			if (strstr($interrupt_total, "hci")) {
197 197
				$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
198 198
				$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $5 }'`;
199 199
			}
src/usr/local/www/status_ipsec.php
356 356
									<td>
357 357
<?php
358 358
				print(gettext("Rekey: ") . htmlspecialchars($childsa['rekey-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['rekey-time']) . ")");
359
				print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")" );
360
				print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")" );
359
				print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")");
360
				print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")");
361 361

  
362 362
?>
363 363
									</td>
......
435 435
					<td>
436 436
<?php
437 437
	list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
438
	if (empty($myid_data))
438
	if (empty($myid_data)) {
439 439
		print(gettext("Unknown"));
440
	else
440
	} else {
441 441
		print(htmlspecialchars($myid_data));
442
	}
442 443
?>
443 444
					</td>
444 445
					<td>
445 446
<?php
446 447
	$ph1src = ipsec_get_phase1_src($ph1ent);
447 448

  
448
	if (empty($ph1src))
449
	if (empty($ph1src)) {
449 450
		print(gettext("Unknown"));
450
	else
451
	} else {
451 452
		print(htmlspecialchars($ph1src));
453
	}
452 454
?>
453 455
					</td>
454 456
					<td>
455 457
<?php
456 458
	list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
457
	if (empty($peerid_data))
459
	if (empty($peerid_data)) {
458 460
		print(gettext("Unknown"));
459
	else
461
	} else {
460 462
		print(htmlspecialchars($peerid_data));
463
	}
461 464
?>
462 465
					</td>
463 466
					<td>
464 467
<?php
465 468
	$ph1src = ipsec_get_phase1_dst($ph1ent);
466
	if (empty($ph1src))
469
	if (empty($ph1src)) {
467 470
		print(gettext("Unknown"));
468
	else
471
	} else {
469 472
		print(htmlspecialchars($ph1src));
473
	}
470 474
?>
471 475
					</td>
472 476
					<td>
src/usr/local/www/status_ipsec_leases.php
141 141
<?php
142 142

  
143 143
					}
144
				}
145
				else {
144
				} else {
146 145
?>
147 146
					<td colspan="3" class="warning"><?=gettext('No leases from this pool yet.')?></td>
148 147
				</tr>
......
154 153
		</table>
155 154
	</div>
156 155
<?php
157
}
158
else
156
} else {
159 157
	print_info_box(gettext('No IPsec pools.'));
158
}
160 159

  
161 160
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
162 161

  
src/usr/local/www/status_ipsec_sad.php
150 150
		</table>
151 151
	</div>
152 152
<?php
153
		}
154
else
153
} else {
155 154
	print_info_box(gettext('No IPsec security associations.'));
155
}
156 156

  
157 157
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
158 158

  
src/usr/local/www/status_ipsec_spd.php
104 104
			<tbody>
105 105
<?php
106 106
		foreach ($spd as $sp) {
107
			if ($sp['dir'] == 'in')
107
			if ($sp['dir'] == 'in') {
108 108
				$dirstr = LEFTARROW . ' Inbound';
109
			else
109
			} else {
110 110
				$dirstr = RIGHTARROW . ' Outbound';
111
			}
111 112
?>
112 113
				<tr>
113 114
					<td>
......
133 134
		</table>
134 135
	</div>
135 136
<?php
136
	 } // e-o-if (count($spd))
137
else {
137
} else {
138 138
	print_info_box(gettext('No IPsec security policies configured.'));
139 139
}
140 140

  
src/usr/local/www/status_lb_pool.php
90 90

  
91 91
$nentries = $config['syslog']['nentries'];
92 92

  
93
if (!$nentries)
93
if (!$nentries) {
94 94
	$nentries = 50;
95
}
95 96

  
96 97
$now = time();
97 98
$year = date("Y");
......
146 147
	}
147 148
}
148 149

  
149
if (is_subsystem_dirty('loadbalancer'))
150
if (is_subsystem_dirty('loadbalancer')) {
150 151
	print_info_box_np('The load balancer configuration has been changed You must apply the changes in order for them to take effect.');
152
}
151 153

  
152 154
/* active tabs */
153 155
$tab_array = array();
......
183 185
						</td>
184 186
						<td>
185 187
<?php
186
	switch($pool['mode']) {
188
	switch ($pool['mode']) {
187 189
		case "loadbalance":
188 190
			echo "Load balancing";
189 191
			break;
......
217 219
	asort($pool_hosts);
218 220

  
219 221
	foreach ((array) $pool_hosts as $server) {
220
		if($server['ip']['addr']!="") {
222
		if ($server['ip']['addr'] != "") {
221 223
			switch ($server['ip']['state']) {
222 224
				case 'up':
223 225
					$bgcolor = LIGHTGREEN;	// lightgreen
......
245 247

  
246 248
			print("<td bgcolor=\"{$bgcolor}\">&nbsp;{$server['ip']['addr']}:{$pool['port']}&nbsp;</td><td bgcolor=\"{$bgcolor}\">&nbsp;");
247 249

  
248
			if($server['ip']['avail'])
250
			if ($server['ip']['avail']) {
249 251
				print(" ({$server['ip']['avail']}) ");
252
			}
250 253
?>
251 254
									</td>
252 255
								</tr>
......
273 276
</form>
274 277

  
275 278
<?php
276
if($rowsprinted > 0) {
279
if ($rowsprinted > 0) {
277 280
?>
278 281
			<nav class="action-buttons">
279 282
				<button name="Submit" type="submit" class="btn btn-primary btn-sm" value="<?= gettext("Save"); ?>" >
src/usr/local/www/status_lb_vs.php
94 94
$tab_array[] = array(gettext("Virtual Servers"), true, "status_lb_vs.php");
95 95
display_top_tabs($tab_array);
96 96

  
97
if(empty($a_vs))
97
if (empty($a_vs)) {
98 98
	print('<div class="alert alert-danger">No load balancers have been configured!</div>');
99
else {
99
} else {
100 100
?>
101 101
<div class="table-responsive"></div>
102 102
	<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
......
148 148
					  $rdr_a[$vsent['name']]['status'] = 'Unknown - relayd not running?';
149 149
				  }
150 150

  
151
				if(!COLOR)
151
				if (!COLOR) {
152 152
					$bgcolor = WHITE;
153
				}
153 154
?>
154 155
				<td bgcolor="<?=$bgcolor?>">
155 156
					<?=$rdr_a[$vsent['name']]['status']?>
src/usr/local/www/status_logs.php
243 243
# Formatted/Raw Display
244 244
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
245 245
	$rawfilter = false;
246
}
247
else if ($config['syslog'][$specific_log]['format'] == 'raw') {
246
} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
248 247
	$rawfilter = true;
249
}	
250
else {	# Use the general logging options setting (global).
248
} else {	# Use the general logging options setting (global).
251 249
	$rawfilter = isset($config['syslog']['rawfilter']);
252 250
}
253 251

  
......
309 307
	display_top_tabs($tab_array, false, 'nav nav-tabs');
310 308
}
311 309

  
312
if ($filter_active)
310
if ($filter_active) {
313 311
	$filter_state = SEC_OPEN;
314
else
312
} else {
315 313
	$filter_state = SEC_CLOSED;
314
}
316 315

  
317 316
if (!$rawfilter) { // Advanced log filter form
318 317
	$form = new Form(false);
......
367 366
		null,
368 367
		'fa-filter'
369 368
	);
370
}
371
else { // Simple log filter form
369
} else { // Simple log filter form
372 370
	$form = new Form(false);
373 371

  
374 372
	$section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
......
412 410

  
413 411
// Now the forms are complete we can draw the log table and its controls
414 412
if (!$rawfilter) {
415
	if ($filterlogentries_submit)
413
	if ($filterlogentries_submit) {
416 414
		$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filterfieldsarray);
417
	else
415
	} else {
418 416
		$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filtertext);
417
	}
419 418
?>
420 419

  
421 420
<div class="panel panel-default">
422 421
	<div class="panel-heading">
423 422
		<h2 class="panel-title">
424 423
<?php
425
	if ((!$filtertext) && (!$filterfieldsarray))
424
	if ((!$filtertext) && (!$filterfieldsarray)) {
426 425
		printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
427
	else
426
	} else {
428 427
		printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
428
	}
429 429

  
430 430
	printf(" (" . gettext("Maximum %d") . ")", $nentries);
431 431
?>
......
466 466
			</tbody>
467 467
		</table>
468 468
<?php
469
	if (count($filterlog) == 0)
469
	if (count($filterlog) == 0) {
470 470
		print_info_box(gettext('No logs to display'));
471
	}
471 472
?>
472 473
		</div>
473 474
	</div>
474 475
</div>
475 476
<?php
476
}
477
else
478
{
477
} else {
479 478
?>
480 479
<div class="panel panel-default">
481 480
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
......
489 488
			</thead>
490 489
			<tbody>
491 490
<?php
492
	if (($logfile == 'resolver') || ($logfile == 'system'))
491
	if (($logfile == 'resolver') || ($logfile == 'system')) {
493 492
		$inverse = array("ppp");
494
	else
493
	} else {
495 494
		$inverse = null;
495
	}
496 496

  
497
	if ($filtertext)
497
	if ($filtertext) {
498 498
		$rows = dump_clog($system_logfile, $nentries, true, array("$filtertext"), $inverse);
499
	else
499
	} else {
500 500
		$rows = dump_clog($system_logfile, $nentries, true, array(), $inverse);
501
	}
501 502
?>
502 503
			</tbody>
503 504
		</table>
504 505
<?php
505
	if ($rows == 0)
506
	if ($rows == 0) {
506 507
		print_info_box(gettext('No logs to display'));
508
	}
507 509
?>
508 510
	</div>
509 511
</div>
......
519 521
	$manage_log_active = true;
520 522
}
521 523

  
522
if ($manage_log_active)
524
if ($manage_log_active) {
523 525
	$manage_log_state = SEC_OPEN;
524
else
526
} else {
525 527
	$manage_log_state = SEC_CLOSED;
528
}
526 529

  
527 530
$form = new Form(false);
528 531

  
src/usr/local/www/status_logs_filter.php
281 281
	# Firewall Specific
282 282
		if ($logfile == 'filter') {
283 283
			if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) ||
284
				($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
285
				($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
286
				($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
284
			    ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
285
			    ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
286
			    ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
287 287

  
288 288
				require_once("filter.inc");
289 289
				$retval |= filter_configure();
......
297 297
# Formatted/Raw Display
298 298
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
299 299
	$rawfilter = false;
300
}
301
else if ($config['syslog'][$specific_log]['format'] == 'raw') {
300
} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
302 301
	$rawfilter = true;
303
}	
304
else {	# Use the general logging options setting (global).
302
} else {	# Use the general logging options setting (global).
305 303
	$rawfilter = isset($config['syslog']['rawfilter']);
306 304
}
307 305

  
......
341 339
	//$iflist = get_interface_list();
342 340
	// Allow extending of the firewall edit interfaces
343 341
	pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
344
	foreach ($iflist as $if => $ifdesc)
342
	foreach ($iflist as $if => $ifdesc) {
345 343
		$interfaces[$if] = $ifdesc;
344
	}
346 345

  
347
	if ($config['l2tp']['mode'] == "server")
346
	if ($config['l2tp']['mode'] == "server") {
348 347
		$interfaces['l2tp'] = "L2TP VPN";
348
	}
349 349

  
350
	if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
350
	if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
351 351
		$interfaces['pppoe'] = "PPPoE Server";
352
	}
352 353

  
353 354
	/* add ipsec interfaces */
354
	if (ipsec_enabled())
355
	if (ipsec_enabled()) {
355 356
		$interfaces["enc0"] = "IPsec";
357
	}
356 358

  
357 359
	/* add openvpn/tun interfaces */
358
	if	($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
360
	if	($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
359 361
		$interfaces["openvpn"] = "OpenVPN";
362
	}
360 363

  
361 364
	return($interfaces);
362 365
}
363 366

  
364 367
$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
365
if ($filterfieldsarray['interface'] == "All")
366
	$interface = "";
367 368

  
369
if ($filterfieldsarray['interface'] == "All") {
370
	$interface = "";
371
}
368 372

  
369 373
$tab_array = array();
370 374
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
......
386 390
$tab_array[] = array(gettext("Summary View"), false, "/status_logs_filter_summary.php");
387 391
display_top_tabs($tab_array, false, 'nav nav-tabs');
388 392

  
389
if ($filter_active)
393
if ($filter_active) {
390 394
	$filter_state = SEC_OPEN;
391
else
395
} else {
392 396
	$filter_state = SEC_CLOSED;
397
}
393 398

  
394 399
if (!$rawfilter) { // Advanced log filter form
395 400
	$form = new Form(false);
......
491 496
		null,
492 497
		'fa-filter'
493 498
	);
494
}
495
else { // Simple log filter form
499
} else { // Simple log filter form
496 500
	$form = new Form(false);
497 501

  
498 502
	$section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
......
549 553
if (!$rawfilter) {
550 554
	$iflist = get_configured_interface_with_descr(false, true);
551 555

  
552
	if ($iflist[$interfacefilter])
556
	if ($iflist[$interfacefilter]) {
553 557
		$interfacefilter = $iflist[$interfacefilter];
558
	}
554 559

  
555
	if ($filterlogentries_submit)
560
	if ($filterlogentries_submit) {
556 561
		$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
557
	else
562
	} else {
558 563
		$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
564
	}
559 565
?>
560 566

  
561 567
<div class="panel panel-default">
562 568
	<div class="panel-heading">
563 569
		<h2 class="panel-title">
564 570
<?php
565
	if ((!$filtertext) && (!$filterfieldsarray))
571
	if ((!$filtertext) && (!$filterfieldsarray)) {
566 572
		printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
567
	else
573
	} else {
568 574
		printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
575
	}
569 576

  
570 577
	printf(" (" . gettext("Maximum %d") . ")", $nentries);
571 578
?>
......
595 602
			</thead>
596 603
			<tbody>
597 604
<?php
598
	if ($config['syslog']['filterdescriptions'])
605
	if ($config['syslog']['filterdescriptions']) {
599 606
		buffer_rules_load();
607
	}
600 608

  
601 609
	foreach ($filterlog as $filterent) {
602 610
?>
......
611 619
?>
612 620
						<i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
613 621
<?php
614
		if ($filterent['count'])
622
		if ($filterent['count']) {
615 623
			echo $filterent['count'];
624
		}
616 625
?>
617 626
					</td>
618 627
					<td style="white-space:nowrap;">
......
620 629
					</td>
621 630
					<td style="white-space:nowrap;">
622 631
<?php
623
		if ($filterent['direction'] == "out")
632
		if ($filterent['direction'] == "out") {
624 633
			print('&#x25ba;' . ' ');
634
		}
625 635
?>
626 636
		<?=htmlspecialchars($filterent['interface'])?>
627 637
					</td>
......
668 678
						<?=$dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>'?>
669 679
					</td>
670 680
<?php
671
		if ($filterent['proto'] == "TCP")
681
		if ($filterent['proto'] == "TCP") {
672 682
			$filterent['proto'] .= ":{$filterent['tcpflags']}";
683
		}
673 684
?>
674 685
					<td style="white-space:nowrap;">
675 686
						<?=htmlspecialchars($filterent['proto'])?>
......
680 691
?>
681 692
				<tr>
682 693
					<td colspan="2" />
683
					<td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])?></td>
694
					<td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?></td>
684 695
				</tr>
685 696
<?php
686 697
		}
......
690 701
			</tbody>
691 702
		</table>
692 703
<?php
693
	if (count($filterlog) == 0)
704
	if (count($filterlog) == 0) {
694 705
		print_info_box(gettext('No logs to display'));
706
	}
695 707
?>
696 708
		</div>
697 709
	</div>
698 710
</div>
699 711

  
700 712
<?php
701
}
702
else
703
{
713
} else {
704 714
?>
705 715
<div class="panel panel-default">
706 716
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
......
714 724
			</thead>
715 725
			<tbody>
716 726
<?php
717
	if ($filtertext)
727
	if ($filtertext) {
718 728
		$rows = dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
719
	else
729
	} else {
720 730
		$rows = dump_clog($filter_logfile, $nentries, true, array());
731
	}
721 732
?>
722 733
			</tbody>
723 734
		</table>
724 735
<?php
725
	if ($rows == 0)
736
	if ($rows == 0) {
726 737
		print_info_box(gettext('No logs to display'));
738
	}
727 739
?>
728 740
	</div>
729 741
</div>
......
750 762
	$manage_log_active = true;
751 763
}
752 764

  
753
if ($manage_log_active)
765
if ($manage_log_active) {
754 766
	$manage_log_state = SEC_OPEN;
755
else
767
} else {
756 768
	$manage_log_state = SEC_CLOSED;
769
}
757 770

  
758 771
$form = new Form(false);
759 772

  
......
1018 1031
	};
1019 1032
}
1020 1033

  
1021
events.push(function(){
1034
events.push(function() {
1022 1035
    $('.fa').tooltip();
1023 1036
});
1024 1037
//]]>
src/usr/local/www/status_logs_filter_dynamic.php
180 180
}
181 181

  
182 182
function fetch_new_rules() {
183
	if(isPaused)
183
	if (isPaused) {
184 184
		return;
185
	if(isBusy)
185
	}
186
	if (isBusy) {
186 187
		return;
188
	}
187 189
	isBusy = true;
188 190
	getURL('status_logs_filter_dynamic.php?lastsawtime=' + lastsawtime, fetch_new_rules_callback);
189 191
}
190 192

  
191 193
function fetch_new_rules_callback(callback_data) {
192
	if(isPaused)
194
	if (isPaused) {
193 195
		return;
196
	}
194 197

  
195 198
	var data_split;
196 199
	var new_data_to_add = Array();
......
198 201

  
199 202
	data_split = data.split("\n");
200 203

  
201
	for(var x=0; x<data_split.length-1; x++) {
204
	for (var x=0; x<data_split.length-1; x++) {
202 205
		/* loop through rows */
203 206
		row_split = data_split[x].split("||");
204 207
		lastsawtime = row_split[9];
205 208

  
206 209
		var tmp = format_log_line(row_split);
207 210

  
208
		if ( !(tmp) )
211
		if (!(tmp)) {
209 212
			continue;
213
		}
210 214

  
211 215
		new_data_to_add[new_data_to_add.length] = tmp;
212 216
	}
......
226 230
}
227 231

  
228 232
function update_table_rows(data) {
229
	if(isPaused)
233
	if (isPaused) {
230 234
		return;
235
	}
231 236

  
232 237
	var isIE = navigator.appName.indexOf('Microsoft') != -1;
233 238
	var isSafari = navigator.userAgent.indexOf('Safari') != -1;
......
251 256
	// Number of rows to move by
252 257
	var move = rows.length + data.length - nentries;
253 258

  
254
	if (move < 0)
259
	if (move < 0) {
255 260
		move = 0;
261
	}
256 262

  
257 263
	if (isReverse == false) {
258 264
		for (var i = move; i < rows.length; i++) {
......
296 302
}
297 303

  
298 304
function toggle_pause() {
299
	if(isPaused) {
305
	if (isPaused) {
300 306
		isPaused = false;
301 307
		fetch_new_rules();
302 308
	} else {
......
308 314
	timer = setInterval('fetch_new_rules()', updateDelay);
309 315
}
310 316

  
311
function toggleListDescriptions(){
317
function toggleListDescriptions() {
312 318
	var ss = document.styleSheets;
313 319
	for (var i=0; i<ss.length; i++) {
314 320
		var rules = ss[i].cssRules || ss[i].rules;
......
380 386
						$dstIP = htmlspecialchars($filterent['dstip']);
381 387
					}
382 388

  
383
					if ($filterent['srcport'])
389
					if ($filterent['srcport']) {
384 390
						$srcPort = ":" . htmlspecialchars($filterent['srcport']);
385
					else
391
					} else {
386 392
						$srcPort = "";
393
					}
387 394

  
388
					if ($filterent['dstport'])
395
					if ($filterent['dstport']) {
389 396
						$dstPort = ":" . htmlspecialchars($filterent['dstport']);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff