Completed
Push — master ( 160f95...944224 )
by Yannick
07:09
created
require/class.Spotter.php 1 patch
Braces   +643 added lines, -223 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalFilter)) {
23
+			$filter = array_merge($globalFilter,$filter);
24
+		}
23 25
 		$filter_query_join = '';
24 26
 		$filter_query_where = '';
25 27
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +46,11 @@  discard block
 block discarded – undo
44 46
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 47
 			}
46 48
 		}
47
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
49
+		if ($filter_query_where == '' && $where) {
50
+			$filter_query_where = ' WHERE';
51
+		} elseif ($filter_query_where != '' && $and) {
52
+			$filter_query_where .= ' AND';
53
+		}
49 54
 		$filter_query = $filter_query_join.$filter_query_where;
50 55
 		return $filter_query;
51 56
 	}
@@ -65,9 +70,15 @@  discard block
 block discarded – undo
65 70
 		$Image = new Image($this->db);
66 71
 		$Schedule = new Schedule($this->db);
67 72
 		$ACARS = new ACARS($this->db);
68
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
69
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
70
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
73
+		if (!isset($globalIVAO)) {
74
+			$globalIVAO = FALSE;
75
+		}
76
+		if (!isset($globalVATSIM)) {
77
+			$globalVATSIM = FALSE;
78
+		}
79
+		if (!isset($globalphpVMS)) {
80
+			$globalphpVMS = FALSE;
81
+		}
71 82
 		date_default_timezone_set('UTC');
72 83
 		
73 84
 		if (!is_string($query))
@@ -114,21 +125,35 @@  discard block
 block discarded – undo
114 125
 			} else {
115 126
 				$temp_array['spotter_id'] = '';
116 127
 			}
117
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
118
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
128
+			if (isset($row['flightaware_id'])) {
129
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
130
+			}
131
+			if (isset($row['modes'])) {
132
+				$temp_array['modes'] = $row['modes'];
133
+			}
119 134
 			$temp_array['ident'] = $row['ident'];
120 135
 			if (isset($row['registration']) && $row['registration'] != '') {
121 136
 				$temp_array['registration'] = $row['registration'];
122 137
 			} elseif (isset($temp_array['modes'])) {
123 138
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
124
-			} else $temp_array['registration'] = '';
125
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
139
+			} else {
140
+				$temp_array['registration'] = '';
141
+			}
142
+			if (isset($row['aircraft_icao'])) {
143
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
144
+			}
126 145
 			
127 146
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
128 147
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
129
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
130
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
131
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
148
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
149
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
150
+			}
151
+			if (isset($row['latitude'])) {
152
+				$temp_array['latitude'] = $row['latitude'];
153
+			}
154
+			if (isset($row['longitude'])) {
155
+				$temp_array['longitude'] = $row['longitude'];
156
+			}
132 157
 			/*
133 158
 			if (Connection->tableExists('countries')) {
134 159
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -138,8 +163,12 @@  discard block
 block discarded – undo
138 163
 				}
139 164
 			}
140 165
 			*/
141
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
142
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
166
+			if (isset($row['waypoints'])) {
167
+				$temp_array['waypoints'] = $row['waypoints'];
168
+			}
169
+			if (isset($row['format_source'])) {
170
+				$temp_array['format_source'] = $row['format_source'];
171
+			}
143 172
 			if (isset($row['route_stop'])) {
144 173
 				$temp_array['route_stop'] = $row['route_stop'];
145 174
 				if ($row['route_stop'] != '') {
@@ -158,13 +187,19 @@  discard block
 block discarded – undo
158 187
 					}
159 188
 				}
160 189
 			}
161
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
190
+			if (isset($row['altitude'])) {
191
+				$temp_array['altitude'] = $row['altitude'];
192
+			}
162 193
 			if (isset($row['heading'])) {
163 194
 				$temp_array['heading'] = $row['heading'];
164 195
 				$heading_direction = $this->parseDirection($row['heading']);
165
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
196
+				if (isset($heading_direction[0]['direction_fullname'])) {
197
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
198
+				}
199
+			}
200
+			if (isset($row['ground_speed'])) {
201
+				$temp_array['ground_speed'] = $row['ground_speed'];
166 202
 			}
167
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
168 203
 			$temp_array['image'] = "";
169 204
 			$temp_array['image_thumbnail'] = "";
170 205
 			$temp_array['image_source'] = "";
@@ -172,7 +207,9 @@  discard block
 block discarded – undo
172 207
  
173 208
 			if (isset($row['highlight'])) {
174 209
 				$temp_array['highlight'] = $row['highlight'];
175
-			} else $temp_array['highlight'] = '';
210
+			} else {
211
+				$temp_array['highlight'] = '';
212
+			}
176 213
 			
177 214
 			if (isset($row['date'])) {
178 215
 				$dateArray = $this->parseDateString($row['date']);
@@ -220,7 +257,9 @@  discard block
 block discarded – undo
220 257
 				
221 258
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
222 259
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
223
-					} else $temp_array['aircraft_shadow'] = 'default.png';
260
+					} else {
261
+						$temp_array['aircraft_shadow'] = 'default.png';
262
+					}
224 263
                                 } else {
225 264
                             		$temp_array['aircraft_shadow'] = 'default.png';
226 265
 					$temp_array['aircraft_name'] = 'N/A';
@@ -228,11 +267,17 @@  discard block
 block discarded – undo
228 267
                             	}
229 268
 			}
230 269
 			$fromsource = NULL;
231
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
232
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
233
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
234
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
235
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
270
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
271
+				$fromsource = $globalAirlinesSource;
272
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
273
+				$fromsource = 'vatsim';
274
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
275
+				$fromsource = 'ivao';
276
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
277
+				$fromsource = 'vatsim';
278
+			} elseif (isset($globalIVAO) && $globalIVAO) {
279
+				$fromsource = 'ivao';
280
+			}
236 281
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
237 282
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
238 283
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -255,12 +300,18 @@  discard block
 block discarded – undo
255 300
 				}
256 301
 			} else {
257 302
 				$temp_array['airline_icao'] = $row['airline_icao'];
258
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
259
-				else $temp_array['airline_iata'] = '';
303
+				if (isset($row['airline_iata'])) {
304
+					$temp_array['airline_iata'] = $row['airline_iata'];
305
+				} else {
306
+					$temp_array['airline_iata'] = '';
307
+				}
260 308
 				$temp_array['airline_name'] = $row['airline_name'];
261 309
 				$temp_array['airline_country'] = $row['airline_country'];
262
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
263
-				else $temp_array['airline_callsign'] = 'N/A';
310
+				if (isset($row['airline_callsign'])) {
311
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
312
+				} else {
313
+					$temp_array['airline_callsign'] = 'N/A';
314
+				}
264 315
 				$temp_array['airline_type'] = $row['airline_type'];
265 316
 			}
266 317
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -276,7 +327,9 @@  discard block
 block discarded – undo
276 327
 			}
277 328
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !isset($temp_array['aircraft_owner'])) {
278 329
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
279
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
330
+				if ($owner_info['owner'] != '') {
331
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
332
+				}
280 333
 				$temp_array['aircraft_base'] = $owner_info['base'];
281 334
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
282 335
 			}
@@ -284,9 +337,14 @@  discard block
 block discarded – undo
284 337
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
285 338
 			{
286 339
 				if ($globalIVAO) {
287
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
288
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
289
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
340
+					if (isset($temp_array['airline_icao'])) {
341
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
342
+					} else {
343
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
344
+					}
345
+				} else {
346
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
347
+				}
290 348
 				if (count($image_array) > 0) {
291 349
 					$temp_array['image'] = $image_array[0]['image'];
292 350
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -336,7 +394,9 @@  discard block
 block discarded – undo
336 394
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
337 395
 			if ($row['departure_airport_icao'] != '') {
338 396
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
339
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
397
+				if (!isset($departure_airport_array[0]['name'])) {
398
+					$departure_airport_array = $this->getAllAirportInfo('NA');
399
+				}
340 400
 			/*
341 401
 			} elseif ($row['departure_airport_name'] != '') {
342 402
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -344,7 +404,9 @@  discard block
 block discarded – undo
344 404
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
345 405
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
346 406
 			*/
347
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
407
+			} else {
408
+				$departure_airport_array = $this->getAllAirportInfo('NA');
409
+			}
348 410
 			if (isset($departure_airport_array[0]['name'])) {
349 411
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
350 412
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -364,8 +426,12 @@  discard block
 block discarded – undo
364 426
 			
365 427
 			if ($row['arrival_airport_icao'] != '') {
366 428
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
367
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
368
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
429
+				if (count($arrival_airport_array) == 0) {
430
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
431
+				}
432
+			} else {
433
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
434
+			}
369 435
 			if (isset($arrival_airport_array[0]['name'])) {
370 436
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
371 437
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -381,27 +447,45 @@  discard block
 block discarded – undo
381 447
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
382 448
 			}
383 449
 			*/
384
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
385
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
386
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
387
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
388
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
450
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
451
+				$temp_array['pilot_id'] = $row['pilot_id'];
452
+			}
453
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
454
+				$temp_array['pilot_name'] = $row['pilot_name'];
455
+			}
456
+			if (isset($row['source_name']) && $row['source_name'] != '') {
457
+				$temp_array['source_name'] = $row['source_name'];
458
+			}
459
+			if (isset($row['over_country']) && $row['over_country'] != '') {
460
+				$temp_array['over_country'] = $row['over_country'];
461
+			}
462
+			if (isset($row['distance']) && $row['distance'] != '') {
463
+				$temp_array['distance'] = $row['distance'];
464
+			}
389 465
 			if (isset($row['squawk'])) {
390 466
 				$temp_array['squawk'] = $row['squawk'];
391 467
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
392 468
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
393
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
469
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
470
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
471
+					}
394 472
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
395 473
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
396
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
474
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
475
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
476
+					}
477
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
478
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
479
+				}
398 480
 			}
