Completed
Push — master ( 0da4d1...d670f0 )
by Yannick
15:46
created
require/class.Spotter.php 1 patch
Braces   +661 added lines, -229 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23
+			$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
24
+		}
25
+		if (is_array($globalFilter)) {
26
+			$filter = array_merge($globalFilter,$filter);
27
+		}
24 28
 		$filter_query_join = '';
25 29
 		$filter_query_where = '';
26 30
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -45,8 +49,11 @@  discard block
 block discarded – undo
45 49
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
46 50
 			}
47 51
 		}
48
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
49
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
52
+		if ($filter_query_where == '' && $where) {
53
+			$filter_query_where = ' WHERE';
54
+		} elseif ($filter_query_where != '' && $and) {
55
+			$filter_query_where .= ' AND';
56
+		}
50 57
 		$filter_query = $filter_query_join.$filter_query_where;
51 58
 		return $filter_query;
52 59
 	}
@@ -66,10 +73,18 @@  discard block
 block discarded – undo
66 73
 		$Image = new Image($this->db);
67 74
 		$Schedule = new Schedule($this->db);
68 75
 		$ACARS = new ACARS($this->db);
69
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
70
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
71
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
72
-		if (!isset($globalVAM)) $globalVAM = FALSE;
76
+		if (!isset($globalIVAO)) {
77
+			$globalIVAO = FALSE;
78
+		}
79
+		if (!isset($globalVATSIM)) {
80
+			$globalVATSIM = FALSE;
81
+		}
82
+		if (!isset($globalphpVMS)) {
83
+			$globalphpVMS = FALSE;
84
+		}
85
+		if (!isset($globalVAM)) {
86
+			$globalVAM = FALSE;
87
+		}
73 88
 		date_default_timezone_set('UTC');
74 89
 		
75 90
 		if (!is_string($query))
@@ -116,21 +131,35 @@  discard block
 block discarded – undo
116 131
 			} else {
117 132
 				$temp_array['spotter_id'] = '';
118 133
 			}
119
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
120
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
134
+			if (isset($row['flightaware_id'])) {
135
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
136
+			}
137
+			if (isset($row['modes'])) {
138
+				$temp_array['modes'] = $row['modes'];
139
+			}
121 140
 			$temp_array['ident'] = $row['ident'];
122 141
 			if (isset($row['registration']) && $row['registration'] != '') {
123 142
 				$temp_array['registration'] = $row['registration'];
124 143
 			} elseif (isset($temp_array['modes'])) {
125 144
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
126
-			} else $temp_array['registration'] = '';
127
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
145
+			} else {
146
+				$temp_array['registration'] = '';
147
+			}
148
+			if (isset($row['aircraft_icao'])) {
149
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
150
+			}
128 151
 			
129 152
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
130 153
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
131
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
132
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
133
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
154
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
155
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
156
+			}
157
+			if (isset($row['latitude'])) {
158
+				$temp_array['latitude'] = $row['latitude'];
159
+			}
160
+			if (isset($row['longitude'])) {
161
+				$temp_array['longitude'] = $row['longitude'];
162
+			}
134 163
 			/*
135 164
 			if (Connection->tableExists('countries')) {
136 165
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -140,8 +169,12 @@  discard block
 block discarded – undo
140 169
 				}
141 170
 			}
142 171
 			*/
143
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
144
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
172
+			if (isset($row['waypoints'])) {
173
+				$temp_array['waypoints'] = $row['waypoints'];
174
+			}
175
+			if (isset($row['format_source'])) {
176
+				$temp_array['format_source'] = $row['format_source'];
177
+			}
145 178
 			if (isset($row['route_stop'])) {
146 179
 				$temp_array['route_stop'] = $row['route_stop'];
147 180
 				if ($row['route_stop'] != '') {
@@ -160,13 +193,19 @@  discard block
 block discarded – undo
160 193
 					}
161 194
 				}
162 195
 			}
163
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
196
+			if (isset($row['altitude'])) {
197
+				$temp_array['altitude'] = $row['altitude'];
198
+			}
164 199
 			if (isset($row['heading'])) {
165 200
 				$temp_array['heading'] = $row['heading'];
166 201
 				$heading_direction = $this->parseDirection($row['heading']);
167
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
202
+				if (isset($heading_direction[0]['direction_fullname'])) {
203
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
204
+				}
205
+			}
206
+			if (isset($row['ground_speed'])) {
207
+				$temp_array['ground_speed'] = $row['ground_speed'];
168 208
 			}
169
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
170 209
 			$temp_array['image'] = "";
171 210
 			$temp_array['image_thumbnail'] = "";
172 211
 			$temp_array['image_source'] = "";
@@ -174,7 +213,9 @@  discard block
 block discarded – undo
174 213
  
175 214
 			if (isset($row['highlight'])) {
176 215
 				$temp_array['highlight'] = $row['highlight'];
177
-			} else $temp_array['highlight'] = '';
216
+			} else {
217
+				$temp_array['highlight'] = '';
218
+			}
178 219
 			
179 220
 			if (isset($row['date'])) {
180 221
 				$dateArray = $this->parseDateString($row['date']);
@@ -222,7 +263,9 @@  discard block
 block discarded – undo
222 263
 				
223 264
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
224 265
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
225
-					} else $temp_array['aircraft_shadow'] = 'default.png';
266
+					} else {
267
+						$temp_array['aircraft_shadow'] = 'default.png';
268
+					}
226 269
                                 } else {
227 270
                             		$temp_array['aircraft_shadow'] = 'default.png';
228 271
 					$temp_array['aircraft_name'] = 'N/A';
@@ -230,11 +273,17 @@  discard block
 block discarded – undo
230 273
                             	}
231 274
 			}
232 275
 			$fromsource = NULL;
233
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
234
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
235
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
236
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
237
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
276
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
277
+				$fromsource = $globalAirlinesSource;
278
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
279
+				$fromsource = 'vatsim';
280
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
281
+				$fromsource = 'ivao';
282
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
283
+				$fromsource = 'vatsim';
284
+			} elseif (isset($globalIVAO) && $globalIVAO) {
285
+				$fromsource = 'ivao';
286
+			}
238 287
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
239 288
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
240 289
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -257,12 +306,18 @@  discard block
 block discarded – undo
257 306
 				}
258 307
 			} else {
259 308
 				$temp_array['airline_icao'] = $row['airline_icao'];
260
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
261
-				else $temp_array['airline_iata'] = '';
309
+				if (isset($row['airline_iata'])) {
310
+					$temp_array['airline_iata'] = $row['airline_iata'];
311
+				} else {
312
+					$temp_array['airline_iata'] = '';
313
+				}
262 314
 				$temp_array['airline_name'] = $row['airline_name'];
263 315
 				$temp_array['airline_country'] = $row['airline_country'];
264
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
265
-				else $temp_array['airline_callsign'] = 'N/A';
316
+				if (isset($row['airline_callsign'])) {
317
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
318
+				} else {
319
+					$temp_array['airline_callsign'] = 'N/A';
320
+				}
266 321
 				$temp_array['airline_type'] = $row['airline_type'];
267 322
 			}
268 323
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -278,7 +333,9 @@  discard block
 block discarded – undo
278 333
 			}
279 334
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
280 335
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
281
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
336
+				if ($owner_info['owner'] != '') {
337
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
338
+				}
282 339
 				$temp_array['aircraft_base'] = $owner_info['base'];
283 340
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
284 341
 			}
@@ -286,9 +343,14 @@  discard block
 block discarded – undo
286 343
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
287 344
 			{
288 345
 				if ($globalIVAO) {
289
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
290
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
291
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
346
+					if (isset($temp_array['airline_icao'])) {
347
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
348
+					} else {
349
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
350
+					}
351
+				} else {
352
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
353
+				}
292 354
 				if (count($image_array) > 0) {
293 355
 					$temp_array['image'] = $image_array[0]['image'];
294 356
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -338,7 +400,9 @@  discard block
 block discarded – undo
338 400
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
339 401
 			if ($row['departure_airport_icao'] != '') {
340 402
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
341
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
403
+				if (!isset($departure_airport_array[0]['name'])) {
404
+					$departure_airport_array = $this->getAllAirportInfo('NA');
405
+				}
342 406
 			/*
343 407
 			} elseif ($row['departure_airport_name'] != '') {
344 408
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -346,7 +410,9 @@  discard block
 block discarded – undo
346 410
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
347 411
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
348 412
 			*/
349
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
413
+			} else {
414
+				$departure_airport_array = $this->getAllAirportInfo('NA');
415
+			}
350 416
 			if (isset($departure_airport_array[0]['name'])) {
351 417
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
352 418
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -366,8 +432,12 @@  discard block
 block discarded – undo
366 432
 			
367 433
 			if ($row['arrival_airport_icao'] != '') {
368 434
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
369
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
370
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
435
+				if (count($arrival_airport_array) == 0) {
436
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
437
+				}
438
+			} else {
439
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
440
+			}
371 441
 			if (isset($arrival_airport_array[0]['name'])) {
372 442
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
373 443
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -383,27 +453,45 @@  discard block
 block discarded – undo
383 453
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
384 454
 			}
385 455
 			*/
386
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
387
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
388
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
389
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
390
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
456
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
457
+				$temp_array['pilot_id'] = $row['pilot_id'];
458
+			}
459
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
460
+				$temp_array['pilot_name'] = $row['pilot_name'];
461
+			}
462
+			if (isset($row['source_name']) && $row['source_name'] != '') {
463
+				$temp_array['source_name'] = $row['source_name'];
464
+			}
465
+			if (isset($row['over_country']) && $row['over_country'] != '') {
466
+				$temp_array['over_country'] = $row['over_country'];
467
+			}
468
+			if (isset($row['distance']) && $row['distance'] != '') {
469
+				$temp_array['distance'] = $row['distance'];
470
+			}
391 471
 			if (isset($row['squawk'])) {
392 472
 				$temp_array['squawk'] = $row['squawk'];
393 473
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
394 474
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
395
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
475
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
476
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
477
+					}
396 478
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
397 479
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
399
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
480
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
481
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
482
+					}
483
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
484
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
485
+				}
400 486
 			}
401 487
     			
402 488
 			$temp_array['query_number_rows'] = $num_rows;
403 489
 			
404 490
 			$spotter_array[] = $temp_array;
405 491
 		}
406
-		if ($num_rows == 0) return array();
492
+		if ($num_rows == 0) {
493
+			return array();
494
+		}
407 495
 		$spotter_array[0]['query_number_rows'] = $num_rows;
408 496
 		return $spotter_array;
409 497
 	}	
@@ -436,7 +524,9 @@  discard block
 block discarded – undo
436 524
 				foreach ($q_array as $q_item){
437 525
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
438 526
 					$additional_query .= " AND (";
439
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
527
+					if (is_int($q_item)) {
528
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
529
+					}
440 530
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
441 531
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
442 532
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -457,7 +547,9 @@  discard block
 block discarded – undo
457 547
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
458 548
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
459 549
 					$translate = $Translation->ident2icao($q_item);
460
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
550
+					if ($translate != $q_item) {
551
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
552
+					}
461 553
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
462 554
 					$additional_query .= ")";
463 555
 				}
@@ -684,7 +776,9 @@  discard block
 block discarded – undo
684 776
 				date_default_timezone_set($globalTimezone);
685 777
 				$datetime = new DateTime();
686 778
 				$offset = $datetime->format('P');
687
-			} else $offset = '+00:00';
779
+			} else {
780
+				$offset = '+00:00';
781
+			}
688 782
 
689 783
 			if ($date_array[1] != "")
690 784
 			{
@@ -716,8 +810,12 @@  discard block
 block discarded – undo
716 810
 			{
717 811
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
718 812
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
719
-			} else $limit_query = "";
720
-		} else $limit_query = "";
813
+			} else {
814
+				$limit_query = "";
815
+			}
816
+		} else {
817
+			$limit_query = "";
818
+		}
721 819
 
722 820
 
723 821
 		if ($sort != "")
@@ -785,8 +883,12 @@  discard block
 block discarded – undo
785 883
 			{
786 884
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
787 885
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
788
-			} else $limit_query = "";
789
-		} else $limit_query = "";
886
+			} else {
887
+				$limit_query = "";
888
+			}
889
+		} else {
890
+			$limit_query = "";
891
+		}
790 892
 		
791 893
 		if ($sort != "")
792 894
 		{
@@ -1110,7 +1212,9 @@  discard block
 block discarded – undo
1110 1212
 		global $global_query;
1111 1213
 		
1112 1214
 		date_default_timezone_set('UTC');
1113
-		if ($id == '') return array();
1215
+		if ($id == '') {
1216
+			return array();
1217
+		}
1114 1218
 		$additional_query = "spotter_output.spotter_id = :id";
1115 1219
 		$query_values = array(':id' => $id);
1116 1220
 
@@ -1747,7 +1851,9 @@  discard block
 block discarded – undo
1747 1851
 		{
1748 1852
 			$highlight = $row['highlight'];
1749 1853
 		}
1750
-		if (isset($highlight)) return $highlight;
1854
+		if (isset($highlight)) {
1855
+			return $highlight;
1856
+		}
1751 1857
 	}
