commit 12745e51a69c8bd5850c94f6063732f49512f53d
Author: Phil Davis <phil.davis@inf.org>
Date:   Tue Dec 15 17:04:23 2015 +0545

    Code style l

diff --git a/src/usr/local/www/license.php b/src/usr/local/www/license.php
index a4507799f1..1233d8328e 100644
--- a/src/usr/local/www/license.php
+++ b/src/usr/local/www/license.php
@@ -115,7 +115,7 @@ include("head.inc");
 			<?= "{$g['product_name']} " . gettext("is based upon/includes various free software packages, ".
 			"listed below.")?><br />
 			<?php printf(gettext("The authors of %s would like to thank the authors of these " .
-			"software packages for their efforts"),$g['product_name'])?>.
+			"software packages for their efforts"), $g['product_name'])?>.
 		</p>
 		<p>
 			FreeBSD (<a href="http://www.freebsd.org" target="_blank">http://www.freebsd.org</a>)<br />
diff --git a/src/usr/local/www/load_balancer_monitor.php b/src/usr/local/www/load_balancer_monitor.php
index f91123411e..e007e18573 100644
--- a/src/usr/local/www/load_balancer_monitor.php
+++ b/src/usr/local/www/load_balancer_monitor.php
@@ -107,19 +107,22 @@ if ($_GET['act'] == "del") {
 	}
 }
 
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Monitor"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Monitor"));
 $shortcut_section = "relayd";
 
 include("head.inc");
 
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
-if ($savemsg)
+if ($savemsg) {
 	print_info_box($savemsg, 'success');
+}
 