399 481
     			
400 482
 			$temp_array['query_number_rows'] = $num_rows;
401 483
 			
402 484
 			$spotter_array[] = $temp_array;
403 485
 		}
404
-		if ($num_rows == 0) return array();
486
+		if ($num_rows == 0) {
487
+			return array();
488
+		}
405 489
 		$spotter_array[0]['query_number_rows'] = $num_rows;
406 490
 		return $spotter_array;
407 491
 	}	
@@ -434,7 +518,9 @@  discard block
 block discarded – undo
434 518
 				foreach ($q_array as $q_item){
435 519
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
436 520
 					$additional_query .= " AND (";
437
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
521
+					if (is_int($q_item)) {
522
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
523
+					}
438 524
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
439 525
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
440 526
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -455,7 +541,9 @@  discard block
 block discarded – undo
455 541
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
456 542
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
457 543
 					$translate = $Translation->ident2icao($q_item);
458
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
544
+					if ($translate != $q_item) {
545
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
546
+					}
459 547
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
460 548
 					$additional_query .= ")";
461 549
 				}
@@ -682,7 +770,9 @@  discard block
 block discarded – undo
682 770
 				date_default_timezone_set($globalTimezone);
683 771
 				$datetime = new DateTime();
684 772
 				$offset = $datetime->format('P');
685
-			} else $offset = '+00:00';
773
+			} else {
774
+				$offset = '+00:00';
775
+			}
686 776
 
687 777
 			if ($date_array[1] != "")
688 778
 			{
@@ -714,8 +804,12 @@  discard block
 block discarded – undo
714 804
 			{
715 805
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
716 806
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
717
-			} else $limit_query = "";
718
-		} else $limit_query = "";
807
+			} else {
808
+				$limit_query = "";
809
+			}
810
+		} else {
811
+			$limit_query = "";
812
+		}
719 813
 
720 814
 
721 815
 		if ($sort != "")
@@ -783,8 +877,12 @@  discard block
 block discarded – undo
783 877
 			{
784 878
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
785 879
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
786
-			} else $limit_query = "";
787
-		} else $limit_query = "";
880
+			} else {
881
+				$limit_query = "";
882
+			}
883
+		} else {
884
+			$limit_query = "";
885
+		}
788 886
 		
789 887
 		if ($sort != "")
790 888
 		{
@@ -1108,7 +1206,9 @@  discard block
 block discarded – undo
1108 1206
 		global $global_query;
1109 1207
 		
1110 1208
 		date_default_timezone_set('UTC');
1111
-		if ($id == '') return array();
1209
+		if ($id == '') {
1210
+			return array();
1211
+		}
1112 1212
 		$additional_query = "spotter_output.spotter_id = :id";
1113 1213
 		$query_values = array(':id' => $id);
1114 1214
 
@@ -1745,7 +1845,9 @@  discard block
 block discarded – undo
1745 1845
 		{
1746 1846
 			$highlight = $row['highlight'];
1747 1847
 		}
1748
-		if (isset($highlight)) return $highlight;
1848
+		if (isset($highlight)) {
1849
+			return $highlight;
1850
+		}
1749 1851
 	}
1750 1852
 
1751 1853
 	
@@ -1772,7 +1874,9 @@  discard block
 block discarded – undo
1772 1874
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1773 1875
 		if (count($row) > 0) {
1774 1876
 			return $row['usage'];
1775
-		} else return '';
1877
+		} else {
1878
+			return '';
1879
+		}
1776 1880
 	}
1777 1881
 
1778 1882
 	/**
@@ -1796,7 +1900,9 @@  discard block
 block discarded – undo
1796 1900
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1797 1901
 		if (count($row) > 0) {
1798 1902
 			return $row['icao'];
1799
-		} else return '';
1903
+		} else {
1904
+			return '';
1905
+		}
1800 1906
 	}
1801 1907
 
1802 1908
 	/**
@@ -1823,7 +1929,9 @@  discard block
 block discarded – undo
1823 1929
 			$airport_longitude = $row['longitude'];
1824 1930
 			$Common = new Common();
1825 1931
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1826
-		} else return '';
1932
+		} else {
1933
+			return '';
1934
+		}
1827 1935
 	}
1828 1936
 	
1829 1937
 	/**
@@ -1935,7 +2043,9 @@  discard block
 block discarded – undo
1935 2043
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1936 2044
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1937 2045
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1938
-		} else return array();
2046
+		} else {
2047
+			return array();
2048
+		}
1939 2049
 		if ($globalDBdriver == 'mysql') {
1940 2050
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1941 2051
 		} else {
@@ -1970,7 +2080,9 @@  discard block
 block discarded – undo
1970 2080
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971 2081
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972 2082
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973
-		} else return array();
2083
+		} else {
2084
+			return array();
2085
+		}
1974 2086
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1975 2087
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1976 2088
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2108,15 +2220,20 @@  discard block
 block discarded – undo
2108 2220
 				'A320-211' => 'A320',
2109 2221
 				'747-8i' => 'B748',
2110 2222
 				'A380' => 'A388');
2111
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2223
+		if (isset($all_aircraft[$aircraft_type])) {
2224
+			return $all_aircraft[$aircraft_type];
2225
+		}
2112 2226
 
2113 2227
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2114 2228
 		$aircraft_type = strtoupper($aircraft_type);
2115 2229
 		$sth = $this->db->prepare($query);
2116 2230
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2117 2231
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2118
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2119
-		else return '';
2232
+		if (isset($result[0]['icao'])) {
2233
+			return $result[0]['icao'];
2234
+		} else {
2235
+			return '';
2236
+		}
2120 2237
 	}
2121 2238
 	
2122 2239
 	/**
@@ -2138,7 +2255,9 @@  discard block
 block discarded – undo
2138 2255
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2139 2256
 		if (isset($row['icaotypecode'])) {
2140 2257
 			return $row['icaotypecode'];
2141
-		} else return '';
2258
+		} else {
2259
+			return '';
2260
+		}
2142 2261
 	}
2143 2262
 
2144 2263
 	/**
@@ -2159,7 +2278,9 @@  discard block
 block discarded – undo
2159 2278
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2160 2279
 		if (isset($row['operator_correct'])) {
2161 2280
 			return $row['operator_correct'];
2162
-		} else return $operator;
2281
+		} else {
2282
+			return $operator;
2283
+		}
2163 2284
 	}
2164 2285
 
2165 2286
 	/**
@@ -2172,7 +2293,9 @@  discard block
 block discarded – undo
2172 2293
 	public function getRouteInfo($callsign)
2173 2294
 	{
2174 2295
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2175
-                if ($callsign == '') return array();
2296
+                if ($callsign == '') {
2297
+                	return array();
2298
+                }
2176 2299
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2177 2300
 		
2178 2301
 		$sth = $this->db->prepare($query);
@@ -2181,7 +2304,9 @@  discard block
 block discarded – undo
2181 2304
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2182 2305
 		if (count($row) > 0) {
2183 2306
 			return $row;
2184
-		} else return array();
2307
+		} else {
2308
+			return array();
2309
+		}
2185 2310
 	}
2186 2311
 	
2187 2312
 	/**
@@ -2233,7 +2358,9 @@  discard block
 block discarded – undo
2233 2358
 			$sth->execute(array(':registration' => $registration));
2234 2359
 
2235 2360
 			return $sth->fetch(PDO::FETCH_ASSOC);
2236
-		} else return array();
2361
+		} else {
2362
+			return array();
2363
+		}
2237 2364
 	}
2238 2365
 	
2239 2366
   
@@ -2389,8 +2516,11 @@  discard block
 block discarded – undo
2389 2516
 		$query .= " ORDER BY spotter_output.source_name ASC";
2390 2517
 
2391 2518
 		$sth = $this->db->prepare($query);
2392
-		if (!empty($query_values)) $sth->execute($query_values);
2393
-		else $sth->execute();
2519
+		if (!empty($query_values)) {
2520
+			$sth->execute($query_values);
2521
+		} else {
2522
+			$sth->execute();
2523
+		}
2394 2524
 
2395 2525
 		$source_array = array();
2396 2526
 		$temp_array = array();
@@ -2422,9 +2552,13 @@  discard block
 block discarded – undo
2422 2552
 								WHERE spotter_output.airline_icao <> '' 
2423 2553
 								ORDER BY spotter_output.airline_name ASC";
2424 2554
 			*/
