Completed
Push — master ( 88853e...561404 )
by Yannick
17:58 queued 10:34
created
require/class.Accident.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	* @param String $date get data for a date
30 30
 	* @return Array Return Accidents data in array
31 31
 	*/
32
-	public function getAccidentData($limit = '',$type = '',$date = '') {
32
+	public function getAccidentData($limit = '', $type = '', $date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
35 35
 		$Spotter = new Spotter($this->db);
36 36
 		$Translation = new Translation($this->db);
37
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
37
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
38 38
 		date_default_timezone_set('UTC');
39 39
 		$result = array();
40 40
 		$limit_query = '';
41 41
 		if ($limit != "")
42 42
 		{
43 43
 			$limit_array = explode(",", $limit);
44
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
45
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
44
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
45
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
46 46
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
47 47
 			{
48 48
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
 
52 52
 		if ($type != '') {
53 53
 			if ($date != '') {
54
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
54
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
55 55
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
56 56
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
57
-					$query_values = array(':type' => $type,':date' => $date);
58
-				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) {
57
+					$query_values = array(':type' => $type, ':date' => $date);
58
+				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) {
59 59
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
60
-					$query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31');
61
-				} elseif (preg_match("/^[0-9]{4}$/",$date)) {
60
+					$query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31');
61
+				} elseif (preg_match("/^[0-9]{4}$/", $date)) {
62 62
 					if ($globalDBdriver == 'mysql') {
63 63
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
64 64
 					} else {
65 65
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
66 66
 					}
67
-					$query_values = array(':type' => $type,':date' => $date);
67
+					$query_values = array(':type' => $type, ':date' => $date);
68 68
 				} else {
69 69
 					$date = $date.'%';
70 70
 					if ($globalDBdriver == 'mysql') {
71 71
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
72
-						$query_values = array(':type' => $type,':date' => $date);
72
+						$query_values = array(':type' => $type, ':date' => $date);
73 73
 					} else {
74 74
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
75 75
 						//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
76
-						$query_values = array(':type' => $type,':date' => $date);
76
+						$query_values = array(':type' => $type, ':date' => $date);
77 77
 					}
78 78
 				}
79 79
 			} else {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			}
84 84
 		} else {
85 85
 			if ($date != '') {
86
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
86
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
87 87
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
88 88
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
89 89
 				} else {
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			echo "error : ".$e->getMessage();
107 107
 		}
108 108
 		$i = 0;
109 109
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 			//print_r($row);
111 111
 			//echo $row['flightaware_id'];
112
-			if (preg_match('/^[\w\-]+$/',$row['registration'])) {
112
+			if (preg_match('/^[\w\-]+$/', $row['registration'])) {
113 113
 				$data = array();
114 114
 				if ($row['registration'] != '') {
115 115
 					$image_array = $Image->getSpotterImage($row['registration']);
116
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
117
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+					if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
117
+					else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
118 118
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
119 119
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
120 120
 					if (!empty($aircraft_info)) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 						$data['aircraft_name'] = $aircraft_info[0]['type'];
123 123
 						$data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer'];
124 124
 					} else {
125
-						$data = array_merge($data,array('aircraft_type' => 'NA'));
125
+						$data = array_merge($data, array('aircraft_type' => 'NA'));
126 126
 					}
127 127
 					$owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']);
128 128
 					if (!empty($owner_data)) {
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 						$data['aircraft_base'] = $owner_data['base'];
131 131
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
132 132
 					}
133
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
133
+				} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
134 134
 				if ($row['registration'] == '') $row['registration'] = 'NA';
135 135
 				if ($row['ident'] == '') $row['ident'] = 'NA';
136
-				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
136
+				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3));
137 137
 				if (isset($identicao[0])) {
138
-					if (substr($row['ident'],0,2) == 'AF') {
139
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
141
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
142
-					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
138
+					if (substr($row['ident'], 0, 2) == 'AF') {
139
+						if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
+						else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
141
+					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
142
+					$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
143 143
 				} else $icao = $row['ident'];
144
-				$icao = $Translation->checkTranslation($icao,false);
144
+				$icao = $Translation->checkTranslation($icao, false);
145 145
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
146 146
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
147 147
 					//echo 'Check airline info... for '.$row['airline_name'].' ';
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 					if (!empty($airline_info)) {
151 151
 						//echo 'data found !'."\n";
152 152
 						//print_r($airline_info);
153
-						$data = array_merge($data,$airline_info);
153
+						$data = array_merge($data, $airline_info);
154 154
 					} 
155 155
 					//else echo 'No data...'."\n";
156 156
 				}
157
-				$data = array_merge($row,$data);
157
+				$data = array_merge($row, $data);
158 158
 				if ($data['ident'] == null) $data['ident'] = $icao;
159 159
 				if ($data['title'] == null) {
160 160
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		try {
191 191
 			$sth = $this->db->prepare($query);
192 192
 			$sth->execute();
193
-		} catch(PDOException $e) {
193
+		} catch (PDOException $e) {
194 194
 			echo "Error : ".$e->getMessage();
195 195
 		}
196 196
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		try {
211 211
 			$sth = $this->db->prepare($query);
212 212
 			$sth->execute();
213
-		} catch(PDOException $e) {
213
+		} catch (PDOException $e) {
214 214
 			echo "Error : ".$e->getMessage();
215 215
 		}
216 216
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -225,15 +225,15 @@  discard block
 block discarded – undo
225 225
 		if ($globalDebug) echo 'Import '.$file."\n";
226 226
 		$result = array();
227 227
 		if (file_exists($file)) {
228
-			if (($handle = fopen($file,'r')) !== FALSE) {
229
-				while (($data = fgetcsv($handle,2000,",")) !== FALSE) {
228
+			if (($handle = fopen($file, 'r')) !== FALSE) {
229
+				while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
230 230
 					if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') {
231
-						$result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam');
231
+						$result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam');
232 232
 					}
233 233
 				}
234 234
 				fclose($handle);
235 235
 			}
236
-			if (!empty($result)) $this->add($result,true);
236
+			if (!empty($result)) $this->add($result, true);
237 237
 			elseif ($globalDebug) echo 'Nothing to import';
238 238
 		}
239 239
 	}
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 		$all_md5_new = array();
250 250
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
251 251
 			if ($this->check_accidents_nb() > 0) {
252
-				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
253
-					while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
252
+				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
253
+					while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
254 254
 						if (isset($data[1])) {
255 255
 							$year = $data[0];
256 256
 							$all_md5[$year] = $data[1];
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 				}
261 261
 			}
262 262
 		}
263
-		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5');
263
+		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5');
264 264
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
265
-			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
266
-				while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
265
+			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
266
+				while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
267 267
 					if (isset($data[1])) {
268 268
 						$year = $data[0];
269 269
 						$all_md5_new[$year] = $data[1];
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 				fclose($handle);
273 273
 			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
274 274
 		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
275
-		$result = $Common->arr_diff($all_md5_new,$all_md5);
275
+		$result = $Common->arr_diff($all_md5_new, $all_md5);
276 276
 		if (empty($result) && $globalDebug) echo 'Nothing to update';
277 277
 		foreach ($result as $file => $md5) {
278
-			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
278
+			$Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file);
279 279
 			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
280 280
 			elseif ($globalDebug) echo 'Download '.$file.' failed';
281 281
 		}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	* Add data to DB
286 286
 	* @param Array $crash An array with accidents/incidents data
287 287
 	*/
288
-	public function add($crash,$new = false) {
288
+	public function add($crash, $new = false) {
289 289
 		global $globalTransaction, $globalDebug;
290 290
 		require_once('class.Connection.php');
291 291
 		require_once('class.Image.php');
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			$sthd->execute(array(':source' => $crash[0]['source']));
302 302
 		}
303 303
 		if ($globalTransaction) $Connection->db->beginTransaction();
304
-		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
304
+		$initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null);
305 305
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
306 306
 		$sth_check = $Connection->db->prepare($query_check);
307 307
 		$query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)';
@@ -314,15 +314,15 @@  discard block
 block discarded – undo
314 314
 				$cr = array_map(function($value) {
315 315
 					return $value === "" ? NULL : $value;
316 316
 				}, $cr);
317
-				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
318
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
319
-					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
317
+				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) {
318
+					if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
319
+					$query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']);
320 320
 					$sth_check->execute($query_check_values);
321 321
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
322 322
 					if ($result_check['nb'] == 0) {
323
-						$query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']);
323
+						$query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']);
324 324
 						$sth->execute($query_values);
325
-						if ($cr['date'] > time()-(30*86400)) {
325
+						if ($cr['date'] > time() - (30*86400)) {
326 326
 							if (empty($Image->getSpotterImage($cr['registration']))) {
327 327
 								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
328 328
 								$Image->addSpotterImage($cr['registration']);
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
332 332
 						}
333 333
 						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
334
-						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
334
+						$Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date']));
335 335
 					}
336 336
 				}
337
-				if ($globalTransaction && $j % 1000 == 0) {
337
+				if ($globalTransaction && $j%1000 == 0) {
338 338
 					$Connection->db->commit();
339 339
 					$Connection->db->beginTransaction();
340 340
 				}
341 341
 			}
342 342
 			if ($globalTransaction) $Connection->db->commit();
343
-		} catch(PDOException $e) {
343
+		} catch (PDOException $e) {
344 344
 			if ($globalTransaction) $Connection->db->rollBack();
345 345
 			echo $e->getMessage();
346 346
 		}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			$Connection = new Connection();
359 359
 			$sth = $Connection->db->prepare($query);
360 360
 			$sth->execute();
361
-		} catch(PDOException $e) {
361
+		} catch (PDOException $e) {
362 362
 			return "error : ".$e->getMessage();
363 363
 		}
364 364
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$Connection = new Connection();
377 377
 			$sth = $Connection->db->prepare($query);
378 378
 			$sth->execute();
379
-		} catch(PDOException $e) {
379
+		} catch (PDOException $e) {
380 380
 			return "error : ".$e->getMessage();
381 381
 		}
