commit f3ec04877ba7ef9aa4e0c43d34cec0f58a53891f
Author: Phil Davis <phil.davis@inf.org>
Date:   Tue Apr 14 14:10:58 2015 +0545

    Code style for small things in usr-local-www

diff --git a/usr/local/www/classes/maintable.inc b/usr/local/www/classes/maintable.inc
index 49d614ef19..1478de8cad 100644
--- a/usr/local/www/classes/maintable.inc
+++ b/usr/local/www/classes/maintable.inc
@@ -1,31 +1,31 @@
 <?php
 /* $Id$ */
 /*
-        part of pfSense (https://www.pfsense.org/)
-
-        Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
-        All rights reserved.
-
-        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.
-
-        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.
+	part of pfSense (https://www.pfsense.org/)
+
+	Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
+	All rights reserved.
+
+	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.
+
+	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.
 */
 
 /*
@@ -52,7 +52,7 @@ class MainTable {
 	}
 
 	function add_content_array($rows) {
-		foreach($rows as $row) {
+		foreach ($rows as $row) {
 			$this->content[] = $row;
 			$this->rows++;
 		}
@@ -160,16 +160,20 @@ class MainTable {
 	private function display_buttons($row) {
 		echo "    <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" summary=\"display buttons\">\n";
 		echo "      <tr>\n";
-		if ($this->buttons['move'])
+		if ($this->buttons['move']) {
 			echo $this->display_button('move', $row);
-		if ($this->buttons['edit'])
+		}
+		if ($this->buttons['edit']) {
 			echo $this->display_button('edit', $row);
+		}
 		echo "      </tr>\n";
 		echo "      <tr>\n";
-		if ($this->buttons['del'])
+		if ($this->buttons['del']) {
 			echo $this->display_button('del', $row);
-		if ($this->buttons['dup'])
+		}
+		if ($this->buttons['dup']) {
 			echo $this->display_button('dup', $row);
+		}
 		echo "      </tr>\n";
 		echo "    </table>\n";
 	}
diff --git a/usr/local/www/filebrowser/browser.js b/usr/local/www/filebrowser/browser.js
index c9788c4e48..2769db37d9 100644
--- a/usr/local/www/filebrowser/browser.js
+++ b/usr/local/www/filebrowser/browser.js
@@ -16,14 +16,15 @@ jQuery(document).ready(
 function fbBrowse(path) {
 	jQuery("#fileContent").fadeOut();
 
-	if(jQuery("#fbCurrentDir"))
+	if (jQuery("#fbCurrentDir")) {
 		jQuery("#fbCurrentDir").html("Loading ...");
+	}
 
 	jQuery.ajax(
 		"/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"),
 		{ type: "get", complete: fbComplete }
 	);
-	
+
 }
 
 function fbComplete(req) {
@@ -36,7 +37,7 @@ function fbComplete(req) {
 		fbFile:  function() { jQuery("#fbTarget").val(this.id);             }
 	}
 
-	for(var type in actions) {
+	for (var type in actions) {
 		jQuery("#fbBrowser ." + type).each(
 			function() {
 				jQuery(this).click(actions[type]);
diff --git a/usr/local/www/filebrowser/browser.php b/usr/local/www/filebrowser/browser.php
index dea747eafc..8ab05db48b 100644
--- a/usr/local/www/filebrowser/browser.php
+++ b/usr/local/www/filebrowser/browser.php
@@ -15,14 +15,18 @@ function get_content($dir) {
 	clearstatcache();
 	$fd = @opendir($dir);
 
-	while($entry = @readdir($fd)) {
-		if($entry == ".")                 continue;
-		if($entry == ".." && $dir == "/") continue;
-
-		if(is_dir("{$dir}/{$entry}"))
+	while ($entry = @readdir($fd)) {
+		if ($entry == ".") {
+			continue;
+		}
+		if ($entry == ".." && $dir == "/") {
+			continue;
+		}
+		if (is_dir("{$dir}/{$entry}")) {
 			array_push($dirs, $entry);
-		else
+		} else {
 			array_push($files, $entry);
+		}
 	}
 
 	@closedir($fd);
@@ -34,8 +38,9 @@ function get_content($dir) {
 }
 
 $path = realpath(strlen($_GET['path']) > 0 ? $_GET['path'] : "/");
-if(is_file($path))
+if (is_file($path)) {
 	$path = dirname($path);
+}
 
 // ----- header -----
 ?>
@@ -54,15 +59,14 @@ if(is_file($path))
 <?php
 
 // ----- read contents -----
-if(is_dir($path)) {
+if (is_dir($path)) {
 	list($dirs, $files) = get_content($path);
 ?>
-			
+
 		</td>
 	</tr>
 <?php
-}
-else {
+} else {
 ?>
 			Directory does not exist.
 		</td>
@@ -73,7 +77,7 @@ else {
 }
 
 // ----- directories -----
-foreach($dirs as $dir):
+foreach ($dirs as $dir):
 	$realDir = realpath("{$path}/{$dir}");
 ?>
 	<tr>
@@ -90,56 +94,56 @@ foreach($dirs as $dir):
 endforeach;
 
 // ----- files -----
-foreach($files as $file):
+foreach ($files as $file):
 	$ext = strrchr($file, ".");
 
 	switch ($ext) {
-	   case ".css":
-	   case ".html":
-	   case ".xml":
-		$type = "code";
-		break;
-	   case ".rrd":
-		$type = "database";
-		break;
-	   case ".gif":
-	   case ".jpg":
-	   case ".png":
-		$type = "image";
-		break;
-	   case ".js":
-		 $type = "js";
-		break;
-	   case ".pdf":
-		$type = "pdf";
-		break;
-	   case ".inc":
-	   case ".php":
-		$type = "php";
-		break;
-	   case ".conf":
-	   case ".pid":
-	   case ".sh":
-		$type = "system";
-		break;
-	   case ".bz2":
-	   case ".gz":
-	   case ".tgz":
-	   case ".zip":
-		$type = "zip";
-		break;
-	   default:
-		$type = "generic";
+		case ".css":
+		case ".html":
+		case ".xml":
+			$type = "code";
+			break;
+		case ".rrd":
+			$type = "database";
+			break;
+		case ".gif":
+		case ".jpg":
+		case ".png":
+			$type = "image";
+			break;
+		case ".js":
+			$type = "js";
+			break;
+		case ".pdf":
+			$type = "pdf";
+			break;
+		case ".inc":
+		case ".php":
+			$type = "php";
+			break;
+		case ".conf":
+		case ".pid":
+		case ".sh":
+			$type = "system";
+			break;
+		case ".bz2":
+		case ".gz":
+		case ".tgz":
+		case ".zip":
+			$type = "zip";
+			break;
+		default:
+			$type = "generic";
 	}
 
 	$fqpn = "{$path}/{$file}";
 
-	if(is_file($fqpn)) {
+	if (is_file($fqpn)) {
 		$fqpn = realpath($fqpn);
 		$size = sprintf("%.2f KiB", filesize($fqpn) / 1024);
-	}
-	else
+	} else {
 		$size = "";
+	}
 
 ?>
 	<tr>
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php
index f2e1191edb..8d8996947a 100644
--- a/usr/local/www/includes/functions.inc.php
+++ b/usr/local/www/includes/functions.inc.php
@@ -5,7 +5,7 @@
 	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
 */
 
