Completed
Push — master ( a24ad0...3afeea )
by Yannick
07:21
created
require/class.Spotter.php 1 patch
Braces   +737 added lines, -258 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
 		if (isset($filter[0]['source'])) {
73 73
 			$filters = array_merge($filters,$filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) {
76
+			$filter = array_merge($filter,$globalFilter);
77
+		}
76 78
 		$filter_query_join = '';
77 79
 		$filter_query_where = '';
78 80
 		foreach($filters as $flt) {
@@ -156,8 +158,11 @@  discard block
 block discarded – undo
156 158
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
157 159
 			}
158 160
 		}
159
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161
+		if ($filter_query_where == '' && $where) {
162
+			$filter_query_where = ' WHERE';
163
+		} elseif ($filter_query_where != '' && $and) {
164
+			$filter_query_where .= ' AND';
165
+		}
161 166
 		if ($filter_query_where != '') {
162 167
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
163 168
 		}
@@ -180,10 +185,18 @@  discard block
 block discarded – undo
180 185
 		$Image = new Image($this->db);
181 186
 		$Schedule = new Schedule($this->db);
182 187
 		$ACARS = new ACARS($this->db);
183
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
184
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
185
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
186
-		if (!isset($globalVAM)) $globalVAM = FALSE;
188
+		if (!isset($globalIVAO)) {
189
+			$globalIVAO = FALSE;
190
+		}
191
+		if (!isset($globalVATSIM)) {
192
+			$globalVATSIM = FALSE;
193
+		}
194
+		if (!isset($globalphpVMS)) {
195
+			$globalphpVMS = FALSE;
196
+		}
197
+		if (!isset($globalVAM)) {
198
+			$globalVAM = FALSE;
199
+		}
187 200
 		date_default_timezone_set('UTC');
188 201
 		
189 202
 		if (!is_string($query))
@@ -230,21 +243,35 @@  discard block
 block discarded – undo
230 243
 			} else {
231 244
 				$temp_array['spotter_id'] = '';
232 245
 			}
233
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
234
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
246
+			if (isset($row['flightaware_id'])) {
247
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
248
+			}
249
+			if (isset($row['modes'])) {
250
+				$temp_array['modes'] = $row['modes'];
251
+			}
235 252
 			$temp_array['ident'] = $row['ident'];
236 253
 			if (isset($row['registration']) && $row['registration'] != '') {
237 254
 				$temp_array['registration'] = $row['registration'];
238 255
 			} elseif (isset($temp_array['modes'])) {
239 256
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
240
-			} else $temp_array['registration'] = '';
241
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
257
+			} else {
258
+				$temp_array['registration'] = '';
259
+			}
260
+			if (isset($row['aircraft_icao'])) {
261
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
262
+			}
242 263
 			
243 264
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
244 265
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
245
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
246
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
247
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
266
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
267
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
268
+			}
269
+			if (isset($row['latitude'])) {
270
+				$temp_array['latitude'] = $row['latitude'];
271
+			}
272
+			if (isset($row['longitude'])) {
273
+				$temp_array['longitude'] = $row['longitude'];
274
+			}
248 275
 			/*
249 276
 			if (Connection->tableExists('countries')) {
250 277
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -254,8 +281,12 @@  discard block
 block discarded – undo
254 281
 				}
255 282
 			}
256 283
 			*/
257
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
258
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
284
+			if (isset($row['waypoints'])) {
285
+				$temp_array['waypoints'] = $row['waypoints'];
286
+			}
287
+			if (isset($row['format_source'])) {
288
+				$temp_array['format_source'] = $row['format_source'];
289
+			}
259 290
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 291
 				$temp_array['route_stop'] = $row['route_stop'];
261 292
 				$allroute = explode(' ',$row['route_stop']);
@@ -271,13 +302,19 @@  discard block
 block discarded – undo
271 302
 					}
272 303
 				}
273 304
 			}
274
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
305
+			if (isset($row['altitude'])) {
306
+				$temp_array['altitude'] = $row['altitude'];
307
+			}
275 308
 			if (isset($row['heading'])) {
276 309
 				$temp_array['heading'] = $row['heading'];
277 310
 				$heading_direction = $this->parseDirection($row['heading']);
278
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
311
+				if (isset($heading_direction[0]['direction_fullname'])) {
312
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
313
+				}
314
+			}
315
+			if (isset($row['ground_speed'])) {
316
+				$temp_array['ground_speed'] = $row['ground_speed'];
279 317
 			}
280
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
281 318
 			$temp_array['image'] = "";
282 319
 			$temp_array['image_thumbnail'] = "";
283 320
 			$temp_array['image_source'] = "";
@@ -285,7 +322,9 @@  discard block
 block discarded – undo
285 322
  
286 323
 			if (isset($row['highlight'])) {
287 324
 				$temp_array['highlight'] = $row['highlight'];
288
-			} else $temp_array['highlight'] = '';
325
+			} else {
326
+				$temp_array['highlight'] = '';
327
+			}
289 328
 			
290 329
 			if (isset($row['date'])) {
291 330
 				$dateArray = $this->parseDateString($row['date']);
@@ -341,7 +380,9 @@  discard block
 block discarded – undo
341 380
 				
342 381
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 382
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344
-					} else $temp_array['aircraft_shadow'] = 'default.png';
383
+					} else {
384
+						$temp_array['aircraft_shadow'] = 'default.png';
385
+					}
345 386
                                 } else {
346 387
                             		$temp_array['aircraft_shadow'] = 'default.png';
347 388
 					$temp_array['aircraft_name'] = 'N/A';
@@ -349,11 +390,17 @@  discard block
 block discarded – undo
349 390
                             	}
350 391
 			}
351 392
 			$fromsource = NULL;
352
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
353
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
354
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
355
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
356
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
393
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
394
+				$fromsource = $globalAirlinesSource;
395
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
396
+				$fromsource = 'vatsim';
397
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
398
+				$fromsource = 'ivao';
399
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
400
+				$fromsource = 'vatsim';
401
+			} elseif (isset($globalIVAO) && $globalIVAO) {
402
+				$fromsource = 'ivao';
403
+			}
357 404
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 405
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 406
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -376,12 +423,18 @@  discard block
 block discarded – undo
376 423
 				}
377 424
 			} else {
378 425
 				$temp_array['airline_icao'] = $row['airline_icao'];
379
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
380
-				else $temp_array['airline_iata'] = 'N/A';
426
+				if (isset($row['airline_iata'])) {
427
+					$temp_array['airline_iata'] = $row['airline_iata'];
428
+				} else {
429
+					$temp_array['airline_iata'] = 'N/A';
430
+				}
381 431
 				$temp_array['airline_name'] = $row['airline_name'];
382 432
 				$temp_array['airline_country'] = $row['airline_country'];
383
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
384
-				else $temp_array['airline_callsign'] = 'N/A';
433
+				if (isset($row['airline_callsign'])) {
434
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
435
+				} else {
436
+					$temp_array['airline_callsign'] = 'N/A';
437
+				}
385 438
 				$temp_array['airline_type'] = $row['airline_type'];
386 439
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
387 440
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -408,7 +461,9 @@  discard block
 block discarded – undo
408 461
 			}
409 462
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
410 463
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
411
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
464
+				if ($owner_info['owner'] != '') {
465
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
466
+				}
412 467
 				$temp_array['aircraft_base'] = $owner_info['base'];
413 468
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 469
 			}
@@ -416,10 +471,16 @@  discard block
 block discarded – undo
416 471
 			if($temp_array['registration'] != "" || (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 472
 			{
418 473
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
421
-				} elseif (isset($temp_array['aircraft_type'])) $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type']);
422
-				else $image_array = $Image->getSpotterImage($temp_array['registration']);
474
+					if (isset($temp_array['airline_icao'])) {
475
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
476
+					} else {
477
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
478
+					}
479
+				} elseif (isset($temp_array['aircraft_type'])) {
480
+					$image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type']);
481
+				} else {
482
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
483
+				}
423 484
 				if (count($image_array) > 0) {
424 485
 					$temp_array['image'] = $image_array[0]['image'];
425 486
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -471,7 +532,9 @@  discard block
 block discarded – undo
471 532
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
472 533
 			if ($row['departure_airport_icao'] != '') {
473 534
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
474
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
535
+				if (!isset($departure_airport_array[0]['name'])) {
536
+					$departure_airport_array = $this->getAllAirportInfo('NA');
537
+				}
475 538
 			/*
476 539
 			} elseif ($row['departure_airport_name'] != '') {
477 540
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -479,7 +542,9 @@  discard block
 block discarded – undo
479 542
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
480 543
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
481 544
 			*/
482
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
545
+			} else {
546
+				$departure_airport_array = $this->getAllAirportInfo('NA');
547
+			}
483 548
 			if (isset($departure_airport_array[0]['name'])) {
484 549
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
485 550
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -499,8 +564,12 @@  discard block
 block discarded – undo
499 564
 			
500 565
 			if ($row['arrival_airport_icao'] != '') {
501 566
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
502
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
503
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
567
+				if (count($arrival_airport_array) == 0) {
568
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
569
+				}
570
+			} else {
571
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
572
+			}
504 573
 			if (isset($arrival_airport_array[0]['name'])) {
505 574
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
506 575
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -516,27 +585,45 @@  discard block
 block discarded – undo
516 585
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
517 586
 			}
518 587
 			*/
519
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
520
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
521
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
522
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
523
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
588
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
589
+				$temp_array['pilot_id'] = $row['pilot_id'];
590
+			}
591
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
592
+				$temp_array['pilot_name'] = $row['pilot_name'];
593
+			}
594
+			if (isset($row['source_name']) && $row['source_name'] != '') {
595
+				$temp_array['source_name'] = $row['source_name'];
596
+			}
597
+			if (isset($row['over_country']) && $row['over_country'] != '') {
598
+				$temp_array['over_country'] = $row['over_country'];
599
+			}
600
+			if (isset($row['distance']) && $row['distance'] != '') {
601
+				$temp_array['distance'] = $row['distance'];
602
+			}
524 603
 			if (isset($row['squawk'])) {
525 604
 				$temp_array['squawk'] = $row['squawk'];
526 605
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
527 606
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
528
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
607
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
608
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
609
+					}
529 610
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
530 611
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
531
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
532
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
612
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
613
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
614
+					}
615
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
616
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
617
+				}
533 618
 			}
534 619
     			
535 620
 			$temp_array['query_number_rows'] = $num_rows;
536 621
 			
537 622
 			$spotter_array[] = $temp_array;
538 623
 		}
539
-		if ($num_rows == 0) return array();
624
+		if ($num_rows == 0) {
625
+			return array();
626
+		}
540 627
 		$spotter_array[0]['query_number_rows'] = $num_rows;
541 628
 		return $spotter_array;
542 629
 	}	
@@ -569,7 +656,9 @@  discard block
 block discarded – undo
569 656
 				foreach ($q_array as $q_item){
570 657
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
571 658
 					$additional_query .= " AND (";
572
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
659
+					if (is_int($q_item)) {
660
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
661
+					}
573 662
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
574 663
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
575 664
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -590,7 +679,9 @@  discard block
 block discarded – undo
590 679
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
591 680
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
592 681
 					$translate = $Translation->ident2icao($q_item);
593
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
682
+					if ($translate != $q_item) {
683
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
684
+					}
594 685
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
595 686
 					$additional_query .= ")";
596 687
 				}
@@ -817,7 +908,9 @@  discard block
 block discarded – undo
817 908
 				date_default_timezone_set($globalTimezone);
818 909
 				$datetime = new DateTime();
819 910
 				$offset = $datetime->format('P');
820
-			} else $offset = '+00:00';
911
+			} else {
912
+				$offset = '+00:00';
913
+			}
821 914
 
822 915
 			if ($date_array[1] != "")
823 916
 			{
@@ -849,8 +942,12 @@  discard block
 block discarded – undo
849 942
 			{
850 943
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
851 944
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
852
-			} else $limit_query = "";
853
-		} else $limit_query = "";
945
+			} else {
946
+				$limit_query = "";
947
+			}
948
+		} else {
949
+			$limit_query = "";
950
+		}
854 951
 
855 952
 
856 953
 		if ($sort != "")