382 382
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			$Connection = new Connection();
392 392
 			$sth = $Connection->db->prepare($query);
393 393
 			$sth->execute();
394
-		} catch(PDOException $e) {
394
+		} catch (PDOException $e) {
395 395
 			return "error : ".$e->getMessage();
396 396
 		}
397 397
 	}
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
37 37
 				if ($flt['airlines'][0] != '') {
38 38
 					if (isset($flt['source'])) {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40 40
 					} else {
41
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42 42
 					}
43 43
 				}
44 44
 			}
45 45
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
46 46
 				if (isset($flt['source'])) {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48 48
 				} else {
49
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50 50
 				}
51 51
 			}
52 52
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
53 53
 				if (isset($flt['source'])) {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55 55
 				} else {
56
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57 57
 				}
58 58
 			}
59 59
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
60 60
 				if (isset($flt['source'])) {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62 62
 				} else {
63
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64 64
 				}
65 65
 			}
66 66
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
67 67
 				if (isset($flt['source'])) {
68
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
68
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69 69
 				}
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
73 73
 			if ($filter['airlines'][0] != '') {
74
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
74
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75 75
 			}
76 76
 		}
77 77
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
82 82
 		}
83 83
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
84
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
84
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85 85
 		}
86 86
 		if (isset($filter['source']) && !empty($filter['source'])) {
87
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
87
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
88 88
 		}
89 89
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
90 90
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
114 114
 				}
115 115
 			}
116
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
116
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122 122
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123 123
 		if ($filter_query_where != '') {
124
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
124
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
125 125
 		}
126 126
 		$filter_query = $filter_query_join.$filter_query_where;
127 127
 		return $filter_query;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		if ($limit != '')