2425
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2426
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2427
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2555
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2556
+				$forsource = $globalAirlinesSource;
2557
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2558
+				$forsource = 'vatsim';
2559
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2560
+				$forsource = 'ivao';
2561
+			}
2428 2562
 			if ($forsource === NULL) {
2429 2563
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2430 2564
 				$query_data = array();
@@ -2722,7 +2856,9 @@  discard block
 block discarded – undo
2722 2856
 			date_default_timezone_set($globalTimezone);
2723 2857
 			$datetime = new DateTime();
2724 2858
 			$offset = $datetime->format('P');
2725
-		} else $offset = '+00:00';
2859
+		} else {
2860
+			$offset = '+00:00';
2861
+		}
2726 2862
 		if ($airport_icao == '') {
2727 2863
 			if ($globalDBdriver == 'mysql') {
2728 2864
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2754,7 +2890,9 @@  discard block
 block discarded – undo
2754 2890
 			date_default_timezone_set($globalTimezone);
2755 2891
 			$datetime = new DateTime();
2756 2892
 			$offset = $datetime->format('P');
2757
-		} else $offset = '+00:00';
2893
+		} else {
2894
+			$offset = '+00:00';
2895
+		}
2758 2896
 		if ($airport_icao == '') {
2759 2897
 			if ($globalDBdriver == 'mysql') {
2760 2898
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2786,7 +2924,9 @@  discard block
 block discarded – undo
2786 2924
 			date_default_timezone_set($globalTimezone);
2787 2925
 			$datetime = new DateTime();
2788 2926
 			$offset = $datetime->format('P');
2789
-		} else $offset = '+00:00';
2927
+		} else {
2928
+			$offset = '+00:00';
2929
+		}
2790 2930
 		if ($airport_icao == '') {
2791 2931
 			if ($globalDBdriver == 'mysql') {
2792 2932
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2829,7 +2969,9 @@  discard block
 block discarded – undo
2829 2969
 			date_default_timezone_set($globalTimezone);
2830 2970
 			$datetime = new DateTime();
2831 2971
 			$offset = $datetime->format('P');
2832
-		} else $offset = '+00:00';
2972
+		} else {
2973
+			$offset = '+00:00';
2974
+		}
2833 2975
 		if ($airport_icao == '') {
2834 2976
 			if ($globalDBdriver == 'mysql') {
2835 2977
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2873,7 +3015,9 @@  discard block
 block discarded – undo
2873 3015
 			date_default_timezone_set($globalTimezone);
2874 3016
 			$datetime = new DateTime();
2875 3017
 			$offset = $datetime->format('P');
2876
-		} else $offset = '+00:00';
3018
+		} else {
3019
+			$offset = '+00:00';
3020
+		}
2877 3021
 		if ($airport_icao == '') {
2878 3022
 			if ($globalDBdriver == 'mysql') {
2879 3023
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2907,7 +3051,9 @@  discard block
 block discarded – undo
2907 3051
 			date_default_timezone_set($globalTimezone);
2908 3052
 			$datetime = new DateTime();
2909 3053
 			$offset = $datetime->format('P');
2910
-		} else $offset = '+00:00';
3054
+		} else {
3055
+			$offset = '+00:00';
3056
+		}
2911 3057
 		if ($airport_icao == '') {
2912 3058
 			if ($globalDBdriver == 'mysql') {
2913 3059
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2953,7 +3099,9 @@  discard block
 block discarded – undo
2953 3099
 			date_default_timezone_set($globalTimezone);
2954 3100
 			$datetime = new DateTime();
2955 3101
 			$offset = $datetime->format('P');
2956
-		} else $offset = '+00:00';
3102
+		} else {
3103
+			$offset = '+00:00';
3104
+		}
2957 3105
 		if ($airport_icao == '') {
2958 3106
 			if ($globalDBdriver == 'mysql') {
2959 3107
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2987,7 +3135,9 @@  discard block
 block discarded – undo
2987 3135
 			date_default_timezone_set($globalTimezone);
2988 3136
 			$datetime = new DateTime();
2989 3137
 			$offset = $datetime->format('P');
2990
-		} else $offset = '+00:00';
3138
+		} else {
3139
+			$offset = '+00:00';
3140
+		}
2991 3141
 		if ($airport_icao == '') {
2992 3142
 			if ($globalDBdriver == 'mysql') {
2993 3143
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3035,7 +3185,9 @@  discard block
 block discarded – undo
3035 3185
 			date_default_timezone_set($globalTimezone);
3036 3186
 			$datetime = new DateTime();
3037 3187
 			$offset = $datetime->format('P');
3038
-		} else $offset = '+00:00';
3188
+		} else {
3189
+			$offset = '+00:00';
3190
+		}
3039 3191
 
3040 3192
 		if ($globalDBdriver == 'mysql') {
3041 3193
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3155,7 +3307,9 @@  discard block
 block discarded – undo
3155 3307
 	*/	
3156 3308
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3157 3309
 	{
3158
-		if ($groundspeed == '') $groundspeed = NULL;
3310
+		if ($groundspeed == '') {
3311
+			$groundspeed = NULL;
3312
+		}
3159 3313
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3160 3314
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3161 3315
 
@@ -3205,9 +3359,15 @@  discard block
 block discarded – undo
3205 3359
 		$Image = new Image($this->db);
3206 3360
 		$Common = new Common();
3207 3361
 		
3208
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3209
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3210
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3362
+		if (!isset($globalIVAO)) {
3363
+			$globalIVAO = FALSE;
3364
+		}
3365
+		if (!isset($globalVATSIM)) {
3366
+			$globalVATSIM = FALSE;
3367
+		}
3368
+		if (!isset($globalphpVMS)) {
3369
+			$globalphpVMS = FALSE;
3370
+		}
3211 3371
 		date_default_timezone_set('UTC');
3212 3372
 		
3213 3373
 		//getting the registration
@@ -3220,23 +3380,33 @@  discard block
 block discarded – undo
3220 3380
 				if ($ModeS != '') {
3221 3381
 					$timeelapsed = microtime(true);
3222 3382
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3223
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3383
+					if ($globalDebugTimeElapsed) {
3384
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3385
+					}
3224 3386
 				} else {
3225 3387
 					$myhex = explode('-',$flightaware_id);
3226 3388
 					if (count($myhex) > 0) {
3227 3389
 						$timeelapsed = microtime(true);
3228 3390
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3229
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3391
+						if ($globalDebugTimeElapsed) {
3392
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3393
+						}
3230 3394
 					}
3231 3395
 				}
3232 3396
 			}
3233 3397
 		}
3234 3398
 		$fromsource = NULL;
3235
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3236
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3237
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3238
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3239
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3399
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3400
+			$fromsource = $globalAirlinesSource;
3401
+		} elseif ($format_source == 'vatsimtxt') {
3402
+			$fromsource = 'vatsim';
3403
+		} elseif ($format_source == 'whazzup') {
3404
+			$fromsource = 'ivao';
3405
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3406
+			$fromsource = 'vatsim';
3407
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3408
+			$fromsource = 'ivao';
3409
+		}
3240 3410
 		//getting the airline information
3241 3411
 		if ($ident != "")
3242 3412
 		{
@@ -3260,15 +3430,21 @@  discard block
 block discarded – undo
3260 3430
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3261 3431
 						$airline_array = $this->getAllAirlineInfo("NA");
3262 3432
 					}
3263
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3433
+					if ($globalDebugTimeElapsed) {
3434
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3435
+					}
3264 3436
 
3265 3437
 				} else {
3266 3438
 					$timeelapsed = microtime(true);
3267 3439
 					$airline_array = $this->getAllAirlineInfo("NA");
3268
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3440
+					if ($globalDebugTimeElapsed) {
3441
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3442
+					}
3269 3443
 				}
3270 3444
 			}
3271
-		} else $airline_array = array();
3445
+		} else {
3446
+			$airline_array = array();
3447
+		}
3272 3448
 		
3273 3449
 		//getting the aircraft information
3274 3450
 		$aircraft_array = array();
@@ -3282,27 +3458,37 @@  discard block
 block discarded – undo
3282 3458
 				{
3283 3459
 					$timeelapsed = microtime(true);
3284 3460
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3285
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3461
+					if ($globalDebugTimeElapsed) {
3462
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3463
+					}
3286 3464
 				} else {
3287 3465
 					$timeelapsed = microtime(true);
3288 3466
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3467
+					if ($globalDebugTimeElapsed) {
3468
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3469
+					}
3290 3470
 				}
3291 3471
 			}