@@ -918,8 +1015,12 @@  discard block
 block discarded – undo
918 1015
 			{
919 1016
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
920 1017
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
921
-			} else $limit_query = "";
922
-		} else $limit_query = "";
1018
+			} else {
1019
+				$limit_query = "";
1020
+			}
1021
+		} else {
1022
+			$limit_query = "";
1023
+		}
923 1024
 		
924 1025
 		if ($sort != "")
925 1026
 		{
@@ -1243,7 +1344,9 @@  discard block
 block discarded – undo
1243 1344
 		global $global_query;
1244 1345
 		
1245 1346
 		date_default_timezone_set('UTC');
1246
-		if ($id == '') return array();
1347
+		if ($id == '') {
1348
+			return array();
1349
+		}
1247 1350
 		$additional_query = "spotter_output.spotter_id = :id";
1248 1351
 		$query_values = array(':id' => $id);
1249 1352
 
@@ -1358,8 +1461,11 @@  discard block
 block discarded – undo
1358 1461
 		if ($sort != "")
1359 1462
 		{
1360 1463
 			$search_orderby_array = $this->getOrderBy();
1361
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1362
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1464
+			if (isset($search_orderby_array[$sort]['sql'])) {
1465
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1466
+			} else {
1467
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1468
+			}
1363 1469
 		} else {
1364 1470
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1365 1471
 		}
@@ -1984,7 +2090,9 @@  discard block
 block discarded – undo
1984 2090
 		{
1985 2091
 			$highlight = $row['highlight'];
1986 2092
 		}
1987
-		if (isset($highlight)) return $highlight;
2093
+		if (isset($highlight)) {
2094
+			return $highlight;
2095
+		}
1988 2096
 	}
1989 2097
 
1990 2098
 	
@@ -2012,7 +2120,9 @@  discard block
 block discarded – undo
2012 2120
 		$sth->closeCursor();
2013 2121
 		if (count($row) > 0) {
2014 2122
 			return $row['usage'];
2015
-		} else return '';
2123
+		} else {
2124
+			return '';
2125
+		}
2016 2126
 	}
2017 2127
 
2018 2128
 	/**
@@ -2037,7 +2147,9 @@  discard block
 block discarded – undo
2037 2147
 		$sth->closeCursor();
2038 2148
 		if (count($row) > 0) {
2039 2149
 			return $row['icao'];
2040
-		} else return '';
2150
+		} else {
2151
+			return '';
2152
+		}
2041 2153
 	}
2042 2154
 
2043 2155
 	/**
@@ -2065,7 +2177,9 @@  discard block
 block discarded – undo
2065 2177
 			$airport_longitude = $row['longitude'];
2066 2178
 			$Common = new Common();
2067 2179
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2068
-		} else return '';
2180
+		} else {
2181
+			return '';
2182
+		}
2069 2183
 	}
2070 2184
 	
2071 2185
 	/**
@@ -2177,7 +2291,9 @@  discard block
 block discarded – undo
2177 2291
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178 2292
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2179 2293
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2180
-		} else return array();
2294
+		} else {
2295
+			return array();
2296
+		}
2181 2297
 		if ($globalDBdriver == 'mysql') {
2182 2298
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2183 2299
 		} else {
@@ -2212,7 +2328,9 @@  discard block
 block discarded – undo
2212 2328
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213 2329
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2214 2330
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2215
-		} else return array();
2331
+		} else {
2332
+			return array();
2333
+		}
2216 2334
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2217 2335
 		$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.")";
2218 2336
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2247,7 +2365,9 @@  discard block
 block discarded – undo
2247 2365
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2248 2366
 	{
2249 2367
 		global $globalUseRealAirlines;
2250
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2368
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2369
+			$fromsource = NULL;
2370
+		}
2251 2371
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2252 2372
 		if ($airline_icao == 'NA') {
2253 2373
 			$airline_array = array();
@@ -2316,7 +2436,9 @@  discard block
 block discarded – undo
2316 2436
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2317 2437
 	{
2318 2438
 		global $globalUseRealAirlines;
2319
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2439
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2440
+			$fromsource = NULL;
2441
+		}
2320 2442
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2321 2443
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2322 2444
 		$sth = $this->db->prepare($query);
@@ -2332,7 +2454,9 @@  discard block
 block discarded – undo
2332 2454
 			$sth->execute(array(':fromsource' => $fromsource));
2333 2455
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2334 2456
 			$sth->closeCursor();
2335
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2457
+			if ($row['nb'] == 0) {
2458
+				$result = $this->getAllAirlineInfoByName($airline_name);
2459
+			}
2336 2460
 		}
2337 2461
 		return $result;
2338 2462
 	}
@@ -2395,15 +2519,20 @@  discard block
 block discarded – undo
2395 2519
 				'A320-211' => 'A320',
2396 2520
 				'747-8i' => 'B748',
2397 2521
 				'A380' => 'A388');
2398
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2522
+		if (isset($all_aircraft[$aircraft_type])) {
2523
+			return $all_aircraft[$aircraft_type];
2524
+		}
2399 2525
 
2400 2526
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2401 2527
 		$aircraft_type = strtoupper($aircraft_type);
2402 2528
 		$sth = $this->db->prepare($query);
2403 2529
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2404 2530
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2405
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2406
-		else return '';
2531
+		if (isset($result[0]['icao'])) {
2532
+			return $result[0]['icao'];
2533
+		} else {
2534
+			return '';
2535
+		}
2407 2536
 	}
2408 2537
 	
2409 2538
 	/**
@@ -2431,11 +2560,15 @@  discard block
 block discarded – undo
2431 2560
 		$sth->closeCursor();
2432 2561
 		if (isset($row['icaotypecode'])) {
2433 2562
 			$icao = $row['icaotypecode'];
2434
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2563
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2564
+				$icao = $this->aircraft_correct_icaotype[$icao];
2565
+			}
2435 2566
 			return $icao;
2436 2567
 		} elseif ($source_type == 'flarm') {
2437 2568
 			return $this->getAllAircraftType($aircraft_modes);
2438
-		} else  return '';
2569
+		} else {
2570
+			return '';
2571
+		}
2439 2572
 	}
2440 2573
 
2441 2574
 	/**
@@ -2458,7 +2591,9 @@  discard block
 block discarded – undo
2458 2591
 		$sth->closeCursor();
2459 2592
 		if (isset($row['icaotypecode'])) {
2460 2593
 			return $row['icaotypecode'];
2461
-		} else return '';
2594
+		} else {
2595
+			return '';
2596
+		}
2462 2597
 	}
2463 2598
 
2464 2599
 	/**
@@ -2504,7 +2639,9 @@  discard block
 block discarded – undo
2504 2639
 		$sth->closeCursor();
2505 2640
 		if (isset($row['operator_correct'])) {
2506 2641
 			return $row['operator_correct'];
2507
-		} else return $operator;
2642
+		} else {
2643
+			return $operator;
2644
+		}
2508 2645
 	}
2509 2646
 
2510 2647
 	/**
@@ -2517,7 +2654,9 @@  discard block
 block discarded – undo
2517 2654
 	public function getRouteInfo($callsign)
2518 2655
 	{
2519 2656
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2520
-                if ($callsign == '') return array();
2657
+                if ($callsign == '') {
2658
+                	return array();
2659
+                }
2521 2660
 		$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";
2522 2661
 		
2523 2662
 		$sth = $this->db->prepare($query);
@@ -2527,7 +2666,9 @@  discard block
 block discarded – undo
2527 2666
 		$sth->closeCursor();
2528 2667
 		if (count($row) > 0) {
2529 2668
 			return $row;
2530
-		} else return array();
2669
+		} else {
2670
+			return array();
2671
+		}
2531 2672
 	}
2532 2673
 	
2533 2674
 	/**
@@ -2580,7 +2721,9 @@  discard block
 block discarded – undo
2580 2721
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2581 2722
 			$sth->closeCursor();
2582 2723
 			return $result;
2583
-		} else return array();
2724
+		} else {
2725
+			return array();
2726
+		}
2584 2727
 	}
2585 2728
 	
2586 2729
   
@@ -2739,8 +2882,11 @@  discard block
 block discarded – undo
2739 2882
 		$query .= " ORDER BY spotter_output.source_name ASC";
2740 2883
 
2741 2884
 		$sth = $this->db->prepare($query);
2742
-		if (!empty($query_values)) $sth->execute($query_values);
2743
-		else $sth->execute();
2885
+		if (!empty($query_values)) {
2886
+			$sth->execute($query_values);
2887
+		} else {
2888
+			$sth->execute();
2889
+		}
2744 2890
 
2745 2891
 		$source_array = array();
2746 2892
 		$temp_array = array();
@@ -2773,9 +2919,13 @@  discard block
 block discarded – undo
2773 2919
 								WHERE spotter_output.airline_icao <> '' 
2774 2920
 								ORDER BY spotter_output.airline_name ASC";
2775 2921
 			*/
2776
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2777
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2778
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2922
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2923
+				$forsource = $globalAirlinesSource;
2924
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2925
+				$forsource = 'vatsim';
2926
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2927
+				$forsource = 'ivao';
2928
+			}
2779 2929
 			if ($forsource === NULL) {
2780 2930
 				$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";
2781 2931
 				$query_data = array();
@@ -2818,9 +2968,13 @@  discard block
 block discarded – undo
2818 2968
 	{
2819 2969
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2820 2970
 		$filter_query = $this->getFilter($filters,true,true);
2821
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2822
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2823
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2971
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2972
+			$forsource = $globalAirlinesSource;
2973
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2974
+			$forsource = 'vatsim';
2975
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2976
+			$forsource = 'ivao';
2977
+		}
2824 2978
 		if ($forsource === NULL) {
2825 2979
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2826 2980
 			$query_data = array();
@@ -3131,7 +3285,9 @@  discard block
 block discarded – undo
3131 3285
 			date_default_timezone_set($globalTimezone);
3132 3286
 			$datetime = new DateTime();
3133 3287
 			$offset = $datetime->format('P');
3134
-		} else $offset = '+00:00';
3288
+		} else {
3289
+			$offset = '+00:00';
3290
+		}
3135 3291
 		if ($airport_icao == '') {
3136 3292
 			if ($globalDBdriver == 'mysql') {
3137 3293
 				$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`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' 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";
@@ -3163,7 +3319,9 @@  discard block
 block discarded – undo
3163 3319
 			date_default_timezone_set($globalTimezone);
3164 3320
 			$datetime = new DateTime();
3165 3321
 			$offset = $datetime->format('P');
3166
-		} else $offset = '+00:00';
3322
+		} else {
3323
+			$offset = '+00:00';
3324
+		}
3167 3325
 		if ($airport_icao == '') {
3168 3326
 			if ($globalDBdriver == 'mysql') {
3169 3327
 				$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 departure_airport_icao <> '' 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";
@@ -3196,7 +3354,9 @@  discard block
 block discarded – undo
3196 3354
 			date_default_timezone_set($globalTimezone);
3197 3355
 			$datetime = new DateTime();
3198 3356
 			$offset = $datetime->format('P');
3199
-		} else $offset = '+00:00';
3357
+		} else {
3358
+			$offset = '+00:00';
3359
+		}
3200 3360
 		if ($airport_icao == '') {
3201 3361
 			if ($globalDBdriver == 'mysql') {
3202 3362
 				$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 
@@ -3235,7 +3395,9 @@  discard block
 block discarded – undo
3235 3395
 			date_default_timezone_set($globalTimezone);
3236 3396
 			$datetime = new DateTime();
3237 3397
 			$offset = $datetime->format('P');
3238
-		} else $offset = '+00:00';
3398
+		} else {
3399
+			$offset = '+00:00';
3400
+		}
3239 3401
 		if ($airport_icao == '') {
3240 3402
 			if ($globalDBdriver == 'mysql') {
3241 3403
 				$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 
@@ -3280,7 +3442,9 @@  discard block
 block discarded – undo
3280 3442
 			date_default_timezone_set($globalTimezone);
3281 3443
 			$datetime = new DateTime();
3282 3444
 			$offset = $datetime->format('P');
3283
-		} else $offset = '+00:00';
3445
+		} else {
3446
+			$offset = '+00:00';
3447
+		}
3284 3448
 		if ($airport_icao == '') {
3285 3449
 			if ($globalDBdriver == 'mysql') {
3286 3450
 				$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`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' 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";
@@ -3315,7 +3479,9 @@  discard block
 block discarded – undo
3315 3479
 			date_default_timezone_set($globalTimezone);
3316 3480
 			$datetime = new DateTime();
3317 3481
 			$offset = $datetime->format('P');
3318
-		} else $offset = '+00:00';
3482
+		} else {
3483
+			$offset = '+00:00';
3484
+		}
3319 3485
 		if ($airport_icao == '') {
3320 3486
 			if ($globalDBdriver == 'mysql') {
3321 3487
 				$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 
@@ -3357,7 +3523,9 @@  discard block
 block discarded – undo
3357 3523
 			date_default_timezone_set($globalTimezone);
3358 3524
 			$datetime = new DateTime();
3359 3525
 			$offset = $datetime->format('P');
3360
-		} else $offset = '+00:00';
3526
+		} else {
3527
+			$offset = '+00:00';
3528
+		}
3361 3529
 		if ($airport_icao == '') {
3362 3530
 			if ($globalDBdriver == 'mysql') {
3363 3531
 				$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 arrival_airport_icao <> '' 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";
@@ -3391,7 +3559,9 @@  discard block
 block discarded – undo
3391 3559
 			date_default_timezone_set($globalTimezone);
3392 3560
 			$datetime = new DateTime();
3393 3561
 			$offset = $datetime->format('P');
3394
-		} else $offset = '+00:00';
3562
+		} else {
3563
+			$offset = '+00:00';
3564
+		}
3395 3565
 		if ($airport_icao == '') {
3396 3566
 			if ($globalDBdriver == 'mysql') {
3397 3567
 				$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 
@@ -3439,7 +3609,9 @@  discard block
 block discarded – undo
3439 3609
 			date_default_timezone_set($globalTimezone);
3440 3610
 			$datetime = new DateTime();
3441 3611
 			$offset = $datetime->format('P');
3442
-		} else $offset = '+00:00';
3612
+		} else {
3613
+			$offset = '+00:00';
3614
+		}
3443 3615
 