145 145
 		{
146 146
 			$limit_array = explode(',', $limit);
147
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
148
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
147
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
148
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
149 149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
150 150
 			{
151 151
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		} else {
170 170
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
171 171
 		}
172
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
172
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
173 173
 
174 174
 		return $spotter_array;
175 175
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	{
185 185
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
186 186
 		date_default_timezone_set('UTC');
187
-		$filter_query = $this->getFilter($filter,true,true);
187
+		$filter_query = $this->getFilter($filter, true, true);
188 188
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189 189
 		if ($globalDBdriver == 'mysql') {
190 190
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		try {
208 208
 			$sth = $this->db->prepare($query);
209 209
 			$sth->execute();
210
-		} catch(PDOException $e) {
210
+		} catch (PDOException $e) {
211 211
 			echo $e->getMessage();
212 212
 			die;
213 213
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
227 227
 		date_default_timezone_set('UTC');
228 228
 
229
-		$filter_query = $this->getFilter($filter,true,true);
229
+		$filter_query = $this->getFilter($filter, true, true);
230 230
 
231 231
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
232 232
 		if ($globalDBdriver == 'mysql') {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
238 238
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
239 239
 				*/
240
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
240
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
241 241
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id 
242 242
 				UNION
243 243
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				WHERE latitude <> '0' AND longitude <> '0' 
246 246
 				ORDER BY flightaware_id, date";
247 247
 			} else {
248
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
248
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
249 249
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date 
250 250
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
251 251
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
259 259
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
260 260
                                */
261
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
261
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
262 262
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id 
263 263
 				UNION
264 264
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				//AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".round($globalLiveInterval*1000)." SECONDS' <= spotter_archive.date
270 270
 			} else {
271
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
271
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
272 272
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date
273 273
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
274 274
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     		try {
278 278
 			$sth = $this->db->prepare($query);
279 279
 			$sth->execute();
280
-		} catch(PDOException $e) {
280
+		} catch (PDOException $e) {
281 281
 			echo $e->getMessage();
282 282
 			die;
283 283
 		}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	public function getLiveSpotterCount($filter = array())
295 295
 	{
296 296
 		global $globalDBdriver, $globalLiveInterval;
297
-		$filter_query = $this->getFilter($filter,true,true);
297
+		$filter_query = $this->getFilter($filter, true, true);
298 298
 
299 299
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
300 300
 		if ($globalDBdriver == 'mysql') {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		try {
308 308
 			$sth = $this->db->prepare($query);
309 309
 			$sth->execute();
310
-		} catch(PDOException $e) {
310
+		} catch (PDOException $e) {
311 311
 			echo $e->getMessage();
312 312
 			die;
313 313
 		}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		$filter_query = $this->getFilter($filter);
331 331
 
332 332
 		if (is_array($coord)) {
333
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
334
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
335
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
333
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
334
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
335
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
336
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
337 337
 		} else return array();
338 338
 		if ($globalDBdriver == 'mysql') {
339 339
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -356,23 +356,23 @@  discard block
 block discarded – undo
356 356
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
357 357
 		$Spotter = new Spotter($this->db);
358 358
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
-		$filter_query = $this->getFilter($filter,true,true);
359
+		$filter_query = $this->getFilter($filter, true, true);
360 360
 
361 361
 		if (is_array($coord)) {
362
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
363
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
364
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
365
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
362
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
363
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
364
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
365
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
366 366
 		} else return array();
367 367
 		if ($globalDBdriver == 'mysql') {
368 368
 			if (isset($globalArchive) && $globalArchive === TRUE) {
369
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
369
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
370 370
 				FROM spotter_live 
371 371
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
372 372
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
373 373
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0';
374 374
 			} else {
375
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
375
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
376 376
 				FROM spotter_live 
377 377
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
378 378
 				    FROM spotter_live l 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 			}
385 385
 		} else {
386 386
 			if (isset($globalArchive) && $globalArchive === TRUE) {
387
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
387
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
388 388
 				FROM spotter_live 
389 389
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
390 390
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
391 391
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
392 392
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
393 393
 			} else {
394
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
394
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
395 395
 				FROM spotter_live 
396 396
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
397 397
 				    FROM spotter_live l 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 		try {
407 407
 			$sth = $this->db->prepare($query);
408 408
 			$sth->execute();
409
-		} catch(PDOException $e) {
409
+		} catch (PDOException $e) {
410 410
 			echo $e->getMessage();
411 411
 			die;
412 412
 		}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                 if ($interval == '1m')
456 456
                 {
457 457
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
458
-                } else if ($interval == '15m'){
458
+                } else if ($interval == '15m') {
459 459
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
460 460
                 } 
461 461
             }
@@ -463,14 +463,14 @@  discard block
 block discarded – undo
463 463
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
464 464
         }
465 465
 
466
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
466
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
467 467
                    WHERE spotter_live.latitude <> '' 
468 468
                                    AND spotter_live.longitude <> '' 
469 469
                    ".$additional_query."
470 470
                    HAVING distance < :radius  
471 471
                                    ORDER BY distance";
472 472
 
473
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
473
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
474 474
 
475 475
                 return $spotter_array;
476 476
         }
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		date_default_timezone_set('UTC');
489 489
 
490 490
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
491
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
491
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
492 492
 
493
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
493
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
494 494
 
495 495
 		return $spotter_array;
496 496
 	}
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
 	* @return Array the spotter information
502 502
 	*
503 503
 	*/
504
-	public function getDateLiveSpotterDataByIdent($ident,$date)
504
+	public function getDateLiveSpotterDataByIdent($ident, $date)
505 505
 	{
506 506
 		$Spotter = new Spotter($this->db);
507 507
 		date_default_timezone_set('UTC');
508 508
 
509 509
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
510
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
510
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
511 511
 
512
-                $date = date('c',$date);
513
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
512
+                $date = date('c', $date);
513
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
514 514
 
515 515
 		return $spotter_array;
516 516
 	}
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 		$Spotter = new Spotter($this->db);
527 527
 		date_default_timezone_set('UTC');
528 528
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
529
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
530
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
529
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
530
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
531 531
 		return $spotter_array;
532 532
 	}
533 533
 
@@ -537,15 +537,15 @@  discard block
 block discarded – undo
537 537
 	* @return Array the spotter information
538 538
 	*
539 539
 	*/
540
-	public function getDateLiveSpotterDataById($id,$date)
540
+	public function getDateLiveSpotterDataById($id, $date)
541 541
 	{
542 542
 		$Spotter = new Spotter($this->db);
543 543
 		date_default_timezone_set('UTC');
544 544
 
545 545
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
546
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
547
-		$date = date('c',$date);
548
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
546
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
547
+		$date = date('c', $date);
548
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
549 549
 		return $spotter_array;
550 550
 	}
551 551
 
@@ -561,13 +561,13 @@  discard block
 block discarded – undo
561 561
 		date_default_timezone_set('UTC');
562 562
 
563 563
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
564
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
564
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
565 565
 
566 566
     		try {
567 567
 			
568 568
 			$sth = $this->db->prepare($query);
569 569
 			$sth->execute(array(':ident' => $ident));
570
-		} catch(PDOException $e) {
570
+		} catch (PDOException $e) {
571 571
 			echo $e->getMessage();
572 572
 			die;
573 573
 		}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	* @return Array the spotter information
583 583
 	*
584 584
 	*/
585
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
585
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
586 586
 	{
587 587
 		global $globalDBdriver, $globalLiveInterval;
588 588
 		date_default_timezone_set('UTC');
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		try {
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':id' => $id));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -619,12 +619,12 @@  discard block
 block discarded – undo
619 619
 	{
620 620
 		date_default_timezone_set('UTC');
621 621
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
622
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
622
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
623 623
     		try {
624 624
 			
625 625
 			$sth = $this->db->prepare($query);
626 626
 			$sth->execute(array(':ident' => $ident));
627
-		} catch(PDOException $e) {
627
+		} catch (PDOException $e) {
628 628
 			echo $e->getMessage();
629 629
 			die;
630 630
 		}
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			
655 655
 			$sth = $this->db->prepare($query);
656 656
 			$sth->execute();
657
-		} catch(PDOException $e) {
657
+		} catch (PDOException $e) {
658 658
 			return "error";
659 659
 		}
660 660
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 				
678 678
 				$sth = $this->db->prepare($query);
679 679
 				$sth->execute();
680
-			} catch(PDOException $e) {
680
+			} catch (PDOException $e) {
681 681
 				return "error";
682 682
 			}
683 683
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
684 684
                         $i = 0;
685
-                        $j =0;
685
+                        $j = 0;
686 686
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
687
-			foreach($all as $row)
687
+			foreach ($all as $row)
688 688
 			{
689 689
 				$i++;
690 690
 				$j++;
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 					if ($globalDebug) echo ".";
693 693
 				    	try {
694 694
 						
695
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
695
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
696 696
 						$sth->execute();
697
-					} catch(PDOException $e) {
697
+					} catch (PDOException $e) {
698 698
 						return "error";
699 699
 					}
700 700
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
 			if ($i > 0) {
706 706
     				try {
707 707
 					
708
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
708
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
709 709
 					$sth->execute();
710
-				} catch(PDOException $e) {
710
+				} catch (PDOException $e) {
711 711
 					return "error";
712 712
 				}
713 713
 			}
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				
721 721
 				$sth = $this->db->prepare($query);
722 722
 				$sth->execute();
723
-			} catch(PDOException $e) {
723
+			} catch (PDOException $e) {
724 724
 				return "error";
725 725
 			}
726 726
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
 	public function deleteLiveSpotterDataByIdent($ident)
769 769
 	{
770 770
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
771
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
771
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
772 772
         
773 773
     		try {
774 774
 			
775 775
 			$sth = $this->db->prepare($query);
776 776
 			$sth->execute(array(':ident' => $ident));
777
-		} catch(PDOException $e) {
777
+		} catch (PDOException $e) {
778 778
 			return "error";
779 779
 		}
780 780
 
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
 	public function deleteLiveSpotterDataById($id)
791 791
 	{
792 792
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
793
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
793
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
794 794
         
795 795
     		try {
796 796
 			
797 797
 			$sth = $this->db->prepare($query);
798 798
 			$sth->execute(array(':id' => $id));
799
-		} catch(PDOException $e) {
799
+		} catch (PDOException $e) {
800 800
 			return "error";
801 801
 		}
802 802
 
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
 	{
815 815
 		global $globalDBdriver, $globalTimezone;
816 816
 		if ($globalDBdriver == 'mysql') {
817
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
817
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
818 818
 				WHERE spotter_live.ident = :ident 
819 819
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
820 820
 				AND spotter_live.date < UTC_TIMESTAMP()';
821 821
 			$query_data = array(':ident' => $ident);
822 822
 		} else {
823
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
823
+			$query = "SELECT spotter_live.ident FROM spotter_live 
824 824
 				WHERE spotter_live.ident = :ident 
825 825
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
826 826
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
 		
830 830
 		$sth = $this->db->prepare($query);
831 831
 		$sth->execute($query_data);
832
-		$ident_result='';
833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
832
+		$ident_result = '';
833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
834 834
 		{
835 835
 			$ident_result = $row['ident'];
836 836
 		}
@@ -847,13 +847,13 @@  discard block
 block discarded – undo
847 847
 	{
848 848
 		global $globalDBdriver, $globalTimezone;
849 849
 		if ($globalDBdriver == 'mysql') {
850
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
850
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
851 851
 				WHERE spotter_live.ident = :ident 
852 852
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
853 853
 //				AND spotter_live.date < UTC_TIMESTAMP()";
854 854
 			$query_data = array(':ident' => $ident);
855 855
 		} else {
856
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
856
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
857 857
 				WHERE spotter_live.ident = :ident 
858 858
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
859 859
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 		
863 863
 		$sth = $this->db->prepare($query);
864 864
 		$sth->execute($query_data);
865
-		$ident_result='';
866
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
865
+		$ident_result = '';
866
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
867 867
 		{
868 868
 			$ident_result = $row['flightaware_id'];
869 869
 		}
@@ -880,13 +880,13 @@  discard block
 block discarded – undo
880 880
 	{
881 881
 		global $globalDBdriver, $globalTimezone;
882 882
 		if ($globalDBdriver == 'mysql') {
883
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
883
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884 884
 				WHERE spotter_live.flightaware_id = :id 
885 885
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
886 886
 //				AND spotter_live.date < UTC_TIMESTAMP()";
887 887
 			$query_data = array(':id' => $id);
888 888
 		} else {
889
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
889
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890 890
 				WHERE spotter_live.flightaware_id = :id 
891 891
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
892 892
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 		
896 896
 		$sth = $this->db->prepare($query);
897 897
 		$sth->execute($query_data);
898
-		$ident_result='';
899
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
898
+		$ident_result = '';
899
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
900 900
 		{
901 901
 			$ident_result = $row['flightaware_id'];
902 902
 		}
@@ -913,13 +913,13 @@  discard block
 block discarded – undo
913 913
 	{
914 914
 		global $globalDBdriver, $globalTimezone;
915 915
 		if ($globalDBdriver == 'mysql') {
916
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
916
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
917 917
 				WHERE spotter_live.ModeS = :modes 
918 918
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
919 919
 //				AND spotter_live.date < UTC_TIMESTAMP()";
920 920
 			$query_data = array(':modes' => $modes);
921 921
 		} else {
922
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
922
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
923 923
 				WHERE spotter_live.ModeS = :modes 
924 924
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
925 925
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 		
929 929
 		$sth = $this->db->prepare($query);
930 930
 		$sth->execute($query_data);
931
-		$ident_result='';
932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
931
+		$ident_result = '';
932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
933 933
 		{
934 934
 			//$ident_result = $row['spotter_live_id'];
935 935
 			$ident_result = $row['flightaware_id'];
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 	* @return String success or false
949 949
 	*
950 950
 	*/
951
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
951
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
952 952
 	{
953 953
 		global $globalURL, $globalArchive, $globalDebug;
954 954
 		$Common = new Common();
@@ -1048,27 +1048,27 @@  discard block
 block discarded – undo
1048 1048
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1049 1049
 
1050 1050
         
1051
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1052
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1053
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1054
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1055
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1056
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1057
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1058
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1059
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1060
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1061
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1062
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1063
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1064
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1065
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1066
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1067
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1068
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1069
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1070
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1071
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1051
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1052
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1053
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1054
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1055
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1056
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1057
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1058
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1059
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1060
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1061
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1062
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1063
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1064
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1065
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1066
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1067
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1068
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1069
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1070
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1071
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1072 1072
 
1073 1073
 		$airline_name = '';
1074 1074
 		$airline_icao = '';
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 		$arrival_airport_country = '';
1091 1091
 		
1092 1092
             	
1093
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1094
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1095
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1096
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1093
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1094
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1095
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1096
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1097 1097
 		
1098 1098
 		$query = '';
1099 1099
 		if ($globalArchive) {
@@ -1104,19 +1104,19 @@  discard block
 block discarded – undo
1104 1104
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1105 1105
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1106 1106
 
1107
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1107
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1108 1108
 		try {
1109 1109
 			
1110 1110
 			$sth = $this->db->prepare($query);
1111 1111
 			$sth->execute($query_values);
1112 1112
 			$sth->closeCursor();
1113
-		} catch(PDOException $e) {
1113
+		} catch (PDOException $e) {
1114 1114
 			return "error : ".$e->getMessage();
1115 1115
 		}
1116 1116
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1117 1117
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1118 1118
 		    $SpotterArchive = new SpotterArchive($this->db);
1119
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1119
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1120 1120
 		    if ($globalDebug) echo $result.')';
1121 1121
 		} elseif ($globalDebug && $putinarchive !== true) {
1122 1122
 			echo '(Not adding to archive)';
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 	public function getOrderBy()
1131 1131
 	{
1132
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1132
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1133 1133
 		return $orderby;
1134 1134
 	}
1135 1135
 
Please login to merge, or discard this patch.
live-czml.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
86 86
 /*
87 87
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
88 88
 	$min = true;
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	$from_archive = true;
130 130
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
131 131
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
133
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
134
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
135
-	$begindate = date('Y-m-d H:i:s',$begindate);
136
-	$enddate = date('Y-m-d H:i:s',$enddate);
137
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
132
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
133
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
134
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
135
+	$begindate = date('Y-m-d H:i:s', $begindate);
136
+	$enddate = date('Y-m-d H:i:s', $enddate);
137
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
138 138
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
139 139
 	$from_archive = true;
140 140
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	$begindate = $_COOKIE['archive_begin'];
145 145
 	$enddate = $_COOKIE['archive_end'];
146 146
 
147
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
148
-	$begindate = date('Y-m-d H:i:s',$begindate);
149
-	$enddate = date('Y-m-d H:i:s',$enddate);
147
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
148
+	$begindate = date('Y-m-d H:i:s', $begindate);
149
+	$enddate = date('Y-m-d H:i:s', $enddate);
150 150
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
151
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
151
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
152 152
 } elseif ($tracker) {
153 153
 	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter);
154 154
 } elseif ($marine) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 //print_r($spotter_array);
160 160
 if (!empty($spotter_array)) {
161 161
 	if (isset($_GET['archive'])) {
162
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
162
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
163 163
 	} elseif ($tracker) {
164 164
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
165 165
 	} elseif ($marine) {
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 	if ($flightcnt == '') $flightcnt = 0;
171 171
 } else $flightcnt = 0;
172 172
 
173
-$sqltime = round(microtime(true)-$begintime,2);
173
+$sqltime = round(microtime(true) - $begintime, 2);
174 174
 $minitime = time();
175 175
 $maxitime = 0;
176 176
 
177 177
 
178 178
 $modelsdb = array();
179 179
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
180
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
181
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
182
-			if (isset($row[1]) ){
180
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
181
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
182
+			if (isset($row[1])) {
183 183
 				$model = $row[0];
184 184
 				$modelsdb[$model] = $row[1];
185 185
 			}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 $output .= '},';
216 216
 if (!empty($spotter_array) && is_array($spotter_array))
217 217
 {
218
-	foreach($spotter_array as $spotter_item)
218
+	foreach ($spotter_array as $spotter_item)
219 219
 	{
220 220
 		$j++;
221 221
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 			$output .= '"cartographicDegrees": [';
541 541
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
542 542
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
543
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
543
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
544 544
 			$output .= $spotter_item['longitude'].', ';
545 545
 			$output .= $spotter_item['latitude'];
546 546
 			$prevlong = $spotter_item['longitude'];
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
560 560
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
561 561
 		} else {
562
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
562
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
563 563
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
564 564
 			if ($spotter_item['ground_speed'] == 0) {
565 565
 				$output .= $prevlong.', ';
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
 }
594 594
 $output .= ']';
595 595
 if (isset($globalArchive) && $globalArchive === TRUE) {
596
-	if ((time()-$globalLiveInterval) > $minitime) $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
597
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
598
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
599
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
596
+	if ((time() - $globalLiveInterval) > $minitime) $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
597
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
598
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
599
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
600 600
 print $output;
601 601
 ?>
Please login to merge, or discard this patch.
aircraft-data.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
59
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
60 60
 	} else $image = $spotter_item['image_thumbnail'];
61 61
 
62 62
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
78 78
 	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
79 79
 		if ($spotter_item['departure_airport_time'] > 2460) {
80
-			print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
80
+			print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
81 81
 		} else {
82 82
 			print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
83 83
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
87 87
 	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
88 88
 		if ($spotter_item['arrival_airport_time'] > 2460) {
89
-			print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
89
+			print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
90 90
 		} else {
91 91
 			print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
92 92
 		}
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 112
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
113 113
 	try {
114
-		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
115
-	} catch(Exception $e) {
114
+		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
115
+	} catch (Exception $e) {
116 116
 	}
117 117
 }
118 118
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
183 183
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
184
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
184
+if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
185 185
 if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
186 186
 print '</div>';
187 187
 ?>
Please login to merge, or discard this patch.
manufacturer-detailed.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 $Spotter = new Spotter();
7
-if (!isset($_GET['aircraft_manufacturer'])){
7
+if (!isset($_GET['aircraft_manufacturer'])) {
8 8
 	header('Location: '.$globalURL.'');
9 9
 } else {
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
 	$limit_previous_1 = $limit_start - $absolute_difference;
28 28
 	$limit_previous_2 = $limit_end - $absolute_difference;
29 29
 	
30
-	$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
31
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
30
+	$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
31
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/manufacturer/'.$manufacturer;
33 33
 	
34 34
 	if ($sort != '') {
35
-		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, $sort);
35
+		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, $sort);
36 36
 	} else {
37
-		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, '');
37
+		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, '');
38 38
 	}
39 39
 	
40 40
 	if (!empty($spotter_array))
41 41
 	{
42
-		$title = sprintf(_("Detailed View for %s"),$manufacturer);
42
+		$title = sprintf(_("Detailed View for %s"), $manufacturer);
43 43
 
44 44
 		require_once('header.php');
45 45
 		print '<div class="select-item">';
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		$Stats = new Stats();
49 49
 		$all_manufacturers = $Stats->getAllManufacturers();
50 50
 		if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
51
-		foreach($all_manufacturers as $all_manufacturer)
51
+		foreach ($all_manufacturers as $all_manufacturer)
52 52
 		{
53
-			if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
53
+			if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
54 54
 			{
55 55
 				print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
56 56
 			} else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		print '</div>';
68 68
 
69 69
 		print '<div class="table column">';
70
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$manufacturer).'</p>';
70
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $manufacturer).'</p>';
71 71
 
72 72
 		include('manufacturer-sub-menu.php');
73 73
 		include('table-output.php'); 
Please login to merge, or discard this patch.
search-ajax.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $orderby = $Spotter->getOrderBy();
7 7
 
8
-$ask = filter_input(INPUT_GET,'ask',FILTER_SANITIZE_STRING);
8
+$ask = filter_input(INPUT_GET, 'ask', FILTER_SANITIZE_STRING);
9 9
 if ($ask == 'aircraftsdetected') {
10 10
 	require_once('require/class.SpotterLive.php');
11 11
 	$SpotterLive = new SpotterLive();
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 } elseif ($ask == 'manufacturer') {
25 25
 	$manufacturers = $Spotter->getAllManufacturers();
26 26
 	$all_manufacturers = array();
27
-	foreach($manufacturers as $manufacturer)
27
+	foreach ($manufacturers as $manufacturer)
28 28
 	{
29
-		$all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ','-',$manufacturer['aircraft_manufacturer'])));
29
+		$all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ', '-', $manufacturer['aircraft_manufacturer'])));
30 30
 	}
31 31
 	echo json_encode($all_manufacturers);
32 32
 } elseif ($ask == 'aircrafttypes') {
33 33
 	$aircraft_types = $Spotter->getAllAircraftTypes();
34 34
 	$all_aircraft_types = array();
35
-	foreach($aircraft_types as $aircraft_type)
35
+	foreach ($aircraft_types as $aircraft_type)
36 36
 	{
37 37
 		$all_aircraft_types[] = array('id' => $aircraft_type['aircraft_icao'], 'value' => $aircraft_type['aircraft_name'].' ('.$aircraft_type['aircraft_icao'].')');
38 38
 	}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 } elseif ($ask == 'airlinenames') {
41 41
 	$airline_names = $Spotter->getAllAirlineNames();
42 42
 	$all_airline_names = array();
43
-	foreach($airline_names as $airline_name)
43
+	foreach ($airline_names as $airline_name)
44 44
 	{
45 45
 		$all_airline_names[] = array('id' => $airline_name['airline_icao'], 'value' => $airline_name['airline_name'].' ('.$airline_name['airline_icao'].')');
46 46
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 } elseif ($ask == 'airlinecountries') {
49 49
 	$airline_countries = $Spotter->getAllAirlineCountries();
50 50
 	$all_airline_countries = array();
51
-	foreach($airline_countries as $airline_country)
51
+	foreach ($airline_countries as $airline_country)
52 52
 	{
53 53
 		$all_airline_countries[] = array('id' => $airline_country['airline_country'], 'value' => $airline_country['airline_country']);
54 54
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	$airport_names = $Spotter->getAllAirportNames();
58 58
 	ksort($airport_names);
59 59
 	$all_airport_names = array();
60
-	foreach($airport_names as $airport_name)
60
+	foreach ($airport_names as $airport_name)
61 61
 	{
62 62
 		$all_airport_names[] = array('id' => $airport_name['airport_icao'], 'value' => $airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')');
63 63
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 } elseif ($ask == 'airportcountries') {
66 66
 	$airport_countries = $Spotter->getAllAirportCountries();
67 67
 	$all_airport_countries = array();
68
-	foreach($airport_countries as $airport_country)
68
+	foreach ($airport_countries as $airport_country)
69 69
 	{
70 70
 		$all_airport_countries[] = array('id' => $airport_country['airport_country'], 'value' => $airport_country['airport_country']);
71 71
 	}
Please login to merge, or discard this patch.
require/class.Elevation.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				throw new \Exception("bad resolution can be only one of 1,3");
43 43
 		}
44
-		register_shutdown_function(function () {
44
+		register_shutdown_function(function() {
45 45
 			$this->closeAllFiles();
46 46
 		});
47 47
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 	private function getElevationAtPosition($fileName, $row, $column) {
57 57
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
58
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
59 59
 				throw new \Exception("File '{$fileName}' not exists.");
60 60
 			}
61
-			$file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r");
61
+			$file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r");
62 62
 			if ($file === false) {
63 63
 				throw new \Exception("Cant open file '{$fileName}' for reading.");
64 64
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			throw new \Exception("Not implemented yet");
73 73
 		}
74 74
 		$aRow     = $this->measPerDeg - $row;
75
-		$position = ($this->measPerDeg * ($aRow - 1)) + $column;
75
+		$position = ($this->measPerDeg*($aRow - 1)) + $column;
76 76
 		$position *= 2;
77 77
 		fseek($file, $position);
78 78
 		$short  = fread($file, 2);
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		$latSec = $this->getSec($lat);
101 101
 		$lonSec = $this->getSec($lon);
102 102
 
103
-		$Xn = round($latSec / $this->resolution, 3);
104
-		$Yn = round($lonSec / $this->resolution, 3);
103
+		$Xn = round($latSec/$this->resolution, 3);
104
+		$Yn = round($lonSec/$this->resolution, 3);
105 105
 
106 106
 		$a1 = round($Xn);
107 107
 		$a2 = round($Yn);
@@ -133,55 +133,55 @@  discard block
 block discarded – undo
133 133
 		$b3 = $this->getElevationAtPosition($fName, $b1, $b2);
134 134
 		$c3 = $this->getElevationAtPosition($fName, $c1, $c2);
135 135
 
136
-		$n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2);
137
-		$n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3);
138
-		$n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1);
136
+		$n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2);
137
+		$n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3);
138
+		$n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1);
139 139
 
140
-		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
141
-		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
140
+		$d  = -$n1*$a1 - $n2*$a2 - $n3*$a3;
141
+		$zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3;
142 142
 
143 143
 		return $zN;
144 144
 	}
145 145
 
146 146
 	private function getDeg($deg, $numPrefix) {
147 147
 		$deg = abs($deg);
148
-		$d   = floor($deg);     // round degrees
148
+		$d   = floor($deg); // round degrees
149 149
 		if ($numPrefix >= 3) {
150 150
 			if ($d < 100) {
151
-				$d = '0' . $d;
151
+				$d = '0'.$d;
152 152
 			}
153 153
 		} // pad with leading zeros
154 154
 		if ($d < 10) {
155
-			$d = '0' . $d;
155
+			$d = '0'.$d;
156 156
 		}
157 157
 		return $d;
158 158
 	}
159 159
 
160 160
 	private function getSec($deg) {
161 161
 		$deg = abs($deg);
162
-		$sec = round($deg * 3600, 4);
163
-		$m   = fmod(floor($sec / 60), 60);
162
+		$sec = round($deg*3600, 4);
163
+		$m   = fmod(floor($sec/60), 60);
164 164
 		$s   = round(fmod($sec, 60), 4);
165
-		return ($m * 60) + $s;
165
+		return ($m*60) + $s;
166 166
 	}
167 167
 
168
-	public function download($lat,$lon, $debug = false) {
168
+	public function download($lat, $lon, $debug = false) {
169 169
 		$N      = $this->getDeg($lat, 2);
170 170
 		$E      = $this->getDeg($lon, 3);
171
-		$fileName  = "N{$N}E{$E}.hgt";
172
-		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
171
+		$fileName = "N{$N}E{$E}.hgt";
172
+		if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
173 173
 			$Common = new Common();
174 174
 			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
175
-			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
175
+			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
176
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) {
177 177
 				if ($debug) echo "File '{$fileName}.gz' not exists.";
178 178
 				return false;
179 179
 			}
180 180
 			if ($debug) echo 'Done'."\n";
181 181
 			if ($debug) echo 'Decompress '.$fileName.' ....';
182
-			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
182
+			$Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName);
183 183
 			if ($debug) echo 'Done'."\n";
184
-			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
184
+			unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
185 185
 		}
186 186
 		return true;
187 187
 	}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 		try {
195 195
 			$sth = $db->prepare($query);
196 196
 			$sth->execute($query_values);
197
-		} catch(PDOException $e) {
197
+		} catch (PDOException $e) {
198 198
 			return "error : ".$e->getMessage();
199 199
 		}
200 200
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
201
-			$this->download($data['latitude'],$data['longitude'],true);
201
+			$this->download($data['latitude'], $data['longitude'], true);
202 202
 		}
203 203
 		$db = $Connection->db;
204 204
 		$query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 100';
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 		try {
207 207
 			$sth = $db->prepare($query);
208 208
 			$sth->execute($query_values);
209
-		} catch(PDOException $e) {
209
+		} catch (PDOException $e) {
210 210
 			return "error : ".$e->getMessage();
211 211
 		}
212 212
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
213
-			$this->download($data['latitude'],$data['longitude'],true);
213
+			$this->download($data['latitude'], $data['longitude'], true);
214 214
 		}
215 215
 	}
216 216
 }
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
 	* @param Array $headers header to submit with the form
15 15
 	* @return String the result
16 16
 	*/
17
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
17
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') {
18 18
 		global $globalProxy, $globalForceIPv4;
19 19
 		$ch = curl_init();
20 20
 		curl_setopt($ch, CURLOPT_URL, $url);
21 21
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
22
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
22
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
23 23
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
24 24
 			}
25 25
 		}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
30 30
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
31 31
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
32
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
32
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
33 33
 		//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');
34 34
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
35 35
 		if ($useragent == '') {
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
41 41
 		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
42
-		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
42
+		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback"));
43 43
 		if ($type == 'post') {
44 44
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
45 45
 			if (is_array($data)) {
46 46
 				curl_setopt($ch, CURLOPT_POST, count($data));
47 47
 				$data_string = '';
48
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
48
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
49 49
 				rtrim($data_string, '&');
50 50
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
51 51
 			} else {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 		if ($cookie != '') {
59 59
 			if (is_array($cookie)) {
60
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
60
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
61 61
 			} else {
62 62
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
63 63
 			}
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		$info = curl_getinfo($ch);
70 70
 		//var_dump($info);
71 71
 		curl_close($ch);
72
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
72
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
73 73
 			echo "Cloudflare Detected\n";
74 74
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
75 75
 			$useragent = UAgent::random();
76 76
 			cloudflare::useUserAgent($useragent);
77 77
 			if ($clearanceCookie = cloudflare::bypass($url)) {
78
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
78
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
79 79
 			}
80 80
 		} else {
81 81
 			return $result;
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
 		fclose($fp);
107 107
 	}
108 108
 
109
-	public static function gunzip($in_file,$out_file_name = '') {
109
+	public static function gunzip($in_file, $out_file_name = '') {
110 110
 		//echo $in_file.' -> '.$out_file_name."\n";
111 111
 		$buffer_size = 4096; // read 4kb at a time
112 112
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
113 113
 		if ($in_file != '' && file_exists($in_file)) {
114 114
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
115
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
116
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
115
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
116
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
117 117
 			else {
118 118
 				echo 'gzopen not available';
119 119
 				die;
120 120
 			}
121 121
 			$out_file = fopen($out_file_name, 'wb'); 
122
-			while(!gzeof($file)) {
122
+			while (!gzeof($file)) {
123 123
 				fwrite($out_file, gzread($file, $buffer_size));
124 124
 			}  
125 125
 			fclose($out_file);
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 	}
129 129
 
130
-	public static function bunzip2($in_file,$out_file_name = '') {
130
+	public static function bunzip2($in_file, $out_file_name = '') {
131 131
 		//echo $in_file.' -> '.$out_file_name."\n";
132 132
 		$buffer_size = 4096; // read 4kb at a time
133 133
 		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
134 134
 		if ($in_file != '' && file_exists($in_file)) {
135 135
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
136
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
136
+			if (function_exists('bzopen')) $file = bzopen($in_file, 'rb');
137 137
 			else {
138 138
 				echo 'bzopen not available';
139 139
 				die;
140 140
 			}
141 141
 			$out_file = fopen($out_file_name, 'wb'); 
142
-			while(!feof($file)) {
142
+			while (!feof($file)) {
143 143
 				fwrite($out_file, bzread($file, $buffer_size));
144 144
 			}  
145 145
 			fclose($out_file);
@@ -157,27 +157,27 @@  discard block
 block discarded – undo
157 157
 		if ($data == '') return array();
158 158
 		$html = str_get_html($data);
159 159
 		if ($html === false) return array();
160
-		$tabledata=array();
161
-		foreach($html->find('tr') as $element)
160
+		$tabledata = array();
161
+		foreach ($html->find('tr') as $element)
162 162
 		{
163 163
 			$td = array();
164
-			foreach( $element->find('th') as $row)
164
+			foreach ($element->find('th') as $row)
165 165
 			{
166 166
 				$td [] = trim($row->plaintext);
167 167
 			}
168
-			$td=array_filter($td);
168
+			$td = array_filter($td);
169 169
 			$tabledata[] = $td;
170 170
 
171 171
 			$td = array();
172 172
 			$tdi = array();
173
-			foreach( $element->find('td') as $row)
173
+			foreach ($element->find('td') as $row)
174 174
 			{
175 175
 				$td [] = trim($row->plaintext);
176 176
 				$tdi [] = trim($row->innertext);
177 177
 			}
178
-			$td=array_filter($td);
179
-			$tdi=array_filter($tdi);
180
-			$tabledata[]=array_merge($td,$tdi);
178
+			$td = array_filter($td);
179
+			$tdi = array_filter($tdi);
180
+			$tabledata[] = array_merge($td, $tdi);
181 181
 		}
182 182
 		$html->clear();
183 183
 		unset($html);
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	public function text2array($data) {
193 193
 		$html = str_get_html($data);
194 194
 		if ($html === false) return array();
195
-		$tabledata=array();
196
-		foreach($html->find('p') as $element)
195
+		$tabledata = array();
196
+		foreach ($html->find('p') as $element)
197 197
 		{
198 198
 			$tabledata [] = trim($element->plaintext);
199 199
 		}
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	*/
214 214
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
215 215
 		if ($lat == $latc && $lon == $lonc) return 0;
216
-		$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;
216
+		$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;
217 217
 		if ($unit == "km") {
218
-			return round($dist * 1.609344);
218
+			return round($dist*1.609344);
219 219
 		} elseif ($unit == "m") {
220
-			return round($dist * 1.609344 * 1000);
220
+			return round($dist*1.609344*1000);
221 221
 		} elseif ($unit == "mile" || $unit == "mi") {
222 222
 			return round($dist);
223 223
 		} elseif ($unit == "nm") {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	* @param float $distance distance covered
234 234
 	* @return whether distance is realistic
235 235
 	*/
236
-	public function withinThreshold ($timeDifference, $distance) {
236
+	public function withinThreshold($timeDifference, $distance) {
237 237
 		$x = abs($timeDifference);
238 238
 		$d = abs($distance);
239 239
 		if ($x == 0 || $d == 0) return true;
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 		return ($array !== array_values($array));
250 250
 	}
251 251
 
252
-	public function isInteger($input){
252
+	public function isInteger($input) {
253 253
 	    return(ctype_digit(strval($input)));
254 254
 	}
255 255
 
256 256
 
257
-	public function convertDec($dms,$latlong) {
257
+	public function convertDec($dms, $latlong) {
258 258
 		if ($latlong == 'latitude') {
259 259
 			$deg = substr($dms, 0, 2);
260 260
 			$min = substr($dms, 2, 4);
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
 			$deg = substr($dms, 0, 3);
263 263
 			$min = substr($dms, 3, 5);
264 264
 		}
265
-		return $deg+(($min*60)/3600);
265
+		return $deg + (($min*60)/3600);
266 266
 	}
267 267
 	
268
-	public function convertDM($coord,$latlong) {
268
+	public function convertDM($coord, $latlong) {
269 269
 		if ($latlong == 'latitude') {
270 270
 			if ($coord < 0) $NSEW = 'S';
271 271
 			else $NSEW = 'N';
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 		}
276 276
 		$coord = abs($coord);
277 277
 		$deg = floor($coord);
278
-		$coord = ($coord-$deg)*60;
278
+		$coord = ($coord - $deg)*60;
279 279
 		$min = $coord;
280
-		return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW);
280
+		return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW);
281 281
 	}
282 282
 	
283 283
 	/**
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	public function xcopy($source, $dest)
290 290
 	{
291 291
 		$files = glob($source.'*.*');
292
-		foreach($files as $file){
293
-			$file_to_go = str_replace($source,$dest,$file);
292
+		foreach ($files as $file) {
293
+			$file_to_go = str_replace($source, $dest, $file);
294 294
 			copy($file, $file_to_go);
295 295
 		}
296 296
 		return true;
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 	* @param	String $url url to check
302 302
 	* @return	bool Return true on succes false on failure
303 303
 	*/
304
-	public function urlexist($url){
305
-		$headers=get_headers($url);
306
-		return stripos($headers[0],"200 OK")?true:false;
304
+	public function urlexist($url) {
305
+		$headers = get_headers($url);
306
+		return stripos($headers[0], "200 OK") ? true : false;
307 307
 	}
308 308
 	
309 309
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	public function hex2str($hex) {
315 315
 		$str = '';
316 316
 		$hexln = strlen($hex);
317
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
317
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
318 318
 		return $str;
319 319
 	}
320 320
 	
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	* @return	String Return result
325 325
 	*/
326 326
 	public function hex2rgb($hex) {
327
-		$hex = str_replace('#','',$hex);
327
+		$hex = str_replace('#', '', $hex);
328 328
 		return sscanf($hex, "%02x%02x%02x"); 
329 329
 	}
330 330
 	
@@ -332,33 +332,33 @@  discard block
 block discarded – undo
332 332
 		//difference in longitudinal coordinates
333 333
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
334 334
 		//difference in the phi of latitudinal coordinates
335
-		$dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4));
335
+		$dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4));
336 336
 		//we need to recalculate $dLon if it is greater than pi
337
-		if(abs($dLon) > pi()) {
338
-			if($dLon > 0) {
339
-				$dLon = (2 * pi() - $dLon) * -1;
337
+		if (abs($dLon) > pi()) {
338
+			if ($dLon > 0) {
339
+				$dLon = (2*pi() - $dLon)*-1;
340 340
 			} else {
341
-				$dLon = 2 * pi() + $dLon;
341
+				$dLon = 2*pi() + $dLon;
342 342
 			}
343 343
 		}
344 344
 		//return the angle, normalized
345
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
345
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
346 346
 	}
347 347
 	
348
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) {
348
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) {
349 349
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
350
-		$a = -($lon2-$lon1);
350
+		$a = -($lon2 - $lon1);
351 351
 		$b = $lat2 - $lat1;
352
-		$c = -($a*$lat1+$b*$lon1);
353
-		$d = $a*$lat3+$b*$lon3+$c;
352
+		$c = -($a*$lat1 + $b*$lon1);
353
+		$d = $a*$lat3 + $b*$lon3 + $c;
354 354
 		if ($d > -$approx && $d < $approx) return true;
355 355
 		else return false;
356 356
 	}
357 357
 	
358 358
 	public function array_merge_noappend() {
359 359
 		$output = array();
360
-		foreach(func_get_args() as $array) {
361
-			foreach($array as $key => $value) {
360
+		foreach (func_get_args() as $array) {
361
+			foreach ($array as $key => $value) {
362 362
 				$output[$key] = isset($output[$key]) ?
363 363
 				array_merge($output[$key], $value) : $value;
364 364
 			}
@@ -422,34 +422,34 @@  discard block
 block discarded – undo
422 422
 		return $result;
423 423
 	}
424 424
 
425
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){
425
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) {
426 426
 		global $globalMapRefresh;
427 427
 		$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
428 428
 		$r = 6378;
429 429
 		$latitude = deg2rad($latitude);
430 430
 		$longitude = deg2rad($longitude);
431 431
 		$bearing = deg2rad($heading); 
432
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
433
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
434
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
432
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
433
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
434
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
435 435
 	}
436 436
 	
437
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
437
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
438 438
 		// distance in meter
439 439
 		$R = 6378.14;
440
-		$latitude1 = $latitude * (M_PI/180);
441
-		$longitude1 = $longitude * (M_PI/180);
442
-		$brng = $bearing * (M_PI/180);
440
+		$latitude1 = $latitude*(M_PI/180);
441
+		$longitude1 = $longitude*(M_PI/180);
442
+		$brng = $bearing*(M_PI/180);
443 443
 		$d = $distance;
444 444
 
445 445
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
446
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
446
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
447 447
 
448
-		$latitude2 = $latitude2 * (180/M_PI);
449
-		$longitude2 = $longitude2 * (180/M_PI);
448
+		$latitude2 = $latitude2*(180/M_PI);
449
+		$longitude2 = $longitude2*(180/M_PI);
450 450
 
451
-		$flat = round ($latitude2,6);
452
-		$flong = round ($longitude2,6);
451
+		$flat = round($latitude2, 6);
452
+		$flong = round($longitude2, 6);
453 453
 /*
454 454
 		$dx = $distance*cos($bearing);
455 455
 		$dy = $distance*sin($bearing);
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		$flong = $longitude + $dlong;
459 459
 		$flat = $latitude + $dlat;
460 460
 */
461
-		return array('latitude' => $flat,'longitude' => $flong);
461
+		return array('latitude' => $flat, 'longitude' => $flong);
462 462
 	}
463 463
 
464 464
 	/**
@@ -472,14 +472,14 @@  discard block
 block discarded – undo
472 472
 	 * @param integer $level GZIP compression level (default: 9)
473 473
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
474 474
 	 */
475
-	public function gzCompressFile($source, $level = 9){ 
476
-		$dest = $source . '.gz'; 
477
-		$mode = 'wb' . $level; 
475
+	public function gzCompressFile($source, $level = 9) { 
476
+		$dest = $source.'.gz'; 
477
+		$mode = 'wb'.$level; 
478 478
 		$error = false; 
479 479
 		if ($fp_out = gzopen($dest, $mode)) { 
480
-			if ($fp_in = fopen($source,'rb')) { 
480
+			if ($fp_in = fopen($source, 'rb')) { 
481 481
 				while (!feof($fp_in)) 
482
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
482
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
483 483
 				fclose($fp_in); 
484 484
 			} else {
485 485
 				$error = true; 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	} 
496 496
 	
497 497
 	public function remove_accents($string) {
498
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
498
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
499 499
 		$chars = array(
500 500
 		    // Decompositions for Latin-1 Supplement
501 501
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
553 553
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
554 554
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
555
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
555
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
556 556
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
557 557
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
558 558
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
569 569
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
570 570
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
571
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
572
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
573
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
574
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
575
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
576
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
577
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
571
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
572
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
573
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
574
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
575
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
576
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
577
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
578 578
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
579 579
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
580 580
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 		for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
609 609
 			if (is_numeric($string[$i]) && $concat_flag) {
610 610
 				$int .= $string[$i];
611
-			} elseif(!$concat && $concat_flag && strlen($int) > 0) {
611
+			} elseif (!$concat && $concat_flag && strlen($int) > 0) {
612 612
 				$concat_flag = false;
613 613
 			}
614 614
 		}
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once(dirname(__FILE__).'/class.create_db.php');
11 11
 require_once(dirname(__FILE__).'/class.update_schema.php');
12 12
 require_once(dirname(__FILE__).'/class.settings.php');
13
-$title="Install";
13
+$title = "Install";
14 14
 require(dirname(__FILE__).'/../require/settings.php');
15 15
 require(dirname(__FILE__).'/header.php');
16 16
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 if (!extension_loaded('curl')) {
70 70
 	$error[] = "Curl is not loaded.";
71 71
 }
72
-if(function_exists('apache_get_modules') ){
73
-	if(!in_array('mod_rewrite',apache_get_modules())) {
72
+if (function_exists('apache_get_modules')) {
73
+	if (!in_array('mod_rewrite', apache_get_modules())) {
74 74
 		$error[] = "mod_rewrite is not available.";
75 75
 	}
76 76
 /*
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>';
87 87
 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
88 88
 	if (function_exists('get_headers')) {
89
-		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"])));
90
-		if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
89
+		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"])));
90
+		if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
91 91
 			print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>';
92 92
 		}
93 93
 	}
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 ?>
453 453
 							<tr>
454 454
 								<?php
455
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
455
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
456 456
 								?>
457 457
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
458 458
 								<td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
459 459
 								<?php
460 460
 								    } else {
461
-									$hostport = explode(':',$source['host']);
461
+									$hostport = explode(':', $source['host']);
462 462
 									if (isset($hostport[1])) {
463 463
 										$host = $hostport[0];
464 464
 										$port = $hostport[1];
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 									<select name="timezone[]" id="timezone">
504 504
 								<?php
505 505
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
506
-									foreach($timezonelist as $timezone){
506
+									foreach ($timezonelist as $timezone) {
507 507
 										if (isset($source['timezone']) && $source['timezone'] == $timezone) {
508 508
 											print '<option selected>'.$timezone.'</option>';
509 509
 										} elseif (!isset($source['timezone']) && $timezone == 'UTC') {
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 									<select name="timezone[]" id="timezone">
554 554
 								<?php
555 555
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
556
-									foreach($timezonelist as $timezone){
556
+									foreach ($timezonelist as $timezone) {
557 557
 										if ($timezone == 'UTC') {
558 558
 											print '<option selected>'.$timezone.'</option>';
559 559
 										} else print '<option>'.$timezone.'</option>';
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 			<br />
866 866
 			<p>
867 867
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
868
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
868
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
869 869
 			</p>
870 870
 			<br />
871 871
 			<p>
@@ -921,14 +921,14 @@  discard block
 block discarded – undo
921 921
 $error = '';
922 922
 
923 923
 if (isset($_POST['dbtype'])) {
924
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
925
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
926
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
927
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
928
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
929
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
930
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
931
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
924
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
925
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
926
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
927
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
928
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
929
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
930
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
931
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
932 932
 
933 933
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
934 934
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -948,49 +948,49 @@  discard block
 block discarded – undo
948 948
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
949 949
 	*/
950 950
 	
951
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
951
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
952 952
 
953
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
954
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
955
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
956
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
957
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
953
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
954
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
955
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
956
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
957
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
958 958
 
959
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
960
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
961
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
962
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
963
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
964
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
965
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
966
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
967
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
968
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
959
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
960
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
961
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
962
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
963
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
964
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
965
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
966
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
967
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
968
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
969 969
 	
970
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
971
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
972
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
973
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
974
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
975
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
970
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
971
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
972
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
973
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
974
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
975
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
976 976
 
977
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
978
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
977
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
978
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
979 979
 
980
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
981
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
982
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
980
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
981
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
982
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
983 983
 
984
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
984
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
985 985
 	if ($acars == 'acars') {
986
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
986
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
987 987
 	} else {
988
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
988
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
989 989
 	}
990 990
 
991
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
992
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
993
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
991
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
992
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
993
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
994 994
 	
995 995
 	$source_name = $_POST['source_name'];
996 996
 	$source_latitude = $_POST['source_latitude'];
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
 	
1005 1005
 	$sources = array();
1006 1006
 	foreach ($source_name as $keys => $name) {
1007
-	    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]);
1008
-	    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]);
1007
+	    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]);
1008
+	    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]);
1009 1009
 	}
1010 1010
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1011 1011
 
@@ -1018,24 +1018,24 @@  discard block
 block discarded – undo
1018 1018
 	$sbsurl = $_POST['sbsurl'];
1019 1019
 	*/
1020 1020
 
1021
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1022
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1023
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1024
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1025
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1026
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1027
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1028
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1021
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1022
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1023
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1024
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1025
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1026
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1027
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1028
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1029 1029
 
1030
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1031
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1032
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1033
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1034
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1035
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1036
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1037
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1038
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1030
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1031
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1032
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1033
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1034
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1035
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1036
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1037
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1038
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1039 1039
 
1040 1040
 /*	
1041 1041
 	$globalSBS1Hosts = array();
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	}
1052 1052
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1053 1053
 */
1054
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1054
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1055 1055
 	$host = $_POST['host'];
1056 1056
 	$port = $_POST['port'];
1057 1057
 	$name = $_POST['name'];
@@ -1068,100 +1068,100 @@  discard block
 block discarded – undo
1068 1068
 		else $cov = 'FALSE';
1069 1069
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1070 1070
 		else $arch = 'FALSE';
1071
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]);
1071
+		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezone[$key]);
1072 1072
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1073 1073
 	}
1074
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1074
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1075 1075
 
1076 1076
 /*
1077 1077
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1078 1078
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1079 1079
 */
1080
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1081
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1082
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1080
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1081
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1082
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1083 1083
 
1084
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1085
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1084
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1085
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1086 1086
 
1087
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1088
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1087
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1088
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1089 1089
 
1090
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1091
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1092
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1093
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1090
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1091
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1092
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1093
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1094 1094
 
1095
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1096
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1097
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1095
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1096
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1097
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1098 1098
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1099
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1100
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1099
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1100
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1101 1101
 
1102
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1103
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1104
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1105
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1106
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1107
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1108
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1109
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1102
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1103
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1104
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1105
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1106
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1107
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1108
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1109
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1110 1110
 
1111
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1112
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1111
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1112
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1113 1113
 
1114
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1115
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1114
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1115
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1116 1116
 	
1117
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1117
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1118 1118
 	if ($archiveyear == "archiveyear") {
1119
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1119
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1120 1120
 	} else {
1121
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1121
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1122 1122
 	}
1123
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1124
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1125
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1126
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1123
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1124
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1125
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1126
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1127 1127
 
1128
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1129
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1130
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1131
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1128
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1129
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1130
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1131
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1132 1132
 
1133
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1134
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1135
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1133
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1134
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1135
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1136 1136
 
1137 1137
 	// Create in settings.php keys not yet configurable if not already here
1138 1138
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1139
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1139
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1140 1140
 
1141
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1141
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1142 1142
 	if ($resetyearstats == 'resetyearstats') {
1143
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1143
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1144 1144
 	} else {
1145
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1145
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1146 1146
 	}
1147 1147
 
1148
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1148
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1149 1149
 	if ($archive == 'archive') {
1150
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1150
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1151 1151
 	} else {
1152
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1152
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1153 1153
 	}
1154
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1154
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1155 1155
 	if ($daemon == 'daemon') {
1156
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1156
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1157 1157
 	} else {
1158
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1158
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1159 1159
 	}
1160
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1160
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1161 1161
 	if ($schedules == 'schedules') {
1162
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1162
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1163 1163
 	} else {
1164
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1164
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1165 1165
 	}
1166 1166
 
1167 1167
 /*
@@ -1172,227 +1172,227 @@  discard block
 block discarded – undo
1172 1172
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1173 1173
 	}
1174 1174
 */
1175
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1176
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1177
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1178
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1179
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1175
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1176
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1177
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1178
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1179
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1180 1180
 	$va = false;
1181 1181
 	if ($globalivao == 'ivao') {
1182
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1182
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1183 1183
 		$va = true;
1184
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1184
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1185 1185
 	if ($globalvatsim == 'vatsim') {
1186
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1186
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1187 1187
 		$va = true;
1188
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1188
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1189 1189
 	if ($globalphpvms == 'phpvms') {
1190
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1190
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1191 1191
 		$va = true;
1192
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1192
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1193 1193
 	if ($globalvam == 'vam') {
1194
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1194
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1195 1195
 		$va = true;
1196
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1196
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1197 1197
 	if ($va) {
1198
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1199
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1198
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1199
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1200 1200
 	if ($globalva == 'va' || $va) {
1201
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1202
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1201
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1202
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1203 1203
 	} else {
1204
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1205
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1206
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1204
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1205
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1206
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1207 1207
 	}
1208 1208
 	
1209 1209
 	
1210 1210
 
1211
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1211
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1212 1212
 	if ($notam == 'notam') {
1213
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1213
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1214 1214
 	} else {
1215
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1215
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1216 1216
 	}
1217
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1217
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1218 1218
 	if ($owner == 'owner') {
1219
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1219
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1220 1220
 	} else {
1221
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1221
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1222 1222
 	}
1223
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1223
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1224 1224
 	if ($map3d == 'map3d') {
1225
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1225
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1226 1226
 	} else {
1227
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1227
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1228 1228
 	}
1229
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1229
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1230 1230
 	if ($crash == 'crash') {
1231
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1231
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1232 1232
 	} else {
1233
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1233
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1234 1234
 	}
1235
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1235
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1236 1236
 	if ($mapsatellites == 'mapsatellites') {
1237
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1237
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1238 1238
 	} else {
1239
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1239
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1240 1240
 	}
1241
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1241
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1242 1242
 	if ($map3ddefault == 'map3ddefault') {
1243
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1243
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1244 1244
 	} else {
1245
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1245
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1246 1246
 	}
1247
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1247
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1248 1248
 	if ($translate == 'translate') {
1249
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1249
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1250 1250
 	} else {
1251
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1251
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1252 1252
 	}
1253
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1253
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1254 1254
 	if ($realairlines == 'realairlines') {
1255
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1255
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1256 1256
 	} else {
1257
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1257
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1258 1258
 	}
1259
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1259
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1260 1260
 	if ($estimation == 'estimation') {
1261
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1261
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1262 1262
 	} else {
1263
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1263
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1264 1264
 	}
1265
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1265
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1266 1266
 	if ($metar == 'metar') {
1267
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1267
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1268 1268
 	} else {
1269
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1269
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1270 1270
 	}
1271
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1271
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1272 1272
 	if ($metarcycle == 'metarcycle') {
1273
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1273
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1274 1274
 	} else {
1275
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1275
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1276 1276
 	}
1277
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1277
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1278 1278
 	if ($fork == 'fork') {
1279
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1279
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1280 1280
 	} else {
1281
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1281
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1282 1282
 	}
1283 1283
 
1284
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1284
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1285 1285
 	if ($colormap == 'colormap') {
1286
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1286
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1287 1287
 	} else {
1288
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1288
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1289 1289
 	}
1290 1290
 	
1291 1291
 	if (isset($_POST['aircrafticoncolor'])) {
1292
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1293
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1292
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1293
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1294 1294
 	}
1295 1295
 
1296
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1297
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1296
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1297
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1298 1298
 
1299
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1300
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1301
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1302
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1303
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1304
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1299
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1300
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1301
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1302
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1303
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1304
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1305 1305
 
1306
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1306
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1307 1307
 	if ($mappopup == 'mappopup') {
1308
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1308
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1309 1309
 	} else {
1310
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1310
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1311 1311
 	}
1312
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1312
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1313 1313
 	if ($airportpopup == 'airportpopup') {
1314
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1314
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1315 1315
 	} else {
1316
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1316
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1317 1317
 	}
1318
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1318
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1319 1319
 	if ($maphistory == 'maphistory') {
1320
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1320
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1321 1321
 	} else {
1322
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1322
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1323 1323
 	}
1324
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1324
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1325 1325
 	if ($maptooltip == 'maptooltip') {
1326
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1326
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1327 1327
 	} else {
1328
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1328
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1329 1329
 	}
1330
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1330
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1331 1331
 	if ($flightroute == 'flightroute') {
1332
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1332
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1333 1333
 	} else {
1334
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1334
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1335 1335
 	}
1336
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1336
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1337 1337
 	if ($flightremainingroute == 'flightremainingroute') {
1338
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1338
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1339 1339
 	} else {
1340
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1340
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1341 1341
 	}
1342
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1342
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1343 1343
 	if ($allflights == 'allflights') {
1344
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1344
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1345 1345
 	} else {
1346
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1346
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1347 1347
 	}
1348
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1348
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1349 1349
 	if ($bbox == 'bbox') {
1350
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1350
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1351 1351
 	} else {
1352
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1352
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1353 1353
 	}
1354
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1354
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1355 1355
 	if ($groundaltitude == 'groundaltitude') {
1356
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1356
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1357 1357
 	} else {
1358
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1358
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1359 1359
 	}
1360
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1360
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1361 1361
 	if ($waypoints == 'waypoints') {
1362
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1362
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1363 1363
 	} else {
1364
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1364
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1365 1365
 	}
1366
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1366
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1367 1367
 	if ($geoid == 'geoid') {
1368
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1368
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1369 1369
 	} else {
1370
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1370
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1371 1371
 	}
1372
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1373
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1372
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1373
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1374 1374
 
1375
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1375
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1376 1376
 	if ($noairlines == 'noairlines') {
1377
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1377
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1378 1378
 	} else {
1379
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1379
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1380 1380
 	}
1381 1381
 
1382
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1382
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1383 1383
 
1384 1384
 	// Set some defaults values...
1385 1385
 	if (!isset($globalAircraftImageSources)) {
1386
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1387
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1386
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1387
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1388 1388
 	}
1389 1389
 
1390 1390
 	if (!isset($globalSchedulesSources)) {
1391
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1392
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1391
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1392
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1393 1393
     	}
1394 1394
 
1395
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1395
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1396 1396
 
1397 1397
 	if ($error == '') settings::modify_settings($settings);
1398 1398
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.