Completed
Push — master ( 237d29...caebd9 )
by Yannick
20:41
created
require/class.Weather.php 1 patch
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.
require/class.Common.php 1 patch
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.
install/index.php 1 patch
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.