3444 3616
 		if ($globalDBdriver == 'mysql') {
3445 3617
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3559,7 +3731,9 @@  discard block
 block discarded – undo
3559 3731
 	*/	
3560 3732
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3561 3733
 	{
3562
-		if ($groundspeed == '') $groundspeed = NULL;
3734
+		if ($groundspeed == '') {
3735
+			$groundspeed = NULL;
3736
+		}
3563 3737
 		$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';
3564 3738
                 $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);
3565 3739
 
@@ -3609,10 +3783,18 @@  discard block
 block discarded – undo
3609 3783
 		$Image = new Image($this->db);
3610 3784
 		$Common = new Common();
3611 3785
 		
3612
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3613
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3614
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3615
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3786
+		if (!isset($globalIVAO)) {
3787
+			$globalIVAO = FALSE;
3788
+		}
3789
+		if (!isset($globalVATSIM)) {
3790
+			$globalVATSIM = FALSE;
3791
+		}
3792
+		if (!isset($globalphpVMS)) {
3793
+			$globalphpVMS = FALSE;
3794
+		}
3795
+		if (!isset($globalVAM)) {
3796
+			$globalVAM = FALSE;
3797
+		}
3616 3798
 		date_default_timezone_set('UTC');
3617 3799
 		
3618 3800
 		//getting the registration
@@ -3625,23 +3807,33 @@  discard block
 block discarded – undo
3625 3807
 				if ($ModeS != '') {
3626 3808
 					$timeelapsed = microtime(true);
3627 3809
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3628
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3810
+					if ($globalDebugTimeElapsed) {
3811
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3812
+					}
3629 3813
 				} else {
3630 3814
 					$myhex = explode('-',$flightaware_id);
3631 3815
 					if (count($myhex) > 0) {
3632 3816
 						$timeelapsed = microtime(true);
3633 3817
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3634
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3818
+						if ($globalDebugTimeElapsed) {
3819
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3820
+						}
3635 3821
 					}
3636 3822
 				}
3637 3823
 			}
3638 3824
 		}
3639 3825
 		$fromsource = NULL;
3640
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3641
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3642
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3643
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3644
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3826
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3827
+			$fromsource = $globalAirlinesSource;
3828
+		} elseif ($format_source == 'vatsimtxt') {
3829
+			$fromsource = 'vatsim';
3830
+		} elseif ($format_source == 'whazzup') {
3831
+			$fromsource = 'ivao';
3832
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3833
+			$fromsource = 'vatsim';
3834
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3835
+			$fromsource = 'ivao';
3836
+		}
3645 3837
 		//getting the airline information
3646 3838
 		if ($ident != "")
3647 3839
 		{
@@ -3665,15 +3857,21 @@  discard block
 block discarded – undo
3665 3857
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3666 3858
 						$airline_array = $this->getAllAirlineInfo("NA");
3667 3859
 					}
3668
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					if ($globalDebugTimeElapsed) {
3861
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3862
+					}
3669 3863
 
3670 3864
 				} else {
3671 3865
 					$timeelapsed = microtime(true);
3672 3866
 					$airline_array = $this->getAllAirlineInfo("NA");
3673
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3867
+					if ($globalDebugTimeElapsed) {
3868
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3869
+					}
3674 3870
 				}
3675 3871
 			}
3676
-		} else $airline_array = array();
3872
+		} else {
3873
+			$airline_array = array();
3874
+		}
3677 3875
 		
3678 3876
 		//getting the aircraft information
3679 3877
 		$aircraft_array = array();
@@ -3687,27 +3885,37 @@  discard block
 block discarded – undo
3687 3885
 				{
3688 3886
 					$timeelapsed = microtime(true);
3689 3887
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3690
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3888
+					if ($globalDebugTimeElapsed) {
3889
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3890
+					}
3691 3891
 				} else {
3692 3892
 					$timeelapsed = microtime(true);
3693 3893
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3694
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3894
+					if ($globalDebugTimeElapsed) {
3895
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3896
+					}
3695 3897
 				}
3696 3898
 			}
3697 3899
 		} else {
3698 3900
 			if ($ModeS != '') {
3699 3901
 				$timeelapsed = microtime(true);
3700 3902
 				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3701
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3903
+				if ($globalDebugTimeElapsed) {
3904
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3905
+				}
3702 3906
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3703 3907
 				{
3704 3908
 					$timeelapsed = microtime(true);
3705 3909
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3706
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3910
+					if ($globalDebugTimeElapsed) {
3911
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3912
+					}
3707 3913
 				} else {
3708 3914
 					$timeelapsed = microtime(true);
3709 3915
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3710
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3916
+					if ($globalDebugTimeElapsed) {
3917
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3918
+					}
3711 3919
 				}
3712 3920
 			}
3713 3921
 		}
@@ -3723,7 +3931,9 @@  discard block
 block discarded – undo
3723 3931
 			} else {
3724 3932
 				$timeelapsed = microtime(true);
3725 3933
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3726
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3934
+				if ($globalDebugTimeElapsed) {
3935
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3936
+				}
3727 3937
 			}
3728 3938
 		}
3729 3939
 		
@@ -3738,7 +3948,9 @@  discard block
 block discarded – undo
3738 3948
 			} else {
3739 3949
 				$timeelapsed = microtime(true);
3740 3950
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3741
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3951
+				if ($globalDebugTimeElapsed) {
3952
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3953
+				}
3742 3954
 			}
3743 3955
 		}
3744 3956
 
@@ -3772,7 +3984,9 @@  discard block
 block discarded – undo
3772 3984
 			{
3773 3985
 				return false;
3774 3986
 			}
3775
-		} else $altitude = 0;
3987
+		} else {
3988
+			$altitude = 0;
3989
+		}
3776 3990
 		
3777 3991
 		if ($heading != "")
3778 3992
 		{
@@ -3801,7 +4015,9 @@  discard block
 block discarded – undo
3801 4015
 		{
3802 4016
 			$timeelapsed = microtime(true);
3803 4017
 			$image_array = $Image->getSpotterImage($registration);
3804
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4018
+			if ($globalDebugTimeElapsed) {
4019
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4020
+			}
3805 4021
 			if (!isset($image_array[0]['registration']))
3806 4022
 			{
3807 4023
 				//echo "Add image !!!! \n";
@@ -3809,14 +4025,21 @@  discard block
 block discarded – undo
3809 4025
 			}
3810 4026
 			$timeelapsed = microtime(true);
3811 4027
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3812
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3813
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4028
+			if ($globalDebugTimeElapsed) {
4029
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4030
+			}
4031
+			if ($owner_info['owner'] != '') {
4032
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4033
+			}
3814 4034
 		}
3815 4035
     
3816 4036
 		if (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && $aircraft_icao != '')
3817 4037
 		{
3818
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3819
-            		else $airline_icao = '';
4038
+            		if (isset($airline_array[0]['icao'])) {
4039
+            			$airline_icao = $airline_array[0]['icao'];
4040
+            		} else {
4041
+            			$airline_icao = '';
4042
+            		}
3820 4043
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3821 4044
 			if (!isset($image_array[0]['registration']))
3822 4045
 			{
@@ -3861,16 +4084,28 @@  discard block
 block discarded – undo
3861 4084
                 {
3862 4085
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3863 4086
                 }
3864
-                if ($registration == '') $registration = 'NA';
4087
+                if ($registration == '') {
4088
+                	$registration = 'NA';
4089
+                }
3865 4090
                 if ($latitude == '' && $longitude == '') {
3866 4091
             		$latitude = 0;
3867 4092
             		$longitude = 0;
3868 4093
             	}
3869
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3870
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3871
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3872
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3873
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4094
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4095
+                	$squawk = NULL;
4096
+                }
4097
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4098
+                	$verticalrate = NULL;
4099
+                }
4100
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4101
+                	$heading = 0;
4102
+                }
4103
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4104
+                	$groundspeed = 0;
4105
+                }
4106
+                if (!isset($aircraft_owner)) {
4107
+                	$aircraft_owner = NULL;
4108
+                }
3874 4109
                 $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) 
3875 4110
                 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)";
3876 4111
 
@@ -3881,9 +4116,13 @@  discard block
 block discarded – undo
3881 4116
 		if ($airline_type == '') {
3882 4117
 			$timeelapsed = microtime(true);
3883 4118
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3884
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4119
+			if ($globalDebugTimeElapsed) {
4120
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4121
+			}
4122
+		}
4123
+		if ($airline_type == null) {
4124
+			$airline_type = '';
3885 4125
 		}
3886
-		if ($airline_type == null) $airline_type = '';
3887 4126
                 $aircraft_type = $aircraft_array[0]['type'];
3888 4127
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3889 4128
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4047,7 +4286,9 @@  discard block
 block discarded – undo
4047 4286
 			}
4048 4287
 		}
4049 4288
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4050
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4289
+		if ($limit) {
4290
+			$query .= " LIMIT 10 OFFSET 0";
4291
+		}
4051 4292
 
4052 4293
 		$sth = $this->db->prepare($query);
4053 4294
 		$sth->execute($query_values);
@@ -4120,7 +4361,9 @@  discard block
 block discarded – undo
4120 4361
 		}
4121 4362
 		
4122 4363
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4123
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4364
+		if ($limit) {
4365
+			$query .= " LIMIT 10 OFFSET 0";
4366
+		}
4124 4367
       
4125 4368
 		
4126 4369
 		$sth = $this->db->prepare($query);
@@ -4164,7 +4407,9 @@  discard block
 block discarded – undo
4164 4407
 			}
4165 4408
 		}
4166 4409
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4167
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4410
+		if ($limit) {
4411
+			$query .= " LIMIT 10 OFFSET 0";
4412
+		}
4168 4413
       
4169 4414
 		
4170 4415
 		$sth = $this->db->prepare($query);
@@ -4240,7 +4485,9 @@  discard block
 block discarded – undo
4240 4485
 			}
4241 4486
 		}
4242 4487
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4243
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4488
+		if ($limit) {
4489
+			$query .= " LIMIT 10 OFFSET 0";
4490
+		}
4244 4491
 		
4245 4492
 		$sth = $this->db->prepare($query);
4246 4493
 		$sth->execute($query_values);
