Completed
Push — master ( 237d29...caebd9 )
by Yannick
20:41
created
require/class.Weather.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 	public function buildcloudlayer($metar) {
12 12
 		//print_r($metar);
13 13
 		$result = array();
14
-		foreach($metar['cloud'] as $key => $data) {
14
+		foreach ($metar['cloud'] as $key => $data) {
15 15
 			$alt_m = $metar['cloud'][$key]['level'];
16 16
 			$alt_ft = $alt_m*3.28084;
17 17
 			$pressure = $metar['QNH'];
18
-			$cumulus_base = 122.0 * ($metar['temperature'] - $metar['dew']);
19
-			$stratus_base = 100.0 * (100.0 * $metar['rh'])*0.3048;
18
+			$cumulus_base = 122.0*($metar['temperature'] - $metar['dew']);
19
+			$stratus_base = 100.0*(100.0*$metar['rh'])*0.3048;
20 20
 			$coverage_norm = 0.0;
21 21
 			if ($metar['cloud'][$key]['type'] == 'Few') {
22 22
 				$coverage_norm = 2.0/8.0;
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 					$layer_type = 'ns';
39 39
 				}
40 40
 			} else {
41
-				if ($cumulus_base * 0.80 < $alt_m && $cumulus_base * 1.20 > $alt_m) {
41
+				if ($cumulus_base*0.80 < $alt_m && $cumulus_base*1.20 > $alt_m) {
42 42
 					$layer_type = 'cu';
43
-				} elseif ($stratus_base * 0.80 < $alt_m && $stratus_base * 1.40 > $alt_m) {
43
+				} elseif ($stratus_base*0.80 < $alt_m && $stratus_base*1.40 > $alt_m) {
44 44
 					$layer_type = 'st';
45 45
 				} else {
46 46
 					if ($alt_ft < 2000) {
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
 				}
54 54
 			}
55 55
 			//echo 'coverage norm : '.$coverage_norm.' - layer_type: '.$layer_type."\n";
56
-			$result[] = array('cov' => $coverage_norm, 'type' => $layer_type,'alt' => $alt_m,'rh' => $metar['rh']);
56
+			$result[] = array('cov' => $coverage_norm, 'type' => $layer_type, 'alt' => $alt_m, 'rh' => $metar['rh']);
57 57
 		}
58 58
 		if (count($result) < 2 && $metar['rh'] > 60) {
59
-			$result[] = array('cov' => 0.75, 'type' => 'ci','alt' => 4000,'rh' => $metar['rh']);
59
+			$result[] = array('cov' => 0.75, 'type' => 'ci', 'alt' => 4000, 'rh' => $metar['rh']);
60 60
 		}
61 61
 		return $result;
62 62
 	}
63 63
 	
64
-	public function openweathermap($latitude,$longitude) {
64
+	public function openweathermap($latitude, $longitude) {
65 65
 		global $globalOpenWeatherMapKey;
66 66
 		if ($globalOpenWeatherMapKey == '') return array();
67 67
 		$Common = new Common();
68 68
 		$url = 'http://api.openweathermap.org/data/2.5/weather?lat='.$latitude.'&lon='.$longitude.'&units=metric&appid='.$globalOpenWeatherMapKey;
69 69
 		//echo $url."\n";
70
-		$weatherdata = json_decode($Common->getData($url),true);
71
-		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(),'rain' => array());
72
-		$dew = $weatherdata['main']['temp'] - ((100-$weatherdata['main']['humidity'])/5);
73
-		$cumulus_base = 122.0 * ($weatherdata['main']['temp'] - $dew);
74
-		$stratus_base = 100.0 * (100.0 * $weatherdata['main']['humidity'])*0.3048;
70
+		$weatherdata = json_decode($Common->getData($url), true);
71
+		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(), 'rain' => array());
72
+		$dew = $weatherdata['main']['temp'] - ((100 - $weatherdata['main']['humidity'])/5);
73
+		$cumulus_base = 122.0*($weatherdata['main']['temp'] - $dew);
74
+		$stratus_base = 100.0*(100.0*$weatherdata['main']['humidity'])*0.3048;
75 75
 		$coverage_norm = 0.0;
76 76
 		if ($weatherdata['weather'][0]['id'] == 801) {
77 77
 			// few clouds
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 			$coverage_norm = 8.0/8.0;
88 88
 		}
89 89
 		$alt_m = 1000;
90
-		if ($cumulus_base * 0.80 < $alt_m && $cumulus_base * 1.20 > $alt_m) {
90
+		if ($cumulus_base*0.80 < $alt_m && $cumulus_base*1.20 > $alt_m) {
91 91
 			$layer_type = 'cu';
92
-		} elseif ($stratus_base * 0.80 < $alt_m && $stratus_base * 1.40 > $alt_m) {
92
+		} elseif ($stratus_base*0.80 < $alt_m && $stratus_base*1.40 > $alt_m) {
93 93
 			$layer_type = 'st';
94 94
 		} else {
95 95
 			$layer_type = 'st';
96 96
 		}
97 97
 		$result = array();
98
-		$result[] = array('cov' => $coverage_norm, 'type' => $layer_type,'alt' => $alt_m,'rh' => $weatherdata['main']['humidity']);
98
+		$result[] = array('cov' => $coverage_norm, 'type' => $layer_type, 'alt' => $alt_m, 'rh' => $weatherdata['main']['humidity']);
99 99
 		if ($weatherdata['main']['humidity'] > 60) {
100
-			$result[] = array('cov' => 0.75, 'type' => 'ci','alt' => 4000,'rh' => $weatherdata['main']['humidity']);
100
+			$result[] = array('cov' => 0.75, 'type' => 'ci', 'alt' => 4000, 'rh' => $weatherdata['main']['humidity']);
101 101
 		}
102
-		return array('clouds' => $result,'rain' => array('tmp' => $weatherdata['main']['temp'],'rh' => $weatherdata['main']['humidity']));
102
+		return array('clouds' => $result, 'rain' => array('tmp' => $weatherdata['main']['temp'], 'rh' => $weatherdata['main']['humidity']));
103 103
 	}
104 104
 	
105 105
 	public function nomad_wind($hour = '') {
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		
118 118
 		// http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl?file=gfs.t05z.pgrb2full.0p50.f000&lev_10_m_above_ground=on&lev_surface=on&var_TMP=on&var_UGRD=on&var_VGRD=on&leftlon=0&rightlon=360&toplat=90&bottomlat=-90&dir=/gfs.2017111717
119 119
 		$resolution = '0.5';
120
-		$baseurl = 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_'.($resolution === '1' ? '1p00':'0p50').'.pl';
121
-		$get = array('file' => 'gfs.t'.sprintf('%02d',(6*floor($hour/6))).($resolution === '1' ? 'z.pgrb2.1p00.f000' : 'z.pgrb2full.0p50.f000'),
120
+		$baseurl = 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_'.($resolution === '1' ? '1p00' : '0p50').'.pl';
121
+		$get = array('file' => 'gfs.t'.sprintf('%02d', (6*floor($hour/6))).($resolution === '1' ? 'z.pgrb2.1p00.f000' : 'z.pgrb2full.0p50.f000'),
122 122
 			'lev_10_m_above_ground' => 'on',
123 123
 			'lev_surface' => 'on',
124 124
 			'var_TMP' => 'on',
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
 			'rightlon' => 360,
129 129
 			'toplat' => 90,
130 130
 			'bottomlat' => -90,
131
-			'dir' => '/gfs.'.date('Ymd').sprintf('%02d',(6*floor($hour/6)))
131
+			'dir' => '/gfs.'.date('Ymd').sprintf('%02d', (6*floor($hour/6)))
132 132
 		);
133 133
 		$url = $baseurl.'?'.http_build_query($get);
134 134
 		//echo $url;
135 135
 		$Common = new Common();
136
-		$Common->download($url,$windpathsrc);
136
+		$Common->download($url, $windpathsrc);
137 137
 		// Check if the downloaded file is in GRIB format
138
-		$file = fopen($windpathsrc,"r");
138
+		$file = fopen($windpathsrc, "r");
139 139
 		$firc = fgetc($file);
140 140
 		fclose($file);
141 141
 		if ($firc == 'G') {
142 142
 			system($grib2json.' --data --output '.$windpathdest.' --names --compact '.$windpathsrc);
143 143
 		} else {
144 144
 			// if not try previous run
145
-			if ($hour == date('G')) $this->nomad_wind(date('G')-6);
145
+			if ($hour == date('G')) $this->nomad_wind(date('G') - 6);
146 146
 		}
147 147
 	}
148 148
 
149 149
 	public function oscar_wave() {
150
-		global $globalWavesPath, $globalPODACCuser,$globalPODACCpass;
150
+		global $globalWavesPath, $globalPODACCuser, $globalPODACCpass;
151 151
 		if ($globalPODACCuser == '' && $globalPODACCpass == '') return;
152 152
 		if (isset($globalWavesPath) && $globalWavesPath != '') {
153 153
 			$grib2json = $globalWavesPath['grib2json'];
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 		$Common = new Common();
164 164
 		$auth = base64_encode("$globalPODACCuser:$globalPODACCpass");
165 165
 		$oscarlst = $Common->getData($url);
166
-		$oscarlst_xml = json_decode(json_encode(simplexml_load_string($oscarlst)),true);
166
+		$oscarlst_xml = json_decode(json_encode(simplexml_load_string($oscarlst)), true);
167 167
 		foreach ($oscarlst_xml['entry']['link'] as $oscarlnk) {
168 168
 			if ($oscarlnk['@attributes']['type'] == 'application/x-netcdf') {
169
-				$Common->download($oscarlnk['@attributes']['href'],$wavepathsrc.'.gz','',array("Authorization: BASIC $auth"));
169
+				$Common->download($oscarlnk['@attributes']['href'], $wavepathsrc.'.gz', '', array("Authorization: BASIC $auth"));
170 170
 				break;
171 171
 			}
172 172
 		}
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,12 +63,16 @@  discard block
 block discarded – undo
63 63
 	
64 64
 	public function openweathermap($latitude,$longitude) {
65 65
 		global $globalOpenWeatherMapKey;
66
-		if ($globalOpenWeatherMapKey == '') return array();
66
+		if ($globalOpenWeatherMapKey == '') {
67
+			return array();
68
+		}
67 69
 		$Common = new Common();
68 70
 		$url = 'http://api.openweathermap.org/data/2.5/weather?lat='.$latitude.'&lon='.$longitude.'&units=metric&appid='.$globalOpenWeatherMapKey;
69 71
 		//echo $url."\n";
70 72
 		$weatherdata = json_decode($Common->getData($url),true);
71
-		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(),'rain' => array());
73
+		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) {
74
+			return array('clouds' => array(),'rain' => array());
75
+		}
72 76
 		$dew = $weatherdata['main']['temp'] - ((100-$weatherdata['main']['humidity'])/5);
73 77
 		$cumulus_base = 122.0 * ($weatherdata['main']['temp'] - $dew);
74 78
 		$stratus_base = 100.0 * (100.0 * $weatherdata['main']['humidity'])*0.3048;
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 	
105 109
 	public function nomad_wind($hour = '') {
106 110
 		global $globalWindsPath;
107
-		if ($hour == '') $hour = date('G');
111
+		if ($hour == '') {
112
+			$hour = date('G');
113
+		}
108 114
 		if (isset($globalWindsPath) && $globalWindsPath != '') {
109 115
 			$grib2json = $globalWindsPath['grib2json'];
110 116
 			$windpathsrc = $globalWindsPath['source'];
@@ -142,13 +148,17 @@  discard block
 block discarded – undo
142 148
 			system($grib2json.' --data --output '.$windpathdest.' --names --compact '.$windpathsrc);
143 149
 		} else {
144 150
 			// if not try previous run
145
-			if ($hour == date('G')) $this->nomad_wind(date('G')-6);
151
+			if ($hour == date('G')) {
152
+				$this->nomad_wind(date('G')-6);
153
+			}
146 154
 		}
147 155
 	}
148 156
 
149 157
 	public function oscar_wave() {
150 158
 		global $globalWavesPath, $globalPODACCuser,$globalPODACCpass;
151
-		if ($globalPODACCuser == '' && $globalPODACCpass == '') return;
159
+		if ($globalPODACCuser == '' && $globalPODACCpass == '') {
160
+			return;
161
+		}
152 162
 		if (isset($globalWavesPath) && $globalWavesPath != '') {
153 163
 			$grib2json = $globalWavesPath['grib2json'];
154 164
 			$wavepathsrc = $globalWavesPath['source'];
Please login to merge, or discard this patch.
require/class.Common.php 2 patches
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	* @param array $headers header to submit with the form
22 22
 	* @return String the result
23 23
 	*/
24
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
24
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
25 25
 		global $globalProxy, $globalForceIPv4;
26 26
 		$ch = curl_init();
27 27
 		curl_setopt($ch, CURLOPT_URL, $url);
28 28
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
29
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
29
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
30 30
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
31 31
 			}
32 32
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
38 38
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
39 39
 		if ($getheaders) curl_setopt($ch, CURLOPT_HEADER, 1); 
40
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
40
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
41 41
 		//curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
42 42
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
43 43
 		if ($useragent == '') {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			if (is_array($data)) {
54 54
 				curl_setopt($ch, CURLOPT_POST, count($data));
55 55
 				$data_string = '';
56
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
56
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
57 57
 				rtrim($data_string, '&');
58 58
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
59 59
 			} else {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		}
66 66
 		if ($cookie != '') {
67 67
 			if (is_array($cookie)) {
68
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
68
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
69 69
 			} else {
70 70
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
71 71
 			}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		if ($sizelimit === true) {
77 77
 			curl_setopt($ch, CURLOPT_BUFFERSIZE, 128);
78 78
 			curl_setopt($ch, CURLOPT_NOPROGRESS, false);
79
-			curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr,$downloadsize, $downloaded, $uploadsize, $uploaded){
79
+			curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr, $downloadsize, $downloaded, $uploadsize, $uploaded) {
80 80
 				return ($downloaded > (3*1024)) ? 1 : 0;
81 81
 			});
82 82
 		}
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		$info = curl_getinfo($ch);
89 89
 		//var_dump($info);
90 90
 		curl_close($ch);
91
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
91
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
92 92
 			echo "Cloudflare Detected\n";
93 93
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
94 94
 			$useragent = UAgent::random();
95 95
 			cloudflare::useUserAgent($useragent);
96 96
 			if ($clearanceCookie = cloudflare::bypass($url)) {
97
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
97
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
98 98
 			}
99 99
 		} else {
100 100
 			return $result;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		curl_setopt($ch, CURLOPT_COOKIEFILE, '');
121 121
 		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
122 122
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
123
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
123
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
124 124
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
125 125
 			}
126 126
 		}
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 		fclose($fp);
139 139
 	}
140 140
 
141
-	public static function gunzip($in_file,$out_file_name = '') {
141
+	public static function gunzip($in_file, $out_file_name = '') {
142 142
 		//echo $in_file.' -> '.$out_file_name."\n";
143 143
 		$buffer_size = 4096; // read 4kb at a time
144 144
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
145 145
 		if ($in_file != '' && file_exists($in_file)) {
146 146
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
147
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
148
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
147
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
148
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
149 149
 			else {
150 150
 				echo 'gzopen not available';
151 151
 				die;
152 152
 			}
153 153
 			$out_file = fopen($out_file_name, 'wb'); 
154
-			while(!gzeof($file)) {
154
+			while (!gzeof($file)) {
155 155
 				fwrite($out_file, gzread($file, $buffer_size));
156 156
 			}  
157 157
 			fclose($out_file);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 	}
161 161
 
162
-	public static function bunzip2($in_file,$out_file_name = '') {
162
+	public static function bunzip2($in_file, $out_file_name = '') {
163 163
 		//echo $in_file.' -> '.$out_file_name."\n";
164 164
 		$buffer_size = 4096; // read 4kb at a time
165 165
 		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
166 166
 		if ($in_file != '' && file_exists($in_file)) {
167 167
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
168
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
168
+			if (function_exists('bzopen')) $file = bzopen($in_file, 'rb');
169 169
 			else {
170 170
 				echo 'bzopen not available';
171 171
 				die;
172 172
 			}
173 173
 			$out_file = fopen($out_file_name, 'wb'); 
174
-			while(!feof($file)) {
174
+			while (!feof($file)) {
175 175
 				fwrite($out_file, bzread($file, $buffer_size));
176 176
 			}  
177 177
 			fclose($out_file);
@@ -189,27 +189,27 @@  discard block
 block discarded – undo
189 189
 		if ($data == '') return array();
190 190
 		$html = str_get_html($data);
191 191
 		if ($html === false) return array();
192
-		$tabledata=array();
193
-		foreach($html->find('tr') as $element)
192
+		$tabledata = array();
193
+		foreach ($html->find('tr') as $element)
194 194
 		{
195 195
 			$td = array();
196
-			foreach( $element->find('th') as $row)
196
+			foreach ($element->find('th') as $row)
197 197
 			{
198 198
 				$td [] = trim($row->plaintext);
199 199
 			}
200
-			$td=array_filter($td);
200
+			$td = array_filter($td);
201 201
 			$tabledata[] = $td;
202 202
 
203 203
 			$td = array();
204 204
 			$tdi = array();
205
-			foreach( $element->find('td') as $row)
205
+			foreach ($element->find('td') as $row)
206 206
 			{
207 207
 				$td [] = trim($row->plaintext);
208 208
 				$tdi [] = trim($row->innertext);
209 209
 			}
210
-			$td=array_filter($td);
211
-			$tdi=array_filter($tdi);
212
-			$tabledata[]=array_merge($td,$tdi);
210
+			$td = array_filter($td);
211
+			$tdi = array_filter($tdi);
212
+			$tabledata[] = array_merge($td, $tdi);
213 213
 		}
214 214
 		$html->clear();
215 215
 		unset($html);
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	public function text2array($data) {
225 225
 		$html = str_get_html($data);
226 226
 		if ($html === false) return array();
227
-		$tabledata=array();
228
-		foreach($html->find('p') as $element)
227
+		$tabledata = array();
228
+		foreach ($html->find('p') as $element)
229 229
 		{
230 230
 			$tabledata [] = trim($element->plaintext);
231 231
 		}
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	*/
246 246
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
247 247
 		if ($lat == $latc && $lon == $lonc) return 0;
248
-		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
248
+		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515;
249 249
 		if ($unit == "km") {
250
-			return round($dist * 1.609344);
250
+			return round($dist*1.609344);
251 251
 		} elseif ($unit == "m") {
252
-			return round($dist * 1.609344 * 1000);
252
+			return round($dist*1.609344*1000);
253 253
 		} elseif ($unit == "mile" || $unit == "mi") {
254 254
 			return round($dist);
255 255
 		} elseif ($unit == "nm") {
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 	* @param String $distance distance between two points in m
267 267
 	* @return Float plunge
268 268
 	*/
269
-	public function plunge($initial_altitude,$final_altitude,$distance) {
270
-		$plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance));
269
+	public function plunge($initial_altitude, $final_altitude, $distance) {
270
+		$plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance));
271 271
 		/*
272 272
 		$siter = 6378137.0 + $initial_altitude;
273 273
 		$planer = 6378137.0 + $final_altitude;
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	public function azimuth($lat, $lon, $latc, $lonc) {
290 290
 		$dX = $latc - $lat;
291 291
 		$dY = $lonc - $lon;
292
-		$azimuth = rad2deg(atan2($dY,$dX));
293
-		if ($azimuth < 0) return $azimuth+360;
292
+		$azimuth = rad2deg(atan2($dY, $dX));
293
+		if ($azimuth < 0) return $azimuth + 360;
294 294
 		return $azimuth;
295 295
 	}
296 296
 	
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	* @param float $distance distance covered
302 302
 	* @return bool whether distance is realistic
303 303
 	*/
304
-	public function withinThreshold ($timeDifference, $distance) {
304
+	public function withinThreshold($timeDifference, $distance) {
305 305
 		$x = abs($timeDifference);
306 306
 		$d = abs($distance);
307 307
 		if ($x == 0 || $d == 0) return true;
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 		return ($array !== array_values($array));
318 318
 	}
319 319
 
320
-	public function isInteger($input){
320
+	public function isInteger($input) {
321 321
 		//return(ctype_digit(strval($input)));
322
-		return preg_match('/^-?[0-9]+$/', (string)$input) ? true : false;
322
+		return preg_match('/^-?[0-9]+$/', (string) $input) ? true : false;
323 323
 	}
324 324
 
325 325
 
326
-	public function convertDec($dms,$latlong) {
326
+	public function convertDec($dms, $latlong) {
327 327
 		if ($latlong == 'latitude') {
328 328
 			$deg = substr($dms, 0, 2);
329 329
 			$min = substr($dms, 2, 4);
@@ -331,33 +331,33 @@  discard block
 block discarded – undo
331 331
 			$deg = substr($dms, 0, 3);
332 332
 			$min = substr($dms, 3, 5);
333 333
 		}
334
-		return $deg+(($min*60)/3600);
334
+		return $deg + (($min*60)/3600);
335 335
 	}
336 336
 	
337 337
 	public function convertDecLatLong($coord) {
338 338
 		//N43°36.763' W5°46.845'
339
-		$coords = explode(' ',$coord);
339
+		$coords = explode(' ', $coord);
340 340
 		$latitude = '';
341 341
 		$longitude = '';
342 342
 		foreach ($coords as $latlong) {
343
-			$type = substr($latlong,0,1);
344
-			$degmin = explode('°',substr($latlong,1,-1));
343
+			$type = substr($latlong, 0, 1);
344
+			$degmin = explode('°', substr($latlong, 1, -1));
345 345
 			$deg = $degmin[0];
346 346
 			$min = $degmin[1];
347 347
 			if ($type == 'N') {
348
-				$latitude = $deg+(($min*60)/3600);
348
+				$latitude = $deg + (($min*60)/3600);
349 349
 			} elseif ($type == 'S') {
350
-				$latitude = -($deg+(($min*60)/3600));
350
+				$latitude = -($deg + (($min*60)/3600));
351 351
 			} elseif ($type == 'E') {
352
-				$longitude = ($deg+(($min*60)/3600));
352
+				$longitude = ($deg + (($min*60)/3600));
353 353
 			} elseif ($type == 'W') {
354
-				$longitude = -($deg+(($min*60)/3600));
354
+				$longitude = -($deg + (($min*60)/3600));
355 355
 			}
356 356
 		}
357
-		return array('latitude' => round($latitude,5),'longitude' => round($longitude,5));
357
+		return array('latitude' => round($latitude, 5), 'longitude' => round($longitude, 5));
358 358
 	}
359 359
 	
360
-	public function convertDM($coord,$latlong) {
360
+	public function convertDM($coord, $latlong) {
361 361
 		if ($latlong == 'latitude') {
362 362
 			if ($coord < 0) $NSEW = 'S';
363 363
 			else $NSEW = 'N';
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 		}
368 368
 		$coord = abs($coord);
369 369
 		$deg = floor($coord);
370
-		$coord = ($coord-$deg)*60;
370
+		$coord = ($coord - $deg)*60;
371 371
 		$min = $coord;
372
-		return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW);
372
+		return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW);
373 373
 	}
374
-	public function convertDMS($coord,$latlong) {
374
+	public function convertDMS($coord, $latlong) {
375 375
 		if ($latlong == 'latitude') {
376 376
 			if ($coord < 0) $NSEW = 'S';
377 377
 			else $NSEW = 'N';
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 		}
382 382
 		$coord = abs($coord);
383 383
 		$deg = floor($coord);
384
-		$coord = ($coord-$deg)*60;
384
+		$coord = ($coord - $deg)*60;
385 385
 		$min = floor($coord);
386
-		$sec = round(($coord-$min)*60);
387
-		return array('deg' => $deg,'min' => $min,'sec' => $sec,'NSEW' => $NSEW);
386
+		$sec = round(($coord - $min)*60);
387
+		return array('deg' => $deg, 'min' => $min, 'sec' => $sec, 'NSEW' => $NSEW);
388 388
 	}
389 389
 	
390 390
 	/**
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	public function xcopy($source, $dest)
397 397
 	{
398 398
 		$files = glob($source.'*.*');
399
-		foreach($files as $file){
400
-			$file_to_go = str_replace($source,$dest,$file);
399
+		foreach ($files as $file) {
400
+			$file_to_go = str_replace($source, $dest, $file);
401 401
 			copy($file, $file_to_go);
402 402
 		}
403 403
 		return true;
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
 	* @param	String $url url to check
409 409
 	* @return	bool Return true on succes false on failure
410 410
 	*/
411
-	public function urlexist($url){
412
-		$headers=get_headers($url);
413
-		return stripos($headers[0],"200 OK")?true:false;
411
+	public function urlexist($url) {
412
+		$headers = get_headers($url);
413
+		return stripos($headers[0], "200 OK") ?true:false;
414 414
 	}
415 415
 	
416 416
 	/**
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	public function hex2str($hex) {
422 422
 		$str = '';
423 423
 		$hexln = strlen($hex);
424
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
424
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
425 425
 		return $str;
426 426
 	}
427 427
 	
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	* @return	String Return result
432 432
 	*/
433 433
 	public function hex2rgb($hex) {
434
-		$hex = str_replace('#','',$hex);
434
+		$hex = str_replace('#', '', $hex);
435 435
 		return sscanf($hex, "%02x%02x%02x"); 
436 436
 	}
437 437
 	
@@ -439,33 +439,33 @@  discard block
 block discarded – undo
439 439
 		//difference in longitudinal coordinates
440 440
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
441 441
 		//difference in the phi of latitudinal coordinates
442
-		$dPhi = log(tan(deg2rad($lat2) / 2 + M_PI / 4) / tan(deg2rad($lat1) / 2 + M_PI / 4));
442
+		$dPhi = log(tan(deg2rad($lat2)/2 + M_PI/4)/tan(deg2rad($lat1)/2 + M_PI/4));
443 443
 		//we need to recalculate $dLon if it is greater than pi
444
-		if(abs($dLon) > M_PI) {
445
-			if($dLon > 0) {
446
-				$dLon = (2 * M_PI - $dLon) * -1;
444
+		if (abs($dLon) > M_PI) {
445
+			if ($dLon > 0) {
446
+				$dLon = (2*M_PI - $dLon)*-1;
447 447
 			} else {
448
-				$dLon = 2 * M_PI + $dLon;
448
+				$dLon = 2*M_PI + $dLon;
449 449
 			}
450 450
 		}
451 451
 		//return the angle, normalized
452
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
452
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
453 453
 	}
454 454
 
455
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) {
455
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) {
456 456
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
457
-		$a = -($lon2-$lon1);
457
+		$a = -($lon2 - $lon1);
458 458
 		$b = $lat2 - $lat1;
459
-		$c = -($a*$lat1+$b*$lon1);
460
-		$d = $a*$lat3+$b*$lon3+$c;
459
+		$c = -($a*$lat1 + $b*$lon1);
460
+		$d = $a*$lat3 + $b*$lon3 + $c;
461 461
 		if ($d > -$approx && $d < $approx) return true;
462 462
 		else return false;
463 463
 	}
464 464
 	
465 465
 	public function array_merge_noappend() {
466 466
 		$output = array();
467
-		foreach(func_get_args() as $array) {
468
-			foreach($array as $key => $value) {
467
+		foreach (func_get_args() as $array) {
468
+			foreach ($array as $key => $value) {
469 469
 				$output[$key] = isset($output[$key]) ?
470 470
 				array_merge($output[$key], $value) : $value;
471 471
 			}
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		return $result;
530 530
 	}
531 531
 
532
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){
532
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') {
533 533
 		global $globalMapRefresh;
534 534
 		if ($seconds == '') {
535 535
 			$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
@@ -540,27 +540,27 @@  discard block
 block discarded – undo
540 540
 		$latitude = deg2rad($latitude);
541 541
 		$longitude = deg2rad($longitude);
542 542
 		$bearing = deg2rad($heading); 
543
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
544
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
545
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
543
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
544
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
545
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
546 546
 	}
547 547
 	
548
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
548
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
549 549
 		// distance in meter
550 550
 		$R = 6378.14;
551
-		$latitude1 = $latitude * (M_PI/180);
552
-		$longitude1 = $longitude * (M_PI/180);
553
-		$brng = $bearing * (M_PI/180);
551
+		$latitude1 = $latitude*(M_PI/180);
552
+		$longitude1 = $longitude*(M_PI/180);
553
+		$brng = $bearing*(M_PI/180);
554 554
 		$d = $distance;
555 555
 
556 556
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
557
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
557
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
558 558
 
559
-		$latitude2 = $latitude2 * (180/M_PI);
560
-		$longitude2 = $longitude2 * (180/M_PI);
559
+		$latitude2 = $latitude2*(180/M_PI);
560
+		$longitude2 = $longitude2*(180/M_PI);
561 561
 
562
-		$flat = round ($latitude2,6);
563
-		$flong = round ($longitude2,6);
562
+		$flat = round($latitude2, 6);
563
+		$flong = round($longitude2, 6);
564 564
 /*
565 565
 		$dx = $distance*cos($bearing);
566 566
 		$dy = $distance*sin($bearing);
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		$flong = $longitude + $dlong;
570 570
 		$flat = $latitude + $dlat;
571 571
 */
572
-		return array('latitude' => $flat,'longitude' => $flong);
572
+		return array('latitude' => $flat, 'longitude' => $flong);
573 573
 	}
574 574
 
575 575
 	/**
@@ -583,14 +583,14 @@  discard block
 block discarded – undo
583 583
 	 * @param integer $level GZIP compression level (default: 9)
584 584
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
585 585
 	 */
586
-	public function gzCompressFile($source, $level = 9){ 
587
-		$dest = $source . '.gz'; 
588
-		$mode = 'wb' . $level; 
586
+	public function gzCompressFile($source, $level = 9) { 
587
+		$dest = $source.'.gz'; 
588
+		$mode = 'wb'.$level; 
589 589
 		$error = false; 
590 590
 		if ($fp_out = gzopen($dest, $mode)) { 
591
-			if ($fp_in = fopen($source,'rb')) { 
591
+			if ($fp_in = fopen($source, 'rb')) { 
592 592
 				while (!feof($fp_in)) 
593
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
593
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
594 594
 				fclose($fp_in); 
595 595
 			} else {
596 596
 				$error = true; 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	} 
607 607
 	
608 608
 	public function remove_accents($string) {
609
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
609
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
610 610
 		$chars = array(
611 611
 		    // Decompositions for Latin-1 Supplement
612 612
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
664 664
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
665 665
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
666
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
666
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
667 667
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
668 668
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
669 669
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
680 680
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
681 681
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
682
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
683
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
684
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
685
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
686
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
687
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
688
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
682
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
683
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
684
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
685
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
686
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
687
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
688
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
689 689
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
690 690
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
691 691
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
720 720
 			if (is_numeric($string[$i]) && $concat_flag) {
721 721
 				$int .= $string[$i];
722
-			} elseif(!$concat && $concat_flag && strlen($int) > 0) {
722
+			} elseif (!$concat && $concat_flag && strlen($int) > 0) {
723 723
 				$concat_flag = false;
724 724
 			}
725 725
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			$slice = array_slice($arr, $offset + 1, $length);
766 766
 			return implode("", $slice);
767 767
 		} else {
768
-			return mb_substr($string,$offset,$length,'UTF-8');
768
+			return mb_substr($string, $offset, $length, 'UTF-8');
769 769
 		}
770 770
 	}
771 771
 
@@ -775,14 +775,14 @@  discard block
 block discarded – undo
775 775
 		//NOTE: use a trailing slash for folders!!!
776 776
 		//see http://bugs.php.net/bug.php?id=27609
777 777
 		//see http://bugs.php.net/bug.php?id=30931
778
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
778
+		if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path
779 779
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
780 780
 		else if (is_dir($path))
781 781
 			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
782 782
 		// check tmp file for read/write capabilities
783 783
 		$rm = file_exists($path);
784 784
 		$f = @fopen($path, 'a');
785
-		if ($f===false)
785
+		if ($f === false)
786 786
 			return false;
787 787
 		fclose($f);
788 788
 		if (!$rm)
@@ -801,29 +801,29 @@  discard block
 block discarded – undo
801 801
 	 * @param Integer $offset Controls the likelyhood that lines will be split which cross the dateline
802 802
 	 * @return Array Coordinate of the route
803 803
 	*/
804
-	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
805
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
804
+	public function greatcircle($begin_lat, $begin_lon, $end_lat, $end_lon, $nbpts = 20, $offset = 10) {
805
+		if ($nbpts <= 2) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat));
806 806
 		$sx = deg2rad($begin_lon);
807 807
 		$sy = deg2rad($begin_lat);
808 808
 		$ex = deg2rad($end_lon);
809 809
 		$ey = deg2rad($end_lat);
810 810
 		$w = $sx - $ex;
811 811
 		$h = $sy - $ey;
812
-		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
812
+		$z = pow(sin($h/2.0), 2) + cos($sy)*cos($ey)*pow(sin($w/2.0), 2);
813 813
 		$g = 2.0*asin(sqrt($z));
814
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
814
+		if ($g == M_PI || is_nan($g)) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat));
815 815
 		$first_pass = array();
816
-		$delta = 1.0/($nbpts-1);
817
-		for ($i =0; $i < $nbpts; ++$i) {
816
+		$delta = 1.0/($nbpts - 1);
817
+		for ($i = 0; $i < $nbpts; ++$i) {
818 818
 			$step = $delta*$i;
819
-			$A = sin((1 - $step) * $g) / sin($g);
820
-			$B = sin($step * $g) / sin($g);
821
-			$x = $A * cos($sy) * cos($sx) + $B * cos($ey) * cos($ex);
822
-			$y = $A * cos($sy) * sin($sx) + $B * cos($ey) * sin($ex);
823
-			$z = $A * sin($sy) + $B * sin($ey);
819
+			$A = sin((1 - $step)*$g)/sin($g);
820
+			$B = sin($step*$g)/sin($g);
821
+			$x = $A*cos($sy)*cos($sx) + $B*cos($ey)*cos($ex);
822
+			$y = $A*cos($sy)*sin($sx) + $B*cos($ey)*sin($ex);
823
+			$z = $A*sin($sy) + $B*sin($ey);
824 824
 			$lat = rad2deg(atan2($z, sqrt(pow($x, 2) + pow($y, 2))));
825 825
 			$lon = rad2deg(atan2($y, $x));
826
-			$first_pass[] = array($lon,$lat);
826
+			$first_pass[] = array($lon, $lat);
827 827
 		}
828 828
 		$bHasBigDiff = false;
829 829
 		$dfMaxSmallDiffLong = 0;
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		// https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342
839 839
 		$first_pass_ln = count($first_pass);
840 840
 		for ($j = 1; $j < $first_pass_ln; ++$j) {
841
-			$dfPrevX = $first_pass[$j-1][0];
841
+			$dfPrevX = $first_pass[$j - 1][0];
842 842
 			$dfX = $first_pass[$j][0];
843 843
 			$dfDiffLong = abs($dfX - $dfPrevX);
844 844
 			if ($dfDiffLong > $dfDiffSpace &&
@@ -856,14 +856,14 @@  discard block
 block discarded – undo
856 856
 			//$poMulti[] = $poNewLS;
857 857
 			for ($k = 0; $k < $first_pass_ln; ++$k) {
858 858
 				$dfX0 = floatval($first_pass[$k][0]);
859
-				if ($k > 0 &&  abs($dfX0 - $first_pass[$k-1][0]) > $dfDiffSpace) {
860
-					$dfX1 = floatval($first_pass[$k-1][0]);
861
-					$dfY1 = floatval($first_pass[$k-1][1]);
859
+				if ($k > 0 && abs($dfX0 - $first_pass[$k - 1][0]) > $dfDiffSpace) {
860
+					$dfX1 = floatval($first_pass[$k - 1][0]);
861
+					$dfY1 = floatval($first_pass[$k - 1][1]);
862 862
 					$dfX2 = floatval($first_pass[$k][0]);
863 863
 					$dfY2 = floatval($first_pass[$k][1]);
864 864
 					if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 &&
865
-					    $k+1 < count($first_pass) &&
866
-					    $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
865
+					    $k + 1 < count($first_pass) &&
866
+					    $first_pass[$k - 1][0] > -180 && $first_pass[$k - 1][0] < $dfRightBorderX)
867 867
 					{
868 868
 						$poNewLS[] = array(-180, $first_pass[$k][1]);
869 869
 						$k++;
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
 						$poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]);
872 872
 						continue;
873 873
 					} else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 &&
874
-					    $k+1 < $first_pass_ln &&
875
-					    $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
874
+					    $k + 1 < $first_pass_ln &&
875
+					    $first_pass[$k - 1][0] > $dfLeftBorderX && $first_pass[$k - 1][0] < 180)
876 876
 					{
877 877
 						$poNewLS[] = array(180, $first_pass[$k][1]);
878 878
 						$k++;
@@ -895,12 +895,12 @@  discard block
 block discarded – undo
895 895
 					}
896 896
 					if ($dfX1 <= 180 && $dfX2 >= 180 && $dfX1 < $dfX2)
897 897
 					{
898
-						$dfRatio = (180 - $dfX1) / ($dfX2 - $dfX1);
899
-						$dfY = $dfRatio * $dfY2 + (1 - $dfRatio) * $dfY1;
900
-						$poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? 180 : -180, $dfY);
898
+						$dfRatio = (180 - $dfX1)/($dfX2 - $dfX1);
899
+						$dfY = $dfRatio*$dfY2 + (1 - $dfRatio)*$dfY1;
900
+						$poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? 180 : -180, $dfY);
901 901
 						$poMulti[] = $poNewLS;
902 902
 						$poNewLS = array();
903
-						$poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? -180 : 180, $dfY);
903
+						$poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? -180 : 180, $dfY);
904 904
 						//$poMulti[] = $poNewLS;
905 905
 					} else {
906 906
 						//$poNewLS[] = array();
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 			$poNewLS0 = array();
919 919
 			//$poMulti[] = $poNewLS0;
920 920
 			for ($l = 0; $l < $first_pass_ln; ++$l) {
921
-				$poNewLS0[] = array($first_pass[$l][0],$first_pass[$l][1]);
921
+				$poNewLS0[] = array($first_pass[$l][0], $first_pass[$l][1]);
922 922
 			}
923 923
 			$poMulti[] = $poNewLS0;
924 924
 		}
Please login to merge, or discard this patch.
Braces   +123 added lines, -53 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
37 37
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
38 38
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
39
-		if ($getheaders) curl_setopt($ch, CURLOPT_HEADER, 1); 
39
+		if ($getheaders) {
40
+			curl_setopt($ch, CURLOPT_HEADER, 1);
41
+		}
40 42
 		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
41 43
 		//curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
42 44
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
@@ -45,8 +47,11 @@  discard block
 block discarded – undo
45 47
 		} else {
46 48
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
47 49
 		}
48
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
49
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
50
+		if ($timeout == '') {
51
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
52
+		} else {
53
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
54
+		}
50 55
 		//curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
51 56
 		if ($type == 'post') {
52 57
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -59,7 +64,9 @@  discard block
 block discarded – undo
59 64
 			} else {
60 65
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
61 66
 			}
62
-		} elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
67
+		} elseif ($type != 'get' && $type != '') {
68
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
69
+		}
63 70
 		if ($headers != '') {
64 71
 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
65 72
 		}
@@ -104,8 +111,9 @@  discard block
 block discarded – undo
104 111
 	private function curlResponseHeaderCallback($ch, $headerLine) {
105 112
 		global $curl_cookies;
106 113
 		$curl_cookies = array();
107
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
108
-			$curl_cookies[] = $cookie;
114
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
115
+					$curl_cookies[] = $cookie;
116
+		}
109 117
 		return strlen($headerLine); // Needed by curl
110 118
 	}
111 119
 
@@ -118,7 +126,9 @@  discard block
 block discarded – undo
118 126
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
119 127
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
120 128
 		curl_setopt($ch, CURLOPT_COOKIEFILE, '');
121
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
129
+		if ($referer != '') {
130
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
131
+		}
122 132
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
123 133
 			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
124 134
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -133,7 +143,9 @@  discard block
 block discarded – undo
133 143
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
134 144
 		curl_setopt($ch, CURLOPT_FILE, $fp);
135 145
 		curl_exec($ch);
136
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
146
+		if (curl_errno($ch) && $globalDebug) {
147
+			echo 'Download error: '.curl_error($ch);
148
+		}
137 149
 		curl_close($ch);
138 150
 		fclose($fp);
139 151
 	}
@@ -141,12 +153,16 @@  discard block
 block discarded – undo
141 153
 	public static function gunzip($in_file,$out_file_name = '') {
142 154
 		//echo $in_file.' -> '.$out_file_name."\n";
143 155
 		$buffer_size = 4096; // read 4kb at a time
144
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
156
+		if ($out_file_name == '') {
157
+			$out_file_name = str_replace('.gz', '', $in_file);
158
+		}
145 159
 		if ($in_file != '' && file_exists($in_file)) {
146 160
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
147
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
148
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
149
-			else {
161
+			if (function_exists('gzopen')) {
162
+				$file = gzopen($in_file,'rb');
163
+			} elseif (function_exists('gzopen64')) {
164
+				$file = gzopen64($in_file,'rb');
165
+			} else {
150 166
 				echo 'gzopen not available';
151 167
 				die;
152 168
 			}
@@ -162,11 +178,14 @@  discard block
 block discarded – undo
162 178
 	public static function bunzip2($in_file,$out_file_name = '') {
163 179
 		//echo $in_file.' -> '.$out_file_name."\n";
164 180
 		$buffer_size = 4096; // read 4kb at a time
165
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
181
+		if ($out_file_name == '') {
182
+			$out_file_name = str_replace('.bz2', '', $in_file);
183
+		}
166 184
 		if ($in_file != '' && file_exists($in_file)) {
167 185
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
168
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
169
-			else {
186
+			if (function_exists('bzopen')) {
187
+				$file = bzopen($in_file,'rb');
188
+			} else {
170 189
 				echo 'bzopen not available';
171 190
 				die;
172 191
 			}
@@ -185,10 +204,16 @@  discard block
 block discarded – undo
185 204
 	* @return array array of the tables in HTML page
186 205
 	*/
187 206
 	public function table2array($data) {
188
-		if (!is_string($data)) return array();
189
-		if ($data == '') return array();
207
+		if (!is_string($data)) {
208
+			return array();
209
+		}
210
+		if ($data == '') {
211
+			return array();
212
+		}
190 213
 		$html = str_get_html($data);
191
-		if ($html === false) return array();
214
+		if ($html === false) {
215
+			return array();
216
+		}
192 217
 		$tabledata=array();
193 218
 		foreach($html->find('tr') as $element)
194 219
 		{
@@ -223,7 +248,9 @@  discard block
 block discarded – undo
223 248
 	*/
224 249
 	public function text2array($data) {
225 250
 		$html = str_get_html($data);
226
-		if ($html === false) return array();
251
+		if ($html === false) {
252
+			return array();
253
+		}
227 254
 		$tabledata=array();
228 255
 		foreach($html->find('p') as $element)
229 256
 		{
@@ -244,7 +271,9 @@  discard block
 block discarded – undo
244 271
 	* @return Float Distance in $unit
245 272
 	*/
246 273
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
247
-		if ($lat == $latc && $lon == $lonc) return 0;
274
+		if ($lat == $latc && $lon == $lonc) {
275
+			return 0;
276
+		}
248 277
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
249 278
 		if ($unit == "km") {
250 279
 			return round($dist * 1.609344);
@@ -290,7 +319,9 @@  discard block
 block discarded – undo
290 319
 		$dX = $latc - $lat;
291 320
 		$dY = $lonc - $lon;
292 321
 		$azimuth = rad2deg(atan2($dY,$dX));
293
-		if ($azimuth < 0) return $azimuth+360;
322
+		if ($azimuth < 0) {
323
+			return $azimuth+360;
324
+		}
294 325
 		return $azimuth;
295 326
 	}
296 327
 	
@@ -304,10 +335,16 @@  discard block
 block discarded – undo
304 335
 	public function withinThreshold ($timeDifference, $distance) {
305 336
 		$x = abs($timeDifference);
306 337
 		$d = abs($distance);
307
-		if ($x == 0 || $d == 0) return true;
338
+		if ($x == 0 || $d == 0) {
339
+			return true;
340
+		}
308 341
 		// may be due to Internet jitter; distance is realistic
309
-		if ($x < 0.7 && $d < 2000) return true;
310
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
342
+		if ($x < 0.7 && $d < 2000) {
343
+			return true;
344
+		} else {
345
+			return $d/$x < 1500*0.27778;
346
+		}
347
+		// 1500 km/h max
311 348
 	}
312 349
 
313 350
 
@@ -359,11 +396,17 @@  discard block
 block discarded – undo
359 396
 	
360 397
 	public function convertDM($coord,$latlong) {
361 398
 		if ($latlong == 'latitude') {
362
-			if ($coord < 0) $NSEW = 'S';
363
-			else $NSEW = 'N';
399
+			if ($coord < 0) {
400
+				$NSEW = 'S';
401
+			} else {
402
+				$NSEW = 'N';
403
+			}
364 404
 		} else {
365
-			if ($coord < 0) $NSEW = 'W';
366
-			else $NSEW = 'E';
405
+			if ($coord < 0) {
406
+				$NSEW = 'W';
407
+			} else {
408
+				$NSEW = 'E';
409
+			}
367 410
 		}
368 411
 		$coord = abs($coord);
369 412
 		$deg = floor($coord);
@@ -373,11 +416,17 @@  discard block
 block discarded – undo
373 416
 	}
374 417
 	public function convertDMS($coord,$latlong) {
375 418
 		if ($latlong == 'latitude') {
376
-			if ($coord < 0) $NSEW = 'S';
377
-			else $NSEW = 'N';
419
+			if ($coord < 0) {
420
+				$NSEW = 'S';
421
+			} else {
422
+				$NSEW = 'N';
423
+			}
378 424
 		} else {
379
-			if ($coord < 0) $NSEW = 'W';
380
-			else $NSEW = 'E';
425
+			if ($coord < 0) {
426
+				$NSEW = 'W';
427
+			} else {
428
+				$NSEW = 'E';
429
+			}
381 430
 		}
382 431
 		$coord = abs($coord);
383 432
 		$deg = floor($coord);
@@ -421,7 +470,9 @@  discard block
 block discarded – undo
421 470
 	public function hex2str($hex) {
422 471
 		$str = '';
423 472
 		$hexln = strlen($hex);
424
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
473
+		for($i=0;$i<$hexln;$i+=2) {
474
+			$str .= chr(hexdec(substr($hex,$i,2)));
475
+		}
425 476
 		return $str;
426 477
 	}
427 478
 	
@@ -458,8 +509,11 @@  discard block
 block discarded – undo
458 509
 		$b = $lat2 - $lat1;
459 510
 		$c = -($a*$lat1+$b*$lon1);
460 511
 		$d = $a*$lat3+$b*$lon3+$c;
461
-		if ($d > -$approx && $d < $approx) return true;
462
-		else return false;
512
+		if ($d > -$approx && $d < $approx) {
513
+			return true;
514
+		} else {
515
+			return false;
516
+		}
463 517
 	}
464 518
 	
465 519
 	public function array_merge_noappend() {
@@ -518,7 +572,9 @@  discard block
 block discarded – undo
518 572
 			return $result;
519 573
 		}
520 574
 		$handle = @opendir('./locale');
521
-		if ($handle === false) return $result;
575
+		if ($handle === false) {
576
+			return $result;
577
+		}
522 578
 		while (false !== ($file = readdir($handle))) {
523 579
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
524 580
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -589,8 +645,9 @@  discard block
 block discarded – undo
589 645
 		$error = false; 
590 646
 		if ($fp_out = gzopen($dest, $mode)) { 
591 647
 			if ($fp_in = fopen($source,'rb')) { 
592
-				while (!feof($fp_in)) 
593
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
648
+				while (!feof($fp_in)) {
649
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
650
+				}
594 651
 				fclose($fp_in); 
595 652
 			} else {
596 653
 				$error = true; 
@@ -599,14 +656,17 @@  discard block
 block discarded – undo
599 656
 		} else {
600 657
 			$error = true; 
601 658
 		}
602
-		if ($error)
603
-			return false; 
604
-		else
605
-			return $dest; 
659
+		if ($error) {
660
+					return false;
661
+		} else {
662
+					return $dest;
663
+		}
606 664
 	} 
607 665
 	
608 666
 	public function remove_accents($string) {
609
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
667
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
668
+			return $string;
669
+		}
610 670
 		$chars = array(
611 671
 		    // Decompositions for Latin-1 Supplement
612 672
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -730,7 +790,9 @@  discard block
 block discarded – undo
730 790
 		$ip = gethostbyname($host);
731 791
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
732 792
 		$r = @socket_connect($s, $ip, $port);
733
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
793
+		if (!socket_set_nonblock($s)) {
794
+			echo "Unable to set nonblock on socket\n";
795
+		}
734 796
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
735 797
 			return $s;
736 798
 		}
@@ -775,18 +837,22 @@  discard block
 block discarded – undo
775 837
 		//NOTE: use a trailing slash for folders!!!
776 838
 		//see http://bugs.php.net/bug.php?id=27609
777 839
 		//see http://bugs.php.net/bug.php?id=30931
778
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
840
+		if ($path{strlen($path)-1}=='/') {
841
+			// recursively return a temporary file path
779 842
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
780
-		else if (is_dir($path))
781
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
843
+		} else if (is_dir($path)) {
844
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
845
+		}
782 846
 		// check tmp file for read/write capabilities
783 847
 		$rm = file_exists($path);
784 848
 		$f = @fopen($path, 'a');
785
-		if ($f===false)
786
-			return false;
849
+		if ($f===false) {
850
+					return false;
851
+		}
787 852
 		fclose($f);
788
-		if (!$rm)
789
-			unlink($path);
853
+		if (!$rm) {
854
+					unlink($path);
855
+		}
790 856
 		return true;
791 857
 	}
792 858
 	
@@ -802,7 +868,9 @@  discard block
 block discarded – undo
802 868
 	 * @return Array Coordinate of the route
803 869
 	*/
804 870
 	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
805
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
871
+		if ($nbpts <= 2) {
872
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
873
+		}
806 874
 		$sx = deg2rad($begin_lon);
807 875
 		$sy = deg2rad($begin_lat);
808 876
 		$ex = deg2rad($end_lon);
@@ -811,7 +879,9 @@  discard block
 block discarded – undo
811 879
 		$h = $sy - $ey;
812 880
 		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
813 881
 		$g = 2.0*asin(sqrt($z));
814
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
882
+		if ($g == M_PI || is_nan($g)) {
883
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
884
+		}
815 885
 		$first_pass = array();
816 886
 		$delta = 1.0/($nbpts-1);
817 887
 		for ($i =0; $i < $nbpts; ++$i) {
Please login to merge, or discard this patch.
install/index.php 2 patches
Spacing   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 require_once(dirname(__FILE__).'/class.create_db.php');
24 24
 require_once(dirname(__FILE__).'/class.update_schema.php');
25 25
 require_once(dirname(__FILE__).'/class.settings.php');
26
-$title="Install";
26
+$title = "Install";
27 27
 require(dirname(__FILE__).'/../require/settings.php');
28 28
 require_once(dirname(__FILE__).'/../require/class.Common.php');
29 29
 require(dirname(__FILE__).'/header.php');
30 30
 
31 31
 if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) {
32
-	$password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING);
32
+	$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
33 33
 	if ($password == '') {
34 34
 		if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) {
35 35
 			print '<div class="alert alert-danger">You need to change $globalInstalled in settings.php to FALSE if you want to access setup again.</div>';
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	if (!file_exists(dirname(__FILE__).'/../.htaccess')) {
111 111
 		$error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache.";
112 112
 	}
113
-	if(function_exists('apache_get_modules') ){
114
-		if(!in_array('mod_rewrite',apache_get_modules())) {
113
+	if (function_exists('apache_get_modules')) {
114
+		if (!in_array('mod_rewrite', apache_get_modules())) {
115 115
 			$error[] = "mod_rewrite is not available.";
116 116
 		}
117 117
 	/*
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 		$alllng = $Language->listLocaleDir();
131 131
 		if (count($alllng) != count($availablelng)) {
132 132
 			$notavailable = array();
133
-			foreach($alllng as $lng) {
133
+			foreach ($alllng as $lng) {
134 134
 				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
135 135
 			}
136
-			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
136
+			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
137 137
 		}
138 138
 	}
139 139
 	print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>';
140 140
 	if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
141 141
 		if (function_exists('get_headers')) {
142 142
 			//$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
143
-			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
144
-			if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
143
+			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
144
+			if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
145 145
 				print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
146 146
 			} else {
147
-				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
148
-				if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
147
+				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
148
+				if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
149 149
 					print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
150 150
 				}
151 151
 			}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
234 234
 					if (isset($_SERVER['REQUEST_URI'])) {
235 235
 						$URL = $_SERVER['REQUEST_URI'];
236
-						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
236
+						$globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL)));
237 237
 					}
238 238
 				    }
239 239
 				?>
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 ?>
584 584
 							<tr>
585 585
 								<?php
586
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
586
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
587 587
 								?>
588 588
 								<td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
589 589
 								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
590 590
 								<?php
591 591
 								    } else {
592
-									$hostport = explode(':',$source['host']);
592
+									$hostport = explode(':', $source['host']);
593 593
 									if (isset($hostport[1])) {
594 594
 										$host = $hostport[0];
595 595
 										$port = $hostport[1];
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 									<select name="timezones[]">
645 645
 								<?php
646 646
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
647
-									foreach($timezonelist as $timezones){
647
+									foreach ($timezonelist as $timezones) {
648 648
 										if (isset($source['timezone']) && $source['timezone'] == $timezones) {
649 649
 											print '<option selected>'.$timezones.'</option>';
650 650
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 									<select name="timezones[]" id="timezones">
705 705
 								<?php
706 706
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
707
-									foreach($timezonelist as $timezones){
707
+									foreach ($timezonelist as $timezones) {
708 708
 										if ($timezones == 'UTC') {
709 709
 											print '<option selected>'.$timezones.'</option>';
710 710
 										} else print '<option>'.$timezones.'</option>';
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 			<br />
1197 1197
 			<p>
1198 1198
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1199
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1199
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
1200 1200
 			</p>
1201 1201
 			<br />
1202 1202
 			<p>
@@ -1279,17 +1279,17 @@  discard block
 block discarded – undo
1279 1279
 $error = '';
1280 1280
 
1281 1281
 if (isset($_POST['dbtype'])) {
1282
-	$installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING);
1283
-	$settings = array_merge($settings,array('globalInstallPassword' => $installpass));
1282
+	$installpass = filter_input(INPUT_POST, 'installpass', FILTER_SANITIZE_STRING);
1283
+	$settings = array_merge($settings, array('globalInstallPassword' => $installpass));
1284 1284
 
1285
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
1286
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
1287
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
1288
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
1289
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
1290
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
1291
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1292
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1285
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
1286
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
1287
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
1288
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
1289
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
1290
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
1291
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
1292
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
1293 1293
 
1294 1294
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1295 1295
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -1309,60 +1309,60 @@  discard block
 block discarded – undo
1309 1309
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1310 1310
 	*/
1311 1311
 	
1312
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1312
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
1313 1313
 
1314
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
1315
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
1316
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
1317
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
1318
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
1314
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
1315
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
1316
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
1317
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
1318
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
1319 1319
 
1320
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
1321
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
1322
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
1323
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
1324
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
1325
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
1326
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
1327
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
1328
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
1329
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
1320
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
1321
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
1322
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
1323
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
1324
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
1325
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
1326
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
1327
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
1328
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
1329
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
1330 1330
 	
1331
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
1332
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
1333
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
1334
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
1335
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
1336
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
1331
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
1332
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
1333
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
1334
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
1335
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
1336
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
1337 1337
 
1338
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
1339
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
1338
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
1339
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
1340 1340
 
1341
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
1342
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
1343
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
1341
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
1342
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
1343
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
1344 1344
 
1345
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
1345
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
1346 1346
 	if ($acars == 'acars') {
1347
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
1347
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
1348 1348
 	} else {
1349
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
1349
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
1350 1350
 	}
1351
-	$updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING);
1351
+	$updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING);
1352 1352
 	if ($updatecheck == 'updatecheck') {
1353
-		$settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE'));
1353
+		$settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE'));
1354 1354
 	} else {
1355
-		$settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE'));
1355
+		$settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE'));
1356 1356
 	}
1357 1357
 
1358
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
1359
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
1360
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
1358
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
1359
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
1360
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
1361 1361
 	
1362
-	$sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING);
1363
-	$sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING);
1364
-	$sailawaykey = filter_input(INPUT_POST,'sailawaykey',FILTER_SANITIZE_STRING);
1365
-	$settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass,'key' => $sailawaykey)));
1362
+	$sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING);
1363
+	$sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING);
1364
+	$sailawaykey = filter_input(INPUT_POST, 'sailawaykey', FILTER_SANITIZE_STRING);
1365
+	$settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass, 'key' => $sailawaykey)));
1366 1366
 	
1367 1367
 	$source_name = $_POST['source_name'];
1368 1368
 	$source_latitude = $_POST['source_latitude'];
@@ -1376,8 +1376,8 @@  discard block
 block discarded – undo
1376 1376
 	
1377 1377
 	$sources = array();
1378 1378
 	foreach ($source_name as $keys => $name) {
1379
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1380
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1379
+	    if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]);
1380
+	    else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]);
1381 1381
 	}
1382 1382
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1383 1383
 
@@ -1386,16 +1386,16 @@  discard block
 block discarded – undo
1386 1386
 	$newstype = $_POST['newstype'];
1387 1387
 	
1388 1388
 	$newsfeeds = array();
1389
-	foreach($newsurl as $newskey => $url) {
1389
+	foreach ($newsurl as $newskey => $url) {
1390 1390
 	    if ($url != '') {
1391 1391
 		$type = $newstype[$newskey];
1392 1392
 		$lng = $newslng[$newskey];
1393 1393
 		if (isset($newsfeeds[$type][$lng])) {
1394
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1394
+		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url));
1395 1395
 		} else $newsfeeds[$type][$lng] = array($url);
1396 1396
 	    }
1397 1397
 	}
1398
-	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1398
+	$settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds));
1399 1399
 
1400 1400
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1401 1401
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1406,28 +1406,28 @@  discard block
 block discarded – undo
1406 1406
 	$sbsurl = $_POST['sbsurl'];
1407 1407
 	*/
1408 1408
 
1409
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1410
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1411
-	$globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING);
1412
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1413
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1414
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1415
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1416
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1417
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1409
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1410
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1411
+	$globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING);
1412
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1413
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1414
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1415
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1416
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1417
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1418 1418
 
1419
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1420
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1421
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1422
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1423
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1424
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1425
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1426
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1427
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1428
-	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1429
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1430
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1419
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1420
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1421
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1422
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1423
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1424
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1425
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1426
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1427
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1428
+	$globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING);
1429
+	if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE'));
1430
+	else $settings = array_merge($settings, array('globalSatellite' => 'FALSE'));
1431 1431
 
1432 1432
 /*	
1433 1433
 	$globalSBS1Hosts = array();
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 	}
1444 1444
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1445 1445
 */
1446
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1446
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1447 1447
 	$host = $_POST['host'];
1448 1448
 	$port = $_POST['port'];
1449 1449
 	$name = $_POST['name'];
@@ -1460,120 +1460,120 @@  discard block
 block discarded – undo
1460 1460
 		else $cov = 'FALSE';
1461 1461
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1462 1462
 		else $arch = 'FALSE';
1463
-		if (strpos($format[$key],'_callback')) {
1464
-			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1463
+		if (strpos($format[$key], '_callback')) {
1464
+			$gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE');
1465 1465
 		} elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) {
1466
-			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1466
+			$gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE');
1467 1467
 		}
1468 1468
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1469 1469
 	}