1752 1858
 
1753 1859
 	
@@ -1775,7 +1881,9 @@  discard block
 block discarded – undo
1775 1881
 		$sth->closeCursor();
1776 1882
 		if (count($row) > 0) {
1777 1883
 			return $row['usage'];
1778
-		} else return '';
1884
+		} else {
1885
+			return '';
1886
+		}
1779 1887
 	}
1780 1888
 
1781 1889
 	/**
@@ -1800,7 +1908,9 @@  discard block
 block discarded – undo
1800 1908
 		$sth->closeCursor();
1801 1909
 		if (count($row) > 0) {
1802 1910
 			return $row['icao'];
1803
-		} else return '';
1911
+		} else {
1912
+			return '';
1913
+		}
1804 1914
 	}
1805 1915
 
1806 1916
 	/**
@@ -1828,7 +1938,9 @@  discard block
 block discarded – undo
1828 1938
 			$airport_longitude = $row['longitude'];
1829 1939
 			$Common = new Common();
1830 1940
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1831
-		} else return '';
1941
+		} else {
1942
+			return '';
1943
+		}
1832 1944
 	}
1833 1945
 	
1834 1946
 	/**
@@ -1940,7 +2052,9 @@  discard block
 block discarded – undo
1940 2052
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1941 2053
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1942 2054
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1943
-		} else return array();
2055
+		} else {
2056
+			return array();
2057
+		}
1944 2058
 		if ($globalDBdriver == 'mysql') {
1945 2059
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1946 2060
 		} else {
@@ -1975,7 +2089,9 @@  discard block
 block discarded – undo
1975 2089
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1976 2090
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1977 2091
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1978
-		} else return array();
2092
+		} else {
2093
+			return array();
2094
+		}
1979 2095
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1980 2096
 		$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.")";
1981 2097
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2010,7 +2126,9 @@  discard block
 block discarded – undo
2010 2126
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2011 2127
 	{
2012 2128
 		global $globalUseRealAirlines;
2013
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2129
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2130
+			$fromsource = NULL;
2131
+		}
2014 2132
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2015 2133
 		if ($airline_icao == 'NA') {
2016 2134
 			$airline_array = array();
@@ -2060,7 +2178,9 @@  discard block
 block discarded – undo
2060 2178
 				$sth->execute(array(':fromsource' => $fromsource));
2061 2179
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2062 2180
 				$sth->closeCursor();
2063
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2181
+				if ($row['nb'] == 0) {
2182
+					$result = $this->getAllAirlineInfo($airline_icao);
2183
+				}
2064 2184
 			}
2065 2185
 			return $result;
2066 2186
 		}
@@ -2124,15 +2244,20 @@  discard block
 block discarded – undo
2124 2244
 				'A320-211' => 'A320',
2125 2245
 				'747-8i' => 'B748',
2126 2246
 				'A380' => 'A388');
2127
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2247
+		if (isset($all_aircraft[$aircraft_type])) {
2248
+			return $all_aircraft[$aircraft_type];
2249
+		}
2128 2250
 
2129 2251
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2130 2252
 		$aircraft_type = strtoupper($aircraft_type);
2131 2253
 		$sth = $this->db->prepare($query);
2132 2254
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2133 2255
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2134
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2135
-		else return '';
2256
+		if (isset($result[0]['icao'])) {
2257
+			return $result[0]['icao'];
2258
+		} else {
2259
+			return '';
2260
+		}
2136 2261
 	}
2137 2262
 	
2138 2263
 	/**
@@ -2155,7 +2280,9 @@  discard block
 block discarded – undo
2155 2280
 		$sth->closeCursor();
2156 2281
 		if (isset($row['icaotypecode'])) {
2157 2282
 			return $row['icaotypecode'];
2158
-		} else return '';
2283
+		} else {
2284
+			return '';
2285
+		}
2159 2286
 	}
2160 2287
 
2161 2288
 	/**
@@ -2177,7 +2304,9 @@  discard block
 block discarded – undo
2177 2304
 		$sth->closeCursor();
2178 2305
 		if (isset($row['operator_correct'])) {
2179 2306
 			return $row['operator_correct'];
2180
-		} else return $operator;
2307
+		} else {
2308
+			return $operator;
2309
+		}
2181 2310
 	}
2182 2311
 
2183 2312
 	/**
@@ -2190,7 +2319,9 @@  discard block
 block discarded – undo
2190 2319
 	public function getRouteInfo($callsign)
2191 2320
 	{
2192 2321
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2193
-                if ($callsign == '') return array();
2322
+                if ($callsign == '') {
2323
+                	return array();
2324
+                }
2194 2325
 		$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";
2195 2326
 		
2196 2327
 		$sth = $this->db->prepare($query);
@@ -2200,7 +2331,9 @@  discard block
 block discarded – undo
2200 2331
 		$sth->closeCursor();
2201 2332
 		if (count($row) > 0) {
2202 2333
 			return $row;
2203
-		} else return array();
2334
+		} else {
2335
+			return array();
2336
+		}
2204 2337
 	}
2205 2338
 	
2206 2339
 	/**
@@ -2253,7 +2386,9 @@  discard block
 block discarded – undo
2253 2386
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2254 2387
 			$sth->closeCursor();
2255 2388
 			return $result;
2256
-		} else return array();
2389
+		} else {
2390
+			return array();
2391
+		}
2257 2392
 	}
2258 2393
 	
2259 2394
   
@@ -2409,8 +2544,11 @@  discard block
 block discarded – undo
2409 2544
 		$query .= " ORDER BY spotter_output.source_name ASC";
2410 2545
 
2411 2546
 		$sth = $this->db->prepare($query);
2412
-		if (!empty($query_values)) $sth->execute($query_values);
2413
-		else $sth->execute();
2547
+		if (!empty($query_values)) {
2548
+			$sth->execute($query_values);
2549
+		} else {
2550
+			$sth->execute();
2551
+		}
2414 2552
 
2415 2553
 		$source_array = array();
2416 2554
 		$temp_array = array();
@@ -2442,9 +2580,13 @@  discard block
 block discarded – undo
2442 2580
 								WHERE spotter_output.airline_icao <> '' 
2443 2581
 								ORDER BY spotter_output.airline_name ASC";
2444 2582
 			*/
2445
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2446
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2447
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2583
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2584
+				$forsource = $globalAirlinesSource;
2585
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2586
+				$forsource = 'vatsim';
2587
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2588
+				$forsource = 'ivao';
2589
+			}
2448 2590
 			if ($forsource === NULL) {
2449 2591
 				$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";
2450 2592
 				$query_data = array();
@@ -2742,7 +2884,9 @@  discard block
 block discarded – undo
2742 2884
 			date_default_timezone_set($globalTimezone);
2743 2885
 			$datetime = new DateTime();
2744 2886
 			$offset = $datetime->format('P');
2745
-		} else $offset = '+00:00';
2887
+		} else {
2888
+			$offset = '+00:00';
2889
+		}
2746 2890
 		if ($airport_icao == '') {
2747 2891
 			if ($globalDBdriver == 'mysql') {
2748 2892
 				$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";
@@ -2774,7 +2918,9 @@  discard block
 block discarded – undo
2774 2918
 			date_default_timezone_set($globalTimezone);
2775 2919
 			$datetime = new DateTime();
2776 2920
 			$offset = $datetime->format('P');
2777
-		} else $offset = '+00:00';
2921
+		} else {
2922
+			$offset = '+00:00';
2923
+		}
2778 2924
 		if ($airport_icao == '') {
2779 2925
 			if ($globalDBdriver == 'mysql') {
2780 2926
 				$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";
@@ -2806,7 +2952,9 @@  discard block
 block discarded – undo
2806 2952
 			date_default_timezone_set($globalTimezone);
2807 2953
 			$datetime = new DateTime();
2808 2954
 			$offset = $datetime->format('P');
2809
-		} else $offset = '+00:00';
2955
+		} else {
2956
+			$offset = '+00:00';
2957
+		}
2810 2958
 		if ($airport_icao == '') {
2811 2959
 			if ($globalDBdriver == 'mysql') {
2812 2960
 				$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 
@@ -2849,7 +2997,9 @@  discard block
 block discarded – undo
2849 2997
 			date_default_timezone_set($globalTimezone);
2850 2998
 			$datetime = new DateTime();
2851 2999
 			$offset = $datetime->format('P');
2852
-		} else $offset = '+00:00';
3000
+		} else {
3001
+			$offset = '+00:00';
3002
+		}
2853 3003
 		if ($airport_icao == '') {
2854 3004
 			if ($globalDBdriver == 'mysql') {
2855 3005
 				$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 
@@ -2893,7 +3043,9 @@  discard block
 block discarded – undo
2893 3043
 			date_default_timezone_set($globalTimezone);
2894 3044
 			$datetime = new DateTime();
2895 3045
 			$offset = $datetime->format('P');
2896
-		} else $offset = '+00:00';
3046
+		} else {
3047
+			$offset = '+00:00';
3048
+		}
2897 3049
 		if ($airport_icao == '') {
2898 3050
 			if ($globalDBdriver == 'mysql') {
2899 3051
 				$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";
@@ -2927,7 +3079,9 @@  discard block
 block discarded – undo
2927 3079
 			date_default_timezone_set($globalTimezone);
2928 3080
 			$datetime = new DateTime();
2929 3081
 			$offset = $datetime->format('P');
2930
-		} else $offset = '+00:00';
3082
+		} else {
3083
+			$offset = '+00:00';
3084
+		}
2931 3085
 		if ($airport_icao == '') {
2932 3086
 			if ($globalDBdriver == 'mysql') {
2933 3087
 				$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 
@@ -2973,7 +3127,9 @@  discard block
 block discarded – undo
2973 3127
 			date_default_timezone_set($globalTimezone);
2974 3128
 			$datetime = new DateTime();
2975 3129
 			$offset = $datetime->format('P');
2976
-		} else $offset = '+00:00';
3130
+		} else {
3131
+			$offset = '+00:00';
3132
+		}
2977 3133
 		if ($airport_icao == '') {
2978 3134
 			if ($globalDBdriver == 'mysql') {
2979 3135
 				$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";
@@ -3007,7 +3163,9 @@  discard block
 block discarded – undo
3007 3163
 			date_default_timezone_set($globalTimezone);
3008 3164
 			$datetime = new DateTime();
3009 3165
 			$offset = $datetime->format('P');
3010
-		} else $offset = '+00:00';
3166
+		} else {
3167
+			$offset = '+00:00';
3168
+		}
3011 3169
 		if ($airport_icao == '') {
3012 3170
 			if ($globalDBdriver == 'mysql') {
3013 3171
 				$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 
@@ -3055,7 +3213,9 @@  discard block
 block discarded – undo
3055 3213
 			date_default_timezone_set($globalTimezone);
3056 3214
 			$datetime = new DateTime();
3057 3215
 			$offset = $datetime->format('P');
3058
-		} else $offset = '+00:00';
3216
+		} else {
3217
+			$offset = '+00:00';
3218
+		}
3059 3219
 
3060 3220
 		if ($globalDBdriver == 'mysql') {
3061 3221
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3175,7 +3335,9 @@  discard block
 block discarded – undo
3175 3335
 	*/	
3176 3336
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3177 3337
 	{
3178
-		if ($groundspeed == '') $groundspeed = NULL;
3338
+		if ($groundspeed == '') {
3339
+			$groundspeed = NULL;
3340
+		}
3179 3341
 		$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';
3180 3342
                 $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);
3181 3343
 
@@ -3225,10 +3387,18 @@  discard block
 block discarded – undo
3225 3387
 		$Image = new Image($this->db);
3226 3388
 		$Common = new Common();
3227 3389
 		
3228
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3229
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3230
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3231
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3390
+		if (!isset($globalIVAO)) {
3391
+			$globalIVAO = FALSE;
3392
+		}
3393
+		if (!isset($globalVATSIM)) {
3394
+			$globalVATSIM = FALSE;
3395
+		}
3396
+		if (!isset($globalphpVMS)) {
3397
+			$globalphpVMS = FALSE;
3398
+		}
3399
+		if (!isset($globalVAM)) {
3400
+			$globalVAM = FALSE;
3401
+		}
3232 3402
 		date_default_timezone_set('UTC');
3233 3403
 		
3234 3404
 		//getting the registration
@@ -3241,23 +3411,33 @@  discard block
 block discarded – undo
3241 3411
 				if ($ModeS != '') {
3242 3412
 					$timeelapsed = microtime(true);
3243 3413
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3244
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3414
+					if ($globalDebugTimeElapsed) {
3415
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3416
+					}
3245 3417
 				} else {
3246 3418
 					$myhex = explode('-',$flightaware_id);
3247 3419
 					if (count($myhex) > 0) {
3248 3420
 						$timeelapsed = microtime(true);
3249 3421
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3250
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3422
+						if ($globalDebugTimeElapsed) {
3423
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3424
+						}
3251 3425
 					}
3252 3426
 				}
3253 3427
 			}