@@ -4282,7 +4529,9 @@  discard block
 block discarded – undo
4282 4529
 			}
4283 4530
 		}
4284 4531
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4285
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4532
+		if ($limit) {
4533
+			$query .= " LIMIT 10 OFFSET 0";
4534
+		}
4286 4535
       
4287 4536
 		
4288 4537
 		$sth = $this->db->prepare($query);
@@ -4527,7 +4776,9 @@  discard block
 block discarded – undo
4527 4776
 			date_default_timezone_set($globalTimezone);
4528 4777
 			$datetime = new DateTime($date);
4529 4778
 			$offset = $datetime->format('P');
4530
-		} else $offset = '+00:00';
4779
+		} else {
4780
+			$offset = '+00:00';
4781
+		}
4531 4782
 
4532 4783
 		if ($globalDBdriver == 'mysql') {
4533 4784
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4575,7 +4826,9 @@  discard block
 block discarded – undo
4575 4826
 			date_default_timezone_set($globalTimezone);
4576 4827
 			$datetime = new DateTime($date);
4577 4828
 			$offset = $datetime->format('P');
4578
-		} else $offset = '+00:00';
4829
+		} else {
4830
+			$offset = '+00:00';
4831
+		}
4579 4832
 		
4580 4833
 		if ($globalDBdriver == 'mysql') {
4581 4834
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4695,9 +4948,13 @@  discard block
 block discarded – undo
4695 4948
 		$sth = $this->db->prepare($query);
4696 4949
 		$sth->execute($query_values);
4697 4950
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4698
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4699
-		elseif ($result[0]['duration'] == '') return 0;
4700
-		else return $result[0]['duration'];
4951
+		if (is_numeric($result[0]['duration'])) {
4952
+			return gmdate('H:i:s',$result[0]['duration']);
4953
+		} elseif ($result[0]['duration'] == '') {
4954
+			return 0;
4955
+		} else {
4956
+			return $result[0]['duration'];
4957
+		}
4701 4958
 	}
4702 4959
 