1470
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1470
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1471 1471
 
1472 1472
 /*
1473 1473
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1474 1474
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1475 1475
 */
1476
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1477
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1478
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1476
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1477
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1478
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1479 1479
 
1480
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1481
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1480
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1481
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1482 1482
 
1483
-	$podaccuser = filter_input(INPUT_POST,'podaccuser',FILTER_SANITIZE_STRING);
1484
-	$settings = array_merge($settings,array('globalPODACCuser' => $podaccuser));
1485
-	$podaccpass = filter_input(INPUT_POST,'podaccpass',FILTER_SANITIZE_STRING);
1486
-	$settings = array_merge($settings,array('globalPODACCpass' => $podaccpass));
1483
+	$podaccuser = filter_input(INPUT_POST, 'podaccuser', FILTER_SANITIZE_STRING);
1484
+	$settings = array_merge($settings, array('globalPODACCuser' => $podaccuser));
1485
+	$podaccpass = filter_input(INPUT_POST, 'podaccpass', FILTER_SANITIZE_STRING);
1486
+	$settings = array_merge($settings, array('globalPODACCpass' => $podaccpass));
1487 1487
 
1488
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1489
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1488
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1489
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1490 1490
 
1491
-	$map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING);
1492
-	$settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile));
1491
+	$map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING);
1492
+	$settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile));
1493 1493
 