3292 3472
 		} else {
3293 3473
 			if ($ModeS != '') {
3294 3474
 				$timeelapsed = microtime(true);
3295 3475
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3296
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3476
+				if ($globalDebugTimeElapsed) {
3477
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3478
+				}
3297 3479
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3298 3480
 				{
3299 3481
 					$timeelapsed = microtime(true);
3300 3482
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3301
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					if ($globalDebugTimeElapsed) {
3484
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3485
+					}
3302 3486
 				} else {
3303 3487
 					$timeelapsed = microtime(true);
3304 3488
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					if ($globalDebugTimeElapsed) {
3490
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3491
+					}
3306 3492
 				}
3307 3493
 			}
3308 3494
 		}
@@ -3317,7 +3503,9 @@  discard block
 block discarded – undo
3317 3503
 			} else {
3318 3504
 				$timeelapsed = microtime(true);
3319 3505
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3320
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3506
+				if ($globalDebugTimeElapsed) {
3507
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3508
+				}
3321 3509
 			}
3322 3510
 		}
3323 3511
 		
@@ -3331,7 +3519,9 @@  discard block
 block discarded – undo
3331 3519
 			} else {
3332 3520
 				$timeelapsed = microtime(true);
3333 3521
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3334
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+				if ($globalDebugTimeElapsed) {
3523
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+				}
3335 3525
 			}
3336 3526
 		}
3337 3527
 
@@ -3366,7 +3556,9 @@  discard block
 block discarded – undo
3366 3556
 			{
3367 3557
 				return false;
3368 3558
 			}
3369
-		} else $altitude = 0;
3559
+		} else {
3560
+			$altitude = 0;
3561
+		}
3370 3562
 		
3371 3563
 		if ($heading != "")
3372 3564
 		{
@@ -3395,7 +3587,9 @@  discard block
 block discarded – undo
3395 3587
 		{
3396 3588
 			$timeelapsed = microtime(true);
3397 3589
 			$image_array = $Image->getSpotterImage($registration);
3398
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3590
+			if ($globalDebugTimeElapsed) {
3591
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3592
+			}
3399 3593
 			if (!isset($image_array[0]['registration']))
3400 3594
 			{
3401 3595
 				//echo "Add image !!!! \n";
@@ -3403,14 +3597,21 @@  discard block
 block discarded – undo
3403 3597
 			}
3404 3598
 			$timeelapsed = microtime(true);
3405 3599
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3406
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3600
+			if ($globalDebugTimeElapsed) {
3601
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3602
+			}
3603
+			if ($owner_info['owner'] != '') {
3604
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3605
+			}
3408 3606
 		}
3409 3607
     
3410 3608
 		if ($globalIVAO && $aircraft_icao != '')
3411 3609
 		{
3412
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3413
-            		else $airline_icao = '';
3610
+            		if (isset($airline_array[0]['icao'])) {
3611
+            			$airline_icao = $airline_array[0]['icao'];
3612
+            		} else {
3613
+            			$airline_icao = '';
3614
+            		}
3414 3615
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3415 3616
 			if (!isset($image_array[0]['registration']))
3416 3617
 			{
@@ -3455,12 +3656,24 @@  discard block
 block discarded – undo
3455 3656
                 {
3456 3657
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3457 3658
                 }
3458
-                if ($registration == '') $registration = 'NA';
3459
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3460
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3461
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3462
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3463
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3659
+                if ($registration == '') {
3660
+                	$registration = 'NA';
3661
+                }
3662
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3663
+                	$squawk = NULL;
3664
+                }
3665
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3666
+                	$verticalrate = NULL;
3667
+                }
3668
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3669
+                	$heading = 0;
3670
+                }
3671
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3672
+                	$groundspeed = 0;
3673
+                }
3674
+                if (!isset($aircraft_owner)) {
3675
+                	$aircraft_owner = NULL;
3676
+                }
3464 3677
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3465 3678
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3466 3679
 
@@ -3471,9 +3684,13 @@  discard block
 block discarded – undo
3471 3684
 		if ($airline_type == '') {
3472 3685
 			$timeelapsed = microtime(true);
3473 3686
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3474
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3687
+			if ($globalDebugTimeElapsed) {
3688
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3689
+			}
3690
+		}
3691
+		if ($airline_type == null) {
3692
+			$airline_type = '';
3475 3693
 		}
3476
-		if ($airline_type == null) $airline_type = '';
3477 3694
                 $aircraft_type = $aircraft_array[0]['type'];
3478 3695
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3479 3696
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3608,7 +3825,9 @@  discard block
 block discarded – undo
3608 3825
 			}
3609 3826
 		}
3610 3827
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3611
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3828
+		if ($limit) {
3829
+			$query .= " LIMIT 10 OFFSET 0";
3830
+		}
3612 3831
 		
3613 3832
 		$sth = $this->db->prepare($query);
3614 3833
 		$sth->execute();
@@ -3653,7 +3872,9 @@  discard block
 block discarded – undo
3653 3872
 			}
3654 3873
 		}
3655 3874
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3656
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3875
+		if ($limit) {
3876
+			$query .= " LIMIT 10 OFFSET 0";
3877
+		}
3657 3878
       
3658 3879
 		
3659 3880
 		$sth = $this->db->prepare($query);
@@ -3698,7 +3919,9 @@  discard block
 block discarded – undo
3698 3919
 			}
3699 3920
 		}
3700 3921
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3701
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3922
+		if ($limit) {
3923
+			$query .= " LIMIT 10 OFFSET 0";
3924
+		}
3702 3925
       
3703 3926
 		
3704 3927
 		$sth = $this->db->prepare($query);
@@ -3745,7 +3968,9 @@  discard block
 block discarded – undo
3745 3968
 			}
3746 3969
 		}
3747 3970
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3748
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3971
+		if ($limit) {
3972
+			$query .= " LIMIT 10 OFFSET 0";
3973
+		}
3749 3974
       
3750 3975
 		
3751 3976
 		$sth = $this->db->prepare($query);
@@ -3789,7 +4014,9 @@  discard block
 block discarded – undo
3789 4014
 			}
3790 4015
 		}
3791 4016
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3792
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4017
+		if ($limit) {
4018
+			$query .= " LIMIT 10 OFFSET 0";
4019
+		}
3793 4020
       
3794 4021
 		
3795 4022
 		$sth = $this->db->prepare($query);
@@ -4038,7 +4265,9 @@  discard block
 block discarded – undo
4038 4265
 			date_default_timezone_set($globalTimezone);
4039 4266
 			$datetime = new DateTime($date);
4040 4267
 			$offset = $datetime->format('P');
4041
-		} else $offset = '+00:00';
4268
+		} else {
4269
+			$offset = '+00:00';
4270
+		}
4042 4271
 
4043 4272
 		if ($globalDBdriver == 'mysql') {
4044 4273
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4087,7 +4316,9 @@  discard block
 block discarded – undo
4087 4316
 			date_default_timezone_set($globalTimezone);
4088 4317
 			$datetime = new DateTime($date);
4089 4318
 			$offset = $datetime->format('P');
4090
-		} else $offset = '+00:00';
4319
+		} else {
4320
+			$offset = '+00:00';
4321
+		}
4091 4322
 		
4092 4323
 		if ($globalDBdriver == 'mysql') {
4093 4324
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4310,7 +4541,9 @@  discard block
 block discarded – undo
4310 4541
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4311 4542
 					GROUP BY spotter_output.airline_country
4312 4543
 					ORDER BY airline_country_count DESC";
4313
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4544
+		if ($limit) {
4545
+			$query .= " LIMIT 10 OFFSET 0";
4546
+		}
4314 4547
       
4315 4548
 		$sth = $this->db->prepare($query);
4316 4549
 		$sth->execute();
@@ -4360,7 +4593,9 @@  discard block
 block discarded – undo
4360 4593
 		}
4361 4594
 
4362 4595
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4363
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4596
+		if ($limit) {
4597
+			$query .= " LIMIT 10 OFFSET 0";
4598
+		}
4364 4599
       
4365 4600
 		
4366 4601
 		$sth = $this->db->prepare($query);
@@ -4410,7 +4645,9 @@  discard block
 block discarded – undo
4410 4645
 		}
4411 4646
 
4412 4647
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4413
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4648
+		if ($limit) {
4649
+			$query .= " LIMIT 10 OFFSET 0";
4650
+		}
4414 4651
  
4415 4652
 		$sth = $this->db->prepare($query);
4416 4653
 		$sth->execute();
@@ -4456,7 +4693,9 @@  discard block
 block discarded – undo
4456 4693
 		}
4457 4694
 
4458 4695
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4459
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4696
+		if ($limit) {
4697
+			$query .= " LIMIT 10 OFFSET 0";
4698
+		}
4460 4699
  
4461 4700
 		$sth = $this->db->prepare($query);
4462 4701
 		$sth->execute();
@@ -4509,7 +4748,9 @@  discard block
 block discarded – undo
4509 4748
 			if($row['registration'] != "")