4703 4960
 	/**
@@ -4786,8 +5043,11 @@  discard block
 block discarded – undo
4786 5043
 		$sth = $this->db->prepare($query);
4787 5044
 		$sth->execute($query_values);
4788 5045
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4789
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4790
-		else return $result[0]['duration'];
5046
+		if (is_int($result[0]['duration'])) {
5047
+			return gmdate('H:i:s',$result[0]['duration']);
5048
+		} else {
5049
+			return $result[0]['duration'];
5050
+		}
4791 5051
 	}
4792 5052
 
4793 5053
 	/**
@@ -4992,7 +5252,9 @@  discard block
 block discarded – undo
4992 5252
 		}
4993 5253
 		$query .= " GROUP BY spotter_output.airline_country, countries.iso3
4994 5254
 					ORDER BY airline_country_count DESC";
4995
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5255
+		if ($limit) {
5256
+			$query .= " LIMIT 10 OFFSET 0";
5257
+		}
4996 5258
       
4997 5259
 		$sth = $this->db->prepare($query);
4998 5260
 		$sth->execute($query_values);
@@ -5021,7 +5283,9 @@  discard block
 block discarded – undo
5021 5283
 		global $globalDBdriver;
5022 5284
 		//$filter_query = $this->getFilter($filters,true,true);
5023 5285
 		$Connection= new Connection($this->db);
5024
-		if (!$Connection->tableExists('countries')) return array();
5286
+		if (!$Connection->tableExists('countries')) {
5287
+			return array();
5288
+		}
5025 5289
 		/*
5026 5290
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
5027 5291
 					FROM countries c, spotter_output s
@@ -5053,7 +5317,9 @@  discard block
 block discarded – undo
5053 5317
 		}
5054 5318
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
5055 5319
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5056
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5320
+		if ($limit) {
5321
+			$query .= " LIMIT 10 OFFSET 0";
5322
+		}
5057 5323
       
5058 5324
 		
5059 5325
 		$sth = $this->db->prepare($query);
@@ -5130,7 +5396,9 @@  discard block
 block discarded – undo
5130 5396
 		}
5131 5397
 
5132 5398
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5133
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5399
+		if ($limit) {
5400
+			$query .= " LIMIT 10 OFFSET 0";
5401
+		}
5134 5402
  
5135 5403
 		$sth = $this->db->prepare($query);
5136 5404
 		$sth->execute($query_values);
@@ -5204,7 +5472,9 @@  discard block
 block discarded – undo
5204 5472
 		}
5205 5473
 
5206 5474
 		$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";
5207
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5475
+		if ($limit) {
5476
+			$query .= " LIMIT 10 OFFSET 0";
5477
+		}
5208 5478
  
5209 5479
 		$sth = $this->db->prepare($query);
5210 5480
 		$sth->execute($query_values);
@@ -5251,7 +5521,9 @@  discard block
 block discarded – undo
5251 5521
 		}
5252 5522
 
5253 5523
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5254
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5524
+		if ($limit) {
5525
+			$query .= " LIMIT 10 OFFSET 0";
5526
+		}
5255 5527
  
5256 5528
 		$sth = $this->db->prepare($query);
5257 5529
 		$sth->execute();
@@ -5304,7 +5576,9 @@  discard block
 block discarded – undo
5304 5576
 			if($row['registration'] != "")
5305 5577
 			{
5306 5578
 				$image_array = $Image->getSpotterImage($row['registration']);
5307
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5579
+				if (isset($image_array[0]['image_thumbnail'])) {
5580
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5581
+				}
5308 5582
 			}
5309 5583
 			$temp_array['registration_count'] = $row['registration_count'];
5310 5584
 
@@ -5379,7 +5653,9 @@  discard block
 block discarded – undo
5379 5653
 			if($row['registration'] != "")
5380 5654
 			{
5381 5655
 				$image_array = $Image->getSpotterImage($row['registration']);
5382
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5656
+				if (isset($image_array[0]['image_thumbnail'])) {
5657
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5658
+				}
5383 5659
 			}
5384 5660
 			$temp_array['registration_count'] = $row['registration_count'];
5385 5661
 
@@ -5486,7 +5762,9 @@  discard block
 block discarded – undo
5486 5762
 			if($row['registration'] != "")
5487 5763
 			{
5488 5764
 				$image_array = $Image->getSpotterImage($row['registration']);
5489
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5765
+				if (isset($image_array[0]['image_thumbnail'])) {
5766
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5767
+				}
5490 5768
 			}
5491 5769
 			$temp_array['registration_count'] = $row['registration_count'];
5492 5770
 			$aircraft_array[] = $temp_array;
@@ -5611,7 +5889,9 @@  discard block
 block discarded – undo
5611 5889
 			date_default_timezone_set($globalTimezone);
5612 5890
 			$datetime = new DateTime($date);
5613 5891
 			$offset = $datetime->format('P');
5614
-		} else $offset = '+00:00';
5892
+		} else {
5893
+			$offset = '+00:00';
5894
+		}
5615 5895
 
5616 5896
 		if ($globalDBdriver == 'mysql') {
5617 5897
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5658,7 +5938,9 @@  discard block
 block discarded – undo
5658 5938
 			date_default_timezone_set($globalTimezone);
5659 5939
 			$datetime = new DateTime($date);
5660 5940
 			$offset = $datetime->format('P');
5661
-		} else $offset = '+00:00';
5941
+		} else {
5942
+			$offset = '+00:00';
5943
+		}
5662 5944
 
5663 5945
 		if ($globalDBdriver == 'mysql') {
5664 5946
 			$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 
@@ -5687,7 +5969,9 @@  discard block
 block discarded – undo
5687 5969
 			if($row['registration'] != "")
5688 5970
 			{
5689 5971
 				$image_array = $Image->getSpotterImage($row['registration']);
5690
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5972
+				if (isset($image_array[0]['image_thumbnail'])) {
5973
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5974
+				}
5691 5975
 			}
5692 5976
 			$temp_array['registration_count'] = $row['registration_count'];
5693 5977
  
@@ -5712,7 +5996,9 @@  discard block
 block discarded – undo
5712 5996
 			date_default_timezone_set($globalTimezone);
5713 5997
 			$datetime = new DateTime($date);
5714 5998
 			$offset = $datetime->format('P');
5715
-		} else $offset = '+00:00';
5999
+		} else {
6000
+			$offset = '+00:00';
6001
+		}
5716 6002
 
5717 6003
 		if ($globalDBdriver == 'mysql') {
5718 6004
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5908,8 +6194,11 @@  discard block
 block discarded – undo
5908 6194
 			if($row['registration'] != "")
5909 6195
 			{
5910 6196
 				$image_array = $Image->getSpotterImage($row['registration']);
5911
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5912
-				else $temp_array['image_thumbnail'] = '';
6197
+				if (isset($image_array[0]['image_thumbnail'])) {
6198
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6199
+				} else {
6200
+					$temp_array['image_thumbnail'] = '';
6201
+				}
5913 6202
 			}
5914 6203
 			$temp_array['registration_count'] = $row['registration_count'];
5915 6204
 			$aircraft_array[] = $temp_array;
@@ -5983,8 +6272,11 @@  discard block
 block discarded – undo
5983 6272
 			if($row['registration'] != "")
5984 6273
 			{
5985 6274
 				$image_array = $Image->getSpotterImage($row['registration']);
5986
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5987
-				else $temp_array['image_thumbnail'] = '';
6275
+				if (isset($image_array[0]['image_thumbnail'])) {
6276
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6277
+				} else {
6278
+					$temp_array['image_thumbnail'] = '';
6279
+				}
5988 6280
 			}
5989 6281
 			$temp_array['registration_count'] = $row['registration_count'];
5990 6282
 			$aircraft_array[] = $temp_array;
@@ -6058,8 +6350,11 @@  discard block
 block discarded – undo
6058 6350
 			if($row['registration'] != "")
6059 6351
 			{
6060 6352
 				$image_array = $Image->getSpotterImage($row['registration']);
6061
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6062
-				else $temp_array['image_thumbnail'] = '';
6353
+				if (isset($image_array[0]['image_thumbnail'])) {
6354
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6355
+				} else {
6356
+					$temp_array['image_thumbnail'] = '';
6357
+				}
6063 6358
 			}
6064 6359
 			$temp_array['registration_count'] = $row['registration_count'];
6065 6360
 			$aircraft_array[] = $temp_array;
@@ -6270,7 +6565,9 @@  discard block
 block discarded – undo
6270 6565
 			if($row['registration'] != "")
6271 6566
 			{
6272 6567
 				$image_array = $Image->getSpotterImage($row['registration']);
6273
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6568
+				if (isset($image_array[0]['image_thumbnail'])) {
6569
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6570
+				}
6274 6571
 			}
6275 6572
 			$temp_array['registration_count'] = $row['registration_count'];
6276 6573
           
@@ -6387,7 +6684,9 @@  discard block
 block discarded – undo
6387 6684
 			if($row['registration'] != "")
6388 6685
 			{
6389 6686
 				$image_array = $Image->getSpotterImage($row['registration']);
6390
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6687
+				if (isset($image_array[0]['image_thumbnail'])) {
6688
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6689
+				}
6391 6690
 			}
6392 6691
 			$temp_array['registration_count'] = $row['registration_count'];
6393 6692
           
@@ -6553,7 +6852,9 @@  discard block
 block discarded – undo
6553 6852
 			}
6554 6853
 		}
6555 6854
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6556
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6855
+		if ($limit) {
6856
+			$query .= " LIMIT 10 OFFSET 0";
6857
+		}
6557 6858
 		
6558 6859
 		$sth = $this->db->prepare($query);
6559 6860
 		$sth->execute($query_values);
@@ -6572,7 +6873,9 @@  discard block
 block discarded – undo
6572 6873
 			if($row['registration'] != "")
6573 6874
 			{
6574 6875
 				$image_array = $Image->getSpotterImage($row['registration']);
6575
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6876
+				if (isset($image_array[0]['image_thumbnail'])) {
6877
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6878
+				}
6576 6879
 			}
6577 6880
           
6578 6881
 			$aircraft_array[] = $temp_array;
@@ -6613,7 +6916,9 @@  discard block
 block discarded – undo
6613 6916
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6614 6917
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6615 6918
                 $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";
6616
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6919
+		if ($limit) {
6920
+			$query .= " LIMIT 10 OFFSET 0";
6921
+		}
6617 6922
 		
6618 6923
 		$sth = $this->db->prepare($query);
6619 6924
 		$sth->execute();
@@ -6633,7 +6938,9 @@  discard block
 block discarded – undo
6633 6938
 			if($row['registration'] != "")
6634 6939
 			{
6635 6940
 				$image_array = $Image->getSpotterImage($row['registration']);
6636
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6941
+				if (isset($image_array[0]['image_thumbnail'])) {
6942
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6943
+				}
6637 6944
 			}
6638 6945
           
6639 6946
 			$aircraft_array[] = $temp_array;
@@ -6699,7 +7006,9 @@  discard block
 block discarded – undo
6699 7006
 		}
6700 7007
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6701 7008
 				ORDER BY airport_departure_icao_count DESC";
6702
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7009
+		if ($limit) {
7010
+			$query .= " LIMIT 10 OFFSET 0";
7011
+		}
6703 7012
 
6704 7013
 		$sth = $this->db->prepare($query);
6705 7014
 		$sth->execute($query_values);
@@ -6751,7 +7060,9 @@  discard block
 block discarded – undo
6751 7060
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6752 7061
                 $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
6753 7062
 				ORDER BY airport_departure_icao_count DESC";
6754
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7063
+		if ($limit) {
7064
+			$query .= " LIMIT 10 OFFSET 0";
7065
+		}
6755 7066
       
6756 7067
 		$sth = $this->db->prepare($query);
6757 7068
 		$sth->execute();
@@ -6829,7 +7140,9 @@  discard block
 block discarded – undo
6829 7140
 		}
6830 7141
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6831 7142
 				ORDER BY airport_departure_icao_count DESC";
6832
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7143
+		if ($limit) {
7144
+			$query .= " LIMIT 10 OFFSET 0";
7145
+		}
6833 7146
     		//echo $query;
6834 7147
 		$sth = $this->db->prepare($query);
6835 7148
 		$sth->execute($query_values);
@@ -6883,7 +7196,9 @@  discard block
 block discarded – undo
6883 7196
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6884 7197
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6885 7198
 				ORDER BY airport_departure_icao_count DESC";
6886
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7199
+		if ($limit) {
7200
+			$query .= " LIMIT 10 OFFSET 0";
7201
+		}
6887 7202
       
6888 7203
 		$sth = $this->db->prepare($query);
6889 7204
 		$sth->execute();
@@ -7274,7 +7589,9 @@  discard block
 block discarded – undo
7274 7589
 			date_default_timezone_set($globalTimezone);
7275 7590
 			$datetime = new DateTime($date);
7276 7591
 			$offset = $datetime->format('P');
7277
-		} else $offset = '+00:00';
7592
+		} else {
7593
+			$offset = '+00:00';
7594
+		}
7278 7595
 
7279 7596
 		if ($globalDBdriver == 'mysql') {
7280 7597
 			$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 
@@ -7324,7 +7641,9 @@  discard block
 block discarded – undo
7324 7641
 			date_default_timezone_set($globalTimezone);
7325 7642
 			$datetime = new DateTime($date);
7326 7643
 			$offset = $datetime->format('P');
7327
-		} else $offset = '+00:00';
7644
+		} else {
7645
+			$offset = '+00:00';
7646
+		}
7328 7647
 
7329 7648
 		if ($globalDBdriver == 'mysql') {
7330 7649
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7673,7 +7992,9 @@  discard block
 block discarded – undo
7673 7992
 		}
7674 7993
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7675 7994
 					ORDER BY airport_arrival_icao_count DESC";
7676
-		if ($limit) $query .= " LIMIT 10";
7995
+		if ($limit) {
7996
+			$query .= " LIMIT 10";
7997
+		}
7677 7998
       
7678 7999
 		
7679 8000
 		$sth = $this->db->prepare($query);
@@ -7695,7 +8016,9 @@  discard block
 block discarded – undo
7695 8016
 			if ($icaoaskey) {
7696 8017
 				$icao = $row['arrival_airport_icao'];
7697 8018
 				$airport_array[$icao] = $temp_array;
7698
-			} else $airport_array[] = $temp_array;
8019
+			} else {
8020
+				$airport_array[] = $temp_array;
8021
+			}
7699 8022
 		}
7700 8023
 
7701 8024
 		return $airport_array;
@@ -7732,7 +8055,9 @@  discard block
 block discarded – undo
7732 8055
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7733 8056
                 $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, countries.iso3
7734 8057
 					ORDER BY airport_arrival_icao_count DESC";
7735
-		if ($limit) $query .= " LIMIT 10";
8058
+		if ($limit) {
8059
+			$query .= " LIMIT 10";
8060
+		}
7736 8061
       
7737 8062
 		
7738 8063
 		$sth = $this->db->prepare($query);
@@ -7754,7 +8079,9 @@  discard block
 block discarded – undo
7754 8079
 			if ($icaoaskey) {
7755 8080
 				$icao = $row['arrival_airport_icao'];
7756 8081
 				$airport_array[$icao] = $temp_array;
7757
-			} else $airport_array[] = $temp_array;
8082
+			} else {
8083
+				$airport_array[] = $temp_array;
8084
+			}
7758 8085
 		}
7759 8086
 
7760 8087
 		return $airport_array;
@@ -7817,7 +8144,9 @@  discard block
 block discarded – undo
7817 8144
 		}
7818 8145
 		$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
7819 8146
 					ORDER BY airport_arrival_icao_count DESC";
7820
-		if ($limit) $query .= " LIMIT 10";
8147
+		if ($limit) {
8148
+			$query .= " LIMIT 10";
8149
+		}
7821 8150
       
7822 8151
 		
7823 8152
 		$sth = $this->db->prepare($query);
@@ -7836,7 +8165,9 @@  discard block
 block discarded – undo
7836 8165
 			if ($icaoaskey) {
7837 8166
 				$icao = $row['arrival_airport_icao'];
7838 8167
 				$airport_array[$icao] = $temp_array;
7839
-			} else $airport_array[] = $temp_array;
8168
+			} else {
8169
+				$airport_array[] = $temp_array;
8170
+			}
7840 8171
 		}
7841 8172
 
7842 8173
 		return $airport_array;
@@ -7873,7 +8204,9 @@  discard block
 block discarded – undo
7873 8204
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874 8205
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7875 8206
 					ORDER BY airport_arrival_icao_count DESC";
7876
-		if ($limit) $query .= " LIMIT 10";
8207
+		if ($limit) {
8208
+			$query .= " LIMIT 10";
8209
+		}
7877 8210
       
7878 8211
 		
7879 8212
 		$sth = $this->db->prepare($query);
@@ -7894,7 +8227,9 @@  discard block
 block discarded – undo
7894 8227
 			if ($icaoaskey) {
7895 8228
 				$icao = $row['arrival_airport_icao'];
7896 8229
 				$airport_array[$icao] = $temp_array;
7897
-			} else $airport_array[] = $temp_array;
8230
+			} else {
8231
+				$airport_array[] = $temp_array;
8232
+			}
7898 8233
 		}
7899 8234
 
7900 8235
 		return $airport_array;
@@ -8272,7 +8607,9 @@  discard block
 block discarded – undo
8272 8607
 			date_default_timezone_set($globalTimezone);
8273 8608
 			$datetime = new DateTime($date);
8274 8609
 			$offset = $datetime->format('P');
8275
-		} else $offset = '+00:00';
8610
+		} else {
8611
+			$offset = '+00:00';
8612
+		}
8276 8613
 
8277 8614
 		if ($globalDBdriver == 'mysql') {
8278 8615
 			$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 
@@ -8322,7 +8659,9 @@  discard block
 block discarded – undo
8322 8659
 			date_default_timezone_set($globalTimezone);
8323 8660
 			$datetime = new DateTime($date);
8324 8661
 			$offset = $datetime->format('P');
8325
-		} else $offset = '+00:00';
8662
+		} else {
8663
+			$offset = '+00:00';
8664
+		}
8326 8665
 
8327 8666
 		if ($globalDBdriver == 'mysql') {
8328 8667
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8713,7 +9052,9 @@  discard block
 block discarded – undo
8713 9052
 		}
8714 9053
 		$query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3
8715 9054
 					ORDER BY airport_arrival_country_count DESC";
8716
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9055
+		if ($limit) {
9056
+			$query .= " LIMIT 10 OFFSET 0";
9057
+		}
8717 9058
       
8718 9059
 		
8719 9060
 		$sth = $this->db->prepare($query);
@@ -9001,7 +9342,9 @@  discard block
 block discarded – undo
9001 9342
 			date_default_timezone_set($globalTimezone);
9002 9343
 			$datetime = new DateTime($date);
9003 9344
 			$offset = $datetime->format('P');
9004
-		} else $offset = '+00:00';
9345
+		} else {
9346
+			$offset = '+00:00';
9347
+		}
9005 9348
 		
9006 9349
 		if ($globalDBdriver == 'mysql') {
9007 9350
 			$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
@@ -9257,12 +9600,18 @@  discard block
 block discarded – undo
9257 9600
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9258 9601
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9259 9602
 		 if ($olderthanmonths > 0) {
9260
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9261
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9603
+			if ($globalDBdriver == 'mysql') {
9604
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9605
+			} else {
9606
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9607
+			}
9262 9608
 		}
9263 9609
 		if ($sincedate != '') {
9264
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9265
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9610
+			if ($globalDBdriver == 'mysql') {
9611
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9612
+			} else {
9613
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9614
+			}
9266 9615
 		}
9267 9616
 		$query_values = array();
9268 9617
 		if ($year != '') {
@@ -9293,7 +9642,9 @@  discard block
 block discarded – undo
9293 9642
 			}
9294 9643
 		}
9295 9644
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9296
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9645
+		if ($limit) {
9646
+			$query .= " LIMIT 10 OFFSET 0";
9647
+		}
9297 9648
       		
9298 9649
 		$sth = $this->db->prepare($query);
9299 9650
 		$sth->execute($query_values);
@@ -9327,15 +9678,23 @@  discard block
 block discarded – undo
9327 9678
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9328 9679
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9329 9680
 		 if ($olderthanmonths > 0) {
9330
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9331
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9681
+			if ($globalDBdriver == 'mysql') {
9682
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9683
+			} else {
9684
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9685
+			}
9332 9686
 		}
9333 9687
 		if ($sincedate != '') {
9334
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9335
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9688
+			if ($globalDBdriver == 'mysql') {
9689
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9690
+			} else {
9691
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9692
+			}
9336 9693
 		}
9337 9694
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9338
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9695
+		if ($limit) {
9696
+			$query .= " LIMIT 10 OFFSET 0";
9697
+		}
9339 9698
       		
9340 9699
 		$sth = $this->db->prepare($query);
9341 9700
 		$sth->execute();
@@ -9372,7 +9731,9 @@  discard block
 block discarded – undo
9372 9731
 			date_default_timezone_set($globalTimezone);
9373 9732
 			$datetime = new DateTime();
9374 9733
 			$offset = $datetime->format('P');
9375
-		} else $offset = '+00:00';
9734
+		} else {
9735
+			$offset = '+00:00';
9736
+		}
9376 9737
 
9377 9738
 		if ($globalDBdriver == 'mysql') {
9378 9739
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9421,7 +9782,9 @@  discard block
 block discarded – undo
9421 9782
 			date_default_timezone_set($globalTimezone);
9422 9783
 			$datetime = new DateTime();
9423 9784
 			$offset = $datetime->format('P');
9424
-		} else $offset = '+00:00';
9785
+		} else {
9786
+			$offset = '+00:00';
9787
+		}
9425 9788
 		$filter_query = $this->getFilter($filters,true,true);
9426 9789
 		if ($globalDBdriver == 'mysql') {
9427 9790
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9470,7 +9833,9 @@  discard block
 block discarded – undo
9470 9833
 			date_default_timezone_set($globalTimezone);
9471 9834
 			$datetime = new DateTime();
9472 9835
 			$offset = $datetime->format('P');
9473
-		} else $offset = '+00:00';
9836
+		} else {
9837
+			$offset = '+00:00';
9838
+		}
9474 9839
 		$filter_query = $this->getFilter($filters,true,true);
9475 9840
 		if ($globalDBdriver == 'mysql') {
9476 9841
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9516,7 +9881,9 @@  discard block
 block discarded – undo
9516 9881
 			date_default_timezone_set($globalTimezone);
9517 9882
 			$datetime = new DateTime();
9518 9883
 			$offset = $datetime->format('P');
9519
-		} else $offset = '+00:00';
9884
+		} else {
9885
+			$offset = '+00:00';
9886
+		}
9520 9887
 		$filter_query = $this->getFilter($filters,true,true);
9521 9888
 		if ($globalDBdriver == 'mysql') {
9522 9889
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9564,7 +9931,9 @@  discard block
 block discarded – undo
9564 9931
 			date_default_timezone_set($globalTimezone);
9565 9932
 			$datetime = new DateTime();
9566 9933
 			$offset = $datetime->format('P');
9567
-		} else $offset = '+00:00';
9934
+		} else {
9935
+			$offset = '+00:00';
9936
+		}
9568 9937
 		
9569 9938
 		if ($globalDBdriver == 'mysql') {
9570 9939
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9612,7 +9981,9 @@  discard block
 block discarded – undo
9612 9981
 			date_default_timezone_set($globalTimezone);
9613 9982
 			$datetime = new DateTime();
9614 9983
 			$offset = $datetime->format('P');
9615
-		} else $offset = '+00:00';
9984
+		} else {
9985
+			$offset = '+00:00';
9986
+		}
9616 9987
 
9617 9988
 		if ($globalDBdriver == 'mysql') {
9618 9989
 			$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
@@ -9659,7 +10030,9 @@  discard block
 block discarded – undo
9659 10030
 			date_default_timezone_set($globalTimezone);
9660 10031
 			$datetime = new DateTime();
9661 10032
 			$offset = $datetime->format('P');
9662
-		} else $offset = '+00:00';
10033
+		} else {
10034
+			$offset = '+00:00';
10035
+		}
9663 10036
 
9664 10037
 		if ($globalDBdriver == 'mysql') {
9665 10038
 			$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
@@ -9707,7 +10080,9 @@  discard block
 block discarded – undo
9707 10080
 			date_default_timezone_set($globalTimezone);
9708 10081
 			$datetime = new DateTime();
9709 10082
 			$offset = $datetime->format('P');
9710
-		} else $offset = '+00:00';
10083
+		} else {
10084
+			$offset = '+00:00';
10085
+		}
9711 10086
 		$filter_query = $this->getFilter($filters,true,true);
9712 10087
 		if ($globalDBdriver == 'mysql') {
9713 10088
 			$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
@@ -9752,7 +10127,9 @@  discard block
 block discarded – undo
9752 10127
 			date_default_timezone_set($globalTimezone);
9753 10128
 			$datetime = new DateTime();
9754 10129
 			$offset = $datetime->format('P');
9755
-		} else $offset = '+00:00';
10130
+		} else {
10131
+			$offset = '+00:00';
10132
+		}
9756 10133
 		$filter_query = $this->getFilter($filters,true,true);
9757 10134
 
9758 10135
 		if ($globalDBdriver == 'mysql') {
@@ -9799,7 +10176,9 @@  discard block
 block discarded – undo
9799 10176
 			date_default_timezone_set($globalTimezone);
9800 10177
 			$datetime = new DateTime();
9801 10178
 			$offset = $datetime->format('P');
9802
-		} else $offset = '+00:00';
10179
+		} else {
10180
+			$offset = '+00:00';
10181
+		}
9803 10182
 
9804 10183
 		if ($globalDBdriver == 'mysql') {
9805 10184
 			$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
@@ -9845,7 +10224,9 @@  discard block
 block discarded – undo
9845 10224
 			date_default_timezone_set($globalTimezone);
9846 10225
 			$datetime = new DateTime();
9847 10226
 			$offset = $datetime->format('P');
9848
-		} else $offset = '+00:00';
10227
+		} else {
10228
+			$offset = '+00:00';
10229
+		}
9849 10230
 		$filter_query = $this->getFilter($filters,true,true);
9850 10231
 
9851 10232
 		if ($globalDBdriver == 'mysql') {
@@ -9892,7 +10273,9 @@  discard block
 block discarded – undo
9892 10273
 			date_default_timezone_set($globalTimezone);
9893 10274
 			$datetime = new DateTime();
9894 10275
 			$offset = $datetime->format('P');
9895
-		} else $offset = '+00:00';
10276
+		} else {
10277
+			$offset = '+00:00';
10278
+		}
9896 10279
 
9897 10280
 		if ($globalDBdriver == 'mysql') {
9898 10281
 			$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
@@ -9939,7 +10322,9 @@  discard block
 block discarded – undo
9939 10322
 			date_default_timezone_set($globalTimezone);
9940 10323
 			$datetime = new DateTime();
9941 10324
 			$offset = $datetime->format('P');
9942
-		} else $offset = '+00:00';
10325
+		} else {
10326
+			$offset = '+00:00';
10327
+		}
9943 10328
 
9944 10329
 		if ($globalDBdriver == 'mysql') {
9945 10330
 			$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
@@ -9984,7 +10369,9 @@  discard block
 block discarded – undo
9984 10369
 			date_default_timezone_set($globalTimezone);
9985 10370
 			$datetime = new DateTime();
9986 10371
 			$offset = $datetime->format('P');
9987
-		} else $offset = '+00:00';
10372
+		} else {
10373
+			$offset = '+00:00';
10374
+		}
9988 10375
 		$filter_query = $this->getFilter($filters,true,true);
9989 10376
 
9990 10377
 		if ($globalDBdriver == 'mysql') {
@@ -10032,7 +10419,9 @@  discard block
 block discarded – undo
10032 10419
 			date_default_timezone_set($globalTimezone);
10033 10420
 			$datetime = new DateTime();
10034 10421
 			$offset = $datetime->format('P');
10035
-		} else $offset = '+00:00';
10422
+		} else {
10423
+			$offset = '+00:00';
10424
+		}
10036 10425
 
10037 10426
 		if ($globalDBdriver == 'mysql') {
10038 10427
 			$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
@@ -10078,7 +10467,9 @@  discard block
 block discarded – undo
10078 10467
 			date_default_timezone_set($globalTimezone);
10079 10468
 			$datetime = new DateTime();
10080 10469
 			$offset = $datetime->format('P');
10081
-		} else $offset = '+00:00';
10470
+		} else {
10471
+			$offset = '+00:00';
10472
+		}
10082 10473
 		$filter_query = $this->getFilter($filters,true,true);
10083 10474
 
10084 10475
 		if ($globalDBdriver == 'mysql') {
@@ -10126,7 +10517,9 @@  discard block
 block discarded – undo
10126 10517
 			date_default_timezone_set($globalTimezone);
10127 10518
 			$datetime = new DateTime();
10128 10519
 			$offset = $datetime->format('P');
10129
-		} else $offset = '+00:00';
10520
+		} else {
10521
+			$offset = '+00:00';
10522
+		}
10130 10523
 
10131 10524
 		if ($globalDBdriver == 'mysql') {
10132 10525
 			$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
@@ -10173,7 +10566,9 @@  discard block
 block discarded – undo
10173 10566
 			date_default_timezone_set($globalTimezone);
10174 10567
 			$datetime = new DateTime();
10175 10568
 			$offset = $datetime->format('P');
10176
-		} else $offset = '+00:00';
10569
+		} else {
10570
+			$offset = '+00:00';
10571
+		}
10177 10572
 		$filter_query = $this->getFilter($filters,true,true);
10178 10573
 		if ($globalDBdriver == 'mysql') {
10179 10574
 			$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
@@ -10222,7 +10617,9 @@  discard block
 block discarded – undo
10222 10617
 			date_default_timezone_set($globalTimezone);
10223 10618
 			$datetime = new DateTime();
10224 10619
 			$offset = $datetime->format('P');
10225
-		} else $offset = '+00:00';
10620
+		} else {
10621
+			$offset = '+00:00';
10622
+		}
10226 10623
 
10227 10624
 		$orderby_sql = '';
10228 10625
 		if ($orderby == "hour")
@@ -10288,7 +10685,9 @@  discard block
 block discarded – undo
10288 10685
 			date_default_timezone_set($globalTimezone);
10289 10686
 			$datetime = new DateTime();
10290 10687
 			$offset = $datetime->format('P');
10291
-		} else $offset = '+00:00';
10688
+		} else {
10689
+			$offset = '+00:00';
10690
+		}
10292 10691
 
10293 10692
 		$orderby_sql = '';
10294 10693
 		if ($orderby == "hour")
@@ -10355,7 +10754,9 @@  discard block
 block discarded – undo
10355 10754
 			date_default_timezone_set($globalTimezone);
10356 10755
 			$datetime = new DateTime();
10357 10756
 			$offset = $datetime->format('P');
10358
-		} else $offset = '+00:00';
10757
+		} else {
10758
+			$offset = '+00:00';
10759
+		}
10359 10760
 
10360 10761
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10361 10762
 
@@ -10406,7 +10807,9 @@  discard block
 block discarded – undo
10406 10807
 			date_default_timezone_set($globalTimezone);
10407 10808
 			$datetime = new DateTime();
10408 10809
 			$offset = $datetime->format('P');
10409
-		} else $offset = '+00:00';
10810
+		} else {
10811
+			$offset = '+00:00';
10812
+		}
10410 10813
 
10411 10814
 		if ($globalDBdriver == 'mysql') {
10412 10815
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10453,7 +10856,9 @@  discard block
 block discarded – undo
10453 10856
 			date_default_timezone_set($globalTimezone);
10454 10857
 			$datetime = new DateTime();
10455 10858
 			$offset = $datetime->format('P');
10456
-		} else $offset = '+00:00';
10859
+		} else {
10860
+			$offset = '+00:00';
10861
+		}
10457 10862
 
10458 10863
 		if ($globalDBdriver == 'mysql') {
10459 10864
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10500,7 +10905,9 @@  discard block
 block discarded – undo
10500 10905
 			date_default_timezone_set($globalTimezone);
10501 10906
 			$datetime = new DateTime();
10502 10907
 			$offset = $datetime->format('P');
10503
-		} else $offset = '+00:00';
10908
+		} else {
10909
+			$offset = '+00:00';
10910
+		}
10504 10911
 
10505 10912
 		if ($globalDBdriver == 'mysql') {
10506 10913
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10548,7 +10955,9 @@  discard block
 block discarded – undo
10548 10955
 			date_default_timezone_set($globalTimezone);
10549 10956
 			$datetime = new DateTime();
10550 10957
 			$offset = $datetime->format('P');
10551
-		} else $offset = '+00:00';
10958
+		} else {
10959
+			$offset = '+00:00';
10960
+		}
10552 10961
 
10553 10962
 		if ($globalDBdriver == 'mysql') {
10554 10963
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10596,7 +11005,9 @@  discard block
 block discarded – undo
10596 11005
 			date_default_timezone_set($globalTimezone);
10597 11006
 			$datetime = new DateTime($date);
10598 11007
 			$offset = $datetime->format('P');
10599
-		} else $offset = '+00:00';
11008
+		} else {
11009
+			$offset = '+00:00';
11010
+		}
10600 11011
 
10601 11012
 		if ($globalDBdriver == 'mysql') {
10602 11013
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10644,7 +11055,9 @@  discard block
 block discarded – undo
10644 11055
 			date_default_timezone_set($globalTimezone);
10645 11056
 			$datetime = new DateTime();
10646 11057
 			$offset = $datetime->format('P');
10647
-		} else $offset = '+00:00';
11058
+		} else {
11059
+			$offset = '+00:00';
11060
+		}
10648 11061
 
10649 11062
 		if ($globalDBdriver == 'mysql') {
10650 11063
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10691,7 +11104,9 @@  discard block
 block discarded – undo
10691 11104
 			date_default_timezone_set($globalTimezone);
10692 11105
 			$datetime = new DateTime();
10693 11106
 			$offset = $datetime->format('P');
10694
-		} else $offset = '+00:00';
11107
+		} else {
11108
+			$offset = '+00:00';
11109
+		}
10695 11110
 
10696 11111
 		if ($globalDBdriver == 'mysql') {
10697 11112
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10738,7 +11153,9 @@  discard block
 block discarded – undo
10738 11153
 			date_default_timezone_set($globalTimezone);
10739 11154
 			$datetime = new DateTime();
10740 11155
 			$offset = $datetime->format('P');
10741
-		} else $offset = '+00:00';
11156
+		} else {
11157
+			$offset = '+00:00';
11158
+		}
10742 11159
 
10743 11160
 		if ($globalDBdriver == 'mysql') {
10744 11161
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10788,7 +11205,9 @@  discard block
 block discarded – undo
10788 11205
 			date_default_timezone_set($globalTimezone);
10789 11206
 			$datetime = new DateTime();
10790 11207
 			$offset = $datetime->format('P');
10791
-		} else $offset = '+00:00';
11208
+		} else {
11209
+			$offset = '+00:00';
11210
+		}
10792 11211
 
10793 11212
 		if ($globalDBdriver == 'mysql') {
10794 11213
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10835,7 +11254,9 @@  discard block
 block discarded – undo
10835 11254
 			date_default_timezone_set($globalTimezone);
10836 11255
 			$datetime = new DateTime();
10837 11256
 			$offset = $datetime->format('P');
10838
-		} else $offset = '+00:00';
11257
+		} else {
11258
+			$offset = '+00:00';
11259
+		}
10839 11260
 
10840 11261
 		if ($globalDBdriver == 'mysql') {
10841 11262
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11046,8 +11467,11 @@  discard block
 block discarded – undo
11046 11467
 				$query_values = array_merge($query_values,array(':month' => $month));
11047 11468
 			}
11048 11469
 		}
11049
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11050
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11470
+		if (empty($query_values)) {
11471
+			$queryi .= $this->getFilter($filters);
11472
+		} else {
11473
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11474
+		}
11051 11475
 		
11052 11476
 		$sth = $this->db->prepare($queryi);
11053 11477
 		$sth->execute($query_values);
@@ -11125,8 +11549,11 @@  discard block
 block discarded – undo
11125 11549
 				$query_values = array_merge($query_values,array(':month' => $month));
11126 11550
 			}
11127 11551
 		}
11128
-                if ($query == '') $queryi .= $this->getFilter($filters);
11129
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11552
+                if ($query == '') {
11553
+                	$queryi .= $this->getFilter($filters);
11554
+                } else {
11555
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11556
+                }
11130 11557
 
11131 11558
 
11132 11559
 		$sth = $this->db->prepare($queryi);
@@ -11149,7 +11576,9 @@  discard block
 block discarded – undo
11149 11576
 			date_default_timezone_set($globalTimezone);
11150 11577
 			$datetime = new DateTime();
11151 11578
 			$offset = $datetime->format('P');
11152
-		} else $offset = '+00:00';
11579
+		} else {
11580
+			$offset = '+00:00';
11581
+		}
11153 11582
 
11154 11583
 		if ($globalDBdriver == 'mysql') {
11155 11584
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11335,7 +11764,9 @@  discard block
 block discarded – undo
11335 11764
 	*/