1494
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1495
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1496
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1497
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1494
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1495
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1496
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1497
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1498 1498
 
1499
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1500
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1501
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1499
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1500
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1501
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1502 1502
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1503
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1504
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1503
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1504
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1505 1505
 
1506
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1507
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1508
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1509
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1510
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1511
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1512
-	$minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT);
1513
-	$settings = array_merge($settings,array('globalMinFetch' => $minfetch));
1514
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1515
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1506
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1507
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1508
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1509
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1510
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1511
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1512
+	$minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT);
1513
+	$settings = array_merge($settings, array('globalMinFetch' => $minfetch));
1514
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1515
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1516 1516
 
1517
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1518
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1517
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1518
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1519 1519
 
1520
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1521
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1520
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1521
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1522 1522
 	
1523
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1523
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1524 1524
 	if ($archiveyear == "archiveyear") {
1525
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1525
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1526 1526
 	} else {
1527
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1527
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1528 1528
 	}
1529
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1530
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1531
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1532
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1529
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1530
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1531
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1532
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1533 1533
 
1534
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1535
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1536
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1537
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1534
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1535
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1536
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1537
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1538 1538
 
1539
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1540
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1541
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1539
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1540
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1541
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1542 1542
 
1543 1543
 	// Create in settings.php keys not yet configurable if not already here