4510 4749
 			{
4511 4750
 				$image_array = $Image->getSpotterImage($row['registration']);
4512
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4751
+				if (isset($image_array[0]['image_thumbnail'])) {
4752
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4753
+				}
4513 4754
 			}
4514 4755
 			$temp_array['registration_count'] = $row['registration_count'];
4515 4756
 
@@ -4585,7 +4826,9 @@  discard block
 block discarded – undo
4585 4826
 			if($row['registration'] != "")
4586 4827
 			{
4587 4828
 				$image_array = $Image->getSpotterImage($row['registration']);
4588
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4829
+				if (isset($image_array[0]['image_thumbnail'])) {
4830
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4831
+				}
4589 4832
 			}
4590 4833
 			$temp_array['registration_count'] = $row['registration_count'];
4591 4834
 
@@ -4819,7 +5062,9 @@  discard block
 block discarded – undo
4819 5062
 			date_default_timezone_set($globalTimezone);
4820 5063
 			$datetime = new DateTime($date);
4821 5064
 			$offset = $datetime->format('P');
4822
-		} else $offset = '+00:00';
5065
+		} else {
5066
+			$offset = '+00:00';
5067
+		}
4823 5068
 
4824 5069
 		if ($globalDBdriver == 'mysql') {
4825 5070
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4867,7 +5112,9 @@  discard block
 block discarded – undo
4867 5112
 			date_default_timezone_set($globalTimezone);
4868 5113
 			$datetime = new DateTime($date);
4869 5114
 			$offset = $datetime->format('P');
4870
-		} else $offset = '+00:00';
5115
+		} else {
5116
+			$offset = '+00:00';
5117
+		}
4871 5118
 
4872 5119
 		if ($globalDBdriver == 'mysql') {
4873 5120
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
@@ -4922,7 +5169,9 @@  discard block
 block discarded – undo
4922 5169
 			date_default_timezone_set($globalTimezone);
4923 5170
 			$datetime = new DateTime($date);
4924 5171
 			$offset = $datetime->format('P');
4925
-		} else $offset = '+00:00';
5172
+		} else {
5173
+			$offset = '+00:00';
5174
+		}
4926 5175
 
4927 5176
 		if ($globalDBdriver == 'mysql') {
4928 5177
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5023,8 +5272,11 @@  discard block
 block discarded – undo
5023 5272
 			if($row['registration'] != "")
5024 5273
 			{
5025 5274
 				$image_array = $Image->getSpotterImage($row['registration']);
5026
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5027
-				else $temp_array['image_thumbnail'] = '';
5275
+				if (isset($image_array[0]['image_thumbnail'])) {
5276
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5277
+				} else {
5278
+					$temp_array['image_thumbnail'] = '';
5279
+				}
5028 5280
 			}
5029 5281
 			$temp_array['registration_count'] = $row['registration_count'];
5030 5282
 			$aircraft_array[] = $temp_array;
@@ -5132,7 +5384,9 @@  discard block
 block discarded – undo
5132 5384
 			if($row['registration'] != "")
5133 5385
 			{
5134 5386
 				$image_array = $Image->getSpotterImage($row['registration']);
5135
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5387
+				if (isset($image_array[0]['image_thumbnail'])) {
5388
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5389
+				}
5136 5390
 			}
5137 5391
 			$temp_array['registration_count'] = $row['registration_count'];
5138 5392
           
@@ -5251,7 +5505,9 @@  discard block
 block discarded – undo
5251 5505
 			if($row['registration'] != "")
5252 5506
 			{
5253 5507
 				$image_array = $Image->getSpotterImage($row['registration']);
5254
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5508
+				if (isset($image_array[0]['image_thumbnail'])) {
5509
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5510
+				}
5255 5511
 			}
5256 5512
 			$temp_array['registration_count'] = $row['registration_count'];
5257 5513
           
@@ -5364,7 +5620,9 @@  discard block
 block discarded – undo
5364 5620
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5365 5621
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5366 5622
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5367
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5623
+		if ($limit) {
5624
+			$query .= " LIMIT 10 OFFSET 0";
5625
+		}
5368 5626
 		
5369 5627
 		$sth = $this->db->prepare($query);
5370 5628
 		$sth->execute();
@@ -5383,7 +5641,9 @@  discard block
 block discarded – undo
5383 5641
 			if($row['registration'] != "")
5384 5642
 			{
5385 5643
 				$image_array = $Image->getSpotterImage($row['registration']);
5386
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5644
+				if (isset($image_array[0]['image_thumbnail'])) {
5645
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5646
+				}
5387 5647
 			}
5388 5648
           
5389 5649
 			$aircraft_array[] = $temp_array;
@@ -5424,7 +5684,9 @@  discard block
 block discarded – undo
5424 5684
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5425 5685
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5426 5686
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5427
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5687
+		if ($limit) {
5688
+			$query .= " LIMIT 10 OFFSET 0";
5689
+		}
5428 5690
 		
5429 5691
 		$sth = $this->db->prepare($query);
5430 5692
 		$sth->execute();
@@ -5444,7 +5706,9 @@  discard block
 block discarded – undo
5444 5706
 			if($row['registration'] != "")
5445 5707
 			{
5446 5708
 				$image_array = $Image->getSpotterImage($row['registration']);
5447
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5709
+				if (isset($image_array[0]['image_thumbnail'])) {
5710
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5711
+				}
5448 5712
 			}
5449 5713
           
5450 5714
 			$aircraft_array[] = $temp_array;
@@ -5485,7 +5749,9 @@  discard block
 block discarded – undo
5485 5749
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5486 5750
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5487 5751
 				ORDER BY airport_departure_icao_count DESC";
5488
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5752
+		if ($limit) {
5753
+			$query .= " LIMIT 10 OFFSET 0";
5754
+		}
5489 5755
       
5490 5756
 		$sth = $this->db->prepare($query);
5491 5757
 		$sth->execute();
@@ -5537,7 +5803,9 @@  discard block
 block discarded – undo
5537 5803
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5538 5804
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5539 5805
 				ORDER BY airport_departure_icao_count DESC";
5540
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5806
+		if ($limit) {
5807
+			$query .= " LIMIT 10 OFFSET 0";
5808
+		}
5541 5809
       
5542 5810
 		$sth = $this->db->prepare($query);
5543 5811
 		$sth->execute();
@@ -5589,7 +5857,9 @@  discard block
 block discarded – undo
5589 5857
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5590 5858
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5591 5859
 				ORDER BY airport_departure_icao_count DESC";
5592
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5860
+		if ($limit) {
5861
+			$query .= " LIMIT 10 OFFSET 0";
5862
+		}
5593 5863
       
5594 5864
 		$sth = $this->db->prepare($query);
5595 5865
 		$sth->execute();
@@ -5641,7 +5911,9 @@  discard block
 block discarded – undo
5641 5911
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5642 5912
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5643 5913
 				ORDER BY airport_departure_icao_count DESC";
5644
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5914
+		if ($limit) {
5915
+			$query .= " LIMIT 10 OFFSET 0";
5916
+		}
5645 5917
       
5646 5918
 		$sth = $this->db->prepare($query);
5647 5919
 		$sth->execute();
@@ -6046,7 +6318,9 @@  discard block
 block discarded – undo
6046 6318
 			date_default_timezone_set($globalTimezone);
6047 6319
 			$datetime = new DateTime($date);
6048 6320
 			$offset = $datetime->format('P');
6049
-		} else $offset = '+00:00';
6321
+		} else {
6322
+			$offset = '+00:00';
6323
+		}
6050 6324
 
6051 6325
 		if ($globalDBdriver == 'mysql') {
6052 6326
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6097,7 +6371,9 @@  discard block
 block discarded – undo
6097 6371
 			date_default_timezone_set($globalTimezone);
6098 6372
 			$datetime = new DateTime($date);
6099 6373
 			$offset = $datetime->format('P');
6100
-		} else $offset = '+00:00';
6374
+		} else {
6375
+			$offset = '+00:00';
6376
+		}
6101 6377
 
6102 6378
 		if ($globalDBdriver == 'mysql') {
6103 6379
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6315,7 +6591,9 @@  discard block
 block discarded – undo
6315 6591
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6316 6592
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6317 6593
 					ORDER BY airport_arrival_icao_count DESC";
6318
-		if ($limit) $query .= " LIMIT 10";
6594
+		if ($limit) {
6595
+			$query .= " LIMIT 10";
6596
+		}
6319 6597
       
6320 6598
 		
6321 6599
 		$sth = $this->db->prepare($query);
@@ -6335,7 +6613,9 @@  discard block
 block discarded – undo
6335 6613
 			if ($icaoaskey) {
6336 6614
 				$icao = $row['arrival_airport_icao'];
6337 6615
 				$airport_array[$icao] = $temp_array;
6338
-			} else $airport_array[] = $temp_array;
6616
+			} else {
6617
+				$airport_array[] = $temp_array;
6618
+			}
6339 6619
 		}
6340 6620
 
6341 6621
 		return $airport_array;
@@ -6377,7 +6657,9 @@  discard block
 block discarded – undo