-if (is_subsystem_dirty('loadbalancer'))
+if (is_subsystem_dirty('loadbalancer')) {
 	print_info_box_np(gettext("The load balancer configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
 
 /* active tabs */
 $tab_array = array();
@@ -146,7 +149,7 @@ display_top_tabs($tab_array);
 				<tbody>
 <?php
 $idx = 0;
-foreach($a_monitor as $monitor) {
+foreach ($a_monitor as $monitor) {
 ?>
 					<tr>
 						<td>
diff --git a/src/usr/local/www/load_balancer_monitor_edit.php b/src/usr/local/www/load_balancer_monitor_edit.php
index 5cd870a8ff..07862394e7 100644
--- a/src/usr/local/www/load_balancer_monitor_edit.php
+++ b/src/usr/local/www/load_balancer_monitor_edit.php
@@ -242,19 +242,20 @@ $types = array("icmp" => gettext("ICMP"), "tcp" => gettext("TCP"), "http" => get
 
 <script type="text/javascript">
 //<![CDATA[
-events.push(function(){
+events.push(function() {
 
 	// Hides all elements of the specified class. This will usually be a section
 	function hideClass(s_class, hide) {
-		if(hide)
+		if (hide) {
 			$('.' + s_class).hide();
-		else
+		} else {
 			$('.' + s_class).show();
+		}
 	}
 
 	// Hide all sections except 't'
-	function updateType(t){
-		switch(t) {
+	function updateType(t) {
+		switch (t) {
 	<?php
 		/* OK, so this is sick using php to generate javascript, but it needed to be done */
 		foreach ($types as $key => $val) {
@@ -288,8 +289,9 @@ events.push(function(){
 </script>
 
 <?php
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
 $form = new Form(new Form_Button(
 	'Submit',
diff --git a/src/usr/local/www/load_balancer_pool.php b/src/usr/local/www/load_balancer_pool.php
index b1db377940..7236129181 100644
--- a/src/usr/local/www/load_balancer_pool.php
+++ b/src/usr/local/www/load_balancer_pool.php
@@ -121,19 +121,22 @@ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
 	$a_pool[$i]['monitor'] = "<a href=\"/load_balancer_monitor_edit.php?id={$mondex[$a_pool[$i]['monitor']]}\">" . htmlspecialchars($a_pool[$i]['monitor']) . "</a>";
 }
 
-$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Pool"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Pool"));
 $shortcut_section = "relayd";
 
 include("head.inc");
 
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
-if ($savemsg)
+if ($savemsg) {
 	print_info_box($savemsg);
+}
 
-if (is_subsystem_dirty('loadbalancer'))
+if (is_subsystem_dirty('loadbalancer')) {
 	print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));
+}
 
 /* active tabs */
 $tab_array = array();
@@ -164,7 +167,7 @@ display_top_tabs($tab_array);
 <?php
 
 $idx = 0;
-foreach($a_pool as $pool) {
+foreach ($a_pool as $pool) {
 ?>
 					<tr>
 						<td>
diff --git a/src/usr/local/www/load_balancer_pool_edit.php b/src/usr/local/www/load_balancer_pool_edit.php
index 9d5c98bd5a..6c6996acdc 100644
--- a/src/usr/local/www/load_balancer_pool_edit.php
+++ b/src/usr/local/www/load_balancer_pool_edit.php
@@ -76,10 +76,12 @@ if (!is_array($config['load_balancer']['lbpool'])) {
 
 $a_pool = &$config['load_balancer']['lbpool'];
 
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
 	$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
 	$id = $_POST['id'];
+}
 
 if (isset($id) && $a_pool[$id]) {
 	$pconfig['name'] = $a_pool[$id]['name'];
@@ -105,55 +107,61 @@ if ($_POST) {
 
 	/* input validation */
 	$reqdfields = explode(" ", "name mode port monitor servers");
-	$reqdfieldsn = array(gettext("Name"),gettext("Mode"),gettext("Port"),gettext("Monitor"),gettext("Server List"));
+	$reqdfieldsn = array(gettext("Name"), gettext("Mode"), gettext("Port"), gettext("Monitor"), gettext("Server List"));
 
 	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
 
 	/* Ensure that our pool names are unique */
-	for ($i=0; isset($config['load_balancer']['lbpool'][$i]); $i++)
-		if (($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name']) && ($i != $id))
+	for ($i=0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
+		if (($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name']) && ($i != $id)) {
 			$input_errors[] = gettext("This pool name has already been used.  Pool names must be unique.");
+		}
+	}
 
-	if (preg_match('/[ \/]/', $_POST['name']))
+	if (preg_match('/[ \/]/', $_POST['name'])) {
 		$input_errors[] = gettext("You cannot use spaces or slashes in the 'name' field.");
+	}
 
-	if (strlen($_POST['name']) > 16)
+	if (strlen($_POST['name']) > 16) {
 		$input_errors[] = gettext("The 'name' field must be 16 characters or less.");
+	}
 
-	if (in_array($_POST['name'], $reserved_table_names))
+	if (in_array($_POST['name'], $reserved_table_names)) {
 		$input_errors[] = sprintf(gettext("The name '%s' is a reserved word and cannot be used."), $_POST['name']);
+	}
 
-	if (is_alias($_POST['name']))
+	if (is_alias($_POST['name'])) {
 		$input_errors[] = sprintf(gettext("Sorry, an alias is already named %s."), $_POST['name']);
+	}
 
-	if (!is_portoralias($_POST['port']))
+	if (!is_portoralias($_POST['port'])) {
 		$input_errors[] = gettext("The port must be an integer between 1 and 65535, or a port alias.");
+	}
 
 	// May as well use is_port as we want a positive integer and such.
-	if (!empty($_POST['retry']) && !is_port($_POST['retry']))
+	if (!empty($_POST['retry']) && !is_port($_POST['retry'])) {
 		$input_errors[] = gettext("The retry value must be an integer between 1 and 65535.");
+	}
 
 	if (!in_array($_POST['mode'], $allowed_modes)) {
 		$input_errors[] = gettext("The submitted mode is not valid.");
 	}
 
 	if (is_array($_POST['servers'])) {
-		foreach($pconfig['servers'] as $svrent) {
+		foreach ($pconfig['servers'] as $svrent) {
 			if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
 				$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"enabled\" list)."), $svrent);
-			}
-			else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
+			} else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
 				$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"enabled\" list)."), $svrent);
 			}
 		}
 	}
 
 	if (is_array($_POST['serversdisabled'])) {
-		foreach($pconfig['serversdisabled'] as $svrent) {
+		foreach ($pconfig['serversdisabled'] as $svrent) {
 			if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
 				$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"disabled\" list)."), $svrent);
-			}
-			else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
+			} else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
 				$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"disabled\" list)."), $svrent);
 			}
 		}
@@ -161,19 +169,23 @@ if ($_POST) {
 
 	$m = array();
 
-	for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++)
+	for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
 		$m[$config['load_balancer']['monitor_type'][$i]['name']] = $config['load_balancer']['monitor_type'][$i];
+	}
 
-	if (!isset($m[$_POST['monitor']]))
+	if (!isset($m[$_POST['monitor']])) {
 		$input_errors[] = gettext("Invalid monitor chosen.");
+	}
 
 	if (!$input_errors) {
 		$poolent = array();
-		if(isset($id) && $a_pool[$id])
+		if (isset($id) && $a_pool[$id]) {
 			$poolent = $a_pool[$id];
+		}
 
-		if($poolent['name'] != "")
+		if ($poolent['name'] != "") {
 			$changedesc .= sprintf(gettext(" modified '%s' pool:"), $poolent['name']);
+		}
 
 		update_if_changed("name", $poolent['name'], $_POST['name']);
 		update_if_changed("mode", $poolent['mode'], $_POST['mode']);
@@ -187,12 +199,14 @@ if ($_POST) {
 		if (isset($id) && $a_pool[$id]) {
 			/* modify all virtual servers with this name */
 			for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
-				if ($config['load_balancer']['virtual_server'][$i]['lbpool'] == $a_pool[$id]['name'])
+				if ($config['load_balancer']['virtual_server'][$i]['lbpool'] == $a_pool[$id]['name']) {
 					$config['load_balancer']['virtual_server'][$i]['lbpool'] = $poolent['name'];
+				}
 			}
 			$a_pool[$id] = $poolent;
-		} else
+		} else {
 			$a_pool[] = $poolent;
+		}
 
 		if ($changecount > 0) {
 			/* Mark pool dirty */
@@ -205,7 +219,7 @@ if ($_POST) {
 	}
 }
 
-$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Pool"),gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Pool"), gettext("Edit"));
 $shortcut_section = "relayd";
 
 include("head.inc");
@@ -213,7 +227,7 @@ include("head.inc");
 
 <script type="text/javascript">
 //<![CDATA[
-events.push(function(){
+events.push(function() {
 
 	// Disables the specified input element
 	function disableInput(id, disable) {
@@ -232,9 +246,9 @@ events.push(function(){
 		var len = From.length;
 		var option;
 
-		if(len > 1) {
-			for(i=0; i<len; i++) {
-				if(From.eq(i).is(':selected')) {
+		if (len > 1) {
+			for (i=0; i<len; i++) {
+				if (From.eq(i).is(':selected')) {
 					option = From.eq(i).val();
 					value  = From.eq(i).text();
 					To.append(new Option(value, option));
@@ -249,7 +263,7 @@ events.push(function(){
 		if ($("#mode").val() == "failover") {
 			disableInput('movetoenabled', $('[name="servers[]"] option').length > 0);
 		} else {
-			disableInput('movetoenabled',false);
+			disableInput('movetoenabled', false);
 		}
 	}
 
@@ -262,8 +276,8 @@ events.push(function(){
 		var len = $('[name="servers[]"] option').length;
 		var option;
 
-		if(len > 1) {
-			for(i=len-1; i>0; i--) {
+		if (len > 1) {
+			for (i=len-1; i>0; i--) {
 				option = $('[name="servers[]"] option').eq(i).val();
 				$('[name="serversdisabled[]"]').append(new Option(option, option));
 				$('[name="servers[]"] option').eq(i).remove();
@@ -310,7 +324,7 @@ events.push(function(){
 	checkPoolControls();
 
 	// On submit
-	$('form').submit(function(){
+	$('form').submit(function() {
 		AllServers($('[name="servers[]"] option'), true);
 		AllServers($('[name="serversdisabled[]"] option'), true);
 	});
@@ -320,8 +334,9 @@ events.push(function(){
 </script>
 
 <?php
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
 $form = new Form(new Form_Button(
 	'Submit',
@@ -375,10 +390,11 @@ $section = new Form_Section('Add item to the pool');
 
 $monitorlist = array();
 
-foreach ($config['load_balancer']['monitor_type'] as $monitor)
+foreach ($config['load_balancer']['monitor_type'] as $monitor) {
 	$monitorlist[$monitor['name']] = $monitor['name'];
+}
 
-if(count($config['load_balancer']['monitor_type'])) {
+if (count($config['load_balancer']['monitor_type'])) {
 	$section->addInput(new Form_Select(
 		'monitor',
 		'Monitor',
@@ -417,8 +433,9 @@ $list = array();
 
 if (is_array($pconfig['serversdisabled'])) {
 	foreach ($pconfig['serversdisabled'] as $svrent) {
-		if ($svrent != '')
+		if ($svrent != '') {
 			$list[$svrent] = $svrent;
+		}
 	}
 }
 
@@ -483,7 +500,7 @@ print($form);
 ?>
 <script type="text/javascript">
 //<![CDATA[
-events.push(function(){
+events.push(function() {
 
 	// --------- Autocomplete -----------------------------------------------------------------------------------------
 	var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
diff --git a/src/usr/local/www/load_balancer_setting.php b/src/usr/local/www/load_balancer_setting.php
index 13dacb5fbc..204d7623a7 100644
--- a/src/usr/local/www/load_balancer_setting.php
+++ b/src/usr/local/www/load_balancer_setting.php
@@ -120,20 +120,23 @@ if ($_POST) {
 	}
 }
 
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Settings"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Settings"));
 $shortcut_section = "relayd";
 
 include("head.inc");
 
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
-if ($savemsg)
+if ($savemsg) {
 	print_info_box($savemsg, 'success');
+}
 
-if (is_subsystem_dirty('loadbalancer'))
+if (is_subsystem_dirty('loadbalancer')) {
 	print_info_box_np(gettext("The load balancer configuration has been changed") . ' ' .
 					  gettext("You must apply the changes in order for them to take effect."), 'Apply', null, false, 'danger');
+}
 
 /* active tabs */
 $tab_array = array();
diff --git a/src/usr/local/www/load_balancer_virtual_server.php b/src/usr/local/www/load_balancer_virtual_server.php
index 41439a44d4..2daed10c0d 100644
--- a/src/usr/local/www/load_balancer_virtual_server.php
+++ b/src/usr/local/www/load_balancer_virtual_server.php
@@ -126,14 +126,17 @@ $shortcut_section = "relayd-virtualservers";
 
 include("head.inc");
 
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
-if ($savemsg)
+if ($savemsg) {
 	print_info_box($savemsg);
+}
 
-if (is_subsystem_dirty('loadbalancer'))
+if (is_subsystem_dirty('loadbalancer')) {
 	print_info_box_np(gettext("The virtual server configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
 
 /* active tabs */
 $tab_array = array();
@@ -163,9 +166,9 @@ display_top_tabs($tab_array);
 				</thead>
 				<tbody>
 <?php
-if(!empty($a_vs)) {
+if (!empty($a_vs)) {
 	$i = 0;
-	foreach($a_vs as $a_v) {
+	foreach ($a_vs as $a_v) {
 ?>
 					<tr>
 						<td><?=htmlspecialchars($a_v['name'])?></td>
diff --git a/src/usr/local/www/load_balancer_virtual_server_edit.php b/src/usr/local/www/load_balancer_virtual_server_edit.php
index b4472dcf57..56e85b8907 100644
--- a/src/usr/local/www/load_balancer_virtual_server_edit.php
+++ b/src/usr/local/www/load_balancer_virtual_server_edit.php
@@ -198,8 +198,9 @@ $shortcut_section = "relayd-virtualservers";
 
 include("head.inc");
 
-if ($input_errors)
+if ($input_errors) {
 	print_input_errors($input_errors);
+}
 
 $form = new Form();
 
@@ -307,7 +308,7 @@ print_info_box(gettext('Don\'t forget to add a firewall rule for the virtual ser
 ?>
 <script type="text/javascript">
 //<![CDATA[
-events.push(function(){
+events.push(function() {
     // --------- Autocomplete -----------------------------------------------------------------------------------------
     var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
     var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