1544 1544
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1545
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1545
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1546 1546
 
1547
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1547
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1548 1548
 	if ($resetyearstats == 'resetyearstats') {
1549
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1549
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1550 1550
 	} else {
1551
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1551
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1552 1552
 	}
1553 1553
 
1554
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1554
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1555 1555
 	if ($archive == 'archive') {
1556
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1556
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1557 1557
 	} else {
1558
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1558
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1559 1559
 	}
1560
-	$archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING);
1560
+	$archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING);
1561 1561
 	if ($archiveresults == 'archiveresults') {
1562
-		$settings = array_merge($settings,array('globalArchiveResults' => 'TRUE'));
1562
+		$settings = array_merge($settings, array('globalArchiveResults' => 'TRUE'));
1563 1563
 	} else {
1564
-		$settings = array_merge($settings,array('globalArchiveResults' => 'FALSE'));
1564
+		$settings = array_merge($settings, array('globalArchiveResults' => 'FALSE'));
1565 1565
 	}
1566
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1566
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1567 1567
 	if ($daemon == 'daemon') {
1568
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1568
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1569 1569
 	} else {
1570
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1570
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1571 1571
 	}
1572
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1572
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1573 1573
 	if ($schedules == 'schedules') {
1574
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1574
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1575 1575
 	} else {
1576
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1576
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1577 1577
 	}