6377 6657
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6378 6658
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6379 6659
 					ORDER BY airport_arrival_icao_count DESC";
6380
-		if ($limit) $query .= " LIMIT 10";
6660
+		if ($limit) {
6661
+			$query .= " LIMIT 10";
6662
+		}
6381 6663
       
6382 6664
 		
6383 6665
 		$sth = $this->db->prepare($query);
@@ -6398,7 +6680,9 @@  discard block
 block discarded – undo
6398 6680
 			if ($icaoaskey) {
6399 6681
 				$icao = $row['arrival_airport_icao'];
6400 6682
 				$airport_array[$icao] = $temp_array;
6401
-			} else $airport_array[] = $temp_array;
6683
+			} else {
6684
+				$airport_array[] = $temp_array;
6685
+			}
6402 6686
 		}
6403 6687
 
6404 6688
 		return $airport_array;
@@ -6440,7 +6724,9 @@  discard block
 block discarded – undo
6440 6724
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441 6725
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6442 6726
 					ORDER BY airport_arrival_icao_count DESC";
6443
-		if ($limit) $query .= " LIMIT 10";
6727
+		if ($limit) {
6728
+			$query .= " LIMIT 10";
6729
+		}
6444 6730
       
6445 6731
 		
6446 6732
 		$sth = $this->db->prepare($query);
@@ -6460,7 +6746,9 @@  discard block
 block discarded – undo
6460 6746
 			if ($icaoaskey) {
6461 6747
 				$icao = $row['arrival_airport_icao'];
6462 6748
 				$airport_array[$icao] = $temp_array;
6463
-			} else $airport_array[] = $temp_array;
6749
+			} else {
6750
+				$airport_array[] = $temp_array;
6751
+			}
6464 6752
 		}
6465 6753
 
6466 6754
 		return $airport_array;
@@ -6502,7 +6790,9 @@  discard block
 block discarded – undo
6502 6790
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6503 6791
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6504 6792
 					ORDER BY airport_arrival_icao_count DESC";
6505
-		if ($limit) $query .= " LIMIT 10";
6793
+		if ($limit) {
6794
+			$query .= " LIMIT 10";
6795
+		}
6506 6796
       
6507 6797
 		
6508 6798
 		$sth = $this->db->prepare($query);
@@ -6523,7 +6813,9 @@  discard block
 block discarded – undo
6523 6813
 			if ($icaoaskey) {
6524 6814
 				$icao = $row['arrival_airport_icao'];
6525 6815
 				$airport_array[$icao] = $temp_array;
6526
-			} else $airport_array[] = $temp_array;
6816
+			} else {
6817
+				$airport_array[] = $temp_array;
6818
+			}
6527 6819
 		}
6528 6820
 
6529 6821
 		return $airport_array;
@@ -6912,7 +7204,9 @@  discard block
 block discarded – undo
6912 7204
 			date_default_timezone_set($globalTimezone);
6913 7205
 			$datetime = new DateTime($date);
6914 7206
 			$offset = $datetime->format('P');
6915
-		} else $offset = '+00:00';
7207
+		} else {
7208
+			$offset = '+00:00';
7209
+		}
6916 7210
 
6917 7211
 		if ($globalDBdriver == 'mysql') {
6918 7212
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -6963,7 +7257,9 @@  discard block
 block discarded – undo
6963 7257
 			date_default_timezone_set($globalTimezone);
6964 7258
 			$datetime = new DateTime($date);
6965 7259
 			$offset = $datetime->format('P');
6966
-		} else $offset = '+00:00';
7260
+		} else {
7261
+			$offset = '+00:00';
7262
+		}
6967 7263
 
6968 7264
 		if ($globalDBdriver == 'mysql') {
6969 7265
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7192,7 +7488,9 @@  discard block
 block discarded – undo
7192 7488
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7193 7489
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7194 7490
 					ORDER BY airport_arrival_country_count DESC";
7195
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7491
+		if ($limit) {
7492
+			$query .= " LIMIT 10 OFFSET 0";
7493
+		}
7196 7494
       
7197 7495
 		
7198 7496
 		$sth = $this->db->prepare($query);
@@ -7487,7 +7785,9 @@  discard block
 block discarded – undo
7487 7785
 			date_default_timezone_set($globalTimezone);
7488 7786
 			$datetime = new DateTime($date);
7489 7787
 			$offset = $datetime->format('P');
7490
-		} else $offset = '+00:00';
7788
+		} else {
7789
+			$offset = '+00:00';
7790
+		}
7491 7791
 		
7492 7792
 		if ($globalDBdriver == 'mysql') {
7493 7793
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7670,15 +7970,23 @@  discard block
 block discarded – undo
7670 7970
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7671 7971
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7672 7972
 		 if ($olderthanmonths > 0) {
7673
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7674
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7973
+			if ($globalDBdriver == 'mysql') {
7974
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7975
+			} else {
7976
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7977
+			}
7675 7978
 		}
7676 7979
 		if ($sincedate != '') {
7677
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7678
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7980
+			if ($globalDBdriver == 'mysql') {
7981
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7982
+			} else {
7983
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7984
+			}
7679 7985
 		}
7680 7986
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7681
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7987
+		if ($limit) {
7988
+			$query .= " LIMIT 10 OFFSET 0";
7989
+		}
7682 7990
       		
7683 7991
 		$sth = $this->db->prepare($query);
7684 7992
 		$sth->execute();
@@ -7712,15 +8020,23 @@  discard block
 block discarded – undo
7712 8020
                     FROM spotter_output
7713 8021
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7714 8022
 		 if ($olderthanmonths > 0) {
7715
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7716
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8023
+			if ($globalDBdriver == 'mysql') {
8024
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8025
+			} else {
8026
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8027
+			}
7717 8028
 		}
7718 8029
 		if ($sincedate != '') {
7719
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7720
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8030
+			if ($globalDBdriver == 'mysql') {
8031
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8032
+			} else {
8033
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8034
+			}
7721 8035
 		}
7722 8036
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7723
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8037
+		if ($limit) {
8038
+			$query .= " LIMIT 10 OFFSET 0";
8039
+		}
7724 8040
       		
7725 8041
 		$sth = $this->db->prepare($query);
7726 8042
 		$sth->execute();
@@ -7757,7 +8073,9 @@  discard block
 block discarded – undo
7757 8073
 			date_default_timezone_set($globalTimezone);
7758 8074
 			$datetime = new DateTime();
7759 8075
 			$offset = $datetime->format('P');
7760
-		} else $offset = '+00:00';
8076
+		} else {
8077
+			$offset = '+00:00';
8078
+		}
7761 8079
 
7762 8080
 		if ($globalDBdriver == 'mysql') {
7763 8081
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7806,7 +8124,9 @@  discard block
 block discarded – undo
7806 8124
 			date_default_timezone_set($globalTimezone);
7807 8125
 			$datetime = new DateTime();
7808 8126
 			$offset = $datetime->format('P');
7809
-		} else $offset = '+00:00';
8127
+		} else {
8128
+			$offset = '+00:00';
8129
+		}
7810 8130
 
7811 8131
 		if ($globalDBdriver == 'mysql') {
7812 8132
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7856,7 +8176,9 @@  discard block
 block discarded – undo
7856 8176
 			date_default_timezone_set($globalTimezone);
7857 8177
 			$datetime = new DateTime();
7858 8178
 			$offset = $datetime->format('P');
7859
-		} else $offset = '+00:00';
8179
+		} else {
8180
+			$offset = '+00:00';
8181
+		}
7860 8182
 		$filter_query = $this->getFilter($filters,true,true);
7861 8183
 		if ($globalDBdriver == 'mysql') {
7862 8184
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7902,7 +8224,9 @@  discard block
 block discarded – undo
7902 8224
 			date_default_timezone_set($globalTimezone);
7903 8225
 			$datetime = new DateTime();
7904 8226
 			$offset = $datetime->format('P');
7905
-		} else $offset = '+00:00';
8227
+		} else {
8228
+			$offset = '+00:00';
8229
+		}
7906 8230
 		$filter_query = $this->getFilter($filters,true,true);
7907 8231
 		if ($globalDBdriver == 'mysql') {
7908 8232
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7949,7 +8273,9 @@  discard block
 block discarded – undo
7949 8273
 			date_default_timezone_set($globalTimezone);
7950 8274
 			$datetime = new DateTime();
7951 8275
 			$offset = $datetime->format('P');
7952
-		} else $offset = '+00:00';
8276
+		} else {
8277
+			$offset = '+00:00';
8278
+		}
7953 8279
 		
7954 8280
 		if ($globalDBdriver == 'mysql') {
7955 8281
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7999,7 +8325,9 @@  discard block
 block discarded – undo
7999 8325
 			date_default_timezone_set($globalTimezone);
8000 8326
 			$datetime = new DateTime();
8001 8327
 			$offset = $datetime->format('P');
8002
-		} else $offset = '+00:00';
8328
+		} else {
8329
+			$offset = '+00:00';
8330
+		}
8003 8331
 