11336 11765
 	public function parseDirection($direction = 0)
11337 11766
 	{
11338
-		if ($direction == '') $direction = 0;
11767
+		if ($direction == '') {
11768
+			$direction = 0;
11769
+		}
11339 11770
 		$direction_array = array();
11340 11771
 		$temp_array = array();
11341 11772
 
@@ -11436,7 +11867,9 @@  discard block
 block discarded – undo
11436 11867
 		if (isset($result->AirlineFlightInfoResult))
11437 11868
 		{
11438 11869
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11439
-		} else return '';
11870
+		} else {
11871
+			return '';
11872
+		}
11440 11873
 		
11441 11874
 		$registration = $this->convertAircraftRegistration($registration);
11442 11875
 		
@@ -11470,7 +11903,9 @@  discard block
 block discarded – undo
11470 11903
 		    return $row['registration'];
11471 11904
 		} elseif ($source_type == 'flarm') {
11472 11905
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11473
-		} else return '';
11906
+		} else {
11907
+			return '';
11908
+		}
11474 11909
 	
11475 11910
 	}
11476 11911
 
@@ -11497,11 +11932,16 @@  discard block
 block discarded – undo
11497 11932
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11498 11933
 		$sth->closeCursor();
11499 11934
 		if (count($row) > 0) {
11500
-			if ($row['type_flight'] == null) return '';
11501
-			else return $row['type_flight'];
11935
+			if ($row['type_flight'] == null) {
11936
+				return '';
11937
+			} else {
11938
+				return $row['type_flight'];
11939
+			}
11502 11940
 		} elseif ($source_type == 'flarm') {
11503 11941
 			return $this->getAircraftTypeBymodeS($aircraft_modes);
11504
-		} else return '';
11942
+		} else {
11943
+			return '';
11944
+		}
11505 11945
 	