-if(Connection_Aborted()) {
+if (Connection_Aborted()) {
 	exit;
 }
 
@@ -37,34 +37,35 @@ function get_gatewaystats() {
 	$gateways_status = return_gateways_status(true);
 	$data = "";
 	$isfirst = true;
-	foreach($a_gateways as $gname => $gw) {
-		if(!$isfirst)
+	foreach ($a_gateways as $gname => $gw) {
+		if (!$isfirst) {
 			$data .= ",";
+		}
 		$isfirst = false;
 		$data .= $gw['name'] . ",";
 		if ($gateways_status[$gname]) {
 			$data .= "<b>" . lookup_gateway_ip_by_name($gname) . "</b>,";
 			$gws = $gateways_status[$gname];
-			switch(strtolower($gws['status'])) {
-			case "none":
-				$online = "Online";
-				$bgcolor = "#90EE90";  // lightgreen
-				break;
-			case "down":
-				$online = "Offline";
-				$bgcolor = "#F08080";  // lightcoral
-				break;
-			case "delay":
-				$online = "Latency";
-				$bgcolor = "#F0E68C";  // khaki
-				break;
-			case "loss":
-				$online = "Packetloss";
-				$bgcolor = "#F0E68C";  // khaki
-				break;
-			default:
-				$online = "Pending";
-				break;
+			switch (strtolower($gws['status'])) {
+				case "none":
+					$online = "Online";
+					$bgcolor = "#90EE90";  // lightgreen
+					break;
+				case "down":
+					$online = "Offline";
+					$bgcolor = "#F08080";  // lightcoral
+					break;
+				case "delay":
+					$online = "Latency";
+					$bgcolor = "#F0E68C";  // khaki
+					break;
+				case "loss":
+					$online = "Packetloss";
+					$bgcolor = "#F0E68C";  // khaki
+					break;
+				default:
+					$online = "Pending";
+					break;
 			}
 		} else {
 			$data .= "~,";
@@ -82,8 +83,9 @@ function get_gatewaystats() {
 function get_uptime() {
 	$uptime = get_uptime_sec();
 
-	if(intval($uptime) == 0)
+	if (intval($uptime) == 0) {
 		return;
+	}
 
 	$updays = (int)($uptime / 86400);
 	$uptime %= 86400;
@@ -94,19 +96,23 @@ function get_uptime() {
 	$upsecs = (int)($uptime);
 
 	$uptimestr = "";
-	if ($updays > 1)
+	if ($updays > 1) {
 		$uptimestr .= "$updays Days ";
-	else if ($updays > 0)
+	} else if ($updays > 0) {
 		$uptimestr .= "1 Day ";
+	}
 
-	if ($uphours > 1)
+	if ($uphours > 1) {
 		$hours = "s";
+	}
 
-	if ($upmins > 1)
+	if ($upmins > 1) {
 		$minutes = "s";
+	}
 
-	if ($upmins > 1)
+	if ($upmins > 1) {
 		$seconds = "s";
+	}
 
 	$uptimestr .= sprintf("%02d Hour$hours %02d Minute$minutes %02d Second$seconds", $uphours, $upmins, $upsecs);
 	return $uptimestr;
@@ -124,8 +130,9 @@ function cpu_usage() {
 	$totalEnd = array_sum($cpuTicks2);
 
 	// Something wrapped ?!?!
-	if ($totalEnd <= $totalStart)
+	if ($totalEnd <= $totalStart) {
 		return 0;
+	}
 
 	// Calculate total cycles used
 	$totalUsed = ($totalEnd - $totalStart) - ($cpuTicks2['idle'] - $cpuTicks['idle']);
@@ -139,23 +146,27 @@ function cpu_usage() {
 function get_pfstate($percent=false) {
 	global $config;
 	$matches = "";
-	if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0)
+	if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) {
 		$maxstates="{$config['system']['maximumstates']}";
-	else
+	} else {
 		$maxstates=pfsense_default_state_size();
+	}
 	$curentries = `/sbin/pfctl -si |grep current`;
 	if (preg_match("/([0-9]+)/", $curentries, $matches)) {
 		$curentries = $matches[1];
 	}
-	if (!is_numeric($curentries))
+	if (!is_numeric($curentries)) {
 		$curentries = 0;
-	if ($percent)
-		if (intval($maxstates) > 0)
+	}
+	if ($percent) {
+		if (intval($maxstates) > 0) {
 			return round(($curentries / $maxstates) * 100, 0);
-		else
+		} else {
 			return "NA";
-	else
+		}
+	} else {
 		return $curentries . "/" . $maxstates;
+	}
 }
 
 function has_temp() {
@@ -171,20 +182,23 @@ function get_hwtype() {
 
 function get_mbuf($percent=false) {
 	$mbufs_output=trim(`/usr/bin/netstat -mb | /usr/bin/grep "mbuf clusters in use" | /usr/bin/awk '{ print $1 }'`);
-	list( $mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max ) = explode( "/", $mbufs_output);
-	if ($percent)
-		if ($mbufs_max > 0)
+	list($mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max) = explode("/", $mbufs_output);
+	if ($percent) {
+		if ($mbufs_max > 0) {
 			return round(($mbufs_total / $mbufs_max) * 100, 0);
-		else
+		} else {
 			return "NA";
-	else
+		}
+	} else {
 		return "{$mbufs_total}/{$mbufs_max}";
+	}
 }
 
 function get_temp() {
 	$temp_out = get_single_sysctl("dev.cpu.0.temperature");
-	if ($temp_out == "")
+	if ($temp_out == "") {
 		$temp_out = get_single_sysctl("hw.acpi.thermal.tz0.temperature");
+	}
 
 	// Remove 'C' from the end
 	return rtrim($temp_out, 'C');
@@ -221,11 +235,12 @@ function disk_usage($slice = '/') {
 function swap_usage() {
 	exec("/usr/sbin/swapinfo", $swap_info);
 	$swap_used = "";
-	foreach ($swap_info as $line)
+	foreach ($swap_info as $line) {
 		if (preg_match('/(\d+)%$/', $line, $matches)) {
 			$swap_used = $matches[1];
 			break;
 		}
+	}
 
 	return $swap_used;
 }
@@ -238,8 +253,9 @@ function mem_usage() {
 		$freeMem = get_single_sysctl("vm.stats.vm.v_free_count");
 		$usedMem = $totalMem - ($inactiveMem + $cachedMem + $freeMem);
 		$memUsage = round(($usedMem * 100) / $totalMem, 0);
-	} else
+	} else {
 		$memUsage = "NA";
+	}
 
 	return $memUsage;
 }
@@ -257,8 +273,9 @@ function get_cpufreq() {
 	$maxfreq = $maxfreq[0];
 	$curfreq = "";
 	$curfreq = get_single_sysctl('dev.cpu.0.freq');
-	if (($curfreq > 0) && ($curfreq != $maxfreq))
+	if (($curfreq > 0) && ($curfreq != $maxfreq)) {
 		$out = "Current: {$curfreq} MHz, Max: {$maxfreq} MHz";
+	}
 	return $out;
 }
 
@@ -295,24 +312,24 @@ function get_interfacestats() {
 	$new_data = "";
 
 	//build data arrays
-	foreach ($ifdescrs as $ifdescr => $ifname){
+	foreach ($ifdescrs as $ifdescr => $ifname) {
 		$ifinfo = get_interface_info($ifdescr);
-			$new_data .= "{$ifinfo['inpkts']},";
-			$new_data .= "{$ifinfo['outpkts']},";
-			$new_data .= format_bytes($ifinfo['inbytes']) . ",";
-			$new_data .= format_bytes($ifinfo['outbytes']) . ",";
-			if (isset($ifinfo['inerrs'])){
-				$new_data .= "{$ifinfo['inerrs']},";
-				$new_data .= "{$ifinfo['outerrs']},";
-			}
-			else{
-				$new_data .= "0,";
-				$new_data .= "0,";
-			}
-			if (isset($ifinfo['collisions']))
-				$new_data .= htmlspecialchars($ifinfo['collisions']) . ",";
-			else
-				$new_data .= "0,";
+		$new_data .= "{$ifinfo['inpkts']},";
+		$new_data .= "{$ifinfo['outpkts']},";
+		$new_data .= format_bytes($ifinfo['inbytes']) . ",";
+		$new_data .= format_bytes($ifinfo['outbytes']) . ",";
+		if (isset($ifinfo['inerrs'])) {
+			$new_data .= "{$ifinfo['inerrs']},";
+			$new_data .= "{$ifinfo['outerrs']},";
+		} else {
+			$new_data .= "0,";
+			$new_data .= "0,";
+		}
+		if (isset($ifinfo['collisions'])) {
+			$new_data .= htmlspecialchars($ifinfo['collisions']) . ",";
+		} else {
+			$new_data .= "0,";
+		}
 	}//end for
 
 	return $new_data;
@@ -325,25 +342,28 @@ function get_interfacestatus() {
 	//build interface list for widget use
 	$ifdescrs = get_configured_interface_with_descr();
 
-	foreach ($ifdescrs as $ifdescr => $ifname){
+	foreach ($ifdescrs as $ifdescr => $ifname) {
 		$ifinfo = get_interface_info($ifdescr);
 		$data .= $ifname . ",";
-		if($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
+		if ($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
 			$data .= "up";
-		}else if ($ifinfo['status'] == "no carrier") {
+		} else if ($ifinfo['status'] == "no carrier") {
 			$data .= "down";
-		}else if ($ifinfo['status'] == "down") {
+		} else if ($ifinfo['status'] == "down") {
 			$data .= "block";
 		}
 		$data .= ",";
-		if ($ifinfo['ipaddr'])
+		if ($ifinfo['ipaddr']) {
 			$data .= "<strong>" . htmlspecialchars($ifinfo['ipaddr']) . "</strong>";
+		}
 		$data .= ",";
-		if ($ifinfo['ipaddrv6'])
+		if ($ifinfo['ipaddrv6']) {
 			$data .= "<strong>" . htmlspecialchars($ifinfo['ipaddrv6']) . "</strong>";
+		}
 		$data .= ",";
-		if ($ifinfo['status'] != "down")
+		if ($ifinfo['status'] != "down") {
 			$data .= htmlspecialchars($ifinfo['media']);
+		}
 
 		$data .= "~";
 
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php
index 8f5dd91e5b..6685034901 100644
--- a/usr/local/www/installer/installer.php
+++ b/usr/local/www/installer/installer.php
@@ -35,7 +35,7 @@ require("guiconfig.inc");
 
 define('PC_SYSINSTALL', '/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh');
 
-if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
+if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
 	header("Location: /");
 	exit;
 }
@@ -63,7 +63,7 @@ switch ($_REQUEST['state']) {
 		exit;
 
 	default:
-		installer_main();	
+		installer_main();
 }
 
 function easy_install($fstype = "UFS+S") {
@@ -102,21 +102,23 @@ function easy_install($fstype = "UFS+S") {
 function write_out_pc_sysinstaller_config($disks, $bootmanager = "bsd") {
 	$diskareas = "";
 	$fd = fopen("/usr/sbin/pc-sysinstall/examples/pfSense-install.cfg", "w");
-	if(!$fd) 
+	if (!$fd) {
 		return true;
-	if($bootmanager == "") 
-	 	$bootmanager = "none";
+	}
+	if ($bootmanager == "") {
+		$bootmanager = "none";
+	}
 	// Yes, -1.  We ++ early in loop.
 	$numdisks = -1;
 	$lastdisk = "";
 	$diskdefs = "";
 	// Run through the disks and create the conf areas for pc-sysinstaller
-	foreach($disks as $disksa) {
+	foreach ($disks as $disksa) {
 		$fstype = $disksa['fstype'];
 		$size = $disksa['size'];
 		$mountpoint = $disksa['mountpoint'];
 		$disk = $disksa['disk'];
-		if($disk <> $lastdisk) {
+		if ($disk <> $lastdisk) {
 			$lastdisk = $disk;
 			$numdisks++;
 			$diskdefs .= "# disk {$disk}\n";
@@ -126,14 +128,15 @@ function write_out_pc_sysinstaller_config($disks, $bootmanager = "bsd") {
 			$diskdefs .= "commitDiskPart\n\n";
 		}
 		$diskareas .= "disk{$numdisks}-part={$fstype} {$size} {$mountpoint} \n";
-		if($encpass)
+		if ($encpass) {
 			$diskareas .= "encpass={$encpass}\n";
+		}
 	}
-	
+
 	$config = <<<EOF
 # Sample configuration file for an installation using pc-sysinstall
 # This file was automatically generated by installer.php
- 
+
 installMode=fresh
 installInteractive=yes
 installType=FreeBSD
@@ -148,8 +151,8 @@ installMedium=LiveCD
 # Size 0 means use the rest of the slice size
 # Alternatively, you can append .eli to any of
 # the above filesystem types to encrypt that disk.
-# If you with to use a passphrase with this 
-# encrypted partition, on the next line 
+# If you with to use a passphrase with this
+# encrypted partition, on the next line
 # the flag "encpass=" should be entered:
 # encpass=mypass
 # disk0-part=UFS 500 /boot
@@ -177,13 +180,15 @@ EOF;
 
 function start_installation() {
 	global $g, $fstype, $savemsg;
-	if(file_exists("/tmp/install_complete"))
+	if (file_exists("/tmp/install_complete")) {
 		return;
+	}
 	$ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'");
-	if($ps_running)	
+	if ($ps_running) {
 		return;
+	}
 	$fd = fopen("/tmp/installer.sh", "w");
-	if(!$fd) {
+	if (!$fd) {
 		die(gettext("Could not open /tmp/installer.sh for writing"));
 		exit;
 	}
@@ -208,16 +213,17 @@ function pcsysinstall_get_disk_info($diskname) {
 	global $g, $fstype, $savemsg;
 	$disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`);
 	$disks_array = array();
-	foreach($disk as $d) {
+	foreach ($disk as $d) {
 		$disks_info = explode(":", $d);
 		$tmp_array = array();
-		if($disks_info[0] == $diskname) {
+		if ($disks_info[0] == $diskname) {
 			$disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`);
 			$disk_info_split = explode("=", $disk_info);
-			foreach($disk_info as $di) { 
+			foreach ($disk_info as $di) {
 				$di_s = explode("=", $di);
-				if($di_s[0])
+				if ($di_s[0]) {
 					$tmp_array[$di_s[0]] = $di_s[1];
+				}
 			}
 			$tmp_array['size']--;
 			$tmp_array['disk'] = trim($disks_info[0]);
@@ -232,16 +238,18 @@ function installer_find_all_disks() {
 	global $g, $fstype, $savemsg;
 	$disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`);
 	$disks_array = array();
-	foreach($disk as $d) {
-		if(!$d) 
+	foreach ($disk as $d) {
+		if (!$d) {
 			continue;
+		}
 		$disks_info = explode(":", $d);
 		$tmp_array = array();
 		$disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`);
-		foreach($disk_info as $di) { 
+		foreach ($disk_info as $di) {
 			$di_s = explode("=", $di);
-			if($di_s[0])
+			if ($di_s[0]) {
 				$tmp_array[$di_s[0]] = $di_s[1];
+			}
 		}
 		$tmp_array['size']--;
 		$tmp_array['disk'] = trim($disks_info[0]);
@@ -254,72 +262,100 @@ function installer_find_all_disks() {
 function update_installer_status() {
 	global $g, $fstype, $savemsg;
 	// Ensure status files exist
-	if(!file_exists("/tmp/installer_installer_running"))
+	if (!file_exists("/tmp/installer_installer_running")) {
 		touch("/tmp/installer_installer_running");
+	}
 	$status = `cat /tmp/.pc-sysinstall/pc-sysinstall.log`;
 	$status = str_replace("\n", "\\n", $status);
 	$status = str_replace("\n", "\\r", $status);
 	$status = str_replace("'", "\\'", $status);
 	echo "document.forms[0].installeroutput.value='$status';\n";
-	echo "document.forms[0].installeroutput.scrollTop = document.forms[0].installeroutput.scrollHeight;\n";	
+	echo "document.forms[0].installeroutput.scrollTop = document.forms[0].installeroutput.scrollHeight;\n";
 	// Find out installer progress
 	$progress = "5";
-	if(strstr($status, "Running: dd")) 
+	if (strstr($status, "Running: dd")) {
 		$progress = "6";
-	if(strstr($status, "Running: gpart create -s GPT")) 
+	}
+	if (strstr($status, "Running: gpart create -s GPT")) {
 		$progress = "7";
-	if(strstr($status, "Running: gpart bootcode")) 
+	}
+	if (strstr($status, "Running: gpart bootcode")) {
 		$progress = "7";
-	if(strstr($status, "Running: newfs -U")) 
+	}
+	if (strstr($status, "Running: newfs -U")) {
 		$progress = "8";
-	if(strstr($status, "Running: sync")) 
+	}
+	if (strstr($status, "Running: sync")) {
 		$progress = "9";
-	if(strstr($status, "/boot /mnt/boot")) 
+	}
+	if (strstr($status, "/boot /mnt/boot")) {
 		$progress = "10";
-	if(strstr($status, "/COPYRIGHT /mnt/COPYRIGHT"))
+	}
+	if (strstr($status, "/COPYRIGHT /mnt/COPYRIGHT")) {
 		$progress = "11";
-	if(strstr($status, "/bin /mnt/bin"))
+	}
+	if (strstr($status, "/bin /mnt/bin")) {
 		$progress = "12";
-	if(strstr($status, "/conf /mnt/conf"))
+	}
+	if (strstr($status, "/conf /mnt/conf")) {
 		$progress = "15";
-	if(strstr($status, "/conf.default /mnt/conf.default"))
+	}
+	if (strstr($status, "/conf.default /mnt/conf.default")) {
 		$progress = "20";
-	if(strstr($status, "/dev /mnt/dev"))
+	}
+	if (strstr($status, "/dev /mnt/dev")) {
 		$progress = "25";
-	if(strstr($status, "/etc /mnt/etc"))
+	}
+	if (strstr($status, "/etc /mnt/etc")) {
 		$progress = "30";
-	if(strstr($status, "/home /mnt/home"))
+	}
+	if (strstr($status, "/home /mnt/home")) {
 		$progress = "35";
-	if(strstr($status, "/kernels /mnt/kernels"))
+	}
+	if (strstr($status, "/kernels /mnt/kernels")) {
 		$progress = "40";
-	if(strstr($status, "/libexec /mnt/libexec"))
+	}
+	if (strstr($status, "/libexec /mnt/libexec")) {
 		$progress = "50";
-	if(strstr($status, "/lib /mnt/lib"))
+	}
+	if (strstr($status, "/lib /mnt/lib")) {
 		$progress = "60";
-	if(strstr($status, "/root /mnt/root"))
+	}
+	if (strstr($status, "/root /mnt/root")) {
 		$progress = "70";
-	if(strstr($status, "/sbin /mnt/sbin"))
+	}
+	if (strstr($status, "/sbin /mnt/sbin")) {
 		$progress = "75";
-	if(strstr($status, "/sys /mnt/sys"))
+	}
+	if (strstr($status, "/sys /mnt/sys")) {
 		$progress = "80";
-	if(strstr($status, "/usr /mnt/usr"))
+	}
+	if (strstr($status, "/usr /mnt/usr")) {
 		$progress = "95";
-	if(strstr($status, "/usr /mnt/usr"))
+	}
+	if (strstr($status, "/usr /mnt/usr")) {
 		$progress = "90";
-	if(strstr($status, "/var /mnt/var"))
+	}
+	if (strstr($status, "/var /mnt/var")) {
 		$progress = "95";
-	if(strstr($status, "cap_mkdb /etc/login.conf"))
+	}
+	if (strstr($status, "cap_mkdb /etc/login.conf")) {
 		$progress = "96";
-	if(strstr($status, "Setting hostname"))
+	}
+	if (strstr($status, "Setting hostname")) {
 		$progress = "97";
-	if(strstr($status, "umount -f /mnt"))
+	}
+	if (strstr($status, "umount -f /mnt")) {
 		$progress = "98";
-	if(strstr($status, "umount -f /mnt"))
+	}
+	if (strstr($status, "umount -f /mnt")) {
 		$progress = "99";
-	if(strstr($status, "Installation finished"))
+	}
+	if (strstr($status, "Installation finished")) {
 		$progress = "100";
+	}
 	// Check for error and bail if we see one.
-	if(stristr($status, "error")) {
+	if (stristr($status, "error")) {
 		$error = true;
 		echo "\$('#installerrunning').html('<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"2\"><b>An error occurred.  Aborting installation.  <a href=\"/installer\">Back</a> to webInstaller'); ";
 		echo "\$('#progressbar').css('width','100%');\n";
@@ -327,19 +363,20 @@ function update_installer_status() {
 		return;
 	}
 	$running_old = trim(file_get_contents("/tmp/installer_installer_running"));
-	if($installer_running <> "running") {
+	if ($installer_running <> "running") {
 		$ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'");
-		if($ps_running)	{
+		if ($ps_running)	{
 			$running = "\$('#installerrunning').html('<table><tr><td valign=\"middle\"><img src=\"/themes/{$g['theme']}/images/misc/loader.gif\"></td><td valign=\"middle\">&nbsp;<font size=\"2\"><b>Installer running ({$progress}% completed)...</td></tr></table>'); ";
-			if($running_old <> $running) {
+			if ($running_old <> $running) {
 				echo $running;
-				file_put_contents("/tmp/installer_installer_running", "$running");			
+				file_put_contents("/tmp/installer_installer_running", "$running");
 			}
 		}
 	}
-	if($progress) 
+	if ($progress) {
 		echo "\$('#progressbar').css('width','{$progress}%');\n";
-	if(file_exists("/tmp/install_complete")) {
+	}
+	if (file_exists("/tmp/install_complete")) {
 		echo "\$('#installerrunning').html('<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"+1\">Installation completed.  Please <a href=\"/reboot.php\">reboot</a> to continue');\n";
 		echo "\$('#pbdiv').fadeOut();\n";
 		unlink_if_exists("/tmp/installer.sh");
@@ -356,8 +393,9 @@ function update_installer_status_win($status) {
 
 function begin_install() {
 	global $g, $savemsg;
-	if(file_exists("/tmp/install_complete"))
+	if (file_exists("/tmp/install_complete")) {
 		return;
+	}
 	unlink_if_exists("/tmp/install_complete");
 	update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."),$disk));
 	start_installation();
@@ -377,22 +415,22 @@ function head_html() {
 				width: 100%;
 				text-align: left;
 			}
-			a:link { 
+			a:link {
 				color: #000000;
 				text-decoration:underline;
 				font-size:14;
 			}
-			a:visited { 
+			a:visited {
 				color: #000000;
 				text-decoration:underline;
 				font-size:14;
 			}
-			a:hover { 
+			a:hover {
 				color: #FFFF00;
 				text-decoration: none;
 				font-size:14;
 			}
-			a:active { 
+			a:active {
 				color: #FFFF00;
 				text-decoration:underline;
 				font-size:14;
@@ -434,10 +472,13 @@ function body_html() {
 	</script>
 EOF;
 
-	if($one_two)
+	if ($one_two) {
 		echo "<p class=\"pgtitle\">{$pgtitle}</font></p>";
+	}
 
-	if ($savemsg) print_info_box($savemsg); 
+	if ($savemsg) {
+		print_info_box($savemsg);
+	}
 }
 
 function end_html() {
@@ -454,18 +495,18 @@ function template() {
 	echo <<<EOF
 	<div id="mainlevel">
 		<table width="100%" border="0" cellpadding="0" cellspacing="0">
-	 		<tr>
-	    		<td>
+			<tr>
+				<td>
 					<div id="mainarea">
 						<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
 							<tr>
-	     						<td class="tabcont" >
-	      							<form action="installer.php" method="post">
+								<td class="tabcont" >
+									<form action="installer.php" method="post">
 									<div id="pfsensetemplate">
 
 
 									</div>
-	     						</td>
+								</td>
 							</tr>
 						</table>
 					</div>
@@ -487,7 +528,7 @@ function verify_before_install() {
 	page_table_start($g['product_name'] . " installer - Verify final installation settings");
 	// If we are visiting this step from anything but the row editor / custom install
 	// then load the on disk layout contents if they are available.
-	if(!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) {
+	if (!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) {
 		$disks = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
 		$bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt"));
 		$restored_layout_from_file = true;
@@ -495,29 +536,33 @@ function verify_before_install() {
 	} else {
 		$disks = array();
 	}
-	if(!$bootmanager) 
+	if (!$bootmanager) {
 		$bootmanager = $_REQUEST['bootmanager'];
+	}
 	// echo "\n<!--" . print_r($_REQUEST, true) . " -->\n";
 	$disk = pcsysinstall_get_disk_info(htmlspecialchars($_REQUEST['disk']));
 	$disksize = format_bytes($disk['size'] * 1048576);
 	// Loop through posted items and create an array
-	for($x=0; $x<99; $x++) { // XXX: Make this more optimal
-		if(!$_REQUEST['fstype' . $x])
+	for ($x=0; $x<99; $x++) { // XXX: Make this more optimal
+		if (!$_REQUEST['fstype' . $x]) {
 			continue;
+		}
 		$tmparray = array();
-		if($_REQUEST['fstype' . $x] <> "SWAP") {
+		if ($_REQUEST['fstype' . $x] <> "SWAP") {
 			$tmparray['mountpoint'] = $_REQUEST['mountpoint' . $x];
 			// Check for encrypted slice /
-			if(stristr($_REQUEST['fstype' . $x], ".eli")) {
-				if($tmparray['mountpoint'] == "/") 
+			if (stristr($_REQUEST['fstype' . $x], ".eli")) {
+				if ($tmparray['mountpoint'] == "/") {
 					$encrypted_root = true;
+				}
 			}
 			// Check if we have a non-encrypted /boot
-			if($tmparray['mountpoint'] == "/boot") 	{
-				if(!stristr($_REQUEST['fstype' . $x], ".eli"))
+			if ($tmparray['mountpoint'] == "/boot") {
+				if (!stristr($_REQUEST['fstype' . $x], ".eli")) {
 					$non_encrypted_boot = true;
+				}
 			}
-			if($tmparray['mountpoint'] == "/conf") {	
+			if ($tmparray['mountpoint'] == "/conf") {
 				$tmparray['mountpoint'] = "/conf{$x}";
 				$error_txt[] = "/conf is not an allowed mount point and has been renamed to /conf{$x}.";
 			}
@@ -525,7 +570,7 @@ function verify_before_install() {
 			$tmparray['mountpoint'] = "none";
 		}
 		// If we have an encrypted /root and lack a non encrypted /boot, throw an error/warning
-		if($encrypted_root && !$non_encrypted_boot && !$non_encrypted_notice) {
+		if ($encrypted_root && !$non_encrypted_boot && !$non_encrypted_notice) {
 			$error_txt[] = "A non-encrypted /boot slice is required when encrypting the / slice";
 			$non_encrypted_notice = true;
 		}
@@ -547,12 +592,12 @@ function verify_before_install() {
 	<input type="hidden" name="bootmanager" value="{$bootmanager}">
 	<div id="mainlevel">
 		<table width="800" border="0" cellpadding="0" cellspacing="0">
-	 		<tr>
-	    		<td>
+			<tr>
+				<td>
 					<div id="mainarea">
 						<table width="100%" border="0" cellpadding="0" cellspacing="0">
 							<tr>
-	     						<td >
+								<td >
 									<div>
 										<center>
 											<div id="pfsensetemplate">
@@ -564,8 +609,9 @@ EOFAMBAC;
 													echo "<tr><td colspan=\"5\">";
 													print_input_errors($error_txt);
 													echo "</td></tr>";
-												} else 
+												} else {
 													echo "<tr><td>&nbsp;</td></tr>";
+												}
 
 	echo <<<EOFAMBACBAF
 
@@ -592,7 +638,7 @@ EOFAMBAC;
 
 EOFAMBACBAF;
 
-													foreach($disks as $disk) {
+													foreach ($disks as $disk) {
 														$desc = pcsysinstall_get_disk_info($disk['disk']);
 														echo "<tr>";
 														echo "<td>&nbsp;&nbsp;&nbsp;" . htmlspecialchars($disk['mountpoint']) . "</td>";
@@ -609,7 +655,7 @@ echo <<<EOFAMB
 											</div>
 										</center>
 									</div>
-	     						</td>
+								</td>
 							</tr>
 						</table>
 					</div>
@@ -617,8 +663,9 @@ echo <<<EOFAMB
 						<p/>
 						<input type="button" value="Cancel" onClick="javascript:document.location='installer.php?state=custominstall';"> &nbsp;&nbsp;
 EOFAMB;
-						if(!$error_txt) 
-						echo "<input type=\"submit\" value=\"Begin installation\"> <br />&nbsp;";
+						if (!$error_txt) {
+							echo "<input type=\"submit\" value=\"Begin installation\"> <br />&nbsp;";
+						}
 echo <<<EOFAMBASDF
 
 					</center>
@@ -649,12 +696,12 @@ function installing_gui() {
 		<tr><td>
 			<div id="mainlevel">
 				<table width="100%" border="0" cellpadding="0" cellspacing="0">
-			 		<tr>
-			    		<td>
+					<tr>
+						<td>
 							<div id="mainarea">
 								<table width="100%" border="0" cellpadding="0" cellspacing="0">
 									<tr>
-			     						<td>
+										<td>
 											<div id="pfsenseinstaller" width="100%">
 												<div id='installerrunning' width='100%' style="padding:8px; border:1px dashed #000000">
 													<table>
@@ -691,7 +738,7 @@ function installing_gui() {
 												<textarea name='installeroutput' id='installeroutput' rows="31" cols="90">
 												</textarea>
 											</div>
-			     						</td>
+										</td>
 									</tr>
 								</table>
 							</div>
@@ -711,8 +758,9 @@ EOF;
 
 function page_table_start($pgtitle = "") {
 	global $g, $fstype, $savemsg;
-	if($pgtitle == "") 
+	if ($pgtitle == "") {
 		$pgtitle = "{$g['product_name']} installer";
+	}
 	echo <<<EOF
 	<center>
 		<img border="0" src="/themes/{$g['theme']}/images/logo.gif"></a><br />
@@ -742,27 +790,29 @@ function page_table_end() {
 	</center>
 
 EOF;
-	
+
 }
 
 function installer_custom() {
 	global $g, $fstype, $savemsg;
 	global $select_txt, $custom_disks;
-	if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) 
+	if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
 		unlink("/tmp/.pc-sysinstall/pc-sysinstall.log");
+	}
 	$disks = installer_find_all_disks();
 	// Pass size of disks down to javascript.
 	$disk_sizes_js_txt = "var disk_sizes = new Array();\n";
-	foreach($disks as $disk) 
+	foreach ($disks as $disk) {
 		$disk_sizes_js_txt .= "disk_sizes['{$disk['disk']}'] = '{$disk['size']}';\n";
+	}
 	head_html();
 	body_html();
 	page_table_start($g['product_name'] . " installer - Customize disk(s) layout");
 	echo <<<EOF
 		<script type="text/javascript">
 			Array.prototype.in_array = function(p_val) {
-				for(var i = 0, l = this.length; i < l; i++) {
-					if(this[i] == p_val) {
+				for (var i = 0, l = this.length; i < l; i++) {
+					if (this[i] == p_val) {
 						return true;
 					}
 				}
@@ -772,43 +822,45 @@ function installer_custom() {
 				var totalsize = 0;
 				{$disk_sizes_js_txt}
 				// Run through all rows and process data
-				for(var x = 0; x<99; x++) { //optimize me better
-					if(\$('#fstype' + x).length) {
-						if(\$('#size' + x).val() == '')
+				for (var x = 0; x<99; x++) { //optimize me better
+					if (\$('#fstype' + x).length) {
+						if (\$('#size' + x).val() == '') {
 							\$('#size' + x).val(disk_sizes[\$('disk' + x).value]);
+						}
 						var fstype = \$('#fstype' + x).val();
-						if(fstype.substring(fstype.length - 4) == ".eli") {
+						if (fstype.substring(fstype.length - 4) == ".eli") {
 							\$('#encpass' + x).prop('disabled',false);
-							if(!encryption_warning_shown) {
+							if (!encryption_warning_shown) {
 								alert('NOTE: If you define a disk encryption password you will need to enter it on *EVERY* bootup!');
 								encryption_warning_shown = true;
 							}
-						} else { 
+						} else {
 							\$('#encpass' + x).prop('disabled',true);
 						}
 					}
 					// Calculate size allocations
-					if(\$('#size' + x).length) {
-						if(parseInt($('#size' + x).val()) > 0)
+					if (\$('#size' + x).length) {
+						if (parseInt($('#size' + x).val()) > 0) {
 							totalsize += parseInt($('#size' + x).val());
+						}
 					}
 				}
 				// If the totalsize element exists, set it and disable
-				if(\$('#totalsize').length) {
-					if(\$('#totalsize').val() != totalsize) {
+				if (\$('#totalsize').length) {
+					if (\$('#totalsize').val() != totalsize) {
 						// When size allocation changes, draw attention.
- 						jQuery('#totalsize').effect('highlight');
+						jQuery('#totalsize').effect('highlight');
 						\$('#totalsize').val(totalsize);
 					}
 					\$('#totalsize').prop('disabled',true);
 				}
-				if(\$('#disktotals').length) {
+				if (\$('#disktotals').length) {
 					var disks_seen = new Array();
 					var tmp_sizedisks = 0;
 					var disksseen = 0;
-					for(var xx = 0; xx<99; xx++) {
-						if(\$('#disk' + xx).length) {
-							if(!disks_seen.in_array(\$('#disk' + xx).val())) {
+					for (var xx = 0; xx<99; xx++) {
+						if (\$('#disk' + xx).length) {
+							if (!disks_seen.in_array(\$('#disk' + xx).val())) {
 								tmp_sizedisks += parseInt(disk_sizes[\$('#disk' + xx).val()]);
 								disks_seen[disksseen] = \$('#disk' + xx).val();
 								disksseen++;
@@ -818,33 +870,33 @@ function installer_custom() {
 					\$('#disktotals').prop('disabled',true);
 					\$('#disktotals').css('color','#000000');
 					var remaining = parseInt(\$('#disktotals').val()) - parseInt(\$('#totalsize').val());
-						if(remaining == 0) {
-							if(\$('#totalsize').length)
+						if (remaining == 0) {
+							if (\$('#totalsize').length)
 								\$('#totalsize').css({
 									'background':'#00FF00',
 									'color':'#000000'
 								});
 						} else {
-							if(\$('#totalsize').length)
+							if (\$('#totalsize').length)
 								\$('#totalsize').css({
 									'background':'#FFFFFF',
 									'color':'#000000'
 								});
 						}
-						if(parseInt(\$('#totalsize').val()) > parseInt(\$('#disktotals').val())) {
-							if(\$('#totalsize'))
+						if (parseInt(\$('#totalsize').val()) > parseInt(\$('#disktotals').val())) {
+							if (\$('#totalsize'))
 								\$('#totalsize').css({
 									'background':'#FF0000',
 									'color':'#000000'
-								});							
+								});
 						}
-						if(\$('#availalloc').length) {
+						if (\$('#availalloc').length) {
 							\$('#availalloc').prop('disabled',true);
 							\$('#availalloc').val(remaining);
-								\$('#availalloc').css({
-									'background':'#FFFFFF',
-									'color':'#000000'
-								});							
+							\$('#availalloc').css({
+								'background':'#FFFFFF',
+								'color':'#000000'
+							});
 						}
 					}
 				}
@@ -881,14 +933,14 @@ function installer_custom() {
 			<div id="mainlevel">
 				<center>
 				<table width="100%" border="0" cellpadding="5" cellspacing="0">
-			 		<tr>
-			    		<td>
+					<tr>
+						<td>
 							<center>
 							<div id="mainarea">
 								<center>
 								<table width="100%" border="0" cellpadding="5" cellspacing="5">
 									<tr>
-			     						<td>
+										<td>
 											<div id="pfsenseinstaller">
 												<center>
 												<div id='loadingdiv'>
@@ -898,7 +950,7 @@ function installer_custom() {
 																<img src="/themes/{$g['theme']}/images/misc/loader.gif">
 															</td>
 															<td valign="center">
-														 		&nbsp;Probing disks, please wait...
+																&nbsp;Probing disks, please wait...
 															</td>
 														</tr>
 													</table>
@@ -906,13 +958,16 @@ function installer_custom() {
 EOF;
 	ob_flush();
 	// Read bootmanager setting from disk if found
-	if(file_exists("/tmp/webInstaller_disk_bootmanager.txt"))
+	if (file_exists("/tmp/webInstaller_disk_bootmanager.txt")) {
 		$bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt"));
-	if($bootmanager == "none") 
+	}
+	if ($bootmanager == "none") {
 		$noneselected = " SELECTED";
-	if($bootmanager == "bsd") 
+	}
+	if ($bootmanager == "bsd") {
 		$bsdeselected = " SELECTED";
-	if(!$disks)  {
+	}
+	if (!$disks)  {
 		$custom_txt = gettext("ERROR: Could not find any suitable disks for installation.");
 	} else {
 		// Prepare disk selection dropdown
@@ -973,20 +1028,20 @@ EOF;
 		// echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size  - $first_disk_size -->\n\n";
 
 		// Check to see if a on disk layout exists
-		if(file_exists("/tmp/webInstaller_disk_layout.txt")) {
+		if (file_exists("/tmp/webInstaller_disk_layout.txt")) {
 			$disks_restored = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
 			$restored_layout_from_file = true;
 			$restored_layout_txt = "<br />* The previous disk layout was restored from a previous session";
 		}
 
 		// If we restored disk layout(s) from a file then build the rows
-		if($restored_layout_from_file == true) {
+		if ($restored_layout_from_file == true) {
 			$diskcounter = 0;
-			foreach($disks_restored as $dr) {
+			foreach ($disks_restored as $dr) {
 				$custom_txt .= return_rowhelper_row("$diskcounter", $dr['mountpoint'], $dr['fstype'], $dr['disk'], $dr['size'], $dr['encpass']);
 				$diskcounter++;
 			}
-		} else {		
+		} else {
 			// Construct the default rows that outline the disks configuration.
 			$custom_txt .= return_rowhelper_row("0", "/", "UFS+S", $first_disk, "{$first_disk_size}", "");
 			$custom_txt .= return_rowhelper_row("1", "none", "SWAP", $first_disk, "$swap_size", "");
@@ -1003,7 +1058,7 @@ EOF;
 		$custom_txt .= "<a onclick=\"javascript:addRowTo('maintable', 'formfldalias'); return false;\" href=\"#\">";
 		$custom_txt .= "<img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" alt=\"\" title=\"add another entry\" /></a>";
 		$custom_txt .= "</div>";
-		$custom_txt .= "</td></tr>";	
+		$custom_txt .= "</td></tr>";
 		// Disk capacity box
 		$custom_txt .= "<tr><td></td><td></td><td align='right'>Disk(s) capacity total:</td><td><input style='border:0px; background-color: #FFFFFF;' size='8' id='disktotals' name='disktotals'></td></tr>";
 		// Remaining allocation box
@@ -1034,7 +1089,7 @@ EOF;
 												</td></tr>
 												</table>
 											</div>
-			     						</td>
+										</td>
 									</tr>
 								</table>
 								</center>
@@ -1061,7 +1116,7 @@ EOF;
 				newrow[2] = "{$custom_disks}";
 			-->
 			</script>
-			
+
 
 EOF;
 	page_table_end();
@@ -1070,14 +1125,16 @@ EOF;
 
 function installer_main() {
 	global $g, $fstype, $savemsg;
-	if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) 
+	if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
 		unlink("/tmp/.pc-sysinstall/pc-sysinstall.log");
+	}
 	head_html();
 	body_html();
 	$disk = installer_find_first_disk();
 	// Only enable ZFS if this exists.  The install will fail otherwise.
-	if(file_exists("/boot/gptzfsboot")) 
+	if (file_exists("/boot/gptzfsboot")) {
 		$zfs_enabled = "<tr bgcolor=\"#9A9A9A\"><td align=\"center\"><a href=\"installer.php?state=easy_install_zfs\">Easy installation of {$g['product_name']} using the ZFS filesystem on disk {$disk}</a></td></tr>";
+	}
 	page_table_start();
 	echo <<<EOF
 		<form action="installer.php" method="post" state="step1_post">
@@ -1086,8 +1143,8 @@ function installer_main() {
 				<b><font face="arial" size="+2">Welcome to the {$g['product_name']} webInstaller!</b></font><p/>
 				<font face="arial" size="+1">This utility will install {$g['product_name']} to a hard disk, flash drive, etc.</font>
 				<table width="100%" border="0" cellpadding="5" cellspacing="0">
-			 		<tr>
-			    		<td>
+					<tr>
+						<td>
 							<center>
 							<div id="mainarea">
 								<br />
@@ -1096,11 +1153,11 @@ function installer_main() {
 								<p/>
 								<table width="100%" border="0" cellpadding="5" cellspacing="5">
 									<tr>
-			     						<td>
+										<td>
 											<div id="pfsenseinstaller">
 												<center>
 EOF;
-	if(!$disk) {
+	if (!$disk) {
 		echo gettext("ERROR: Could not find any suitable disks for installation.");
 		echo "</div></td></tr></table></div></table></div>";
 		end_html();
@@ -1112,7 +1169,7 @@ EOF;
 														<tr bgcolor="#CECECE"><td align="center">
 															<a href="installer.php?state=easy_install_ufs">Easy installation of {$g['product_name']} using the UFS filesystem on disk {$disk}</a>
 														</td></tr>
-													 	{$zfs_enabled}
+														{$zfs_enabled}
 														<tr bgcolor="#AAAAAA"><td align="center">
 															<a href="installer.php?state=custominstall">Custom installation of {$g['product_name']}</a>
 														</td></tr>
@@ -1122,7 +1179,7 @@ EOF;
 													</table>
 												</center>
 											</div>
-			     						</td>
+										</td>
 									</tr>
 								</table>
 							</div>
@@ -1136,78 +1193,81 @@ EOF;
 }
 
 function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encpass) {
-		global $g, $select_txt, $custom_disks, $savemsg;
-		$release = php_uname("r");
-		// Get release number like 8.3 or 10.1
-		$relnum = strtok($release, "-");
-
-		// Mount point
-		$disks = installer_find_all_disks();
-		$custom_txt .= "<tr>";
-		$custom_txt .=  "<td><input size='8' id='mountpoint{$rownum}' name='mountpoint{$rownum}' value='{$mountpoint}'></td>";
-
-		// Filesystem type array
-		$types = array(
-			'UFS' => 'UFS',
-			'UFS+S' => 'UFS + Softupdates',
-			'UFS.eli' => 'Encrypted UFS',
-			'UFS+S.eli' => 'Encrypted UFS + Softupdates',
-			'SWAP' => 'SWAP'
-		);
-
-		// UFS + Journaling was introduced in 9.0
-		if($relnum >= 9) {
-			$types['UFS+J'] = "UFS + Journaling";
-			$types['UFS+J.eli'] = "Encrypted UFS + Journaling";
-		}
-		
-		// Add ZFS Boot loader if it exists
-		if(file_exists("/boot/gptzfsboot")) {
-			$types['ZFS'] = "Zetabyte Filesystem";
-			$types['ZFS.eli'] = "Encrypted Zetabyte Filesystem";
-		}
+	global $g, $select_txt, $custom_disks, $savemsg;
+	$release = php_uname("r");
+	// Get release number like 8.3 or 10.1
+	$relnum = strtok($release, "-");
+
+	// Mount point
+	$disks = installer_find_all_disks();
+	$custom_txt .= "<tr>";
+	$custom_txt .=  "<td><input size='8' id='mountpoint{$rownum}' name='mountpoint{$rownum}' value='{$mountpoint}'></td>";
+
+	// Filesystem type array
+	$types = array(
+		'UFS' => 'UFS',
+		'UFS+S' => 'UFS + Softupdates',
+		'UFS.eli' => 'Encrypted UFS',
+		'UFS+S.eli' => 'Encrypted UFS + Softupdates',
+		'SWAP' => 'SWAP'
+	);
+
+	// UFS + Journaling was introduced in 9.0
+	if ($relnum >= 9) {
+		$types['UFS+J'] = "UFS + Journaling";
+		$types['UFS+J.eli'] = "Encrypted UFS + Journaling";
+	}
 
-		// fstype form field
-		$custom_txt .=  "<td><select onChange='javascript:row_helper_dynamic_custom()' id='fstype{$rownum}' name='fstype{$rownum}'>";
-		$select_txt = "";
-		foreach($types as $type => $desc) {
-			if($type == $fstype)
-				$SELECTED="SELECTED";
-			else 
-				$SELECTED="";
-			$select_txt .= "<option value='$type' $SELECTED>$desc</option>";
+	// Add ZFS Boot loader if it exists
+	if (file_exists("/boot/gptzfsboot")) {
+		$types['ZFS'] = "Zetabyte Filesystem";
+		$types['ZFS.eli'] = "Encrypted Zetabyte Filesystem";
+	}
+
+	// fstype form field
+	$custom_txt .=  "<td><select onChange='javascript:row_helper_dynamic_custom()' id='fstype{$rownum}' name='fstype{$rownum}'>";
+	$select_txt = "";
+	foreach ($types as $type => $desc) {
+		if ($type == $fstype) {
+			$SELECTED="SELECTED";
+		} else {
+			$SELECTED="";
 		}
-		$custom_txt .= "{$select_txt}</select>\n";
-		$custom_txt .= "</td>";
-		
-		// Disk selection form field
-		$custom_txt .= "<td><select id='disk{$rownum}' name='disk{$rownum}'>\n";
-		$custom_disks = "";
-		foreach($disks as $dsk) {
-			$disksize_bytes = format_bytes($dsk['size'] * 1048576);
-			$disksize = $dsk['size'];
-			if($disk == $dsk['disk'])
-				$SELECTED="SELECTED";
-			else 
-				$SELECTED="";
-			$custom_disks .= "<option value='{$dsk['disk']}' $SELECTED>{$dsk['disk']} - {$dsk['desc']} - {$disksize}MB ({$disksize_bytes})</option>";
+		$select_txt .= "<option value='$type' $SELECTED>$desc</option>";
+	}
+	$custom_txt .= "{$select_txt}</select>\n";
+	$custom_txt .= "</td>";
+
+	// Disk selection form field
+	$custom_txt .= "<td><select id='disk{$rownum}' name='disk{$rownum}'>\n";
+	$custom_disks = "";
+	foreach ($disks as $dsk) {
+		$disksize_bytes = format_bytes($dsk['size'] * 1048576);
+		$disksize = $dsk['size'];
+		if ($disk == $dsk['disk']) {
+			$SELECTED="SELECTED";
+		} else {
+			$SELECTED="";
 		}
-		$custom_txt .= "{$custom_disks}</select></td>\n";
-
-		// Slice size
-		$custom_txt .= "<td><input onChange='javascript:row_helper_dynamic_custom();' name='size{$rownum}' id='size{$rownum}' size='8' type='text' value='{$size}'></td>";
-
-		// Encryption password
-		$custom_txt .= "<td>";
-		$custom_txt .= "<input id='encpass{$rownum}' name='encpass{$rownum}' size='8' value='{$encpass}'>";
-		$custom_txt .= "</td>";
-	
-		// Add Rowhelper + button
-		if($rownum > 0) 
-			$custom_txt .= "<td><a onclick=\"removeRow(this); return false;\" href=\"#\"><img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" alt=\"\" title=\"remove this entry\"/></a></td>";
-
-		$custom_txt .= "</tr>";	
-		return $custom_txt;
+		$custom_disks .= "<option value='{$dsk['disk']}' $SELECTED>{$dsk['disk']} - {$dsk['desc']} - {$disksize}MB ({$disksize_bytes})</option>";
+	}
+	$custom_txt .= "{$custom_disks}</select></td>\n";
+
+	// Slice size
+	$custom_txt .= "<td><input onChange='javascript:row_helper_dynamic_custom();' name='size{$rownum}' id='size{$rownum}' size='8' type='text' value='{$size}'></td>";
+
+	// Encryption password
+	$custom_txt .= "<td>";
+	$custom_txt .= "<input id='encpass{$rownum}' name='encpass{$rownum}' size='8' value='{$encpass}'>";
+	$custom_txt .= "</td>";
+
+	// Add Rowhelper + button
+	if ($rownum > 0) {
+		$custom_txt .= "<td><a onclick=\"removeRow(this); return false;\" href=\"#\"><img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" alt=\"\" title=\"remove this entry\"/></a></td>";
+	}
+
+	$custom_txt .= "</tr>";
+	return $custom_txt;
 }
 
 ?>
diff --git a/usr/local/www/widgets/include/thermal_sensors.inc b/usr/local/www/widgets/include/thermal_sensors.inc
index a27b1eb04b..a6e727adb6 100644
--- a/usr/local/www/widgets/include/thermal_sensors.inc
+++ b/usr/local/www/widgets/include/thermal_sensors.inc
@@ -7,6 +7,7 @@
 	Used by:
 		\usr\local\www\widgets\widgets\thermal_sensors.widget.php
 
+
 */
 
 //set variable for custom title
diff --git a/usr/local/www/widgets/javascript/ipsec.js b/usr/local/www/widgets/javascript/ipsec.js
index c9d704a3e0..d38f6cd107 100644
--- a/usr/local/www/widgets/javascript/ipsec.js
+++ b/usr/local/www/widgets/javascript/ipsec.js
@@ -1,9 +1,9 @@
-function updateIpsec(){
+function updateIpsec() {
 	selectIntLink = "ipsecDetailed";
 	ipsecsettings = "ipsecDetail=";
 	ipsecsettings += d.getElementById(selectIntLink).checked;
-	
-    selectIntLink = "ipsec-config";
+
+	selectIntLink = "ipsec-config";
 	textlink = d.getElementById(selectIntLink);
 	textlink.value = ipsecsettings;
 }
\ No newline at end of file
diff --git a/usr/local/www/widgets/javascript/thermal_sensors.js b/usr/local/www/widgets/javascript/thermal_sensors.js
index f244296249..7415b015fb 100644
--- a/usr/local/www/widgets/javascript/thermal_sensors.js
+++ b/usr/local/www/widgets/javascript/thermal_sensors.js
@@ -1,9 +1,9 @@
 /*
 	$Id: thermal_sensors.js
-	Description:	
+	Description:
 		Javascript functions to get and show thermal sensors data in thermal_sensors.widget.php.
 		NOTE: depends on proper config in System >> Advanced >> Miscellaneous tab >> Thermal Sensors section.
-	File location: 
+	File location:
 		\usr\local\www\widgets\javascript\
 	Used by:
 		\usr\local\www\widgets\widgets\thermal_sensors.widget.php
@@ -36,7 +36,7 @@
 function showThermalSensorsData() {
 
 	//get data from thermal_sensors.widget.php
-	url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1" 
+	url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1"
 			//IE fix to disable cache when using http:// , just append timespan
 			+ new Date().getTime();
 
@@ -46,14 +46,14 @@ function showThermalSensorsData() {
 			var thermalSensorsData = data || "";
 			buildThermalSensorsData(thermalSensorsData);
 		},
-		error: function(jqXHR, status, error){
+		error: function(jqXHR, status, error) {
 			buildThermalSensorsDataRaw(
-				"Error getting data from [thermal_sensors.widget.php] - |" + 
-				"status: [" + (status || "") + "]|" + 
+				"Error getting data from [thermal_sensors.widget.php] - |" +
+				"status: [" + (status || "") + "]|" +
 				"error: [" + (error || "") + "]");
 		}
 	});
-	
+
 	//call itself in 11 seconds
 	window.setTimeout(showThermalSensorsData, 11000);
 }
@@ -62,21 +62,20 @@ function buildThermalSensorsData(thermalSensorsData) {
 	//NOTE: variable thermal_sensors_widget_showRawOutput is declared/set in "thermal_sensors.widget.php"
 	if (thermal_sensors_widget_showRawOutput) {
 		buildThermalSensorsDataRaw(thermalSensorsData);
-	}
-	else {
+	} else {
 		buildThermalSensorsDataGraph(thermalSensorsData);
 	}
 }
 
 function buildThermalSensorsDataRaw(thermalSensorsData) {
-	
+
 	var thermalSensorsContent = "";
-	
+
 	if (thermalSensorsData && thermalSensorsData != "") {
 		thermalSensorsContent = thermalSensorsData.replace(/\|/g, "<br />");
 		//rawData = thermalSensorsData.split("|").join("<br />");
 	}
-	
+
 	loadThermalSensorsContainer(thermalSensorsContent);
 }
 
@@ -88,7 +87,7 @@ function loadThermalSensorsContainer (thermalSensorsContent) {
 	} else {
 		jQuery('#thermalSensorsContainer').html("No Thermal Sensors data available.<br /><br />");
 		jQuery('<div/>').html(
-				"<span>* You can configure a proper Thermal Sensor / Module under <br />" + 
+				"<span>* You can configure a proper Thermal Sensor / Module under <br />" +
 				"&nbsp;&nbsp;&nbsp;<a href='system_advanced_misc.php'>System &gt; Advanced &gt; Miscellaneous : Thermal Sensors section</a>.</span>"
 				).appendTo('#thermalSensorsContainer');
 	}
@@ -100,51 +99,51 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
 	var normalColor = "LimeGreen";
 	var normalColorShadowTop = "Lime";
 	var normalColorShadowBottom = "Green";
-	
+
 	var warningColor = "Orange";
 	var warningColorShadowBottom = "Chocolate";
-	
+
 	var criticalColor = "Red";
 	var criticalColorShadowBottom = "DarkRed";
-	
+
 	//local variables
 	var barBgColor = normalColor; //green/normal as default
 	var barBgColorShadowTop = normalColorShadowTop; //green/normal as default
 	var barBgColorShadowBottom = normalColorShadowBottom; //green/normal as default
-		
+
 	var thermalSensorsArray = new Array();
-	
-	if (thermalSensorsData && thermalSensorsData != ""){
+
+	if (thermalSensorsData && thermalSensorsData != "") {
 		thermalSensorsArray = thermalSensorsData.split("|");
 	}
 
 	var thermalSensorsHTMLContent = "";
 	var itemsToPulsate = new Array();
-	
+
 	//generate graph for each temperature sensor and append to thermalSensorsHTMLContent string
 	for (var i = 0; i < thermalSensorsArray.length; i++) {
-	
+
 		var sensorDataArray = thermalSensorsArray[i].split(":");
 		var sensorName = sensorDataArray[0].trim();
 		var thermalSensorValue = getThermalSensorValue(sensorDataArray[1]);
 
 		var pulsateTimes = 0;
 		var pulsateDuration = 0;
-		
+
 		var warningTempThresholdPosition = 0;
 		var criticalTempThresholdPosition = 0;
-		
-		//NOTE: the following variables are declared/set in "thermal_sensors.widget.php": 
-		//		thermal_sensors_widget_coreWarningTempThreshold, thermal_sensors_widget_coreCriticalTempThreshold, 
+
+		//NOTE: the following variables are declared/set in "thermal_sensors.widget.php":
+		//		thermal_sensors_widget_coreWarningTempThreshold, thermal_sensors_widget_coreCriticalTempThreshold,
 		//		thermal_sensors_widget_zoneWarningTempThreshold, thermal_sensors_widget_zoneCriticalTempThreshold
 		//		thermal_sensors_widget_pulsateWarning, thermal_sensors_widget_pulsateCritical
-		
+
 		//set graph color and pulsate parameters
 		if (sensorName.indexOf("cpu") > -1) { //check CPU Threshold config settings
-			
+
 			warningTempThresholdPosition = thermal_sensors_widget_coreWarningTempThreshold;
 			criticalTempThresholdPosition = thermal_sensors_widget_coreCriticalTempThreshold;
-			
+
 			if (thermalSensorValue < thermal_sensors_widget_coreWarningTempThreshold) {
 				barBgColor = normalColor;
 				barBgColorShadowTop = normalColorShadowTop;
@@ -165,21 +164,21 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
 				pulsateDuration = thermal_sensors_widget_pulsateCritical ? 900 : 0;
 			}
 		} else { //assuming sensor is for a zone, check Zone Threshold config settings
-			
+
 			warningTempThresholdPosition = thermal_sensors_widget_zoneWarningTempThreshold;
 			criticalTempThresholdPosition = thermal_sensors_widget_zoneCriticalTempThreshold;
 
 			if (thermalSensorValue < thermal_sensors_widget_zoneWarningTempThreshold) {
-			
+
 				barBgColor = normalColor;
 				barBgColorShadowTop = normalColorShadowTop;
 				barBgColorShadowBottom = normalColorShadowBottom;
 				pulsateTimes = 0;
 				pulsateDuration = 0;
 
-			} else if (thermalSensorValue >= thermal_sensors_widget_zoneWarningTempThreshold 
-						&& thermalSensorValue < thermal_sensors_widget_zoneCriticalTempThreshold) {
-						
+			} else if (thermalSensorValue >= thermal_sensors_widget_zoneWarningTempThreshold &&
+			    thermalSensorValue < thermal_sensors_widget_zoneCriticalTempThreshold) {
+
 				barBgColor = warningColor;
 				barBgColorShadowTop = warningColor;
 				barBgColorShadowBottom = warningColorShadowBottom;
@@ -187,7 +186,7 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
 				pulsateDuration = thermal_sensors_widget_pulsateWarning ? 900 : 0;
 
 			} else { // thermalSensorValue > thermal_sensors_widget_zoneCriticalTempThreshold
-			
+
 				barBgColor = criticalColor;
 				barBgColorShadowTop = criticalColor;
 				barBgColorShadowBottom = criticalColorShadowBottom;
@@ -203,44 +202,44 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
 
 		//build temperature item/row for a sensor
 		//NOTE: additional styles are set in 'thermal_sensors.widget.php'
-		var thermalSensorRow = 	"<div class='thermalSensorRow' id='thermalSensorRow" + i + "' >" + 
+		var thermalSensorRow = 	"<div class='thermalSensorRow' id='thermalSensorRow" + i + "' >" +
 							//sensor name and temperature value
-							"	<div class='thermalSensorTextShell'><div class='thermalSensorText' id='thermalSensorText" + i + "'>" + sensorName + ": </div><div class='thermalSensorValue' id='thermalSensorValue" + i + "'>" + thermalSensorValue + " &deg;C</div></div>" + 
+							"	<div class='thermalSensorTextShell'><div class='thermalSensorText' id='thermalSensorText" + i + "'>" + sensorName + ": </div><div class='thermalSensorValue' id='thermalSensorValue" + i + "'>" + thermalSensorValue + " &deg;C</div></div>" +
 							//temperature bar
-							"	<div class='thermalSensorBarShell' id='thermalSensorBarShell" + i + "' >" + 
-							"		<div class='thermalSensorBar' id='thermalSensorBar" + i + "' style='background-color: " + barBgColor + "; border-top-color: " + barBgColorShadowTop + "; border-bottom-color: " + barBgColorShadowBottom + "; width:" + thermalSensorValue + "%;' ></div>" + 
+							"	<div class='thermalSensorBarShell' id='thermalSensorBarShell" + i + "' >" +
+							"		<div class='thermalSensorBar' id='thermalSensorBar" + i + "' style='background-color: " + barBgColor + "; border-top-color: " + barBgColorShadowTop + "; border-bottom-color: " + barBgColorShadowBottom + "; width:" + thermalSensorValue + "%;' ></div>" +
 							//threshold targets (warning and critical)
-							"		<div class='thermalSensorWarnThresh' id='thermalSensorWarnThresh" + i + "' style='left:" + warningTempThresholdPosition  + "%;' ></div>" + 
-							"		<div class='thermalSensorCritThresh' id='thermalSensorCritThresh" + i + "' style='left:" + criticalTempThresholdPosition + "%;' ></div>" + 
+							"		<div class='thermalSensorWarnThresh' id='thermalSensorWarnThresh" + i + "' style='left:" + warningTempThresholdPosition  + "%;' ></div>" +
+							"		<div class='thermalSensorCritThresh' id='thermalSensorCritThresh" + i + "' style='left:" + criticalTempThresholdPosition + "%;' ></div>" +
 							//temperature scale (max 100 C)
-							"		<div class='thermal_sensors_widget_scale000'></div>" + 
-							"		<div class='thermal_sensors_widget_scale010'></div>" + 
-							"		<div class='thermal_sensors_widget_scale020'></div>" + 
-							"		<div class='thermal_sensors_widget_scale030'></div>" + 
-							"		<div class='thermal_sensors_widget_scale040'></div>" + 
-							"		<div class='thermal_sensors_widget_scale050'></div>" + 
-							"		<div class='thermal_sensors_widget_scale060'></div>" + 
-							"		<div class='thermal_sensors_widget_scale070'></div>" + 
-							"		<div class='thermal_sensors_widget_scale080'></div>" + 
-							"		<div class='thermal_sensors_widget_scale090'></div>" + 
-							"		<div class='thermal_sensors_widget_scale100'></div>" + 
-							"		<div class='thermal_sensors_widget_mark100'>100&deg;</div>" + 
-							"	</div>" + 
+							"		<div class='thermal_sensors_widget_scale000'></div>" +
+							"		<div class='thermal_sensors_widget_scale010'></div>" +
+							"		<div class='thermal_sensors_widget_scale020'></div>" +
+							"		<div class='thermal_sensors_widget_scale030'></div>" +
+							"		<div class='thermal_sensors_widget_scale040'></div>" +
+							"		<div class='thermal_sensors_widget_scale050'></div>" +
+							"		<div class='thermal_sensors_widget_scale060'></div>" +
+							"		<div class='thermal_sensors_widget_scale070'></div>" +
+							"		<div class='thermal_sensors_widget_scale080'></div>" +
+							"		<div class='thermal_sensors_widget_scale090'></div>" +
+							"		<div class='thermal_sensors_widget_scale100'></div>" +
+							"		<div class='thermal_sensors_widget_mark100'>100&deg;</div>" +
+							"	</div>" +
 							"</div>";
-						
+
 		//collect parameters for warning/critical items we need to pulsate
 		if (pulsateTimes > 0) {
 			var params = i + "|" + barBgColor + "|" + pulsateTimes + "|" + pulsateDuration;
 			itemsToPulsate.push(params);
 		}
-		
+
 		//append HTML item
 		thermalSensorsHTMLContent = thermalSensorsHTMLContent + thermalSensorRow;
 	}
-	
+
 	//load generated graph into thermalSensorsContainer (DIV defined in "thermal_sensors.widget.php")
 	loadThermalSensorsContainer(thermalSensorsHTMLContent);
-	
+
 	if (itemsToPulsate.length > 0) {
 		//pulsate/flash warning/critical items we collected
 		pulsateThermalSensorsItems(itemsToPulsate);
@@ -248,10 +247,10 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
 }
 
 function pulsateThermalSensorsItems(itemsToPulsate) {
-	
+
 	//pulsate/flash warning/critical items we collected
 	for (var i = 0; i < itemsToPulsate.length; i++) {
-	
+
 		var pulsateParams = itemsToPulsate[i].split("|");
 		var rowNum = parseInt(pulsateParams[0]);
 		//var textColor = pulsateParams[1];
@@ -260,36 +259,38 @@ function pulsateThermalSensorsItems(itemsToPulsate) {
 
 		//pulsate temp Value
 		var divThermalSensorValue = jQuery("#thermalSensorValue" + rowNum); //get temp value by id
-		divThermalSensorValue.effect("pulsate", { 
-				 times: pulsateTimes
-				,easing: 'linear' //'easeInExpo' 
+		divThermalSensorValue.effect("pulsate", {
+			times: pulsateTimes,
+			easing: 'linear' //'easeInExpo'
 		}, pulsateDuration);
 		////set Temp Value color
-		//divThermalSensorValue.css( { color: textColor } );		
-		
+		//divThermalSensorValue.css({ color: textColor });
+
 		//pulsate temp Bar
 		var divThermalSensorBar = jQuery("#thermalSensorBar" + rowNum); //get temp bar by id
-		divThermalSensorBar.effect("pulsate", { 
-				 times: pulsateTimes
-				,easing: 'linear' //'easeInExpo' 
+		divThermalSensorBar.effect("pulsate", {
+			times: pulsateTimes,
+			easing: 'linear' //'easeInExpo'
 		}, pulsateDuration);
-		
+
 	}
 }
 
-function getSensorFriendlyName(sensorFullName){
+function getSensorFriendlyName(sensorFullName) {
 	var rzone = /^hw\.acpi\.thermal\.tz([0-9]+)\.temperature$/;
 	var rcore = /^dev\.cpu\.([0-9]+)\.temperature$/;
 
-	if (rzone.test(sensorFullName))
+	if (rzone.test(sensorFullName)) {
 		return "Zone " + rzone.exec(sensorFullName)[1];
+	}
 
-	if (rcore.test(sensorFullName))
+	if (rcore.test(sensorFullName)) {
 		return "Core " + rcore.exec(sensorFullName)[1];
+	}
 
 	return sensorFullName;
 }
 
-function getThermalSensorValue(stringValue){
+function getThermalSensorValue(stringValue) {
 	return (+parseFloat(stringValue) || 0).toFixed(1);
 }
diff --git a/usr/local/www/widgets/javascript/traffic_graph.js b/usr/local/www/widgets/javascript/traffic_graph.js
index dcfd4f346f..83fc48114e 100644
--- a/usr/local/www/widgets/javascript/traffic_graph.js
+++ b/usr/local/www/widgets/javascript/traffic_graph.js
@@ -1,34 +1,34 @@
-function trafficshowDiv(incDiv,swapButtons){
+function trafficshowDiv(incDiv,swapButtons) {
 	//appear element
 	selectedDiv = incDiv + "graphdiv";
-	jQuery('#' + selectedDiv).effect('blind',{mode:'show'},1000);      
-	d = document;	
-	if (swapButtons){
+	jQuery('#' + selectedDiv).effect('blind',{mode:'show'},1000);
+	d = document;
+	if (swapButtons) {
 		selectIntLink = selectedDiv + "-min";
 		textlink = d.getElementById(selectIntLink);
-		textlink.style.display = "inline";	    
-		
+		textlink.style.display = "inline";
+
 		selectIntLink = selectedDiv + "-open";
 		textlink = d.getElementById(selectIntLink);
 		textlink.style.display = "none";
 	}
 	document.iform["shown[" + incDiv + "]"].value = "show";
 }
-	
-function  trafficminimizeDiv(incDiv,swapButtons){
+
+function  trafficminimizeDiv(incDiv,swapButtons) {
 	//fade element
 	selectedDiv = incDiv + "graphdiv";
 	jQuery('#' + selectedDiv).effect('blind',{mode:'hide'},1000);
-	d = document;	
-	if (swapButtons){
+	d = document;
+	if (swapButtons) {
 		selectIntLink = selectedDiv + "-open";
 		textlink = d.getElementById(selectIntLink);
-		textlink.style.display = "inline";	    
-		
+		textlink.style.display = "inline";
+
 		selectIntLink = selectedDiv + "-min";
 		textlink = d.getElementById(selectIntLink);
 		textlink.style.display = "none";
-	} 
+	}
 	document.iform["shown[" + incDiv + "]"].value = "hide";
 }
 