8004 8332
 		if ($globalDBdriver == 'mysql') {
8005 8333
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8047,7 +8375,9 @@  discard block
 block discarded – undo
8047 8375
 			date_default_timezone_set($globalTimezone);
8048 8376
 			$datetime = new DateTime();
8049 8377
 			$offset = $datetime->format('P');
8050
-		} else $offset = '+00:00';
8378
+		} else {
8379
+			$offset = '+00:00';
8380
+		}
8051 8381
 
8052 8382
 		if ($globalDBdriver == 'mysql') {
8053 8383
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8096,7 +8426,9 @@  discard block
 block discarded – undo
8096 8426
 			date_default_timezone_set($globalTimezone);
8097 8427
 			$datetime = new DateTime();
8098 8428
 			$offset = $datetime->format('P');
8099
-		} else $offset = '+00:00';
8429
+		} else {
8430
+			$offset = '+00:00';
8431
+		}
8100 8432
 
8101 8433
 		if ($globalDBdriver == 'mysql') {
8102 8434
 			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8143,7 +8475,9 @@  discard block
 block discarded – undo
8143 8475
 			date_default_timezone_set($globalTimezone);
8144 8476
 			$datetime = new DateTime();
8145 8477
 			$offset = $datetime->format('P');
8146
-		} else $offset = '+00:00';
8478
+		} else {
8479
+			$offset = '+00:00';
8480
+		}
8147 8481
 
8148 8482
 		if ($globalDBdriver == 'mysql') {
8149 8483
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8190,7 +8524,9 @@  discard block
 block discarded – undo
8190 8524
 			date_default_timezone_set($globalTimezone);
8191 8525
 			$datetime = new DateTime();
8192 8526
 			$offset = $datetime->format('P');
8193
-		} else $offset = '+00:00';
8527
+		} else {
8528
+			$offset = '+00:00';
8529
+		}
8194 8530
 
8195 8531
 		if ($globalDBdriver == 'mysql') {
8196 8532
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8238,7 +8574,9 @@  discard block
 block discarded – undo
8238 8574
 			date_default_timezone_set($globalTimezone);
8239 8575
 			$datetime = new DateTime();
8240 8576
 			$offset = $datetime->format('P');
8241
-		} else $offset = '+00:00';
8577
+		} else {
8578
+			$offset = '+00:00';
8579
+		}
8242 8580
 
8243 8581
 		if ($globalDBdriver == 'mysql') {
8244 8582
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8285,7 +8623,9 @@  discard block
 block discarded – undo
8285 8623
 			date_default_timezone_set($globalTimezone);
8286 8624
 			$datetime = new DateTime();
8287 8625
 			$offset = $datetime->format('P');
8288
-		} else $offset = '+00:00';
8626
+		} else {
8627
+			$offset = '+00:00';
8628
+		}
8289 8629
 
8290 8630
 		if ($globalDBdriver == 'mysql') {
8291 8631
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8333,7 +8673,9 @@  discard block
 block discarded – undo
8333 8673
 			date_default_timezone_set($globalTimezone);
8334 8674
 			$datetime = new DateTime();
8335 8675
 			$offset = $datetime->format('P');
8336
-		} else $offset = '+00:00';
8676
+		} else {
8677
+			$offset = '+00:00';
8678
+		}
8337 8679
 
8338 8680
 		if ($globalDBdriver == 'mysql') {
8339 8681
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8380,7 +8722,9 @@  discard block
 block discarded – undo
8380 8722
 			date_default_timezone_set($globalTimezone);
8381 8723
 			$datetime = new DateTime();
8382 8724
 			$offset = $datetime->format('P');
8383
-		} else $offset = '+00:00';
8725
+		} else {
8726
+			$offset = '+00:00';
8727
+		}
8384 8728
 
8385 8729
 		if ($globalDBdriver == 'mysql') {
8386 8730
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8428,7 +8772,9 @@  discard block
 block discarded – undo
8428 8772
 			date_default_timezone_set($globalTimezone);
8429 8773
 			$datetime = new DateTime();
8430 8774
 			$offset = $datetime->format('P');
8431
-		} else $offset = '+00:00';
8775
+		} else {
8776
+			$offset = '+00:00';
8777
+		}
8432 8778
 
8433 8779
 		if ($globalDBdriver == 'mysql') {
8434 8780
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8476,7 +8822,9 @@  discard block
 block discarded – undo
8476 8822
 			date_default_timezone_set($globalTimezone);
8477 8823
 			$datetime = new DateTime();
8478 8824
 			$offset = $datetime->format('P');
8479
-		} else $offset = '+00:00';
8825
+		} else {
8826
+			$offset = '+00:00';
8827
+		}
8480 8828
 
8481 8829
 		if ($globalDBdriver == 'mysql') {
8482 8830
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8524,7 +8872,9 @@  discard block
 block discarded – undo
8524 8872
 			date_default_timezone_set($globalTimezone);
8525 8873
 			$datetime = new DateTime();
8526 8874
 			$offset = $datetime->format('P');
8527
-		} else $offset = '+00:00';
8875
+		} else {
8876
+			$offset = '+00:00';
8877
+		}
8528 8878
 
8529 8879
 		if ($globalDBdriver == 'mysql') {
8530 8880
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8573,7 +8923,9 @@  discard block
 block discarded – undo
8573 8923
 			date_default_timezone_set($globalTimezone);
8574 8924
 			$datetime = new DateTime();
8575 8925
 			$offset = $datetime->format('P');
8576
-		} else $offset = '+00:00';
8926
+		} else {
8927
+			$offset = '+00:00';
8928
+		}
8577 8929
 		$filter_query = $this->getFilter($filters,true,true);
8578 8930
 		if ($globalDBdriver == 'mysql') {
8579 8931
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8622,7 +8974,9 @@  discard block
 block discarded – undo
8622 8974
 			date_default_timezone_set($globalTimezone);
8623 8975
 			$datetime = new DateTime();
8624 8976
 			$offset = $datetime->format('P');
8625
-		} else $offset = '+00:00';
8977
+		} else {
8978
+			$offset = '+00:00';
8979
+		}
8626 8980
 
8627 8981
 		$orderby_sql = '';
8628 8982
 		if ($orderby == "hour")
@@ -8687,7 +9041,9 @@  discard block
 block discarded – undo
8687 9041
 			date_default_timezone_set($globalTimezone);
8688 9042
 			$datetime = new DateTime();
8689 9043
 			$offset = $datetime->format('P');
8690
-		} else $offset = '+00:00';
9044
+		} else {
9045
+			$offset = '+00:00';
9046
+		}
8691 9047
 
8692 9048
 		$orderby_sql = '';
8693 9049
 		if ($orderby == "hour")
@@ -8755,7 +9111,9 @@  discard block
 block discarded – undo
8755 9111
 			date_default_timezone_set($globalTimezone);
8756 9112
 			$datetime = new DateTime();
8757 9113
 			$offset = $datetime->format('P');
8758
-		} else $offset = '+00:00';
9114
+		} else {
9115
+			$offset = '+00:00';
9116
+		}
8759 9117
 
8760 9118
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8761 9119
 
@@ -8807,7 +9165,9 @@  discard block
 block discarded – undo
8807 9165
 			date_default_timezone_set($globalTimezone);
8808 9166
 			$datetime = new DateTime();
8809 9167
 			$offset = $datetime->format('P');
8810
-		} else $offset = '+00:00';
9168
+		} else {
9169
+			$offset = '+00:00';
9170
+		}
8811 9171
 
8812 9172
 		if ($globalDBdriver == 'mysql') {
8813 9173
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8855,7 +9215,9 @@  discard block
 block discarded – undo
8855 9215
 			date_default_timezone_set($globalTimezone);
8856 9216
 			$datetime = new DateTime();
8857 9217
 			$offset = $datetime->format('P');
8858
-		} else $offset = '+00:00';
9218
+		} else {
9219
+			$offset = '+00:00';
9220
+		}
8859 9221
 
8860 9222
 		if ($globalDBdriver == 'mysql') {
8861 9223
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8903,7 +9265,9 @@  discard block
 block discarded – undo
8903 9265
 			date_default_timezone_set($globalTimezone);
8904 9266
 			$datetime = new DateTime();
8905 9267
 			$offset = $datetime->format('P');
8906
-		} else $offset = '+00:00';
9268
+		} else {
9269
+			$offset = '+00:00';
9270
+		}
8907 9271
 
8908 9272
 		if ($globalDBdriver == 'mysql') {
8909 9273
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8952,7 +9316,9 @@  discard block
 block discarded – undo
8952 9316
 			date_default_timezone_set($globalTimezone);
8953 9317
 			$datetime = new DateTime();
8954 9318
 			$offset = $datetime->format('P');
8955
-		} else $offset = '+00:00';
9319
+		} else {
9320
+			$offset = '+00:00';
9321
+		}
8956 9322
 