3254 3428
 		}
3255 3429
 		$fromsource = NULL;
3256
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3257
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3258
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3259
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3260
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3430
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3431
+			$fromsource = $globalAirlinesSource;
3432
+		} elseif ($format_source == 'vatsimtxt') {
3433
+			$fromsource = 'vatsim';
3434
+		} elseif ($format_source == 'whazzup') {
3435
+			$fromsource = 'ivao';
3436
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3437
+			$fromsource = 'vatsim';
3438
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3439
+			$fromsource = 'ivao';
3440
+		}
3261 3441
 		//getting the airline information
3262 3442
 		if ($ident != "")
3263 3443
 		{
@@ -3281,15 +3461,21 @@  discard block
 block discarded – undo
3281 3461
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3282 3462
 						$airline_array = $this->getAllAirlineInfo("NA");
3283 3463
 					}
3284
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3464
+					if ($globalDebugTimeElapsed) {
3465
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3466
+					}
3285 3467
 
3286 3468
 				} else {
3287 3469
 					$timeelapsed = microtime(true);
3288 3470
 					$airline_array = $this->getAllAirlineInfo("NA");
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3471
+					if ($globalDebugTimeElapsed) {
3472
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3473
+					}
3290 3474
 				}
3291 3475
 			}
3292
-		} else $airline_array = array();
3476
+		} else {
3477
+			$airline_array = array();
3478
+		}
3293 3479
 		
3294 3480
 		//getting the aircraft information
3295 3481
 		$aircraft_array = array();
@@ -3303,27 +3489,37 @@  discard block
 block discarded – undo
3303 3489
 				{
3304 3490
 					$timeelapsed = microtime(true);
3305 3491
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3306
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3492
+					if ($globalDebugTimeElapsed) {
3493
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3494
+					}
3307 3495
 				} else {
3308 3496
 					$timeelapsed = microtime(true);
3309 3497
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3310
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3498
+					if ($globalDebugTimeElapsed) {
3499
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3500
+					}
3311 3501
 				}
3312 3502
 			}
3313 3503
 		} else {
3314 3504
 			if ($ModeS != '') {
3315 3505
 				$timeelapsed = microtime(true);
3316 3506
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3317
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3507
+				if ($globalDebugTimeElapsed) {
3508
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3509
+				}
3318 3510
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3319 3511
 				{
3320 3512
 					$timeelapsed = microtime(true);
3321 3513
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3322
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3514
+					if ($globalDebugTimeElapsed) {
3515
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3516
+					}
3323 3517
 				} else {
3324 3518
 					$timeelapsed = microtime(true);
3325 3519
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3326
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3520
+					if ($globalDebugTimeElapsed) {
3521
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+					}
3327 3523
 				}
3328 3524
 			}
3329 3525
 		}
@@ -3338,7 +3534,9 @@  discard block
 block discarded – undo
3338 3534
 			} else {
3339 3535
 				$timeelapsed = microtime(true);
3340 3536
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3341
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3537
+				if ($globalDebugTimeElapsed) {
3538
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3539
+				}
3342 3540
 			}
3343 3541
 		}
3344 3542
 		
@@ -3352,7 +3550,9 @@  discard block
 block discarded – undo
3352 3550
 			} else {
3353 3551
 				$timeelapsed = microtime(true);
3354 3552
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3355
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3553
+				if ($globalDebugTimeElapsed) {
3554
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3555
+				}
3356 3556
 			}
3357 3557
 		}
3358 3558
 
@@ -3387,7 +3587,9 @@  discard block
 block discarded – undo
3387 3587
 			{
3388 3588
 				return false;
3389 3589
 			}
3390
-		} else $altitude = 0;
3590
+		} else {
3591
+			$altitude = 0;
3592
+		}
3391 3593
 		
3392 3594
 		if ($heading != "")
3393 3595
 		{
@@ -3416,7 +3618,9 @@  discard block
 block discarded – undo
3416 3618
 		{
3417 3619
 			$timeelapsed = microtime(true);
3418 3620
 			$image_array = $Image->getSpotterImage($registration);
3419
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3621
+			if ($globalDebugTimeElapsed) {
3622
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3623
+			}
3420 3624
 			if (!isset($image_array[0]['registration']))
3421 3625
 			{
3422 3626
 				//echo "Add image !!!! \n";
@@ -3424,14 +3628,21 @@  discard block
 block discarded – undo
3424 3628
 			}
3425 3629
 			$timeelapsed = microtime(true);
3426 3630
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3427
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3428
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3631
+			if ($globalDebugTimeElapsed) {
3632
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3633
+			}
3634
+			if ($owner_info['owner'] != '') {
3635
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3636
+			}
3429 3637
 		}
3430 3638
     
3431 3639
 		if ($globalIVAO && $aircraft_icao != '')
3432 3640
 		{
3433
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3434
-            		else $airline_icao = '';
3641
+            		if (isset($airline_array[0]['icao'])) {
3642
+            			$airline_icao = $airline_array[0]['icao'];
3643
+            		} else {
3644
+            			$airline_icao = '';
3645
+            		}
3435 3646
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3436 3647
 			if (!isset($image_array[0]['registration']))
3437 3648
 			{
@@ -3476,12 +3687,24 @@  discard block
 block discarded – undo
3476 3687
                 {
3477 3688
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3478 3689
                 }
3479
-                if ($registration == '') $registration = 'NA';
3480
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3481
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3482
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3483
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3484
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3690
+                if ($registration == '') {
3691
+                	$registration = 'NA';
3692
+                }
3693
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3694
+                	$squawk = NULL;
3695
+                }
3696
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3697
+                	$verticalrate = NULL;
3698
+                }
3699
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3700
+                	$heading = 0;
3701
+                }
3702
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3703
+                	$groundspeed = 0;
3704
+                }
3705
+                if (!isset($aircraft_owner)) {
3706
+                	$aircraft_owner = NULL;
3707
+                }
3485 3708
                 $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) 
3486 3709
                 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)";
3487 3710
 
@@ -3492,9 +3715,13 @@  discard block
 block discarded – undo
3492 3715
 		if ($airline_type == '') {
3493 3716
 			$timeelapsed = microtime(true);
3494 3717
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3495
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3718
+			if ($globalDebugTimeElapsed) {
3719
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3720
+			}
3721
+		}
3722
+		if ($airline_type == null) {
3723
+			$airline_type = '';
3496 3724
 		}
3497
-		if ($airline_type == null) $airline_type = '';
3498 3725
                 $aircraft_type = $aircraft_array[0]['type'];
3499 3726
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3500 3727
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3629,7 +3856,9 @@  discard block
 block discarded – undo
3629 3856
 			}
3630 3857
 		}
3631 3858
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3632
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3859
+		if ($limit) {
3860
+			$query .= " LIMIT 10 OFFSET 0";
3861
+		}
3633 3862
 		
3634 3863
 		$sth = $this->db->prepare($query);
3635 3864
 		$sth->execute();
@@ -3674,7 +3903,9 @@  discard block
 block discarded – undo
3674 3903
 			}
3675 3904
 		}
3676 3905
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3677
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3906
+		if ($limit) {
3907
+			$query .= " LIMIT 10 OFFSET 0";
3908
+		}
3678 3909
       
3679 3910
 		
3680 3911
 		$sth = $this->db->prepare($query);
@@ -3719,7 +3950,9 @@  discard block
 block discarded – undo
3719 3950
 			}
3720 3951
 		}
3721 3952
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3722
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3953
+		if ($limit) {
3954
+			$query .= " LIMIT 10 OFFSET 0";
3955
+		}
3723 3956
       
3724 3957
 		
3725 3958
 		$sth = $this->db->prepare($query);
@@ -3766,7 +3999,9 @@  discard block
 block discarded – undo
3766 3999
 			}
3767 4000
 		}
3768 4001
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3769
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4002
+		if ($limit) {
4003
+			$query .= " LIMIT 10 OFFSET 0";
4004
+		}
3770 4005
       
3771 4006
 		
3772 4007
 		$sth = $this->db->prepare($query);
@@ -3811,7 +4046,9 @@  discard block
 block discarded – undo
3811 4046
 			}
3812 4047
 		}
3813 4048
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3814
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4049
+		if ($limit) {
4050
+			$query .= " LIMIT 10 OFFSET 0";
4051
+		}
3815 4052
       
3816 4053
 		
3817 4054
 		$sth = $this->db->prepare($query);
@@ -4054,7 +4291,9 @@  discard block
 block discarded – undo
4054 4291
 			date_default_timezone_set($globalTimezone);
4055 4292
 			$datetime = new DateTime($date);
4056 4293
 			$offset = $datetime->format('P');
4057
-		} else $offset = '+00:00';
4294
+		} else {
4295
+			$offset = '+00:00';
4296
+		}
4058 4297
 
4059 4298
 		if ($globalDBdriver == 'mysql') {
4060 4299
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4102,7 +4341,9 @@  discard block
 block discarded – undo
4102 4341
 			date_default_timezone_set($globalTimezone);
4103 4342
 			$datetime = new DateTime($date);
4104 4343
 			$offset = $datetime->format('P');
4105
-		} else $offset = '+00:00';
4344
+		} else {
4345
+			$offset = '+00:00';
4346
+		}
4106 4347
 		