1578 1578
 
1579 1579
 /*
@@ -1584,311 +1584,311 @@  discard block
 block discarded – undo
1584 1584
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1585 1585
 	}
1586 1586
 */
1587
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1588
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1589
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1590
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1591
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1587
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1588
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1589
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1590
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1591
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1592 1592
 	$va = false;
1593 1593
 	if ($globalivao == 'ivao') {
1594
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1594
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1595 1595
 		$va = true;
1596
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1596
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1597 1597
 	if ($globalvatsim == 'vatsim') {
1598
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1598
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1599 1599
 		$va = true;
1600
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1600
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1601 1601
 	if ($globalphpvms == 'phpvms') {
1602
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1602
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1603 1603
 		$va = true;
1604
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1604
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1605 1605
 	if ($globalvam == 'vam') {
1606
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1606
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1607 1607
 		$va = true;
1608
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1608
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1609 1609
 	if ($va) {
1610
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1611
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1610
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1611
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1612 1612
 	if ($globalva == 'va' || $va) {
1613
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1614
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1613
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1614
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1615 1615
 	} else {
1616
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1617
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1618
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1616
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1617
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1618
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1619 1619
 	}
1620 1620
 	if ($globalvm == 'vm') {
1621
-		$settings = array_merge($settings,array('globalVM' => 'TRUE'));
1621
+		$settings = array_merge($settings, array('globalVM' => 'TRUE'));
1622 1622
 	} else {
1623
-		$settings = array_merge($settings,array('globalVM' => 'FALSE'));
1623
+		$settings = array_merge($settings, array('globalVM' => 'FALSE'));
1624 1624
 	}
1625 1625
 	
1626
-	$mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING);
1626
+	$mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING);
1627 1627
 	if ($mapoffline == 'mapoffline') {
1628
-		$settings = array_merge($settings,array('globalMapOffline' => 'TRUE'));
1628
+		$settings = array_merge($settings, array('globalMapOffline' => 'TRUE'));
1629 1629
 	} else {
1630
-		$settings = array_merge($settings,array('globalMapOffline' => 'FALSE'));
1630
+		$settings = array_merge($settings, array('globalMapOffline' => 'FALSE'));
1631 1631
 	}
1632
-	$globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING);
1632
+	$globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING);
1633 1633
 	if ($globaloffline == 'globaloffline') {
1634
-		$settings = array_merge($settings,array('globalOffline' => 'TRUE'));
1634
+		$settings = array_merge($settings, array('globalOffline' => 'TRUE'));
1635 1635
 	} else {
1636
-		$settings = array_merge($settings,array('globalOffline' => 'FALSE'));
1636
+		$settings = array_merge($settings, array('globalOffline' => 'FALSE'));
1637 1637
 	}
1638 1638
 
1639
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1639
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1640 1640
 	if ($notam == 'notam') {
1641
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1641
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1642 1642
 	} else {
1643
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1643
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1644 1644
 	}
1645
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1645
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1646 1646
 	if ($owner == 'owner') {
1647
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1647
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1648 1648
 	} else {
1649
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1649
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1650 1650
 	}
1651
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1651
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1652 1652
 	if ($map3d == 'map3d') {
1653
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1653
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1654 1654
 	} else {
1655
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1655
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1656 1656
 	}
1657
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1657
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1658 1658
 	if ($crash == 'crash') {
1659
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1659
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1660 1660
 	} else {
1661
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1661
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1662 1662
 	}
1663
-	$fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING);
1663
+	$fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING);
1664 1664
 	if ($fires == 'fires') {
1665
-		$settings = array_merge($settings,array('globalMapFires' => 'TRUE'));
1665
+		$settings = array_merge($settings, array('globalMapFires' => 'TRUE'));
1666 1666
 	} else {
1667
-		$settings = array_merge($settings,array('globalMapFires' => 'FALSE'));
1667
+		$settings = array_merge($settings, array('globalMapFires' => 'FALSE'));
1668 1668
 	}
1669
-	$firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING);
1669
+	$firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING);
1670 1670
 	if ($firessupport == 'firessupport') {
1671
-		$settings = array_merge($settings,array('globalFires' => 'TRUE'));
1671
+		$settings = array_merge($settings, array('globalFires' => 'TRUE'));
1672 1672
 	} else {
1673
-		$settings = array_merge($settings,array('globalFires' => 'FALSE'));
1673
+		$settings = array_merge($settings, array('globalFires' => 'FALSE'));
1674 1674
 	}
1675
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1675
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1676 1676
 	if ($mapsatellites == 'mapsatellites') {
1677
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1677
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1678 1678
 	} else {
1679
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1679
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1680 1680
 	}
1681
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1681
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1682 1682
 	if ($map3ddefault == 'map3ddefault') {
1683
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1683
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1684 1684
 	} else {
1685
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1685
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1686 1686
 	}
1687
-	$one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING);
1687
+	$one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING);
1688 1688
 	if ($one3dmodel == 'one3dmodel') {
1689
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE'));
1689
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE'));
1690 1690
 	} else {
1691
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE'));
1691
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE'));
1692 1692
 	}
1693
-	$map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING);
1693
+	$map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING);
1694 1694
 	if ($map3dliveries == 'map3dliveries') {
1695
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE'));
1695
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE'));
1696 1696
 	} else {
1697
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE'));
1697
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE'));
1698 1698
 	}
1699
-	$map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING);
1699
+	$map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING);
1700 1700
 	if ($map3dshadows == 'map3dshadows') {
1701
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE'));
1701
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE'));
1702 1702
 	} else {
1703
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE'));
1703
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE'));
1704 1704
 	}
1705
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1705
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1706 1706
 	if ($translate == 'translate') {
1707
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1707
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1708 1708
 	} else {
1709
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1709
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1710 1710
 	}
1711
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1711
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1712 1712
 	if ($realairlines == 'realairlines') {
1713
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1713
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1714 1714
 	} else {
1715
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1715
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1716 1716
 	}
1717
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1717
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1718 1718
 	if ($estimation == 'estimation') {
1719
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1719
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1720 1720
 	} else {
1721
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1721
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1722 1722
 	}
1723
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1723
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1724 1724
 	if ($metar == 'metar') {
1725
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1725
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1726 1726
 	} else {
1727
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1727
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1728 1728
 	}
1729
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1729
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1730 1730
 	if ($metarcycle == 'metarcycle') {
1731
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1731
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1732 1732
 	} else {
1733
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1733
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1734 1734
 	}
1735
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1735
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1736 1736
 	if ($fork == 'fork') {
1737
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1737
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1738 1738
 	} else {
1739
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1739
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1740 1740
 	}
1741 1741
 
1742
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1742
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1743 1743
 	if ($colormap == 'colormap') {
1744
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1744
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1745 1745
 	} else {
1746
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1746
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1747 1747
 	}
1748 1748
 	
1749 1749
 	if (isset($_POST['aircrafticoncolor'])) {
1750
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1751
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1750
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1751
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1752 1752
 	}
1753 1753
 	if (isset($_POST['marineiconcolor'])) {
1754
-		$marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING);
1755
-		$settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1)));
1754
+		$marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING);
1755
+		$settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1)));
1756 1756
 	}
1757 1757
 	if (isset($_POST['trackericoncolor'])) {
1758
-		$trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING);
1759
-		$settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1)));
1758
+		$trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING);
1759
+		$settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1)));
1760 1760
 	}
1761 1761
 	if (isset($_POST['satelliteiconcolor'])) {
1762
-		$satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING);
1763
-		$settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1)));
1762
+		$satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING);
1763
+		$settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1)));
1764 1764
 	}
1765 1765
 
1766
-	$corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING);
1767
-	$settings = array_merge($settings,array('globalCORSproxy' => $corsproxy));
1766
+	$corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING);
1767
+	$settings = array_merge($settings, array('globalCORSproxy' => $corsproxy));
1768 1768
 
1769
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1770
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1769
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1770
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1771 1771
 
1772
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1773
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1774
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1775
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1776
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1777
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1772
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1773
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1774
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1775
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1776
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1777
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1778 1778
 
1779
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1779
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1780 1780
 	if ($mappopup == 'mappopup') {
1781
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1781
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1782 1782
 	} else {
1783
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1783
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1784 1784
 	}
1785
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1785
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1786 1786
 	if ($airportpopup == 'airportpopup') {
1787
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1787
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1788 1788
 	} else {
1789
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1789
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1790 1790
 	}
1791
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1791
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1792 1792
 	if ($maphistory == 'maphistory') {
1793
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1793
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1794 1794
 	} else {
1795
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1795
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1796 1796
 	}
1797
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1797
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1798 1798
 	if ($maptooltip == 'maptooltip') {
1799
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1799
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1800 1800
 	} else {
1801
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1801
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1802 1802
 	}
1803
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1803
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1804 1804
 	if ($flightroute == 'flightroute') {
1805
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1805
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1806 1806
 	} else {
1807
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1807
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1808 1808
 	}
1809
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1809
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1810 1810
 	if ($flightremainingroute == 'flightremainingroute') {
1811
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1811
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1812 1812
 	} else {
1813
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1813
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1814 1814
 	}
1815
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1815
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1816 1816
 	if ($allflights == 'allflights') {
1817
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1817
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1818 1818
 	} else {
1819
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1819
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1820 1820
 	}
1821
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1821
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1822 1822
 	if ($bbox == 'bbox') {
1823
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1823
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1824 1824
 	} else {
1825
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1825
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1826 1826
 	}