8957 9323
 		if ($globalDBdriver == 'mysql') {
8958 9324
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9001,7 +9367,9 @@  discard block
 block discarded – undo
9001 9367
 			date_default_timezone_set($globalTimezone);
9002 9368
 			$datetime = new DateTime($date);
9003 9369
 			$offset = $datetime->format('P');
9004
-		} else $offset = '+00:00';
9370
+		} else {
9371
+			$offset = '+00:00';
9372
+		}
9005 9373
 
9006 9374
 		if ($globalDBdriver == 'mysql') {
9007 9375
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9050,7 +9418,9 @@  discard block
 block discarded – undo
9050 9418
 			date_default_timezone_set($globalTimezone);
9051 9419
 			$datetime = new DateTime();
9052 9420
 			$offset = $datetime->format('P');
9053
-		} else $offset = '+00:00';
9421
+		} else {
9422
+			$offset = '+00:00';
9423
+		}
9054 9424
 
9055 9425
 		if ($globalDBdriver == 'mysql') {
9056 9426
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9101,7 +9471,9 @@  discard block
 block discarded – undo
9101 9471
 			date_default_timezone_set($globalTimezone);
9102 9472
 			$datetime = new DateTime();
9103 9473
 			$offset = $datetime->format('P');
9104
-		} else $offset = '+00:00';
9474
+		} else {
9475
+			$offset = '+00:00';
9476
+		}
9105 9477
 
9106 9478
 		if ($globalDBdriver == 'mysql') {
9107 9479
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9149,7 +9521,9 @@  discard block
 block discarded – undo
9149 9521
 			date_default_timezone_set($globalTimezone);
9150 9522
 			$datetime = new DateTime();
9151 9523
 			$offset = $datetime->format('P');
9152
-		} else $offset = '+00:00';
9524
+		} else {
9525
+			$offset = '+00:00';
9526
+		}
9153 9527
 
9154 9528
 		if ($globalDBdriver == 'mysql') {
9155 9529
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9318,7 +9692,9 @@  discard block
 block discarded – undo
9318 9692
 			date_default_timezone_set($globalTimezone);
9319 9693
 			$datetime = new DateTime();
9320 9694
 			$offset = $datetime->format('P');
9321
-		} else $offset = '+00:00';
9695
+		} else {
9696
+			$offset = '+00:00';
9697
+		}
9322 9698
 
9323 9699
 		if ($globalDBdriver == 'mysql') {
9324 9700
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9507,7 +9883,9 @@  discard block
 block discarded – undo
9507 9883
 	*/
9508 9884
 	public function parseDirection($direction = 0)
9509 9885
 	{
9510
-		if ($direction == '') $direction = 0;
9886
+		if ($direction == '') {
9887
+			$direction = 0;
9888
+		}
9511 9889
 		$direction_array = array();
9512 9890
 		$temp_array = array();
9513 9891
 
@@ -9608,7 +9986,9 @@  discard block
 block discarded – undo
9608 9986
 		if (isset($result->AirlineFlightInfoResult))
9609 9987
 		{
9610 9988
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9611
-		} else return '';
9989
+		} else {
9990
+			return '';
9991
+		}
9612 9992
 		
9613 9993
 		$registration = $this->convertAircraftRegistration($registration);
9614 9994
 		
@@ -9636,7 +10016,9 @@  discard block
 block discarded – undo
9636 10016
 		if (count($row) > 0) {
9637 10017
 		    //return $row['Registration'];
9638 10018
 		    return $row['registration'];
9639
-		} else return '';
10019
+		} else {
10020
+			return '';
10021
+		}
9640 10022
 	
9641 10023
 	}
9642 10024
 
@@ -9658,9 +10040,14 @@  discard block
 block discarded – undo
9658 10040
     
9659 10041
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9660 10042
 		if (count($row) > 0) {
9661
-		    if ($row['type_flight'] == null) return '';
9662
-		    else return $row['type_flight'];
9663
-		} else return '';
10043
+		    if ($row['type_flight'] == null) {
10044
+		    	return '';
10045
+		    } else {
10046
+		    	return $row['type_flight'];
10047
+		    }
10048
+		} else {
10049
+			return '';
10050
+		}
9664 10051
 	
9665 10052
 	}
9666 10053
 
@@ -9678,7 +10065,9 @@  discard block
 block discarded – undo
9678 10065
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9679 10066
 	
9680 10067
 		$Connection = new Connection();
9681
-		if (!$Connection->tableExists('countries')) return '';
10068
+		if (!$Connection->tableExists('countries')) {
10069
+			return '';
10070
+		}
9682 10071
 	
9683 10072
 		try {
9684 10073
 			/*
@@ -9697,9 +10086,13 @@  discard block
 block discarded – undo
9697 10086
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
9698 10087
 			if (count($row) > 0) {
9699 10088
 				return $row;
9700
-			} else return '';
10089
+			} else {
10090
+				return '';
10091
+			}
9701 10092
 		} catch (PDOException $e) {
9702
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10093
+			if (isset($globalDebug) && $globalDebug) {
10094
+				echo 'Error : '.$e->getMessage()."\n";
10095
+			}
9703 10096
 			return '';
9704 10097
 		}
9705 10098
 	
@@ -9847,7 +10240,9 @@  discard block
 block discarded – undo
9847 10240
 	{
9848 10241
 		global $globalBitlyAccessToken;
9849 10242
 		
9850
-		if ($globalBitlyAccessToken == '') return $url;
10243
+		if ($globalBitlyAccessToken == '') {
10244
+			return $url;
10245
+		}
9851 10246
         
9852 10247
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9853 10248
 		
@@ -9996,7 +10391,9 @@  discard block
 block discarded – undo
9996 10391
 		
9997 10392
 
9998 10393
 		// routes
9999
-		if ($globalDebug) print "Routes...\n";
10394
+		if ($globalDebug) {
10395
+			print "Routes...\n";
10396
+		}
10000 10397
 		if ($globalDBdriver == 'mysql') {
10001 10398
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
10002 10399
 		} else {
@@ -10015,7 +10412,9 @@  discard block
 block discarded – undo
10015 10412
 			}
10016 10413
 		}
10017 10414
 		
10018
-		if ($globalDebug) print "Airlines...\n";
10415
+		if ($globalDebug) {
10416
+			print "Airlines...\n";
10417
+		}
10019 10418
 		//airlines
10020 10419
 		if ($globalDBdriver == 'mysql') {
10021 10420
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -10029,10 +10428,15 @@  discard block
 block discarded – undo
10029 10428
 			if (is_numeric(substr($row['ident'], -1, 1)))
10030 10429
 			{
10031 10430
 				$fromsource = NULL;
10032
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10033
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10034
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10035
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10431
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10432
+					$fromsource = 'vatsim';
10433
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10434
+					$fromsource = 'ivao';
10435
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10436
+					$fromsource = 'vatsim';
10437
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10438
+					$fromsource = 'ivao';
10439
+				}
10036 10440
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10037 10441
 				if (isset($airline_array[0]['name'])) {
10038 10442
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -10042,13 +10446,17 @@  discard block
 block discarded – undo
10042 10446
 			}
10043 10447
 		}
10044 10448
 
10045
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10449
+		if ($globalDebug) {
10450
+			print "Remove Duplicate in aircraft_modes...\n";
10451
+		}
10046 10452
 		//duplicate modes
10047 10453
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10048 10454
 		$sth = $this->db->prepare($query);
10049 10455
 		$sth->execute();
10050 10456
 		
10051
-		if ($globalDebug) print "Aircraft...\n";
10457
+		if ($globalDebug) {
10458
+			print "Aircraft...\n";
10459
+		}
10052 10460
 		//aircraft
10053 10461
 		if ($globalDBdriver == 'mysql') {
10054 10462
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10091,26 +10499,38 @@  discard block
 block discarded – undo
10091 10499
 				 if (isset($closestAirports[0])) {
10092 10500
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10093 10501
 						$airport_icao = $closestAirports[0]['icao'];
10094
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10502
+						if ($globalDebug) {
10503
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10504
+						}
10095 10505
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10096 10506
 						foreach ($closestAirports as $airport) {
10097 10507
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10098 10508
 								$airport_icao = $airport['icao'];
10099
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10509
+								if ($globalDebug) {
10510
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10511
+								}
10100 10512
 								break;
10101 10513
 							}
10102 10514
 						}
10103 10515
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10104 10516
 						$airport_icao = $closestAirports[0]['icao'];
10105
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10517
+						if ($globalDebug) {
10518
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10519
+						}
10106 10520
 					} else {
10107
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10521
+						if ($globalDebug) {
10522
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10523
+						}
10108 10524
 					}
10109 10525
 				} else {
10110
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10526
+					if ($globalDebug) {
10527
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10528
+					}
10111 10529
 				}
10112 10530
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10113
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10531
+					if ($globalDebug) {
10532
+						echo "Updating airport to ".$airport_icao."...\n";
10533
+					}
10114 10534
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10115 10535
 					$sthu = $this->db->prepare($update_query);
10116 10536
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.