4107 4348
 		if ($globalDBdriver == 'mysql') {
4108 4349
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4320,7 +4561,9 @@  discard block
 block discarded – undo
4320 4561
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4321 4562
 					GROUP BY spotter_output.airline_country
4322 4563
 					ORDER BY airline_country_count DESC";
4323
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4564
+		if ($limit) {
4565
+			$query .= " LIMIT 10 OFFSET 0";
4566
+		}
4324 4567
       
4325 4568
 		$sth = $this->db->prepare($query);
4326 4569
 		$sth->execute();
@@ -4348,7 +4591,9 @@  discard block
 block discarded – undo
4348 4591
 		global $globalDBdriver;
4349 4592
 		$filter_query = $this->getFilter($filters,true,true);
4350 4593
 		$Connection= new Connection($this->db);
4351
-		if (!$Connection->tableExists('countries')) return array();
4594
+		if (!$Connection->tableExists('countries')) {
4595
+			return array();
4596
+		}
4352 4597
 		/*
4353 4598
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4354 4599
 					FROM countries c, spotter_output s
@@ -4373,7 +4618,9 @@  discard block
 block discarded – undo
4373 4618
 		}
4374 4619
 
4375 4620
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4376
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4621
+		if ($limit) {
4622
+			$query .= " LIMIT 10 OFFSET 0";
4623
+		}
4377 4624
       
4378 4625
 		
4379 4626
 		$sth = $this->db->prepare($query);
@@ -4423,7 +4670,9 @@  discard block
 block discarded – undo
4423 4670
 		}
4424 4671
 
4425 4672
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4426
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4673
+		if ($limit) {
4674
+			$query .= " LIMIT 10 OFFSET 0";
4675
+		}
4427 4676
  
4428 4677
 		$sth = $this->db->prepare($query);
4429 4678
 		$sth->execute();
@@ -4469,7 +4718,9 @@  discard block
 block discarded – undo
4469 4718
 		}
4470 4719
 
4471 4720
 		$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";
4472
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4721
+		if ($limit) {
4722
+			$query .= " LIMIT 10 OFFSET 0";
4723
+		}
4473 4724
  
4474 4725
 		$sth = $this->db->prepare($query);
4475 4726
 		$sth->execute();
@@ -4522,7 +4773,9 @@  discard block
 block discarded – undo
4522 4773
 			if($row['registration'] != "")
4523 4774
 			{
4524 4775
 				$image_array = $Image->getSpotterImage($row['registration']);
4525
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4776
+				if (isset($image_array[0]['image_thumbnail'])) {
4777
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4778
+				}
4526 4779
 			}
4527 4780
 			$temp_array['registration_count'] = $row['registration_count'];
4528 4781
 
@@ -4597,7 +4850,9 @@  discard block
 block discarded – undo
4597 4850
 			if($row['registration'] != "")
4598 4851
 			{
4599 4852
 				$image_array = $Image->getSpotterImage($row['registration']);
4600
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4853
+				if (isset($image_array[0]['image_thumbnail'])) {
4854
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4855
+				}
4601 4856
 			}
4602 4857
 			$temp_array['registration_count'] = $row['registration_count'];
4603 4858
 
@@ -4830,7 +5085,9 @@  discard block
 block discarded – undo
4830 5085
 			date_default_timezone_set($globalTimezone);
4831 5086
 			$datetime = new DateTime($date);
4832 5087
 			$offset = $datetime->format('P');
4833
-		} else $offset = '+00:00';
5088
+		} else {
5089
+			$offset = '+00:00';
5090
+		}
4834 5091
 
4835 5092
 		if ($globalDBdriver == 'mysql') {
4836 5093
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4877,7 +5134,9 @@  discard block
 block discarded – undo
4877 5134
 			date_default_timezone_set($globalTimezone);
4878 5135
 			$datetime = new DateTime($date);
4879 5136
 			$offset = $datetime->format('P');
4880
-		} else $offset = '+00:00';
5137
+		} else {
5138
+			$offset = '+00:00';
5139
+		}
4881 5140
 
4882 5141
 		if ($globalDBdriver == 'mysql') {
4883 5142
 			$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    
@@ -4931,7 +5190,9 @@  discard block
 block discarded – undo
4931 5190
 			date_default_timezone_set($globalTimezone);
4932 5191
 			$datetime = new DateTime($date);
4933 5192
 			$offset = $datetime->format('P');
4934
-		} else $offset = '+00:00';
5193
+		} else {
5194
+			$offset = '+00:00';
5195
+		}
4935 5196
 
4936 5197
 		if ($globalDBdriver == 'mysql') {
4937 5198
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5029,8 +5290,11 @@  discard block
 block discarded – undo
5029 5290
 			if($row['registration'] != "")
5030 5291
 			{
5031 5292
 				$image_array = $Image->getSpotterImage($row['registration']);
5032
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5033
-				else $temp_array['image_thumbnail'] = '';
5293
+				if (isset($image_array[0]['image_thumbnail'])) {
5294
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5295
+				} else {
5296
+					$temp_array['image_thumbnail'] = '';
5297
+				}
5034 5298
 			}
5035 5299
 			$temp_array['registration_count'] = $row['registration_count'];
5036 5300
 			$aircraft_array[] = $temp_array;
@@ -5137,7 +5401,9 @@  discard block
 block discarded – undo
5137 5401
 			if($row['registration'] != "")
5138 5402
 			{
5139 5403
 				$image_array = $Image->getSpotterImage($row['registration']);
5140
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5404
+				if (isset($image_array[0]['image_thumbnail'])) {
5405
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5406
+				}
5141 5407
 			}
5142 5408
 			$temp_array['registration_count'] = $row['registration_count'];
5143 5409
           
@@ -5254,7 +5520,9 @@  discard block
 block discarded – undo
5254 5520
 			if($row['registration'] != "")
5255 5521
 			{
5256 5522
 				$image_array = $Image->getSpotterImage($row['registration']);
5257
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5523
+				if (isset($image_array[0]['image_thumbnail'])) {
5524
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5525
+				}
5258 5526
 			}
5259 5527
 			$temp_array['registration_count'] = $row['registration_count'];
5260 5528
           
@@ -5366,7 +5634,9 @@  discard block
 block discarded – undo
5366 5634
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5367 5635
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5368 5636
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5369
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5637
+		if ($limit) {
5638
+			$query .= " LIMIT 10 OFFSET 0";
5639
+		}
5370 5640
 		
5371 5641
 		$sth = $this->db->prepare($query);
5372 5642
 		$sth->execute();
@@ -5385,7 +5655,9 @@  discard block
 block discarded – undo
5385 5655
 			if($row['registration'] != "")
5386 5656
 			{
5387 5657
 				$image_array = $Image->getSpotterImage($row['registration']);
5388
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5658
+				if (isset($image_array[0]['image_thumbnail'])) {
5659
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5660
+				}
5389 5661
 			}
5390 5662
           
5391 5663
 			$aircraft_array[] = $temp_array;
@@ -5426,7 +5698,9 @@  discard block
 block discarded – undo
5426 5698
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5427 5699
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5428 5700
                 $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";
5429
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5701
+		if ($limit) {
5702
+			$query .= " LIMIT 10 OFFSET 0";
5703
+		}
5430 5704
 		
5431 5705
 		$sth = $this->db->prepare($query);
5432 5706
 		$sth->execute();
@@ -5446,7 +5720,9 @@  discard block
 block discarded – undo
5446 5720
 			if($row['registration'] != "")
5447 5721
 			{
5448 5722
 				$image_array = $Image->getSpotterImage($row['registration']);
5449
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5723
+				if (isset($image_array[0]['image_thumbnail'])) {
5724
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5725
+				}
5450 5726
 			}
5451 5727
           
5452 5728
 			$aircraft_array[] = $temp_array;
@@ -5487,7 +5763,9 @@  discard block
 block discarded – undo
5487 5763
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5488 5764
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5489 5765
 				ORDER BY airport_departure_icao_count DESC";
5490
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5766
+		if ($limit) {
5767
+			$query .= " LIMIT 10 OFFSET 0";
5768
+		}
5491 5769
       
5492 5770
 		$sth = $this->db->prepare($query);
5493 5771
 		$sth->execute();
@@ -5539,7 +5817,9 @@  discard block
 block discarded – undo
5539 5817
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5540 5818
                 $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
5541 5819
 				ORDER BY airport_departure_icao_count DESC";
5542
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5820
+		if ($limit) {
5821
+			$query .= " LIMIT 10 OFFSET 0";
5822
+		}
5543 5823
       
5544 5824
 		$sth = $this->db->prepare($query);
5545 5825
 		$sth->execute();
@@ -5591,7 +5871,9 @@  discard block
 block discarded – undo
5591 5871
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5592 5872
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5593 5873
 				ORDER BY airport_departure_icao_count DESC";
5594
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5874
+		if ($limit) {
5875
+			$query .= " LIMIT 10 OFFSET 0";
5876
+		}
5595 5877
       
5596 5878
 		$sth = $this->db->prepare($query);
5597 5879
 		$sth->execute();
@@ -5643,7 +5925,9 @@  discard block
 block discarded – undo
5643 5925
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5644 5926
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5645 5927
 				ORDER BY airport_departure_icao_count DESC";
5646
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5928
+		if ($limit) {
5929
+			$query .= " LIMIT 10 OFFSET 0";
5930
+		}
5647 5931
       
5648 5932
 		$sth = $this->db->prepare($query);
5649 5933
 		$sth->execute();
@@ -6038,7 +6322,9 @@  discard block
 block discarded – undo
6038 6322
 			date_default_timezone_set($globalTimezone);
6039 6323
 			$datetime = new DateTime($date);
6040 6324
 			$offset = $datetime->format('P');
6041
-		} else $offset = '+00:00';
6325
+		} else {
6326
+			$offset = '+00:00';
6327
+		}
6042 6328
 
6043 6329
 		if ($globalDBdriver == 'mysql') {
6044 6330
 			$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 
@@ -6088,7 +6374,9 @@  discard block
 block discarded – undo
6088 6374
 			date_default_timezone_set($globalTimezone);
6089 6375
 			$datetime = new DateTime($date);
6090 6376
 			$offset = $datetime->format('P');
6091
-		} else $offset = '+00:00';
6377
+		} else {
6378
+			$offset = '+00:00';
6379
+		}
6092 6380
 
6093 6381
 		if ($globalDBdriver == 'mysql') {
6094 6382
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6301,7 +6589,9 @@  discard block
 block discarded – undo
6301 6589
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6302 6590
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6303 6591
 					ORDER BY airport_arrival_icao_count DESC";
6304
-		if ($limit) $query .= " LIMIT 10";
6592
+		if ($limit) {
6593
+			$query .= " LIMIT 10";
6594
+		}
6305 6595
       
6306 6596
 		
6307 6597
 		$sth = $this->db->prepare($query);
@@ -6321,7 +6611,9 @@  discard block
 block discarded – undo
6321 6611
 			if ($icaoaskey) {
6322 6612
 				$icao = $row['arrival_airport_icao'];
6323 6613
 				$airport_array[$icao] = $temp_array;
6324
-			} else $airport_array[] = $temp_array;
6614
+			} else {
6615
+				$airport_array[] = $temp_array;
6616
+			}
6325 6617
 		}
6326 6618
 
6327 6619
 		return $airport_array;
@@ -6363,7 +6655,9 @@  discard block
 block discarded – undo
6363 6655
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6364 6656
                 $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
6365 6657
 					ORDER BY airport_arrival_icao_count DESC";
6366
-		if ($limit) $query .= " LIMIT 10";
6658
+		if ($limit) {
6659
+			$query .= " LIMIT 10";
6660
+		}
6367 6661
       
6368 6662
 		
6369 6663
 		$sth = $this->db->prepare($query);
@@ -6384,7 +6678,9 @@  discard block
 block discarded – undo
6384 6678
 			if ($icaoaskey) {
6385 6679
 				$icao = $row['arrival_airport_icao'];
6386 6680
 				$airport_array[$icao] = $temp_array;
6387
-			} else $airport_array[] = $temp_array;
6681
+			} else {
6682
+				$airport_array[] = $temp_array;
6683
+			}
6388 6684
 		}
6389 6685
 
6390 6686
 		return $airport_array;
@@ -6426,7 +6722,9 @@  discard block
 block discarded – undo
6426 6722
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6427 6723
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6428 6724
 					ORDER BY airport_arrival_icao_count DESC";
6429
-		if ($limit) $query .= " LIMIT 10";
6725
+		if ($limit) {
6726
+			$query .= " LIMIT 10";
6727
+		}
6430 6728
       
6431 6729
 		
6432 6730
 		$sth = $this->db->prepare($query);
@@ -6446,7 +6744,9 @@  discard block
 block discarded – undo
6446 6744
 			if ($icaoaskey) {
6447 6745
 				$icao = $row['arrival_airport_icao'];
6448 6746
 				$airport_array[$icao] = $temp_array;
6449
-			} else $airport_array[] = $temp_array;
6747
+			} else {
6748
+				$airport_array[] = $temp_array;
6749
+			}
6450 6750
 		}
6451 6751
 
6452 6752
 		return $airport_array;
@@ -6488,7 +6788,9 @@  discard block
 block discarded – undo
6488 6788
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6489 6789
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6490 6790
 					ORDER BY airport_arrival_icao_count DESC";
6491
-		if ($limit) $query .= " LIMIT 10";
6791
+		if ($limit) {
6792
+			$query .= " LIMIT 10";
6793
+		}
6492 6794
       
6493 6795
 		
6494 6796
 		$sth = $this->db->prepare($query);
@@ -6509,7 +6811,9 @@  discard block
 block discarded – undo
6509 6811
 			if ($icaoaskey) {
6510 6812
 				$icao = $row['arrival_airport_icao'];
6511 6813
 				$airport_array[$icao] = $temp_array;
6512
-			} else $airport_array[] = $temp_array;
6814
+			} else {
6815
+				$airport_array[] = $temp_array;
6816
+			}
6513 6817
 		}
6514 6818
 
6515 6819
 		return $airport_array;
@@ -6890,7 +7194,9 @@  discard block
 block discarded – undo
6890 7194
 			date_default_timezone_set($globalTimezone);
6891 7195
 			$datetime = new DateTime($date);
6892 7196
 			$offset = $datetime->format('P');
6893
-		} else $offset = '+00:00';
7197
+		} else {
7198
+			$offset = '+00:00';
7199
+		}
6894 7200
 
6895 7201
 		if ($globalDBdriver == 'mysql') {
6896 7202
 			$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 
@@ -6940,7 +7246,9 @@  discard block
 block discarded – undo
6940 7246
 			date_default_timezone_set($globalTimezone);
6941 7247
 			$datetime = new DateTime($date);
6942 7248
 			$offset = $datetime->format('P');
6943
-		} else $offset = '+00:00';
7249
+		} else {
7250
+			$offset = '+00:00';
7251
+		}
6944 7252
 
6945 7253
 		if ($globalDBdriver == 'mysql') {
6946 7254
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7163,7 +7471,9 @@  discard block
 block discarded – undo
7163 7471
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7164 7472
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7165 7473
 					ORDER BY airport_arrival_country_count DESC";
7166
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7474
+		if ($limit) {
7475
+			$query .= " LIMIT 10 OFFSET 0";
7476
+		}
7167 7477
       
7168 7478
 		
7169 7479
 		$sth = $this->db->prepare($query);
@@ -7450,7 +7760,9 @@  discard block
 block discarded – undo
7450 7760
 			date_default_timezone_set($globalTimezone);
7451 7761
 			$datetime = new DateTime($date);
7452 7762
 			$offset = $datetime->format('P');
7453
-		} else $offset = '+00:00';
7763
+		} else {
7764
+			$offset = '+00:00';
7765
+		}
7454 7766
 		
7455 7767
 		if ($globalDBdriver == 'mysql') {
7456 7768
 			$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
@@ -7626,15 +7938,23 @@  discard block
 block discarded – undo
7626 7938
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7627 7939
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7628 7940
 		 if ($olderthanmonths > 0) {
7629
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7630
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7941
+			if ($globalDBdriver == 'mysql') {
7942
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7943
+			} else {
7944
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7945
+			}
7631 7946
 		}
7632 7947
 		if ($sincedate != '') {
7633
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7634
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7948
+			if ($globalDBdriver == 'mysql') {
7949
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7950
+			} else {
7951
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7952
+			}
7635 7953
 		}
7636 7954
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7637
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7955
+		if ($limit) {
7956
+			$query .= " LIMIT 10 OFFSET 0";
7957
+		}
7638 7958
       		
7639 7959
 		$sth = $this->db->prepare($query);
7640 7960
 		$sth->execute();
@@ -7668,15 +7988,23 @@  discard block
 block discarded – undo
7668 7988
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7669 7989
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7670 7990
 		 if ($olderthanmonths > 0) {
7671
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7672
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7991
+			if ($globalDBdriver == 'mysql') {
7992
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7993
+			} else {
7994
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7995
+			}
7673 7996
 		}
7674 7997
 		if ($sincedate != '') {
7675
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7676
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7998
+			if ($globalDBdriver == 'mysql') {
7999
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8000
+			} else {
8001
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8002
+			}
7677 8003
 		}
7678 8004
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7679
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8005
+		if ($limit) {
8006
+			$query .= " LIMIT 10 OFFSET 0";
8007
+		}
7680 8008
       		
7681 8009
 		$sth = $this->db->prepare($query);
7682 8010
 		$sth->execute();
@@ -7713,7 +8041,9 @@  discard block
 block discarded – undo
7713 8041
 			date_default_timezone_set($globalTimezone);
7714 8042
 			$datetime = new DateTime();
7715 8043
 			$offset = $datetime->format('P');
7716
-		} else $offset = '+00:00';
8044
+		} else {
8045
+			$offset = '+00:00';
8046
+		}
7717 8047
 
7718 8048
 		if ($globalDBdriver == 'mysql') {
7719 8049
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7762,7 +8092,9 @@  discard block
 block discarded – undo
7762 8092
 			date_default_timezone_set($globalTimezone);
7763 8093
 			$datetime = new DateTime();
7764 8094
 			$offset = $datetime->format('P');
7765
-		} else $offset = '+00:00';
8095
+		} else {
8096
+			$offset = '+00:00';
8097
+		}
7766 8098
 		$filter_query = $this->getFilter($filters,true,true);
7767 8099
 		if ($globalDBdriver == 'mysql') {
7768 8100
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7811,7 +8143,9 @@  discard block
 block discarded – undo
7811 8143
 			date_default_timezone_set($globalTimezone);
7812 8144
 			$datetime = new DateTime();
7813 8145
 			$offset = $datetime->format('P');
7814
-		} else $offset = '+00:00';
8146
+		} else {
8147
+			$offset = '+00:00';
8148
+		}
7815 8149
 		$filter_query = $this->getFilter($filters,true,true);
7816 8150
 		if ($globalDBdriver == 'mysql') {
7817 8151
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7857,7 +8191,9 @@  discard block
 block discarded – undo
7857 8191
 			date_default_timezone_set($globalTimezone);
7858 8192
 			$datetime = new DateTime();
7859 8193
 			$offset = $datetime->format('P');
7860
-		} else $offset = '+00:00';
8194
+		} else {
8195
+			$offset = '+00:00';
8196
+		}
7861 8197
 		$filter_query = $this->getFilter($filters,true,true);
7862 8198
 		if ($globalDBdriver == 'mysql') {
7863 8199
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7905,7 +8241,9 @@  discard block
 block discarded – undo
7905 8241
 			date_default_timezone_set($globalTimezone);
7906 8242
 			$datetime = new DateTime();
7907 8243
 			$offset = $datetime->format('P');
7908
-		} else $offset = '+00:00';
8244
+		} else {
8245
+			$offset = '+00:00';
8246
+		}
7909 8247
 		
7910 8248
 		if ($globalDBdriver == 'mysql') {
7911 8249
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7953,7 +8291,9 @@  discard block
 block discarded – undo
7953 8291
 			date_default_timezone_set($globalTimezone);
7954 8292
 			$datetime = new DateTime();
7955 8293
 			$offset = $datetime->format('P');
7956
-		} else $offset = '+00:00';
8294
+		} else {
8295
+			$offset = '+00:00';
8296
+		}
7957 8297
 
7958 8298
 		if ($globalDBdriver == 'mysql') {
7959 8299
 			$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
@@ -8000,7 +8340,9 @@  discard block
 block discarded – undo
8000 8340
 			date_default_timezone_set($globalTimezone);
8001 8341
 			$datetime = new DateTime();
8002 8342
 			$offset = $datetime->format('P');
8003
-		} else $offset = '+00:00';
8343
+		} else {
8344
+			$offset = '+00:00';
8345
+		}
8004 8346
 
8005 8347
 		if ($globalDBdriver == 'mysql') {
8006 8348
 			$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
@@ -8048,7 +8390,9 @@  discard block
 block discarded – undo
8048 8390
 			date_default_timezone_set($globalTimezone);
8049 8391
 			$datetime = new DateTime();
8050 8392
 			$offset = $datetime->format('P');
8051
-		} else $offset = '+00:00';
8393
+		} else {
8394
+			$offset = '+00:00';
8395
+		}
8052 8396
 		$filter_query = $this->getFilter($filters,true,true);
8053 8397
 		if ($globalDBdriver == 'mysql') {
8054 8398
 			$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
@@ -8093,7 +8437,9 @@  discard block
 block discarded – undo
8093 8437
 			date_default_timezone_set($globalTimezone);
8094 8438
 			$datetime = new DateTime();
8095 8439
 			$offset = $datetime->format('P');
8096
-		} else $offset = '+00:00';
8440
+		} else {
8441
+			$offset = '+00:00';
8442
+		}
8097 8443
 		$filter_query = $this->getFilter($filters,true,true);
8098 8444
 
8099 8445
 		if ($globalDBdriver == 'mysql') {
@@ -8140,7 +8486,9 @@  discard block
 block discarded – undo
8140 8486
 			date_default_timezone_set($globalTimezone);
8141 8487
 			$datetime = new DateTime();
8142 8488
 			$offset = $datetime->format('P');
8143
-		} else $offset = '+00:00';
8489
+		} else {
8490
+			$offset = '+00:00';
8491
+		}
8144 8492
 
8145 8493
 		if ($globalDBdriver == 'mysql') {
8146 8494
 			$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
@@ -8186,7 +8534,9 @@  discard block
 block discarded – undo
8186 8534
 			date_default_timezone_set($globalTimezone);
8187 8535
 			$datetime = new DateTime();
8188 8536
 			$offset = $datetime->format('P');
8189
-		} else $offset = '+00:00';
8537
+		} else {
8538
+			$offset = '+00:00';
8539
+		}
8190 8540
 		$filter_query = $this->getFilter($filters,true,true);
8191 8541
 
8192 8542
 		if ($globalDBdriver == 'mysql') {
@@ -8233,7 +8583,9 @@  discard block
 block discarded – undo
8233 8583
 			date_default_timezone_set($globalTimezone);
8234 8584
 			$datetime = new DateTime();
8235 8585
 			$offset = $datetime->format('P');
8236
-		} else $offset = '+00:00';
8586
+		} else {
8587
+			$offset = '+00:00';
8588
+		}
8237 8589
 
8238 8590
 		if ($globalDBdriver == 'mysql') {
8239 8591
 			$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
@@ -8280,7 +8632,9 @@  discard block
 block discarded – undo
8280 8632
 			date_default_timezone_set($globalTimezone);
8281 8633
 			$datetime = new DateTime();
8282 8634
 			$offset = $datetime->format('P');
8283
-		} else $offset = '+00:00';
8635
+		} else {
8636
+			$offset = '+00:00';
8637
+		}
8284 8638
 
8285 8639
 		if ($globalDBdriver == 'mysql') {
8286 8640
 			$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
@@ -8325,7 +8679,9 @@  discard block
 block discarded – undo
8325 8679
 			date_default_timezone_set($globalTimezone);
8326 8680
 			$datetime = new DateTime();
8327 8681
 			$offset = $datetime->format('P');
8328
-		} else $offset = '+00:00';
8682
+		} else {
8683
+			$offset = '+00:00';
8684
+		}
8329 8685
 		$filter_query = $this->getFilter($filters,true,true);
8330 8686
 
8331 8687
 		if ($globalDBdriver == 'mysql') {
@@ -8373,7 +8729,9 @@  discard block
 block discarded – undo
8373 8729
 			date_default_timezone_set($globalTimezone);
8374 8730
 			$datetime = new DateTime();
8375 8731
 			$offset = $datetime->format('P');
8376
-		} else $offset = '+00:00';
8732
+		} else {
8733
+			$offset = '+00:00';
8734
+		}
8377 8735
 
8378 8736
 		if ($globalDBdriver == 'mysql') {
8379 8737
 			$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
@@ -8419,7 +8777,9 @@  discard block
 block discarded – undo
8419 8777
 			date_default_timezone_set($globalTimezone);
8420 8778
 			$datetime = new DateTime();
8421 8779
 			$offset = $datetime->format('P');
8422
-		} else $offset = '+00:00';
8780
+		} else {
8781
+			$offset = '+00:00';
8782
+		}
8423 8783
 		$filter_query = $this->getFilter($filters,true,true);
8424 8784
 
8425 8785
 		if ($globalDBdriver == 'mysql') {
@@ -8467,7 +8827,9 @@  discard block
 block discarded – undo
8467 8827
 			date_default_timezone_set($globalTimezone);
8468 8828
 			$datetime = new DateTime();
8469 8829
 			$offset = $datetime->format('P');
8470
-		} else $offset = '+00:00';
8830
+		} else {
8831
+			$offset = '+00:00';
8832
+		}
8471 8833
 
8472 8834
 		if ($globalDBdriver == 'mysql') {
8473 8835
 			$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
@@ -8514,7 +8876,9 @@  discard block
 block discarded – undo
8514 8876
 			date_default_timezone_set($globalTimezone);
8515 8877
 			$datetime = new DateTime();
8516 8878
 			$offset = $datetime->format('P');
8517
-		} else $offset = '+00:00';
8879
+		} else {
8880
+			$offset = '+00:00';
8881
+		}
8518 8882
 		$filter_query = $this->getFilter($filters,true,true);
8519 8883
 		if ($globalDBdriver == 'mysql') {
8520 8884
 			$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
@@ -8563,7 +8927,9 @@  discard block
 block discarded – undo
8563 8927
 			date_default_timezone_set($globalTimezone);
8564 8928
 			$datetime = new DateTime();
8565 8929
 			$offset = $datetime->format('P');
8566
-		} else $offset = '+00:00';
8930
+		} else {
8931
+			$offset = '+00:00';
8932
+		}
8567 8933
 
8568 8934
 		$orderby_sql = '';
8569 8935
 		if ($orderby == "hour")
@@ -8629,7 +8995,9 @@  discard block
 block discarded – undo
8629 8995
 			date_default_timezone_set($globalTimezone);
8630 8996
 			$datetime = new DateTime();
8631 8997
 			$offset = $datetime->format('P');
8632
-		} else $offset = '+00:00';
8998
+		} else {
8999
+			$offset = '+00:00';
9000
+		}
8633 9001
 
8634 9002
 		$orderby_sql = '';
8635 9003
 		if ($orderby == "hour")
@@ -8696,7 +9064,9 @@  discard block
 block discarded – undo
8696 9064
 			date_default_timezone_set($globalTimezone);
8697 9065
 			$datetime = new DateTime();
8698 9066
 			$offset = $datetime->format('P');
8699
-		} else $offset = '+00:00';
9067
+		} else {
9068
+			$offset = '+00:00';
9069
+		}
8700 9070
 
8701 9071
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8702 9072
 
@@ -8747,7 +9117,9 @@  discard block
 block discarded – undo
8747 9117
 			date_default_timezone_set($globalTimezone);
8748 9118
 			$datetime = new DateTime();
8749 9119
 			$offset = $datetime->format('P');
8750
-		} else $offset = '+00:00';
9120
+		} else {
9121
+			$offset = '+00:00';
9122
+		}
8751 9123
 
8752 9124
 		if ($globalDBdriver == 'mysql') {
8753 9125
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8794,7 +9166,9 @@  discard block
 block discarded – undo
8794 9166
 			date_default_timezone_set($globalTimezone);
8795 9167
 			$datetime = new DateTime();
8796 9168
 			$offset = $datetime->format('P');
8797
-		} else $offset = '+00:00';
9169
+		} else {
9170
+			$offset = '+00:00';
9171
+		}
8798 9172
 
8799 9173
 		if ($globalDBdriver == 'mysql') {
8800 9174
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8841,7 +9215,9 @@  discard block
 block discarded – undo
8841 9215
 			date_default_timezone_set($globalTimezone);
8842 9216
 			$datetime = new DateTime();
8843 9217
 			$offset = $datetime->format('P');
8844
-		} else $offset = '+00:00';
9218
+		} else {
9219
+			$offset = '+00:00';
9220
+		}
8845 9221
 
8846 9222
 		if ($globalDBdriver == 'mysql') {
8847 9223
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8889,7 +9265,9 @@  discard block
 block discarded – undo
8889 9265
 			date_default_timezone_set($globalTimezone);
8890 9266
 			$datetime = new DateTime();
8891 9267
 			$offset = $datetime->format('P');
8892
-		} else $offset = '+00:00';
9268
+		} else {
9269
+			$offset = '+00:00';
9270
+		}
8893 9271
 
8894 9272
 		if ($globalDBdriver == 'mysql') {
8895 9273
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8937,7 +9315,9 @@  discard block
 block discarded – undo
8937 9315
 			date_default_timezone_set($globalTimezone);
8938 9316
 			$datetime = new DateTime($date);
8939 9317
 			$offset = $datetime->format('P');
8940
-		} else $offset = '+00:00';
9318
+		} else {
9319
+			$offset = '+00:00';
9320
+		}
8941 9321
 
8942 9322
 		if ($globalDBdriver == 'mysql') {
8943 9323
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8985,7 +9365,9 @@  discard block
 block discarded – undo
8985 9365
 			date_default_timezone_set($globalTimezone);
8986 9366
 			$datetime = new DateTime();
8987 9367
 			$offset = $datetime->format('P');
8988
-		} else $offset = '+00:00';
9368
+		} else {
9369
+			$offset = '+00:00';
9370
+		}
8989 9371
 
8990 9372
 		if ($globalDBdriver == 'mysql') {
8991 9373
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9035,7 +9417,9 @@  discard block
 block discarded – undo
9035 9417
 			date_default_timezone_set($globalTimezone);
9036 9418
 			$datetime = new DateTime();
9037 9419
 			$offset = $datetime->format('P');
9038
-		} else $offset = '+00:00';
9420
+		} else {
9421
+			$offset = '+00:00';
9422
+		}
9039 9423
 
9040 9424
 		if ($globalDBdriver == 'mysql') {
9041 9425
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9082,7 +9466,9 @@  discard block
 block discarded – undo
9082 9466
 			date_default_timezone_set($globalTimezone);
9083 9467
 			$datetime = new DateTime();
9084 9468
 			$offset = $datetime->format('P');
9085
-		} else $offset = '+00:00';
9469
+		} else {
9470
+			$offset = '+00:00';
9471
+		}
9086 9472
 
9087 9473
 		if ($globalDBdriver == 'mysql') {
9088 9474
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9250,7 +9636,9 @@  discard block
 block discarded – undo
9250 9636
 			date_default_timezone_set($globalTimezone);
9251 9637
 			$datetime = new DateTime();
9252 9638
 			$offset = $datetime->format('P');
9253
-		} else $offset = '+00:00';
9639
+		} else {
9640
+			$offset = '+00:00';
9641
+		}
9254 9642
 
9255 9643
 		if ($globalDBdriver == 'mysql') {
9256 9644
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9436,7 +9824,9 @@  discard block
 block discarded – undo
9436 9824
 	*/
9437 9825
 	public function parseDirection($direction = 0)
9438 9826
 	{
9439
-		if ($direction == '') $direction = 0;
9827
+		if ($direction == '') {
9828
+			$direction = 0;
9829
+		}
9440 9830
 		$direction_array = array();
9441 9831
 		$temp_array = array();
9442 9832
 
@@ -9537,7 +9927,9 @@  discard block
 block discarded – undo
9537 9927
 		if (isset($result->AirlineFlightInfoResult))
9538 9928
 		{
9539 9929
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9540
-		} else return '';
9930
+		} else {
9931
+			return '';
9932
+		}
9541 9933
 		
9542 9934
 		$registration = $this->convertAircraftRegistration($registration);
9543 9935
 		
@@ -9566,7 +9958,9 @@  discard block
 block discarded – undo
9566 9958
 		if (count($row) > 0) {
9567 9959
 		    //return $row['Registration'];
9568 9960
 		    return $row['registration'];
9569
-		} else return '';
9961
+		} else {
9962
+			return '';
9963
+		}
9570 9964
 	