1827
-	$singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING);
1827
+	$singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING);
1828 1828
 	if ($singlemodel == 'singlemodel') {
1829
-		$settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE'));
1829
+		$settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE'));
1830 1830
 	} else {
1831
-		$settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE'));
1831
+		$settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE'));
1832 1832
 	}
1833
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1833
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1834 1834
 	if ($groundaltitude == 'groundaltitude') {
1835
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1835
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1836 1836
 	} else {
1837
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1837
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1838 1838
 	}
1839
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1839
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1840 1840
 	if ($waypoints == 'waypoints') {
1841
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1841
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1842 1842
 	} else {
1843
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1843
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1844 1844
 	}
1845
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1845
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1846 1846
 	if ($geoid == 'geoid') {
1847
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1847
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1848 1848
 	} else {
1849
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1849
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1850 1850
 	}
1851
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1852
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1851
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1852
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1853 1853
 
1854
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1854
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1855 1855
 	if ($noairlines == 'noairlines') {
1856
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1856
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1857 1857
 	} else {
1858
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1858
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1859 1859
 	}
1860 1860
 
1861
-	$tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING);
1861
+	$tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING);
1862 1862
 	if ($tsk == 'tsk') {
1863
-		$settings = array_merge($settings,array('globalTSK' => 'TRUE'));
1863
+		$settings = array_merge($settings, array('globalTSK' => 'TRUE'));
1864 1864
 	} else {
1865
-		$settings = array_merge($settings,array('globalTSK' => 'FALSE'));
1865
+		$settings = array_merge($settings, array('globalTSK' => 'FALSE'));
1866 1866
 	}
1867
-	$mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING);
1867
+	$mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING);
1868 1868
 	if ($mapmatching == 'mapmatching') {
1869
-		$settings = array_merge($settings,array('globalMapMatching' => 'TRUE'));
1869
+		$settings = array_merge($settings, array('globalMapMatching' => 'TRUE'));
1870 1870
 	} else {
1871
-		$settings = array_merge($settings,array('globalMapMatching' => 'FALSE'));
1871
+		$settings = array_merge($settings, array('globalMapMatching' => 'FALSE'));
1872 1872
 	}
1873
-	$mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING);
1874
-	$settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource));
1875
-	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1876
-	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1873
+	$mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING);
1874
+	$settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource));
1875
+	$graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING);
1876
+	$settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper));
1877 1877
 
1878
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1878
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1879 1879
 
1880 1880
 	// Set some defaults values...
1881 1881
 	if (!isset($globalAircraftImageSources)) {
1882
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1883
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1882
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1883
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1884 1884
 	}
1885 1885
 
1886 1886
 	if (!isset($globalSchedulesSources)) {
1887
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1888
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1887
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1888
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1889 1889
     	}
1890 1890
 
1891
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1891
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1892 1892
 
1893 1893
 	if ($error == '') settings::modify_settings($settings);