11506 11946
 	}
11507 11947
 
@@ -11519,7 +11959,9 @@  discard block
 block discarded – undo
11519 11959
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11520 11960
 	
11521 11961
 		$Connection = new Connection($this->db);
11522
-		if (!$Connection->tableExists('countries')) return '';
11962
+		if (!$Connection->tableExists('countries')) {
11963
+			return '';
11964
+		}
11523 11965
 	
11524 11966
 		try {
11525 11967
 			/*
@@ -11539,9 +11981,13 @@  discard block
 block discarded – undo
11539 11981
 			$sth->closeCursor();
11540 11982
 			if (count($row) > 0) {
11541 11983
 				return $row;
11542
-			} else return '';
11984
+			} else {
11985
+				return '';
11986
+			}
11543 11987
 		} catch (PDOException $e) {
11544
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11988
+			if (isset($globalDebug) && $globalDebug) {
11989
+				echo 'Error : '.$e->getMessage()."\n";
11990
+			}
11545 11991
 			return '';
11546 11992
 		}
11547 11993
 	
@@ -11559,7 +12005,9 @@  discard block
 block discarded – undo
11559 12005
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11560 12006
 	
11561 12007
 		$Connection = new Connection($this->db);
11562
-		if (!$Connection->tableExists('countries')) return '';
12008
+		if (!$Connection->tableExists('countries')) {
12009
+			return '';
12010
+		}
11563 12011
 	
11564 12012
 		try {
11565 12013
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11571,9 +12019,13 @@  discard block
 block discarded – undo
11571 12019
 			$sth->closeCursor();
11572 12020
 			if (count($row) > 0) {
11573 12021
 				return $row;
11574
-			} else return '';
12022
+			} else {
12023
+				return '';
12024
+			}
11575 12025
 		} catch (PDOException $e) {
11576
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
12026
+			if (isset($globalDebug) && $globalDebug) {
12027
+				echo 'Error : '.$e->getMessage()."\n";
12028
+			}
11577 12029
 			return '';
11578 12030
 		}
11579 12031
 	
@@ -11823,7 +12275,9 @@  discard block
 block discarded – undo
11823 12275
 	{
11824 12276
 		global $globalBitlyAccessToken;
11825 12277
 		
11826
-		if ($globalBitlyAccessToken == '') return $url;
12278
+		if ($globalBitlyAccessToken == '') {
12279
+			return $url;
12280
+		}
11827 12281
         
11828 12282
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11829 12283
 		
@@ -11972,7 +12426,9 @@  discard block
 block discarded – undo
11972 12426
 		
11973 12427
 
11974 12428
 		// routes
11975
-		if ($globalDebug) print "Routes...\n";
12429
+		if ($globalDebug) {
12430
+			print "Routes...\n";
12431
+		}
11976 12432
 		if ($globalDBdriver == 'mysql') {
11977 12433
 			$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)";
11978 12434
 		} else {
@@ -11991,7 +12447,9 @@  discard block
 block discarded – undo
11991 12447
 			}
11992 12448
 		}
11993 12449
 		
11994
-		if ($globalDebug) print "Airlines...\n";
12450
+		if ($globalDebug) {
12451
+			print "Airlines...\n";
12452
+		}
11995 12453
 		//airlines
11996 12454
 		if ($globalDBdriver == 'mysql') {
11997 12455
 			$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)";
@@ -12005,10 +12463,15 @@  discard block
 block discarded – undo
12005 12463
 			if (is_numeric(substr($row['ident'], -1, 1)))
12006 12464
 			{
12007 12465
 				$fromsource = NULL;
12008
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
12009
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12010
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12011
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12466
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12467
+					$fromsource = 'vatsim';
12468
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12469
+					$fromsource = 'ivao';
12470
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12471
+					$fromsource = 'vatsim';
12472
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12473
+					$fromsource = 'ivao';
12474
+				}
12012 12475
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12013 12476
 				if (isset($airline_array[0]['name'])) {
12014 12477
 					$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";
@@ -12018,13 +12481,17 @@  discard block
 block discarded – undo
12018 12481
 			}
12019 12482
 		}
12020 12483
 
12021
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12484
+		if ($globalDebug) {
12485
+			print "Remove Duplicate in aircraft_modes...\n";
12486
+		}
12022 12487
 		//duplicate modes
12023 12488
 		$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";
12024 12489
 		$sth = $this->db->prepare($query);
12025 12490
 		$sth->execute();
12026 12491
 		
12027
-		if ($globalDebug) print "Aircraft...\n";
12492
+		if ($globalDebug) {
12493
+			print "Aircraft...\n";
12494
+		}
12028 12495
 		//aircraft
12029 12496
 		if ($globalDBdriver == 'mysql') {
12030 12497
 			$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)";
@@ -12067,26 +12534,38 @@  discard block
 block discarded – undo
12067 12534
 				 if (isset($closestAirports[0])) {
12068 12535
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12069 12536
 						$airport_icao = $closestAirports[0]['icao'];
12070
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12537
+						if ($globalDebug) {
12538
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12539
+						}
12071 12540
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12072 12541
 						foreach ($closestAirports as $airport) {
12073 12542
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12074 12543
 								$airport_icao = $airport['icao'];
12075
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12544
+								if ($globalDebug) {
12545
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12546
+								}
12076 12547
 								break;
12077 12548
 							}
12078 12549
 						}
12079 12550
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12080 12551
 						$airport_icao = $closestAirports[0]['icao'];
12081
-						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";
12552
+						if ($globalDebug) {
12553
+							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";
12554
+						}
12082 12555
 					} else {
12083
-						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";
12556
+						if ($globalDebug) {
12557
+							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";
12558
+						}
12084 12559
 					}
12085 12560
 				} else {
12086
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12561
+					if ($globalDebug) {
12562
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12563
+					}
12087 12564
 				}
12088 12565
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12089
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12566
+					if ($globalDebug) {
12567
+						echo "Updating airport to ".$airport_icao."...\n";
12568
+					}
12090 12569
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12091 12570
 					$sthu = $this->db->prepare($update_query);
12092 12571
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Braces   +149 added lines, -57 removed lines patch added patch discarded remove patch
@@ -107,17 +107,23 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
110
+	    if ($globalDebug) {
111
+	    	echo '!!! APRS invalid : '.$input."\n";
112
+	    }
111 113
 	    return false;
112 114
 	}
113 115
 	
114
-	if ($debug) echo 'input : '.$input."\n";
116
+	if ($debug) {
117
+		echo 'input : '.$input."\n";
118
+	}
115 119
 	/* Save header and body. */
116 120
 	$body = substr($input,$splitpos+1,$input_len);
117 121
 	$body_len = strlen($body);
118 122
 	$header = substr($input,0,$splitpos);
119 123
 	//$header_len = strlen($header);
120
-	if ($debug) echo 'header : '.$header."\n";
124
+	if ($debug) {
125
+		echo 'header : '.$header."\n";
126
+	}
121 127
 	
122 128
 	/* Parse source, target and path. */
123 129
 	//FLRDF0A52>APRS,qAS,LSTB
@@ -131,10 +137,14 @@  discard block
 block discarded – undo
131 137
 		$result['format_source'] = 'famaprs';
132 138
 		$result['source_type'] = 'ais';
133 139
 	    } else {
134
-		if ($debug) echo 'ident : '.$ident."\n";
140
+		if ($debug) {
141
+			echo 'ident : '.$ident."\n";
142
+		}
135 143
 		$result['ident'] = $ident;
136 144
 	    }