9571 9965
 	}
9572 9966
 
@@ -9589,9 +9983,14 @@  discard block
 block discarded – undo
9589 9983
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9590 9984
 		$sth->closeCursor();
9591 9985
 		if (count($row) > 0) {
9592
-		    if ($row['type_flight'] == null) return '';
9593
-		    else return $row['type_flight'];
9594
-		} else return '';
9986
+		    if ($row['type_flight'] == null) {
9987
+		    	return '';
9988
+		    } else {
9989
+		    	return $row['type_flight'];
9990
+		    }
9991
+		} else {
9992
+			return '';
9993
+		}
9595 9994
 	
9596 9995
 	}
9597 9996
 
@@ -9609,7 +10008,9 @@  discard block
 block discarded – undo
9609 10008
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9610 10009
 	
9611 10010
 		$Connection = new Connection($this->db);
9612
-		if (!$Connection->tableExists('countries')) return '';
10011
+		if (!$Connection->tableExists('countries')) {
10012
+			return '';
10013
+		}
9613 10014
 	
9614 10015
 		try {
9615 10016
 			/*
@@ -9629,9 +10030,13 @@  discard block
 block discarded – undo
9629 10030
 			$sth->closeCursor();
9630 10031
 			if (count($row) > 0) {
9631 10032
 				return $row;
9632
-			} else return '';
10033
+			} else {
10034
+				return '';
10035
+			}
9633 10036
 		} catch (PDOException $e) {
9634
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10037
+			if (isset($globalDebug) && $globalDebug) {
10038
+				echo 'Error : '.$e->getMessage()."\n";
10039
+			}
9635 10040
 			return '';
9636 10041
 		}
9637 10042
 	
@@ -9779,7 +10184,9 @@  discard block
 block discarded – undo
9779 10184
 	{
9780 10185
 		global $globalBitlyAccessToken;
9781 10186
 		
9782
-		if ($globalBitlyAccessToken == '') return $url;
10187
+		if ($globalBitlyAccessToken == '') {
10188
+			return $url;
10189
+		}
9783 10190
         
9784 10191
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9785 10192
 		
@@ -9928,7 +10335,9 @@  discard block
 block discarded – undo
9928 10335
 		
9929 10336
 
9930 10337
 		// routes
9931
-		if ($globalDebug) print "Routes...\n";
10338
+		if ($globalDebug) {
10339
+			print "Routes...\n";
10340
+		}
9932 10341
 		if ($globalDBdriver == 'mysql') {
9933 10342
 			$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)";
9934 10343
 		} else {
@@ -9947,7 +10356,9 @@  discard block
 block discarded – undo
9947 10356
 			}
9948 10357
 		}
9949 10358
 		
9950
-		if ($globalDebug) print "Airlines...\n";
10359
+		if ($globalDebug) {
10360
+			print "Airlines...\n";
10361
+		}
9951 10362
 		//airlines
9952 10363
 		if ($globalDBdriver == 'mysql') {
9953 10364
 			$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)";
@@ -9961,10 +10372,15 @@  discard block
 block discarded – undo
9961 10372
 			if (is_numeric(substr($row['ident'], -1, 1)))
9962 10373
 			{
9963 10374
 				$fromsource = NULL;
9964
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9965
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9966
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9967
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10375
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10376
+					$fromsource = 'vatsim';
10377
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10378
+					$fromsource = 'ivao';
10379
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10380
+					$fromsource = 'vatsim';
10381
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10382
+					$fromsource = 'ivao';
10383
+				}
9968 10384
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9969 10385
 				if (isset($airline_array[0]['name'])) {
9970 10386
 					$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";
@@ -9974,13 +10390,17 @@  discard block
 block discarded – undo
9974 10390
 			}
9975 10391
 		}
9976 10392
 
9977
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10393
+		if ($globalDebug) {
10394
+			print "Remove Duplicate in aircraft_modes...\n";
10395
+		}
9978 10396
 		//duplicate modes
9979 10397
 		$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";
9980 10398
 		$sth = $this->db->prepare($query);
9981 10399
 		$sth->execute();
9982 10400
 		
9983
-		if ($globalDebug) print "Aircraft...\n";
10401
+		if ($globalDebug) {
10402
+			print "Aircraft...\n";
10403
+		}
9984 10404
 		//aircraft
9985 10405
 		if ($globalDBdriver == 'mysql') {
9986 10406
 			$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)";
@@ -10023,26 +10443,38 @@  discard block
 block discarded – undo
10023 10443
 				 if (isset($closestAirports[0])) {
10024 10444
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10025 10445
 						$airport_icao = $closestAirports[0]['icao'];
10026
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10446
+						if ($globalDebug) {
10447
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10448
+						}
10027 10449
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10028 10450
 						foreach ($closestAirports as $airport) {
10029 10451
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10030 10452
 								$airport_icao = $airport['icao'];
10031
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10453
+								if ($globalDebug) {
10454
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10455
+								}
10032 10456
 								break;
10033 10457
 							}
10034 10458
 						}
10035 10459
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10036 10460
 						$airport_icao = $closestAirports[0]['icao'];
10037
-						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";
10461
+						if ($globalDebug) {
10462
+							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";
10463
+						}
10038 10464
 					} else {
10039
-						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";
10465
+						if ($globalDebug) {
10466
+							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";
10467
+						}
10040 10468
 					}
10041 10469
 				} else {
10042
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10470
+					if ($globalDebug) {
10471
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10472
+					}
10043 10473
 				}
10044 10474
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10045
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10475
+					if ($globalDebug) {
10476
+						echo "Updating airport to ".$airport_icao."...\n";
10477
+					}
10046 10478
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10047 10479
 					$sthu = $this->db->prepare($update_query);
10048 10480
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Braces   +236 added lines, -84 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -80,9 +88,14 @@  discard block
 block discarded – undo
80 88
 
81 89
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
82 90
 		global $globalStatsFilters;
83
-		if ($filter_name == '') $filter_name = $this->filter_name;
84
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
85
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
91
+		if ($filter_name == '') {
92
+			$filter_name = $this->filter_name;
93
+		}
94
+		if ($limit) {
95
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
96
+		} else {
97
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
98
+		}
86 99
                  try {
87 100
                         $sth = $this->db->prepare($query);
88 101
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -102,9 +115,14 @@  discard block
 block discarded – undo
102 115
 	}
103 116
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 117
 		global $globalStatsFilters;
105
-		if ($filter_name == '') $filter_name = $this->filter_name;
106
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
107
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
118
+		if ($filter_name == '') {
119
+			$filter_name = $this->filter_name;
120
+		}
121
+		if ($limit) {
122
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
123
+		} else {
124
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
125
+		}
108 126
                  try {
109 127
                         $sth = $this->db->prepare($query);
110 128
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -124,9 +142,14 @@  discard block
 block discarded – undo
124 142
 	}
125 143
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 144
 		global $globalStatsFilters;
127
-		if ($filter_name == '') $filter_name = $this->filter_name;
128
-		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
129
-		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
145
+		if ($filter_name == '') {
146
+			$filter_name = $this->filter_name;
147
+		}
148
+		if ($limit) {
149
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
150
+		} else {
151
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
152
+		}
130 153
                  try {
131 154
                         $sth = $this->db->prepare($query);
132 155
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -147,9 +170,14 @@  discard block
 block discarded – undo
147 170
 
148 171
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
149 172
 		global $globalStatsFilters;
150
-		if ($filter_name == '') $filter_name = $this->filter_name;
151
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
152
-		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
173
+		if ($filter_name == '') {
174
+			$filter_name = $this->filter_name;
175
+		}
176
+		if ($limit) {
177
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
178
+		} else {
179
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
180
+		}
153 181
                  try {
154 182
                         $sth = $this->db->prepare($query);
155 183
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -169,9 +197,14 @@  discard block
 block discarded – undo
169 197
 	}
170 198
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 199
 		global $globalStatsFilters;
172
-		if ($filter_name == '') $filter_name = $this->filter_name;
173
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
174
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
200
+		if ($filter_name == '') {
201
+			$filter_name = $this->filter_name;
202
+		}
203
+		if ($limit) {
204
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
205
+		} else {
206
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
207
+		}
175 208
                  try {
176 209
                         $sth = $this->db->prepare($query);
177 210
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -192,9 +225,14 @@  discard block
 block discarded – undo
192 225
 
193 226
 	public function countAllAirlines($limit = true,$filter_name = '') {
194 227
 		global $globalStatsFilters;
195
-		if ($filter_name == '') $filter_name = $this->filter_name;
196
-		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
197
-		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
228
+		if ($filter_name == '') {
229
+			$filter_name = $this->filter_name;
230
+		}
231
+		if ($limit) {
232
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
233
+		} else {
234
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
235
+		}
198 236
                  try {
199 237
                         $sth = $this->db->prepare($query);
200 238
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -215,9 +253,14 @@  discard block
 block discarded – undo
215 253
 	}
216 254
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 255
 		global $globalStatsFilters;
218
-		if ($filter_name == '') $filter_name = $this->filter_name;
219
-		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
220
-		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
256
+		if ($filter_name == '') {
257
+			$filter_name = $this->filter_name;
258
+		}
259
+		if ($limit) {
260
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
261
+		} else {
262
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
263
+		}
221 264
                  try {
222 265
                         $sth = $this->db->prepare($query);
223 266
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -237,9 +280,14 @@  discard block
 block discarded – undo
237 280
 	}
238 281
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 282
 		global $globalStatsFilters;
240
-		if ($filter_name == '') $filter_name = $this->filter_name;
241
-		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
242
-		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
283
+		if ($filter_name == '') {
284
+			$filter_name = $this->filter_name;
285
+		}
286
+		if ($limit) {
287
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
288
+		} else {
289
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
290
+		}
243 291
 		 try {
244 292
 			$sth = $this->db->prepare($query);
245 293
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -259,10 +307,15 @@  discard block
 block discarded – undo
259 307
 	}
260 308
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
261 309
 		$Connection = new Connection();
262
-		if ($filter_name == '') $filter_name = $this->filter_name;
310
+		if ($filter_name == '') {
311
+			$filter_name = $this->filter_name;
312
+		}
263 313
 		if ($Connection->tableExists('countries')) {
264
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
265
-			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
314
+			if ($limit) {
315
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
316
+			} else {
317
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
318
+			}
266 319
 			 try {
267 320
 				$sth = $this->db->prepare($query);
268 321
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -283,9 +336,14 @@  discard block
 block discarded – undo
283 336
 	}
284 337
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
285 338
 		global $globalStatsFilters;
286
-		if ($filter_name == '') $filter_name = $this->filter_name;
287
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
339
+		if ($filter_name == '') {
340
+			$filter_name = $this->filter_name;
341
+		}
342
+		if ($limit) {
343
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
344
+		} else {
345
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
346
+		}
289 347
                  try {
290 348
                         $sth = $this->db->prepare($query);
291 349
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -305,9 +363,14 @@  discard block
 block discarded – undo
305 363
 	}
306 364
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 365
 		global $globalStatsFilters;
308
-		if ($filter_name == '') $filter_name = $this->filter_name;
309
-		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
310
-		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
366
+		if ($filter_name == '') {
367
+			$filter_name = $this->filter_name;
368
+		}
369
+		if ($limit) {
370
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
371
+		} else {
372
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
373
+		}
311 374
                  try {
312 375
                         $sth = $this->db->prepare($query);
313 376
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -327,9 +390,14 @@  discard block
 block discarded – undo
327 390
 	}
328 391
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 392
 		global $globalStatsFilters;
330
-		if ($filter_name == '') $filter_name = $this->filter_name;
331
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332
-		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
393
+		if ($filter_name == '') {
394
+			$filter_name = $this->filter_name;
395
+		}
396
+		if ($limit) {
397
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
398
+		} else {
399
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
400
+		}
333 401
                  try {
334 402
                         $sth = $this->db->prepare($query);
335 403
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -355,7 +423,9 @@  discard block
 block discarded – undo
355 423
         			$icao = $value['airport_departure_icao'];
356 424
         			if (isset($all[$icao])) {
357 425
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
426
+        			} else {
427
+        				$all[$icao] = $value;
428
+        			}
359 429
         		}
360 430
         		$count = array();
361 431
         		foreach ($all as $key => $row) {
@@ -367,9 +437,14 @@  discard block
 block discarded – undo
367 437
 	}
368 438
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 439
 		global $globalStatsFilters;
370
-		if ($filter_name == '') $filter_name = $this->filter_name;
371
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372
-		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
440
+		if ($filter_name == '') {
441
+			$filter_name = $this->filter_name;
442
+		}
443
+		if ($limit) {
444
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
445
+		} else {
446
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
447
+		}
373 448
 		try {
374 449
 			$sth = $this->db->prepare($query);
375 450
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -395,7 +470,9 @@  discard block
 block discarded – undo
395 470
         			$icao = $value['airport_arrival_icao'];
396 471
         			if (isset($all[$icao])) {
397 472
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
473
+        			} else {
474
+        				$all[$icao] = $value;
475
+        			}
399 476
         		}
400 477
         		$count = array();
401 478
         		foreach ($all as $key => $row) {
@@ -408,13 +485,21 @@  discard block
 block discarded – undo
408 485
 	}
409 486
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 487
 		global $globalDBdriver, $globalStatsFilters;
411
-		if ($filter_name == '') $filter_name = $this->filter_name;
488
+		if ($filter_name == '') {
489
+			$filter_name = $this->filter_name;
490
+		}
412 491
 		if ($globalDBdriver == 'mysql') {
413
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
414
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
492
+			if ($limit) {
493
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
494
+			} else {
495
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
496
+			}
415 497
 		} else {
416
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
417
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
498
+			if ($limit) {
499
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
500
+			} else {
501
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
502
+			}
418 503
 		}
419 504
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420 505
                  try {
@@ -438,7 +523,9 @@  discard block
 block discarded – undo
438 523
 	
439 524
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
440 525
 		global $globalStatsFilters;
441
-		if ($filter_name == '') $filter_name = $this->filter_name;
526
+		if ($filter_name == '') {
527
+			$filter_name = $this->filter_name;
528
+		}
442 529
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
443 530
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444 531
                  try {
@@ -460,7 +547,9 @@  discard block
 block discarded – undo
460 547
 	}
461 548
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 549
 		global $globalDBdriver, $globalStatsFilters;
463
-		if ($filter_name == '') $filter_name = $this->filter_name;
550
+		if ($filter_name == '') {
551
+			$filter_name = $this->filter_name;
552
+		}
464 553
 		if ($globalDBdriver == 'mysql') {
465 554
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
466 555
 		} else {
@@ -486,7 +575,9 @@  discard block
 block discarded – undo
486 575
 	}
487 576
 	public function countAllDates($stats_airline = '',$filter_name = '') {
488 577
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
578
+		if ($filter_name == '') {
579
+			$filter_name = $this->filter_name;
580
+		}
490 581
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 582
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 583
                  try {
@@ -508,7 +599,9 @@  discard block
 block discarded – undo
508 599
 	}
509 600
 	public function countAllDatesByAirlines($filter_name = '') {
510 601
 		global $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
602
+		if ($filter_name == '') {
603
+			$filter_name = $this->filter_name;
604
+		}
512 605
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
513 606
 		$query_data = array('filter_name' => $filter_name);
514 607
                  try {
@@ -530,7 +623,9 @@  discard block
 block discarded – undo
530 623
 	}
531 624
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 625
 		global $globalStatsFilters;
533
-		if ($filter_name == '') $filter_name = $this->filter_name;
626
+		if ($filter_name == '') {
627
+			$filter_name = $this->filter_name;
628
+		}
534 629
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535 630
                  try {
536 631
                         $sth = $this->db->prepare($query);
@@ -551,7 +646,9 @@  discard block
 block discarded – undo
551 646
 	}
552 647
 	public function countAllMilitaryMonths($filter_name = '') {
553 648
 		global $globalStatsFilters;
554
-		if ($filter_name == '') $filter_name = $this->filter_name;
649
+		if ($filter_name == '') {
650
+			$filter_name = $this->filter_name;
651
+		}
555 652
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
556 653
                  try {
557 654
                         $sth = $this->db->prepare($query);
@@ -572,9 +669,14 @@  discard block
 block discarded – undo
572 669
 	}
573 670
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 671
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
577
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
672
+		if ($filter_name == '') {
673
+			$filter_name = $this->filter_name;
674
+		}
675
+		if ($limit) {
676
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
677
+		} else {
678
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
679
+		}
578 680
 		if ($orderby == 'hour') {
579 681
 			/*
580 682
 			if ($globalDBdriver == 'mysql') {
@@ -583,7 +685,9 @@  discard block
 block discarded – undo
583 685
 			*/
584 686
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 687
 		}