1894 1894
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
Braces   +667 added lines, -177 removed lines patch added patch discarded remove patch
@@ -4,12 +4,22 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-	if (isset($_SESSION['identitied'])) unset($_SESSION['identified']);
12
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	if (isset($_SESSION['identitied'])) {
20
+		unset($_SESSION['identified']);
21
+	}
22
+	}
13 23
 /*
14 24
 if (isset($_SESSION['errorlst'])) {
15 25
 	header('Content-Encoding: none;');
@@ -131,7 +141,9 @@  discard block
 block discarded – undo
131 141
 		if (count($alllng) != count($availablelng)) {
132 142
 			$notavailable = array();
133 143
 			foreach($alllng as $lng) {
134
-				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
144
+				if (!isset($availablelng[$lng])) {
145
+					$notavailable[] = $lng;
146
+				}
135 147
 			}
136 148
 			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
137 149
 		}
@@ -170,7 +182,10 @@  discard block
 block discarded – undo
170 182
 			<legend>Install script configuration</legend>
171 183
 			<p>
172 184
 				<label for="installpass">Install password</label>
173
-				<input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) print $globalInstallPassword; ?>" />
185
+				<input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) {
186
+	print $globalInstallPassword;
187
+}
188
+?>" />
174 189
 			</p>
175 190
 			<p class="help-block">Password needed to access this install script. If empty, to access this script,  you will need to change the $globalInstalled setting in require/settings.php to FALSE</p>
176 191
 		</fieldset>
@@ -200,31 +215,49 @@  discard block
 block discarded – undo
200 215
 			</div>
201 216
 			<p>
202 217
 				<label for="dbhost">Database hostname</label>
203
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
218
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
219
+	print $globalDBhost;
220
+}
221
+?>" />
204 222
 			</p>
205 223
 			<p>
206 224
 				<label for="dbport">Database port</label>
207
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
225
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
226
+	print $globalDBport;
227
+}
228
+?>" />
208 229
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
209 230
 			</p>
210 231
 			<p>
211 232
 				<label for="dbname">Database name</label>
212
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
233
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
234
+	print $globalDBname;
235
+}
236
+?>" />
213 237
 			</p>
214 238
 			<p>
215 239
 				<label for="dbuser">Database user</label>
216
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
240
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
241
+	print $globalDBuser;
242
+}
243
+?>" />
217 244
 			</p>
218 245
 			<p>
219 246
 				<label for="dbuserpass">Database user password</label>
220
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
247
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
248
+	print $globalDBpass;
249
+}
250
+?>" />
221 251
 			</p>
222 252
 		</fieldset>
223 253
 		<fieldset id="site">
224 254
 			<legend>Site configuration</legend>
225 255
 			<p>
226 256
 				<label for="sitename">Site name</label>
227
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
257
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
258
+	print $globalName;
259
+}
260
+?>" />
228 261
 			</p>
229 262
 			<p>
230 263
 				<label for="siteurl">Site directory</label>
@@ -237,18 +270,27 @@  discard block
 block discarded – undo
237 270
 					}
238 271
 				    }
239 272
 				?>
240
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
273
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
274
+	print $globalURL;
275
+}
276
+?>" />
241 277
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
242 278
 				<p class="help-block">Can be empty</p>
243 279
 			</p>
244 280
 			<p>
245 281
 				<label for="timezone">Timezone</label>
246
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
282
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
283
+	print $globalTimezone;
284
+}
285
+?>" />
247 286
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
248 287
 			</p>
249 288
 			<p>
250 289
 				<label for="language">Language</label>
251
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
290
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
291
+	print $globalLanguage;
292
+}
293
+?>" />
252 294
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
253 295
 			</p>
254 296
 		</fieldset>
@@ -268,11 +310,17 @@  discard block
 block discarded – undo
268 310
 			<div id="mapbox_data">
269 311
 				<p>
270 312
 					<label for="mapboxid">Mapbox id</label>
271
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
313
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
314
+	print $globalMapboxId;
315
+}
316
+?>" />
272 317
 				</p>
273 318
 				<p>
274 319
 					<label for="mapboxtoken">Mapbox token</label>
275
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
320
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
321
+	print $globalMapboxToken;
322
+}
323
+?>" />
276 324
 				</p>
277 325
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
278 326
 			</div>
@@ -280,7 +328,10 @@  discard block
 block discarded – undo
280 328
 			<div id="google_data">
281 329
 				<p>
282 330
 					<label for="googlekey">Google API key</label>
283
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
331
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
332
+	print $globalGoogleAPIKey;
333
+}
334
+?>" />
284 335
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
285 336
 				</p>
286 337
 			</div>
@@ -288,7 +339,10 @@  discard block
 block discarded – undo
288 339
 			<div id="bing_data">
289 340
 				<p>
290 341
 					<label for="bingkey">Bing Map key</label>
291
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
342
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
343
+	print $globalBingMapKey;
344
+}
345
+?>" />
292 346
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
293 347
 				</p>
294 348
 			</div>
@@ -296,7 +350,10 @@  discard block
 block discarded – undo
296 350
 			<div id="mapquest_data">
297 351
 				<p>
298 352
 					<label for="mapquestkey">MapQuest key</label>
299
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
353
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
354
+	print $globalMapQuestKey;
355
+}
356
+?>" />
300 357
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
301 358
 				</p>
302 359
 			</div>
@@ -304,11 +361,17 @@  discard block
 block discarded – undo
304 361
 			<div id="here_data">
305 362
 				<p>
306 363
 					<label for="hereappid">Here App_Id</label>
307
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
364
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
365
+	print $globalHereappId;
366
+}
367
+?>" />
308 368
 				</p>
309 369
 				<p>
310 370
 					<label for="hereappcode">Here App_Code</label>
311
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
371
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
372
+	print $globalHereappCode;
373
+}
374
+?>" />
312 375
 				</p>
313 376
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
314 377
 			</div>
@@ -316,7 +379,10 @@  discard block
 block discarded – undo
316 379
 			<div id="openweathermap_data">
317 380
 				<p>
318 381
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
319
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
382
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
383
+	print $globalOpenWeatherMapKey;
384
+}
385
+?>" />
320 386
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
321 387
 				</p>
322 388
 			</div>
@@ -345,42 +411,86 @@  discard block
 block discarded – undo
345 411
 			<legend>Coverage area</legend>
346 412
 			<p>
347 413
 				<label for="latitudemax">The maximum latitude (north)</label>
348
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
414
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
415
+	print $globalLatitudeMax;
416
+}
417
+?>" />
349 418
 			</p>
350 419
 			<p>
351 420
 				<label for="latitudemin">The minimum latitude (south)</label>
352
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
421
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
422
+	print $globalLatitudeMin;
423
+}
424
+?>" />
353 425
 			</p>
354 426
 			<p>
355 427
 				<label for="longitudemax">The maximum longitude (west)</label>
356
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
428
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
429
+	print $globalLongitudeMax;
430
+}
431
+?>" />
357 432
 			</p>
358 433
 			<p>
359 434
 				<label for="longitudemin">The minimum longitude (east)</label>
360
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
435
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
436
+	print $globalLongitudeMin;
437
+}
438
+?>" />
361 439
 			</p>
362 440
 			<p>
363 441
 				<label for="latitudecenter">The latitude center</label>
364
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
442
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
443
+	print $globalCenterLatitude;
444
+}
445
+?>" />
365 446
 			</p>
366 447
 			<p>
367 448
 				<label for="longitudecenter">The longitude center</label>
368
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
449
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
450
+	print $globalCenterLongitude;
451
+}
452
+?>" />
369 453
 			</p>
370 454
 			<p>
371 455
 				<label for="livezoom">Default Zoom on live map</label>
372
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
456
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
457
+	print $globalLiveZoom;
458
+} else {
459
+	print '9';
460
+}
461
+?>" />
373 462
 			</p>
374 463
 			<p>
375 464
 				<label for="squawk_country">Country for squawk usage</label>
376 465
 				<select name="squawk_country" id="squawk_country">
377
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
378
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
379
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
380
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
381
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
382
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
383
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
466
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
467
+	print ' selected ';
468
+}
469
+?>>UK</option>
470
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
471
+	print ' selected ';
472
+}
473
+?>>NZ</option>
474
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
475
+	print ' selected ';
476
+}
477
+?>>US</option>
478
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
479
+	print ' selected ';
480
+}
481
+?>>AU</option>
482
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
483
+	print ' selected ';
484
+}
485
+?>>NL</option>
486
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
487
+	print ' selected ';
488
+}
489
+?>>FR</option>
490
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
491
+	print ' selected ';
492
+}
493
+?>>TR</option>
384 494
 				</select>
385 495
 			</p>
386 496
 		</fieldset>
@@ -389,15 +499,24 @@  discard block
 block discarded – undo
389 499
 			<p><i>Only put in DB flights that are inside a circle</i></p>
390 500
 			<p>
391 501
 				<label for="latitude">Center latitude</label>
392
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
502
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
503
+	echo $globalDistanceIgnore['latitude'];
504
+}
505
+?>" />
393 506
 			</p>
394 507
 			<p>
395 508
 				<label for="longitude">Center longitude</label>
396
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
509
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
510
+	echo $globalDistanceIgnore['longitude'];
511
+}
512
+?>" />
397 513
 			</p>
398 514
 			<p>
399 515
 				<label for="Distance">Distance (in km)</label>
400
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
516
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
517
+	echo $globalDistanceIgnore['distance'];
518
+}
519
+?>" />
401 520
 			</p>
402 521
 		</fieldset>
403 522
 		<fieldset id="sourceloc">
@@ -523,28 +642,43 @@  discard block
 block discarded – undo
523 642
 			<div id="flightaware_data">
524 643
 				<p>
525 644
 					<label for="flightawareusername">FlightAware username</label>
526
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
645
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
646
+	print $globalFlightAwareUsername;
647
+}
648
+?>" />
527 649
 				</p>
528 650
 				<p>
529 651
 					<label for="flightawarepassword">FlightAware password/API key</label>
530
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
652
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
653
+	print $globalFlightAwarePassword;
654
+}
655
+?>" />
531 656
 				</p>
532 657
 			</div>
533 658
 -->
534 659
 			<div id="sailaway_data">
535 660
 				<p>
536 661
 					<label for="sailawayemail">Sailaway email</label>
537
-					<input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" />
662
+					<input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) {
663
+	print $globalSailaway['email'];
664
+}
665
+?>" />
538 666
 					<p class="help-block">Only needed for Sailaway full format</p>
539 667
 				</p>
540 668
 				<p>
541 669
 					<label for="sailawaypassword">Sailaway password</label>
542
-					<input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" />
670
+					<input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) {
671
+	print $globalSailaway['password'];
672
+}
673
+?>" />
543 674
 					<p class="help-block">Only needed for Sailaway full format</p>
544 675
 				</p>
545 676
 				<p>
546 677
 					<label for="sailawaykey">Sailaway API key</label>
547
-					<input type="text" name="sailawaykey" id="sailawaykey" value="<?php if (isset($globalSailaway['key'])) print $globalSailaway['key']; ?>" />
678
+					<input type="text" name="sailawaykey" id="sailawaykey" value="<?php if (isset($globalSailaway['key'])) {
679
+	print $globalSailaway['key'];
680
+}
681
+?>" />
548 682
 				</p>
549 683
 			</div>
550 684
 
@@ -586,7 +720,10 @@  discard block
 block discarded – undo
586 720
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
587 721
 								?>
588 722
 								<td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
589
-								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
723
+								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) {
724
+	print $source['port'];
725
+}
726
+?>" /></td>
590 727
 								<?php
591 728
 								    } else {
592 729
 									$hostport = explode(':',$source['host']);
@@ -605,41 +742,134 @@  discard block
 block discarded – undo
605 742
 								?>
606 743
 								<td>
607 744
 									<select name="format[]">
608
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
609
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
610
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
611
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
612
-										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
613
-										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option>
614
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
615
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
616
-                                        <option value="radarcapejson" <?php if (isset($source['format']) && $source['format'] == 'radarcapejson') print 'selected'; ?>>Radarcape json</option>
617
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
618
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
619
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
620
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
621
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
622
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
623
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
624
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
625
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
626
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
627
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
628
-										<option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') print 'selected'; ?>>ACARS from acarsdec json and vdlm2dec</option>
629
-										<option value="acarsjsonudp" <?php if (isset($source['format']) && $source['format'] == 'acarsjsonudp') print 'selected'; ?>>ACARS from acarsdec json and vdlm2dec over UDP</option>
630
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
631
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
632
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
633
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
634
-										<option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option>
635
-										<option value="sailawayfull" <?php if (isset($source['format']) && $source['format'] == 'sailawayfull') print 'selected'; ?>>Sailaway with missions, races,...</option>
745
+										<option value="auto" <?php if (!isset($source['format'])) {
746
+	print 'selected';
747
+}
748
+?>>Auto</option>
749
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
750
+	print 'selected';
751
+}
752
+?>>SBS</option>
753
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
754
+	print 'selected';
755
+}
756
+?>>TSV</option>
757
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
758
+	print 'selected';
759
+}
760
+?>>Raw</option>
761
+										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') {
762
+	print 'selected';
763
+}
764
+?>>Dump1090 aircraft.json</option>
765
+										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') {
766
+	print 'selected';
767
+}
768
+?>>Planefinder client</option>
769
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
770
+	print 'selected';
771
+}
772
+?>>APRS</option>
773
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
774
+	print 'selected';
775
+}
776
+?>>Radarcape deltadb.txt</option>
777
+                                        <option value="radarcapejson" <?php if (isset($source['format']) && $source['format'] == 'radarcapejson') {
778
+	print 'selected';
779
+}
780
+?>>Radarcape json</option>
781
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
782
+	print 'selected';
783
+}
784
+?>>Vatsim</option>
785
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
786
+	print 'selected';
787
+}
788
+?>>Virtual Radar Server AircraftList.json</option>
789
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
790
+	print 'selected';
791
+}
792
+?>>Virtual Radar Server TCP</option>
793
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
794
+	print 'selected';
795
+}
796
+?>>phpVMS</option>
797
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
798
+	print 'selected';
799
+}
800
+?>>Virtual Airline Operations System (VAOS)</option>
801
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
802
+	print 'selected';
803
+}
804
+?>>Virtual Airlines Manager</option>
805
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
806
+	print 'selected';
807
+}
808
+?>>IVAO</option>
809
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
810
+	print 'selected';
811
+}
812
+?>>FlightGear Multiplayer</option>
813
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
814
+	print 'selected';
815
+}
816
+?>>FlightGear Singleplayer</option>
817
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
818
+	print 'selected';
819
+}
820
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
821
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
822
+	print 'selected';
823
+}
824
+?>>ACARS SBS-3 over TCP</option>
825
+										<option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') {
826
+	print 'selected';
827
+}
828
+?>>ACARS from acarsdec json and vdlm2dec</option>
829
+										<option value="acarsjsonudp" <?php if (isset($source['format']) && $source['format'] == 'acarsjsonudp') {
830
+	print 'selected';
831
+}
832
+?>>ACARS from acarsdec json and vdlm2dec over UDP</option>
833
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
834
+	print 'selected';
835
+}
836
+?>>NMEA AIS over TCP</option>
837
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
838
+	print 'selected';
839
+}
840
+?>>AirWhere website</option>
841
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
842
+	print 'selected';
843
+}
844
+?>>HidnSeek Callback</option>
845
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
846
+	print 'selected';
847
+}
848
+?>>Blitzortung</option>
849
+										<option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') {
850
+	print 'selected';
851
+}
852
+?>>Sailaway</option>
853
+										<option value="sailawayfull" <?php if (isset($source['format']) && $source['format'] == 'sailawayfull') {
854
+	print 'selected';
855
+}
856
+?>>Sailaway with missions, races,...</option>
636 857
 									</select>
637 858
 								</td>
638 859
 								<td>
639
-									<input type="text" name="name[]" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
860
+									<input type="text" name="name[]" value="<?php if (isset($source['name'])) {
861
+	print $source['name'];
862
+}
863
+?>" />
640 864
 								</td>
641
-								<td><input type="checkbox" name="sourcestats[]" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
642
-								<td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
865
+								<td><input type="checkbox" name="sourcestats[]" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
866
+	print 'checked';
867
+}
868
+?> /></td>
869
+								<td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
870
+	print 'checked';
871
+}
872
+?> /></td>
643 873
 								<td>
644 874
 									<select name="timezones[]">
645 875
 								<?php
@@ -649,7 +879,9 @@  discard block
 block discarded – undo
649 879
 											print '<option selected>'.$timezones.'</option>';
650 880
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
651 881
 											print '<option selected>'.$timezones.'</option>';
652
-										} else print '<option>'.$timezones.'</option>';
882
+										} else {
883
+											print '<option>'.$timezones.'</option>';
884
+										}
653 885
 									}
654 886
 								?>
655 887
 									</select>
@@ -707,7 +939,9 @@  discard block
 block discarded – undo
707 939
 									foreach($timezonelist as $timezones){
708 940
 										if ($timezones == 'UTC') {
709 941
 											print '<option selected>'.$timezones.'</option>';
710
-										} else print '<option>'.$timezones.'</option>';
942
+										} else {
943
+											print '<option>'.$timezones.'</option>';
944
+										}
711 945
 									}
712 946
 								?>
713 947
 									</select>
@@ -732,11 +966,17 @@  discard block
 block discarded – undo
732 966
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
733 967
 					<p>
734 968
 						<label for="acarshost">ACARS UDP host</label>
735
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
969
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
970
+	print $globalACARSHost;
971
+}
972
+?>" />
736 973
 					</p>
737 974
 					<p>
738 975
 						<label for="acarsport">ACARS UDP port</label>
739
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
976
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
977
+	print $globalACARSPort;
978
+}
979
+?>" />
740 980
 					</p>
741 981
 					<p class="help-block"><i>daemon-acars.php</i> can only be run as daemon. It's an alternate script for ACARS data, <i>daemon-spotter.php</i> may be better.</p>
742 982
 				</fieldset>
@@ -763,17 +1003,38 @@  discard block
 block discarded – undo
763 1003
 				    <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
764 1004
 				    <td>
765 1005
 					<select name="newslang[]">
766
-					    <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
767
-					    <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
1006
+					    <option value="en"<?php if ($lng == 'en') {
1007
+	print ' selected';
1008
+}
1009
+?>>English</option>
1010
+					    <option value="fr"<?php if ($lng == 'fr') {
1011
+	print ' selected';
1012
+}
1013
+?>>French</option>
768 1014
 					</select>
769 1015
 				    </td>
770 1016
 				    <td>
771 1017
 					<select name="newstype[]">
772
-					    <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
773
-					    <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
774
-					    <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
775
-					    <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
776
-					    <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
1018
+					    <option value="global"<?php if ($type == 'global') {
1019
+	print ' selected';
1020
+}
1021
+?>>Global</option>
1022
+					    <option value="aircraft"<?php if ($type == 'aircraft') {
1023
+	print ' selected';
1024
+}
1025
+?>>Aircraft</option>
1026
+					    <option value="marine"<?php if ($type == 'marine') {
1027
+	print ' selected';
1028
+}
1029
+?>>Marine</option>
1030
+					    <option value="tracker"<?php if ($type == 'tracker') {
1031
+	print ' selected';
1032
+}
1033
+?>>Tracker</option>
1034
+					    <option value="satellite"<?php if ($type == 'Satellite') {
1035
+	print ' selected';
1036
+}
1037
+?>>Satellite</option>
777 1038
 					</select>
778 1039
 				    </td>
779 1040
 				    <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
@@ -857,7 +1118,10 @@  discard block
 block discarded – undo
857 1118
 			</p>
858 1119
 			<p>
859 1120
 				<label for="corsproxy">CORS proxy</label>
860
-				<input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" />
1121
+				<input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) {
1122
+	print $globalCORSproxy;
1123
+} else {
1124
+	print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" />
861 1125
 				<p class="help-block">CORS proxy used for some WMS servers</p>
862 1126
 			</p>
863 1127
 <!--
@@ -920,13 +1184,18 @@  discard block
 block discarded – undo
920 1184
 			<div id="schedules_options">
921 1185
 				<p>
922 1186
 					<label for="britishairways">British Airways API Key</label>
923
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
1187
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey;
1188
+}
1189
+?>" />
924 1190
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
925 1191
 				</p>
926 1192
 				<!--
927 1193
 				<p>
928 1194
 					<label for="transavia">Transavia Test API Consumer Key</label>
929
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
1195
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
1196
+	print $globalTransaviaKey;
1197
+}
1198
+?>" />
930 1199
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
931 1200
 				</p>
932 1201
 				-->
@@ -935,10 +1204,16 @@  discard block
 block discarded – undo
935 1204
 						<b>Lufthansa API Key</b>
936 1205
 						<p>
937 1206
 							<label for="lufthansakey">Key</label>
938
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
1207
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
1208
+	print $globalLufthansaKey['key'];
1209
+}
1210
+?>" />
939 1211
 						</p><p>
940 1212
 							<label for="lufthansasecret">Secret</label>
941
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
1213
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
1214
+	print $globalLufthansaKey['secret'];
1215
+}
1216
+?>" />
942 1217
 						</p>
943 1218
 					</div>
944 1219
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -948,11 +1223,17 @@  discard block
 block discarded – undo
948 1223
 						<b>FlightAware API Key</b>
949 1224
 						<p>
950 1225
 							<label for="flightawareusername">Username</label>
951
-							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
1226
+							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
1227
+	print $globalFlightAwareUsername;
1228
+}
1229
+?>" />
952 1230
 						</p>
953 1231
 						<p>
954 1232
 							<label for="flightawarepassword">API key</label>
955
-							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
1233
+							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
1234
+	print $globalFlightAwarePassword;
1235
+}
1236
+?>" />
956 1237
 						</p>
957 1238
 					</div>
958 1239
 					<p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
@@ -969,10 +1250,22 @@  discard block
 block discarded – undo
969 1250
 				<p>
970 1251
 					<label for="mapmatchingsource">Map Matching source</label>
971 1252
 					<select name="mapmatchingsource" id="mapmatchingsource">
972
-						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
973
-						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
974
-						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
975
-						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
1253
+						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) {
1254
+	print 'selected="selected" ';
1255
+}
1256
+?>>FlightAirMap Map Matching</option>
1257
+						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') {
1258
+	print 'selected="selected" ';
1259
+}
1260
+?>>GraphHopper</option>
1261
+						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') {
1262
+	print 'selected="selected" ';
1263
+}
1264
+?>>OSMR</option>
1265
+						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') {
1266
+	print 'selected="selected" ';
1267
+}
1268
+?>>Mapbox</option>
976 1269
 					</select>
977 1270
 					<p class="help-block">Mapbox need the API Key defined in map section.</p>
978 1271
 					<p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
@@ -980,7 +1273,10 @@  discard block
 block discarded – undo
980 1273
 				<br />
981 1274
 				<p>
982 1275
 					<label for="graphhopper">GraphHopper API Key</label>
983
-					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
1276
+					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) {
1277
+	print $globalGraphHopperKey;
1278
+}
1279
+?>" />
984 1280
 					<p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
985 1281
 				</p>
986 1282
 			</div>
@@ -998,7 +1294,10 @@  discard block
 block discarded – undo
998 1294
 			</p>
999 1295
 			<p>
1000 1296
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
1001
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
1297
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
1298
+	print $globalNOTAMSource;
1299
+}
1300
+?>" />
1002 1301
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
1003 1302
 			</p>
1004 1303
 			<br />
@@ -1014,7 +1313,10 @@  discard block
 block discarded – undo
1014 1313
 			<div id="metarsrc">
1015 1314
 				<p>
1016 1315
 					<label for="metarsource">URL of your METAR source</label>
1017
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1316
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
1317
+	print $globalMETARurl;
1318
+}
1319
+?>" />
1018 1320
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
1019 1321
 				</p>
1020 1322
 			</div>
@@ -1022,18 +1324,27 @@  discard block
 block discarded – undo
1022 1324
 			<div id="podaac">
1023 1325
 				<p>
1024 1326
 					<label for="podaccuser">PO.DAAC username (used for waves)</label>
1025
-					<input type="text" name="podaccuser" id="podaccuser" value="<?php if (isset($globalPODAACuser)) print $globalPODAACuser; ?>" />
1327
+					<input type="text" name="podaccuser" id="podaccuser" value="<?php if (isset($globalPODAACuser)) {
1328
+	print $globalPODAACuser;
1329
+}
1330
+?>" />
1026 1331
 				</p>
1027 1332
 				<p>
1028 1333
 					<label for="podaccpass">PO.DAAC password</label>
1029
-					<input type="text" name="podaccpass" id="podaccpass" value="<?php if (isset($globalPODAACpass)) print $globalPODAACpass; ?>" />
1334
+					<input type="text" name="podaccpass" id="podaccpass" value="<?php if (isset($globalPODAACpass)) {
1335
+	print $globalPODAACpass;
1336
+}
1337
+?>" />
1030 1338
 				</p>
1031 1339
 				<p class="help-block">Register an account on <a href="https://podaac-tools.jpl.nasa.gov/drive/">https://podaac-tools.jpl.nasa.gov/drive/</a></p>
1032 1340
 			</div>
1033 1341
 			<br />
1034 1342
 			<p>
1035 1343
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
1036
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1344
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1345
+	print $globalBitlyAccessToken;
1346
+}
1347
+?>" />
1037 1348
 			</p>
1038 1349
 			<br />
1039 1350
 			<p>
@@ -1049,11 +1360,26 @@  discard block
 block discarded – undo
1049 1360
 			<p>
1050 1361
 				<label for="geoid_source">Geoid Source</label>
1051 1362
 				<select name="geoid_source" id="geoid_source">
1052
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
1053
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
1054
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
1055
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
1056
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1363
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1364
+	print ' selected="selected"';
1365
+}
1366
+?>>EGM96 15' (2.1MB)</option>
1367
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1368
+	print ' selected="selected"';
1369
+}
1370
+?>>EGM96 5' (19MB)</option>
1371
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1372
+	print ' selected="selected"';
1373
+}
1374
+?>>EGM2008 5' (19MB)</option>
1375
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1376
+	print ' selected="selected"';
1377
+}
1378
+?>>EGM2008 2.5' (75MB)</option>
1379
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1380
+	print ' selected="selected"';
1381
+}
1382
+?>>EGM2008 1' (470MB)</option>
1057 1383
 				</select>
1058 1384
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
1059 1385
 			</p>
@@ -1075,7 +1401,12 @@  discard block
 block discarded – undo
1075 1401
 			</p>
1076 1402
 			<p>
1077 1403
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
1078
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1404
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1405
+	print $globalArchiveMonths;
1406
+} else {
1407
+	echo '1';
1408
+}
1409
+?>" />
1079 1410
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
1080 1411
 			</p>
1081 1412
 			<p>
@@ -1085,12 +1416,22 @@  discard block
 block discarded – undo
1085 1416
 			</p>
1086 1417
 			<p>
1087 1418
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
1088
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1419
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1420
+	print $globalArchiveKeepMonths;
1421
+} else {
1422
+	echo '1';
1423
+}
1424
+?>" />
1089 1425
 				<p class="help-block">0 to disable</p>
1090 1426
 			</p>
1091 1427
 			<p>
1092 1428
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
1093
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1429
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1430
+	print $globalArchiveKeepTrackMonths;
1431
+} else {
1432
+	echo '1';
1433
+}
1434
+?>" />
1094 1435
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
1095 1436
 			</p>
1096 1437
 			<br />
@@ -1100,7 +1441,12 @@  discard block
 block discarded – undo
1100 1441
 				<p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p>
1101 1442
 				<div id="cronends"> 
1102 1443
 					<label for="cronend">Run script for xx seconds</label>
1103
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1444
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1445
+	print $globalCronEnd;
1446
+} else {
1447
+	print '0';
1448
+}
1449
+?>" />
1104 1450
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
1105 1451
 				</div>
1106 1452
 			</p>
@@ -1159,20 +1505,40 @@  discard block
 block discarded – undo
1159 1505
 			<br />
1160 1506
 			<p>
1161 1507
 				<label for="refresh">Show flights detected since xxx seconds</label>
1162
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1508
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1509
+	echo $globalLiveInterval;
1510
+} else {
1511
+	echo '200';
1512
+}
1513
+?>" />
1163 1514
 			</p>
1164 1515
 			<p>
1165 1516
 				<label for="maprefresh">Live map refresh (in seconds)</label>
1166
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1517
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1518
+	echo $globalMapRefresh;
1519
+} else {
1520
+	echo '30';
1521
+}
1522
+?>" />
1167 1523
 			</p>
1168 1524
 			<p>
1169 1525
 				<label for="mapidle">Map idle timeout (in minutes)</label>
1170
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1526
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1527
+	echo $globalMapIdleTimeout;
1528
+} else {
1529
+	echo '30';
1530
+}
1531
+?>" />
1171 1532
 				<p class="help-block">0 to disable</p>
1172 1533
 			</p>
1173 1534
 			<p>
1174 1535
 				<label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1175
-				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1536
+				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) {
1537
+	echo $globalMinFetch;
1538
+} else {
1539
+	echo '20';
1540
+}
1541
+?>" />
1176 1542
 			</p>
1177 1543
 			<p>
1178 1544
 				<label for="bbox">Only display flights that we can see on screen (bounding box)</label>
@@ -1191,12 +1557,20 @@  discard block
 block discarded – undo
1191 1557
 			<br />
1192 1558
 			<p>
1193 1559
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
1194
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1560
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1561
+	echo $globalClosestMinDist;
1562
+} else {
1563
+	echo '50';
1564
+}
1565
+?>" />
1195 1566
 			</p>
1196 1567
 			<br />
1197 1568
 			<p>
1198 1569
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1199
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1570
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1571
+	echo $globalAircraftSize;
1572
+}
1573
+?>" />
1200 1574
 			</p>
1201 1575
 			<br />
1202 1576
 			<p>
@@ -1215,22 +1589,42 @@  discard block
 block discarded – undo
1215 1589
 			<br />
1216 1590
 			<p>
1217 1591
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1218
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1592
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1593
+	echo $globalAircraftIconColor;
1594
+} else {
1595
+	echo '1a3151';
1596
+}
1597
+?>" />
1219 1598
 			</p>
1220 1599
 			<br />
1221 1600
 			<p>
1222 1601
 				<label for="marineiconcolor">Color of marine icon on map</label>
1223
-				<input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" />
1602
+				<input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) {
1603
+	echo $globalMarineIconColor;
1604
+} else {
1605
+	echo '43d1d8';
1606
+}
1607
+?>" />
1224 1608
 			</p>
1225 1609
 			<br />
1226 1610
 			<p>
1227 1611
 				<label for="trackericoncolor">Color of tracker icon on map</label>
1228
-				<input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" />
1612
+				<input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) {
1613
+	echo $globalTrackerIconColor;
1614
+} else {
1615
+	echo '1a3151';
1616
+}
1617
+?>" />
1229 1618
 			</p>
1230 1619
 			<br />
1231 1620
 			<p>
1232 1621
 				<label for="satelliteiconcolor">Color of satellite icon on map</label>
1233
-				<input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" />
1622
+				<input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) {
1623
+	echo $globalSatelliteIconColor;
1624
+} else {
1625
+	echo '1a3151';
1626
+}
1627
+?>" />
1234 1628
 			</p>
1235 1629
 			<?php
1236 1630
 				if (!is_writable('../cache')) {
@@ -1254,14 +1648,27 @@  discard block
 block discarded – undo
1254 1648
 			<p>
1255 1649
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
1256 1650
 				<div class="range">
1257
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1258
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1651
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1652
+	echo $globalAirportZoom;
1653
+} else {
1654
+	echo '7';
1655
+}
1656
+?>" />
1657
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1658
+	echo $globalAirportZoom;
1659
+} else {
1660
+	echo '7';
1661
+}
1662
+?></output>
1259 1663
 				</div>
1260 1664
 			</p>
1261 1665
 			<br />
1262 1666
 			<p>
1263 1667
 				<label for="customcss">Custom CSS web path</label>
1264
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1668
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1669
+	echo $globalCustomCSS;
1670
+}
1671
+?>" />
1265 1672
 			</p>
1266 1673
 		</fieldset>
1267 1674
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -1291,8 +1698,12 @@  discard block
 block discarded – undo
1291 1698
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1292 1699
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1293 1700
 
1294
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1295
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1701
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1702
+		$error .= 'Mysql driver for PDO must be loaded';
1703
+	}
1704
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1705
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1706
+	}
1296 1707
 	
1297 1708
 	$_SESSION['database_root'] = $dbroot;
1298 1709
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1371,15 +1782,23 @@  discard block
 block discarded – undo
1371 1782
 	$source_city = $_POST['source_city'];
1372 1783
 	$source_country = $_POST['source_country'];
1373 1784
 	$source_ref = $_POST['source_ref'];
1374
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1375
-	else $source_id = array();
1785
+	if (isset($source_id)) {
1786
+		$source_id = $_POST['source_id'];
1787
+	} else {
1788
+		$source_id = array();
1789
+	}
1376 1790
 	
1377 1791
 	$sources = array();
1378 1792
 	foreach ($source_name as $keys => $name) {
1379
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1380
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1793
+	    if (isset($source_id[$keys])) {
1794
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1795
+	    } else {
1796
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1797
+	    }
1798
+	}
1799
+	if (count($sources) > 0) {
1800
+		$_SESSION['sources'] = $sources;
1381 1801
 	}
1382
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1383 1802
 
1384 1803
 	$newsurl = $_POST['newsurl'];
1385 1804
 	$newslng = $_POST['newslang'];
@@ -1392,7 +1811,9 @@  discard block
 block discarded – undo
1392 1811
 		$lng = $newslng[$newskey];
1393 1812
 		if (isset($newsfeeds[$type][$lng])) {
1394 1813
 		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1395
-		} else $newsfeeds[$type][$lng] = array($url);
1814
+		} else {
1815
+			$newsfeeds[$type][$lng] = array($url);
1816
+		}
1396 1817
 	    }
1397 1818
 	}
1398 1819
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
@@ -1417,17 +1838,29 @@  discard block
 block discarded – undo
1417 1838
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1418 1839
 
1419 1840
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1420
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1421
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1841
+	if ($globalaircraft == 'aircraft') {
1842
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1843
+	} else {
1844
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1845
+	}
1422 1846
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1423
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1424
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1847
+	if ($globaltracker == 'tracker') {
1848
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1849
+	} else {
1850
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1851
+	}
1425 1852
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1426
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1427
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1853
+	if ($globalmarine == 'marine') {
1854
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1855
+	} else {
1856
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1857
+	}
1428 1858
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1429
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1430
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1859
+	if ($globalsatellite == 'satellite') {
1860
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1861
+	} else {
1862
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1863
+	}
1431 1864
 
1432 1865
 /*	
1433 1866
 	$globalSBS1Hosts = array();
@@ -1449,23 +1882,37 @@  discard block
 block discarded – undo
1449 1882
 	$name = $_POST['name'];
1450 1883
 	$format = $_POST['format'];
1451 1884
 	$timezones = $_POST['timezones'];
1452
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1453
-	else $sourcestats = array();
1454
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1455
-	else $noarchive = array();
1885
+	if (isset($_POST['sourcestats'])) {
1886
+		$sourcestats = $_POST['sourcestats'];
1887
+	} else {
1888
+		$sourcestats = array();
1889
+	}
1890
+	if (isset($_POST['noarchive'])) {
1891
+		$noarchive = $_POST['noarchive'];
1892
+	} else {
1893
+		$noarchive = array();
1894
+	}
1456 1895
 	$gSources = array();
1457 1896
 	$forcepilots = false;
1458 1897
 	foreach ($host as $key => $h) {
1459
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1460
-		else $cov = 'FALSE';
1461
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1462
-		else $arch = 'FALSE';
1898
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1899
+			$cov = 'TRUE';
1900
+		} else {
1901
+			$cov = 'FALSE';
1902
+		}
1903
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1904
+			$arch = 'TRUE';
1905
+		} else {
1906
+			$arch = 'FALSE';
1907
+		}
1463 1908
 		if (strpos($format[$key],'_callback')) {
1464 1909
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1465 1910
 		} elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) {
1466 1911
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1467 1912
 		}
1468
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1913
+		if ($format[$key] == 'airwhere') {
1914
+			$forcepilots = true;
1915
+		}
1469 1916
 	}
1470 1917
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1471 1918
 
@@ -1501,7 +1948,9 @@  discard block
 block discarded – undo
1501 1948
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1502 1949
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1503 1950
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1504
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1951
+	} else {
1952
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1953
+	}
1505 1954
 
1506 1955
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1507 1956
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1542,7 +1991,9 @@  discard block
 block discarded – undo
1542 1991
 
1543 1992
 	// Create in settings.php keys not yet configurable if not already here
1544 1993
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1545
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1994
+	if (!isset($globalDebug)) {
1995
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1996
+	}
1546 1997
 
1547 1998
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1548 1999
 	if ($resetyearstats == 'resetyearstats') {
@@ -1585,37 +2036,56 @@  discard block
 block discarded – undo
1585 2036
 	}
1586 2037
 */