137
-	} else return false;
145
+	} else {
146
+		return false;
147
+	}
138 148
 	$elements = explode(',',$all_elements);
139 149
 	$source = end($elements);
140 150
 	$result['source'] = $source;
@@ -143,7 +153,9 @@  discard block
 block discarded – undo
143 153
 	        //echo "ok";
144 154
 	        //if ($element == 'TCPIP*') return false;
145 155
 	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
146
-		if ($debug) echo 'element : '.$element."\n";
156
+		if ($debug) {
157
+			echo 'element : '.$element."\n";
158
+		}
147 159
 		return false;
148 160
 	    }
149 161
 	    /*
@@ -156,11 +168,15 @@  discard block
 block discarded – undo
156 168
 	}
157 169
 	
158 170
 	$type = substr($body,0,1);
159
-	if ($debug) echo 'type : '.$type."\n";
171
+	if ($debug) {
172
+		echo 'type : '.$type."\n";
173
+	}
160 174
 	if ($type == ';') {
161 175
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
162 176
 			$result['address'] = trim(substr($body,1,9));
163
-		} else $result['ident'] = trim(substr($body,1,9));
177
+		} else {
178
+			$result['ident'] = trim(substr($body,1,9));
179
+		}
164 180
 	} elseif ($type == ',') {
165 181
 		// Invalid data or test data
166 182
 		return false;
@@ -228,7 +244,9 @@  discard block
 block discarded – undo
228 244
 		//$symbol_table = $matches[4];
229 245
 		$lat = intval($lat_deg);
230 246
 		$lon = intval($lon_deg);
231
-		if ($lat > 89 || $lon > 179) return false;
247
+		if ($lat > 89 || $lon > 179) {
248
+			return false;
249
+		}
232 250
 	    
233 251
 	    /*
234 252
 	    $tmp_5b = str_replace('.','',$lat_min);
@@ -238,8 +256,12 @@  discard block
 block discarded – undo
238 256
 	    */
239 257
 		$latitude = $lat + floatval($lat_min)/60;
240 258
 		$longitude = $lon + floatval($lon_min)/60;
241
-		if ($sind == 'S') $latitude = 0-$latitude;
242
-		if ($wind == 'W') $longitude = 0-$longitude;
259
+		if ($sind == 'S') {
260
+			$latitude = 0-$latitude;
261
+		}
262
+		if ($wind == 'W') {
263
+			$longitude = 0-$longitude;
264
+		}
243 265
 		$result['latitude'] = $latitude;
244 266
 		$result['longitude'] = $longitude;
245 267
 		$body_parse = substr($body_parse,18);
@@ -273,7 +295,9 @@  discard block
 block discarded – undo
273 295
 			$body_parse = substr($body_parse,1);
274 296
 			$body_parse_len = strlen($body_parse);
275 297
 			$result['symbol_code'] = $symbol_code;
276
-			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
298
+			if (isset($this->symbols[$symbol_code])) {
299
+				$result['symbol'] = $this->symbols[$symbol_code];
300
+			}
277 301
 			if ($symbol_code != '_') {
278 302
 			}
279 303
 		    //$body_parse = substr($body_parse,1);
@@ -284,7 +308,9 @@  discard block
 block discarded – undo
284 308
 		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
285 309
 		    	    $course = substr($body_parse,0,3);
286 310
 		    	    $tmp_s = intval($course);
287
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
311
+		    	    if ($tmp_s >= 1 && $tmp_s <= 360) {
312
+		    	    	$result['heading'] = intval($course);
313
+		    	    }
288 314
 		    	    $speed = substr($body_parse,4,3);
289 315
 		    	    if ($speed != '...') {
290 316
 		    		//$result['speed'] = round($speed*1.852);
@@ -325,10 +351,16 @@  discard block
 block discarded – undo
325 351
 			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
326 352
 			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
327 353
 			    
328
-				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
329
-				else $result['latitude'] += $lat_off;
330
-				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
331
-				else $result['longitude'] += $lon_off;
354
+				if ($result['latitude'] < 0) {
355
+					$result['latitude'] -= $lat_off;
356
+				} else {
357
+					$result['latitude'] += $lat_off;
358
+				}
359
+				if ($result['longitude'] < 0) {
360
+					$result['longitude'] -= $lon_off;
361
+				} else {
362
+					$result['longitude'] += $lon_off;
363
+				}
332 364
 			    }
333 365
 			    
334 366
 		            $body_parse = substr($body_parse,6);
@@ -364,27 +396,48 @@  discard block
 block discarded – undo
364 396
 			$address = substr($id,2);
365 397
 			//print_r($matches);
366 398
 			$addressType = (intval(substr($id,0,2),16))&3;
367
-			if ($addressType == 0) $result['addresstype'] = "RANDOM";
368
-			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
369
-			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
370
-			elseif ($addressType == 3) $result['addresstype'] = "OGN";
399
+			if ($addressType == 0) {
400
+				$result['addresstype'] = "RANDOM";
401
+			} elseif ($addressType == 1) {
402
+				$result['addresstype'] = "ICAO";
403
+			} elseif ($addressType == 2) {
404
+				$result['addresstype'] = "FLARM";
405
+			} elseif ($addressType == 3) {
406
+				$result['addresstype'] = "OGN";
407
+			}
371 408
 			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
372 409
 			$result['aircrafttype_code'] = $aircraftType;
373
-			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
374
-			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
375
-			elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE";
376
-			elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
377
-			elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE";
378
-			elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE";
379
-			elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER";
380
-			elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER";
381
-			elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT";
382
-			elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT";
383
-			elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO";
384
-			elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON";
385
-			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
386
-			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
387
-			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
410
+			if ($aircraftType == 0) {
411
+				$result['aircrafttype'] = "UNKNOWN";
412
+			} elseif ($aircraftType == 1) {
413
+				$result['aircrafttype'] = "GLIDER";
414
+			} elseif ($aircraftType == 2) {
415
+				$result['aircrafttype'] = "TOW_PLANE";
416
+			} elseif ($aircraftType == 3) {
417
+				$result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
418
+			} elseif ($aircraftType == 4) {
419
+				$result['aircrafttype'] = "PARACHUTE";
420
+			} elseif ($aircraftType == 5) {
421
+				$result['aircrafttype'] = "DROP_PLANE";
422
+			} elseif ($aircraftType == 6) {
423
+				$result['aircrafttype'] = "HANG_GLIDER";
424
+			} elseif ($aircraftType == 7) {
425
+				$result['aircrafttype'] = "PARA_GLIDER";
426
+			} elseif ($aircraftType == 8) {
427
+				$result['aircrafttype'] = "POWERED_AIRCRAFT";
428
+			} elseif ($aircraftType == 9) {
429
+				$result['aircrafttype'] = "JET_AIRCRAFT";
430
+			} elseif ($aircraftType == 10) {
431
+				$result['aircrafttype'] = "UFO";
432
+			} elseif ($aircraftType == 11) {
433
+				$result['aircrafttype'] = "BALLOON";
434
+			} elseif ($aircraftType == 12) {
435
+				$result['aircrafttype'] = "AIRSHIP";
436
+			} elseif ($aircraftType == 13) {
437
+				$result['aircrafttype'] = "UAV";
438
+			} elseif ($aircraftType == 15) {
439
+				$result['aircrafttype'] = "STATIC_OBJECT";
440
+			}
388 441
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
389 442
 			$result['stealth'] = $stealth;
390 443
 			$result['address'] = $address;
@@ -424,13 +477,21 @@  discard block
 block discarded – undo
424 477
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
425 478
 		    }
426 479
 		}
427
-		} else $result['comment'] = trim($body_parse);
480
+		} else {
481
+			$result['comment'] = trim($body_parse);
482
+		}
428 483
 
429 484
 	    }
430 485
 	//}
431
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
432
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
433
-	if ($debug) print_r($result);
486
+	if (isset($result['latitude'])) {
487
+		$result['latitude'] = round($result['latitude'],4);
488
+	}
489
+	if (isset($result['longitude'])) {
490
+		$result['longitude'] = round($result['longitude'],4);
491
+	}
492
+	if ($debug) {
493
+		print_r($result);
494
+	}
434 495
 	return $result;
435 496
     }
436 497
     
@@ -439,12 +500,21 @@  discard block
 block discarded – undo
439 500
 	$aprs_connect = 0;
440 501
 	$aprs_keep = 120;
441 502
 	$aprs_last_tx = time();
442
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
443
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
444
-	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
445
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
446
-	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
447
-	else $aprs_pass = '-1';
503
+	if (isset($globalAPRSversion)) {
504
+		$aprs_version = $globalAPRSversion;
505
+	} else {
506
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
507
+	}
508
+	if (isset($globalServerAPRSssid)) {
509
+		$aprs_ssid = $globalServerAPRSssid;
510
+	} else {
511
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
512
+	}
513
+	if (isset($globalServerAPRSpass)) {
514
+		$aprs_pass = $globalServerAPRSpass;
515
+	} else {
516
+		$aprs_pass = '-1';
517
+	}
448 518
 	
449 519
 	$aprs_filter  = '';
450 520
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
@@ -476,7 +546,9 @@  discard block
 block discarded – undo
476 546
     }
477 547
     
478 548
     public function send($data) {
479
-	if ($this->connected === false) $this->connect();
549
+	if ($this->connected === false) {
550
+		$this->connect();
551
+	}
480 552
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
481 553
 	if ($send === FALSE) {
482 554
 		socket_close($this->socket);
@@ -498,18 +570,26 @@  discard block
 block discarded – undo
498 570
 			//$w = '00';
499 571
 			$custom = '';
500 572
 			if ($ident != '') {
501
-				if ($custom != '') $custom .= '/';
573
+				if ($custom != '') {
574
+					$custom .= '/';
575
+				}
502 576
 				$custom .= 'CS='.$ident;
503 577
 			}
504 578
 			if ($squawk != '') {
505
-				if ($custom != '') $custom .= '/';
579
+				if ($custom != '') {
580
+					$custom .= '/';
581
+				}
506 582
 				$custom .= 'SQ='.$squawk;
507 583
 			}
508 584
 			if ($aircraft_icao != '' && $aircraft_icao != 'NA') {
509
-				if ($custom != '') $custom .= '/';
585
+				if ($custom != '') {
586
+					$custom .= '/';
587
+				}
510 588
 				$custom .= 'AI='.$aircraft_icao;
511 589
 			}
512
-			if ($custom != '') $custom = ' '.$custom;
590
+			if ($custom != '') {
591
+				$custom = ' '.$custom;
592
+			}
513 593
 			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
514 594
 		}
515 595
 	}
@@ -527,26 +607,38 @@  discard block
 block discarded – undo
527 607
 			//$w = '00';
528 608
 			$custom = '';
529 609
 			if ($ident != '') {
530
-				if ($custom != '') $custom .= '/';
610
+				if ($custom != '') {
611
+					$custom .= '/';
612
+				}
531 613
 				$custom .= 'CS='.$ident;
532 614
 			}
533 615
 			if ($typeid != '') {
534
-				if ($custom != '') $custom .= '/';
616
+				if ($custom != '') {
617
+					$custom .= '/';
618
+				}
535 619
 				$custom .= 'TI='.$typeid;
536 620
 			}
537 621
 			if ($imo != '') {
538
-				if ($custom != '') $custom .= '/';
622
+				if ($custom != '') {
623
+					$custom .= '/';
624
+				}
539 625
 				$custom .= 'IMO='.$imo;
540 626
 			}
541 627
 			if ($arrival_date != '') {
542
-				if ($custom != '') $custom .= '/';
628
+				if ($custom != '') {
629
+					$custom .= '/';
630
+				}
543 631
 				$custom .= 'AD='.strtotime($arrival_date);
544 632
 			}
545 633
 			if ($arrival_code != '') {
546
-				if ($custom != '') $custom .= '/';
634
+				if ($custom != '') {
635
+					$custom .= '/';
636
+				}
547 637
 				$custom .= 'AC='.$arrival_code;
548 638
 			}
549
-			if ($custom != '') $custom = ' '.$custom;
639
+			if ($custom != '') {
640
+				$custom = ' '.$custom;
641
+			}
550 642
 			$altitude = 0;
551 643
 			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
552 644
 		}
Please login to merge, or discard this patch.