586
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
688
+		if ($orderby == 'count') {
689
+			$query .= " ORDER BY hour_count DESC";
690
+		}
587 691
                  try {
588 692
                         $sth = $this->db->prepare($query);
589 693
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -604,7 +708,9 @@  discard block
 block discarded – undo
604 708
 	
605 709
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 710
 		global $globalStatsFilters;
607
-		if ($filter_name == '') $filter_name = $this->filter_name;
711
+		if ($filter_name == '') {
712
+			$filter_name = $this->filter_name;
713
+		}
608 714
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
609 715
 		if (empty($all)) {
610 716
 			$filters = array('airlines' => array($stats_airline));
@@ -618,7 +724,9 @@  discard block
 block discarded – undo
618 724
 	}
619 725
 	public function countOverallMilitaryFlights($filter_name = '') {
620 726
 		global $globalStatsFilters;
621
-		if ($filter_name == '') $filter_name = $this->filter_name;
727
+		if ($filter_name == '') {
728
+			$filter_name = $this->filter_name;
729
+		}
622 730
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 731
 		if (empty($all)) {
624 732
 		        $filters = array();
@@ -632,7 +740,9 @@  discard block
 block discarded – undo
632 740
 	}
633 741
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
634 742
 		global $globalStatsFilters;
635
-		if ($filter_name == '') $filter_name = $this->filter_name;
743
+		if ($filter_name == '') {
744
+			$filter_name = $this->filter_name;
745
+		}
636 746
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
637 747
 		if (empty($all)) {
638 748
 			$filters = array('airlines' => array($stats_airline));
@@ -646,7 +756,9 @@  discard block
 block discarded – undo
646 756
 	}
647 757
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
648 758
 		global $globalStatsFilters;
649
-		if ($filter_name == '') $filter_name = $this->filter_name;
759
+		if ($filter_name == '') {
760
+			$filter_name = $this->filter_name;
761
+		}
650 762
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
651 763
 		if (empty($all)) {
652 764
 			$filters = array('airlines' => array($stats_airline));
@@ -660,7 +772,9 @@  discard block
 block discarded – undo
660 772
 	}
661 773
 	public function countOverallAirlines($filter_name = '') {
662 774
 		global $globalStatsFilters;
663
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
664 778
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665 779
                  try {
666 780
                         $sth = $this->db->prepare($query);
@@ -683,7 +797,9 @@  discard block
 block discarded – undo
683 797
 	}
684 798
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
685 799
 		global $globalStatsFilters;
686
-		if ($filter_name == '') $filter_name = $this->filter_name;
800
+		if ($filter_name == '') {
801
+			$filter_name = $this->filter_name;
802
+		}
687 803
 		/*
688 804
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
689 805
                  try {
@@ -708,7 +824,9 @@  discard block
 block discarded – undo
708 824
 	}
709 825
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
710 826
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
827
+		if ($filter_name == '') {
828
+			$filter_name = $this->filter_name;
829
+		}
712 830
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
713 831
 		if (empty($all)) {
714 832
 			$filters = array('airlines' => array($stats_airline));
@@ -722,7 +840,9 @@  discard block
 block discarded – undo
722 840
 	}
723 841
 
724 842
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
725
-		if ($filter_name == '') $filter_name = $this->filter_name;
843
+		if ($filter_name == '') {
844
+			$filter_name = $this->filter_name;
845
+		}
726 846
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
727 847
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 848
                  try {
@@ -735,7 +855,9 @@  discard block
 block discarded – undo
735 855
                 return $all;
736 856
 	}
737 857
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738
-		if ($filter_name == '') $filter_name = $this->filter_name;
858
+		if ($filter_name == '') {
859
+			$filter_name = $this->filter_name;
860
+		}
739 861
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740 862
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741 863
                  try {
@@ -748,7 +870,9 @@  discard block
 block discarded – undo
748 870
                 return $all;
749 871
         }
750 872
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751
-		if ($filter_name == '') $filter_name = $this->filter_name;
873
+		if ($filter_name == '') {
874
+			$filter_name = $this->filter_name;
875
+		}
752 876
     		global $globalArchiveMonths, $globalDBdriver;
753 877
     		if ($globalDBdriver == 'mysql') {
754 878
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -767,7 +891,9 @@  discard block
 block discarded – undo
767 891
         }
768 892
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769 893
     		global $globalArchiveMonths, $globalDBdriver;
770
-		if ($filter_name == '') $filter_name = $this->filter_name;
894
+		if ($filter_name == '') {
895
+			$filter_name = $this->filter_name;
896
+		}
771 897
     		if ($globalDBdriver == 'mysql') {
772 898
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
773 899
 		} else {
@@ -785,7 +911,9 @@  discard block
 block discarded – undo
785 911
         }
786 912
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787 913
     		global $globalArchiveMonths, $globalDBdriver;
788
-		if ($filter_name == '') $filter_name = $this->filter_name;
914
+		if ($filter_name == '') {
915
+			$filter_name = $this->filter_name;
916
+		}
789 917
     		if ($globalDBdriver == 'mysql') {
790 918
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791 919
                 } else {
@@ -802,7 +930,9 @@  discard block
 block discarded – undo
802 930
         }
803 931
 	public function getStatsAirlineTotal($filter_name = '') {
804 932
     		global $globalArchiveMonths, $globalDBdriver;
805
-		if ($filter_name == '') $filter_name = $this->filter_name;
933
+		if ($filter_name == '') {
934
+			$filter_name = $this->filter_name;
935
+		}
806 936
     		if ($globalDBdriver == 'mysql') {
807 937
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808 938
                 } else {
@@ -819,7 +949,9 @@  discard block
 block discarded – undo
819 949
         }
820 950
 	public function getStatsOwnerTotal($filter_name = '') {
821 951
     		global $globalArchiveMonths, $globalDBdriver;
822
-		if ($filter_name == '') $filter_name = $this->filter_name;
952
+		if ($filter_name == '') {
953
+			$filter_name = $this->filter_name;
954
+		}
823 955
     		if ($globalDBdriver == 'mysql') {
824 956
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 957
 		} else {
@@ -836,7 +968,9 @@  discard block
 block discarded – undo
836 968
         }
837 969
 	public function getStatsPilotTotal($filter_name = '') {
838 970
     		global $globalArchiveMonths, $globalDBdriver;
839
-		if ($filter_name == '') $filter_name = $this->filter_name;
971
+		if ($filter_name == '') {
972
+			$filter_name = $this->filter_name;
973
+		}
840 974
     		if ($globalDBdriver == 'mysql') {
841 975
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842 976
             	} else {
@@ -854,7 +988,9 @@  discard block
 block discarded – undo
854 988
 
855 989
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 990
 		global $globalDBdriver;
857
-		if ($filter_name == '') $filter_name = $this->filter_name;
991
+		if ($filter_name == '') {
992
+			$filter_name = $this->filter_name;
993
+		}
858 994
 		if ($globalDBdriver == 'mysql') {
859 995
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
860 996
                 } else {
@@ -870,7 +1006,9 @@  discard block
 block discarded – undo
870 1006
         }
871 1007
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 1008
 		global $globalDBdriver;
873
-		if ($filter_name == '') $filter_name = $this->filter_name;
1009
+		if ($filter_name == '') {
1010
+			$filter_name = $this->filter_name;
1011
+		}
874 1012
 		if ($globalDBdriver == 'mysql') {
875 1013
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
876 1014
 		} else {
@@ -1356,7 +1494,9 @@  discard block
 block discarded – undo
1356 1494
 			echo 'Update stats !'."\n";
1357 1495
 			if (isset($last_update[0]['value'])) {
1358 1496
 				$last_update_day = $last_update[0]['value'];
1359
-			} else $last_update_day = '2012-12-12 12:12:12';
1497
+			} else {
1498
+				$last_update_day = '2012-12-12 12:12:12';
1499
+			}
1360 1500
 			$Spotter = new Spotter($this->db);
1361 1501
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1362 1502
 			foreach ($alldata as $number) {
@@ -1395,7 +1535,9 @@  discard block
 block discarded – undo
1395 1535
     				$icao = $value['airport_departure_icao'];
1396 1536
         			if (isset($alldata[$icao])) {
1397 1537
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1398
-        			} else $alldata[$icao] = $value;
1538
+        			} else {
1539
+        				$alldata[$icao] = $value;
1540
+        			}
1399 1541
 			}
1400 1542
     			$count = array();
1401 1543
     			foreach ($alldata as $key => $row) {
@@ -1416,7 +1558,9 @@  discard block
 block discarded – undo
1416 1558
     				$icao = $value['airport_arrival_icao'];
1417 1559
         			if (isset($alldata[$icao])) {
1418 1560
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1419
-	        		} else $alldata[$icao] = $value;
1561
+	        		} else {
1562
+	        			$alldata[$icao] = $value;
1563
+	        		}
1420 1564
     			}
1421 1565
         		$count = array();
1422 1566
         		foreach ($alldata as $key => $row) {
@@ -1442,7 +1586,9 @@  discard block
 block discarded – undo
1442 1586
 			$alldata = $Spotter->countAllMonths();
1443 1587
 			$lastyear = false;
1444 1588
 			foreach ($alldata as $number) {
1445
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1589
+				if ($number['year_name'] != date('Y')) {
1590
+					$lastyear = true;
1591
+				}
1446 1592
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1447 1593
 			}
1448 1594
 			$alldata = $Spotter->countAllMilitaryMonths();
@@ -1659,7 +1805,9 @@  discard block
 block discarded – undo
1659 1805
 			$alldata = $Spotter->countAllMonthsByAirlines();
1660 1806
 			$lastyear = false;
1661 1807
 			foreach ($alldata as $number) {
1662
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1808
+				if ($number['year_name'] != date('Y')) {
1809
+					$lastyear = true;
1810
+				}
1663 1811
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1664 1812
 			}
1665 1813
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
@@ -1751,7 +1899,9 @@  discard block
 block discarded – undo
1751 1899
 			}
1752 1900
 			
1753 1901
 
1754
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
1902
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
1903
+				$globalStatsFilters = array();
1904
+			}
1755 1905
 			foreach ($globalStatsFilters as $name => $filter) {
1756 1906
 				//$filter_name = $filter['name'];
1757 1907
 				$filter_name = $name;
@@ -1827,7 +1977,9 @@  discard block
 block discarded – undo
1827 1977
 				$alldata = $Spotter->countAllMonths($filter);
1828 1978
 				$lastyear = false;
1829 1979
 				foreach ($alldata as $number) {
1830
-					if ($number['year_name'] != date('Y')) $lastyear = true;
1980
+					if ($number['year_name'] != date('Y')) {
1981
+						$lastyear = true;
1982
+					}
1831 1983
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1832 1984
 				}
1833 1985
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +68 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,8 +18,12 @@  discard block
 block discarded – undo
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilter, $globalFilterName;
21
-		if (is_array($globalStatsFilter) && isset($globalStatsFilter[$globalFilterName])) $filter = array_merge($globalStatsFilter[$globalFilterName],$filter);
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalStatsFilter) && isset($globalStatsFilter[$globalFilterName])) {
22
+			$filter = array_merge($globalStatsFilter[$globalFilterName],$filter);
23
+		}
24
+		if (is_array($globalFilter)) {
25
+			$filter = array_merge($globalFilter,$filter);
26
+		}
23 27
 		$filter_query_join = '';
24 28
 		$filter_query_where = '';
25 29
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +48,11 @@  discard block
 block discarded – undo
44 48
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 49
 			}
46 50
 		}
47
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
51
+		if ($filter_query_where == '' && $where) {
52
+			$filter_query_where = ' WHERE';
53
+		} elseif ($filter_query_where != '' && $and) {
54
+			$filter_query_where .= ' AND';
55
+		}
49 56
 		$filter_query = $filter_query_join.$filter_query_where;
50 57
 		return $filter_query;
51 58
 	}
@@ -81,7 +88,9 @@  discard block
 block discarded – undo
81 88
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
82 89
 		}
83 90
 
84
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
91
+		if (!isset($globalLiveInterval)) {
92
+			$globalLiveInterval = '200';
93
+		}
85 94
 		if ($globalDBdriver == 'mysql') {
86 95
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
87 96
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -106,7 +115,9 @@  discard block
 block discarded – undo
106 115
 
107 116
 		$filter_query = $this->getFilter($filter);
108 117
 
109
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
118
+		if (!isset($globalLiveInterval)) {
119
+			$globalLiveInterval = '200';
120
+		}
110 121
 		if ($globalDBdriver == 'mysql') {
111 122
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
112 123
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -155,7 +166,9 @@  discard block
 block discarded – undo
155 166
 
156 167
 		$filter_query = $this->getFilter($filter,true,true);
157 168
 
158
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
169
+		if (!isset($globalLiveInterval)) {
170
+			$globalLiveInterval = '200';
171
+		}
159 172
 		if ($globalDBdriver == 'mysql') {
160 173
 
161 174
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -195,7 +208,9 @@  discard block
 block discarded – undo
195 208
 		global $globalDBdriver, $globalLiveInterval;
196 209
 		$filter_query = $this->getFilter($filter,true,true);
197 210
 
198
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
211
+		if (!isset($globalLiveInterval)) {
212
+			$globalLiveInterval = '200';
213
+		}
199 214
 		if ($globalDBdriver == 'mysql') {
200 215
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
201 216
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -225,7 +240,9 @@  discard block
 block discarded – undo
225 240
 	{
226 241
 		global $globalDBdriver, $globalLiveInterval;
227 242
 		$Spotter = new Spotter($this->db);
228
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
243
+		if (!isset($globalLiveInterval)) {
244
+			$globalLiveInterval = '200';
245
+		}
229 246
 		$filter_query = $this->getFilter($filter);
230 247
 
231 248
 		if (is_array($coord)) {
@@ -233,7 +250,9 @@  discard block
 block discarded – undo
233 250
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
234 251
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
235 252
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
236
-		} else return array();
253
+		} else {
254
+			return array();
255
+		}
237 256
 		if ($globalDBdriver == 'mysql') {
238 257
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
239 258
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -424,11 +443,15 @@  discard block
 block discarded – undo
424 443
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
425 444
 		if ($globalDBdriver == 'mysql') {
426 445
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
427
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
446
+			if ($liveinterval) {
447
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
448
+			}
428 449
 			$query .= ' ORDER BY date';
429 450
 		} else {
430 451
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
431
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
452
+			if ($liveinterval) {
453
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
454
+			}
432 455
 			$query .= ' ORDER BY date';
433 456
 		}
434 457
 
@@ -523,7 +546,9 @@  discard block
 block discarded – undo
523 546
 				$i++;
524 547
 				$j++;
525 548
 				if ($j == 30) {
526
-					if ($globalDebug) echo ".";
549
+					if ($globalDebug) {
550
+						echo ".";
551
+					}
527 552
 				    	try {
528 553
 						
529 554
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -855,7 +880,9 @@  discard block
 block discarded – undo
855 880
 			{
856 881
 				return false;
857 882
 			}
858
-		} else $altitude = 0;
883
+		} else {
884
+			$altitude = 0;
885
+		}
859 886
 
860 887
 		if ($heading != '')
861 888
 		{
@@ -863,7 +890,9 @@  discard block
 block discarded – undo
863 890
 			{
864 891
 				return false;
865 892
 			}
866
-		} else $heading = 0;
893
+		} else {
894
+			$heading = 0;
895
+		}
867 896
 
868 897
 		if ($groundspeed != '')
869 898
 		{
@@ -871,9 +900,13 @@  discard block
 block discarded – undo
871 900
 			{
872 901
 				return false;
873 902
 			}
874
-		} else $groundspeed = 0;
903
+		} else {
904
+			$groundspeed = 0;
905
+		}
875 906
 		date_default_timezone_set('UTC');
876
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
907
+		if ($date == '') {
908
+			$date = date("Y-m-d H:i:s", time());
909
+		}
877 910
 
878 911
         
879 912
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -917,10 +950,18 @@  discard block
 block discarded – undo
917 950
 		$arrival_airport_country = '';
918 951
 		
919 952
             	
920
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
921
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
922
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
923
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
953
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
954
+            		$squawk = NULL;
955
+            	}
956
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
957
+            		$verticalrate = NULL;
958
+            	}
959
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
960
+            		$groundspeed = 0;
961
+            	}
962
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
963
+            		$heading = 0;
964
+            	}
924 965
             	
925 966
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
926 967
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -935,9 +976,13 @@  discard block
 block discarded – undo
935 976
                 	return "error : ".$e->getMessage();
936 977
                 }
937 978
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
938
-		    if ($globalDebug) echo '(Add to SBS archive : ';
979
+		    if ($globalDebug) {
980
+		    	echo '(Add to SBS archive : ';
981
+		    }
939 982
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
940
-		    if ($globalDebug) echo $result.')';
983
+		    if ($globalDebug) {
984
+		    	echo $result.')';
985
+		    }
941 986
 		}
942 987
 		return "success";
943 988
 
Please login to merge, or discard this patch.
airport.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	  $limit_start = 0;
14 14
 	  $limit_end = 25;
15 15
 	  $absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
Please login to merge, or discard this patch.