1587 2038
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1588
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1589
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1590
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1591
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
2039
+	if ($globalsbs == 'sbs') {
2040
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
2041
+	} else {
2042
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
2043
+	}
2044
+	if ($globalaprs == 'aprs') {
2045
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
2046
+	} else {
2047
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
2048
+	}
1592 2049
 	$va = false;
1593 2050
 	if ($globalivao == 'ivao') {
1594 2051
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1595 2052
 		$va = true;
1596
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
2053
+	} else {
2054
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
2055
+	}
1597 2056
 	if ($globalvatsim == 'vatsim') {
1598 2057
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1599 2058
 		$va = true;
1600
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
2059
+	} else {
2060
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
2061
+	}
1601 2062
 	if ($globalphpvms == 'phpvms') {
1602 2063
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1603 2064
 		$va = true;
1604
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
2065
+	} else {
2066
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
2067
+	}
1605 2068
 	if ($globalvam == 'vam') {
1606 2069
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1607 2070
 		$va = true;
1608
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
2071
+	} else {
2072
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
2073
+	}
1609 2074
 	if ($va) {
1610 2075
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1611
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
2076
+	} else {
2077
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
2078
+	}
1612 2079
 	if ($globalva == 'va' || $va) {
1613 2080
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1614 2081
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1615 2082
 	} else {
1616 2083
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1617
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1618
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
2084
+		if ($forcepilots) {
2085
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
2086
+		} else {
2087
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
2088
+		}
1619 2089
 	}
1620 2090
 	if ($globalvm == 'vm') {
1621 2091
 		$settings = array_merge($settings,array('globalVM' => 'TRUE'));
@@ -1875,7 +2345,9 @@  discard block
 block discarded – undo
1875 2345
 	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1876 2346
 	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1877 2347
 
1878
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2348
+	if (!isset($globalTransaction)) {
2349
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2350
+	}
1879 2351
 
1880 2352
 	// Set some defaults values...
1881 2353
 	if (!isset($globalAircraftImageSources)) {
@@ -1890,15 +2362,23 @@  discard block
 block discarded – undo
1890 2362
 
1891 2363
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1892 2364
 
1893
-	if ($error == '') settings::modify_settings($settings);
1894
-	if ($error == '') settings::comment_settings($settings_comment);
2365
+	if ($error == '') {
2366
+		settings::modify_settings($settings);
2367
+	}
2368
+	if ($error == '') {
2369
+		settings::comment_settings($settings_comment);
2370
+	}
1895 2371
 	if ($error != '') {
1896 2372
 		print '<div class="info column">'.$error.'</div>';
1897 2373
 		require('../footer.php');
1898 2374
 		exit;
1899 2375
 	} else {
1900
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1901
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
2376
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
2377
+			$_SESSION['waypoints'] = 1;
2378
+		}
2379
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
2380
+			$_SESSION['owner'] = 1;
2381
+		}
1902 2382
 		if (isset($_POST['createdb'])) {
1903 2383
 			$_SESSION['install'] = 'database_create';
1904 2384
 		} else {
@@ -1935,10 +2415,18 @@  discard block
 block discarded – undo
1935 2415
 	$popw = false;
1936 2416
 	foreach ($_SESSION['done'] as $done) {
1937 2417
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1938
-	    if ($done == 'Create database') $pop = true;
1939
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1940
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1941
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
2418
+	    if ($done == 'Create database') {
2419
+	    	$pop = true;
2420
+	    }
2421
+	    if ($_SESSION['install'] == 'database_create') {
2422
+	    	$pop = true;
2423
+	    }
2424
+	    if ($_SESSION['install'] == 'database_import') {
2425
+	    	$popi = true;
2426
+	    }
2427
+	    if ($_SESSION['install'] == 'waypoints') {
2428
+	    	$popw = true;
2429
+	    }
1942 2430
 	}
1943 2431
 	if ($pop) {
1944 2432
 	    sleep(5);
@@ -1949,7 +2437,9 @@  discard block
 block discarded – undo
1949 2437
 	} else if ($popw) {
1950 2438
 	    sleep(5);
1951 2439
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1952
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2440
+	} else {
2441
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2442
+	}
1953 2443
 	print '</div></ul>';
1954 2444
 	print '<div id="error"></div>';
1955 2445
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.