Completed
Push — master ( 078d82...094023 )
by Yannick
06:07
created
manufacturer-statistics-departure-airport-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-departure-airport.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-arrival-airport-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,14 +26,19 @@  discard block
 block discarded – undo
26 26
 		$filter = $globalStatsFilters[$globalFilterName];
27 27
 	    }
28 28
 	}
29
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+	if (is_array($globalFilter)) {
30
+		$filter = array_merge($filter,$globalFilter);
31
+	}
30 32
 	$filter_query_join = '';
31 33
 	$filter_query_where = '';
32 34
 	if (isset($filter['source']) && !empty($filter['source'])) {
33 35
 	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
34 36
 	}
35
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
36
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
37
+	if ($filter_query_where == '' && $where) {
38
+		$filter_query_where = ' WHERE';
39
+	} elseif ($filter_query_where != '' && $and) {
40
+		$filter_query_where .= ' AND';
41
+	}
37 42
 	$filter_query = $filter_query_join.$filter_query_where;
38 43
 	return $filter_query;
39 44
     }
@@ -57,7 +62,9 @@  discard block
 block discarded – undo
57 62
     		$info = str_replace('^','<br />',$info);
58 63
     		$info = str_replace('&amp;sect;','',$info);
59 64
     		$info = str_replace('"','',$info);
60
-    		if ($type == '') $type = NULL;
65
+    		if ($type == '') {
66
+    			$type = NULL;
67
+    		}
61 68
                 $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
62 69
                 $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
63 70
                  try {
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +31 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 			$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24 24
 		}
25 25
 	}
26
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
26
+	if (is_array($globalFilter)) {
27
+		$filter = array_merge($filter,$globalFilter);
28
+	}
27 29
 	$filter_query_join = '';
28 30
 	$filter_query_where = '';
29 31
 	foreach($filters as $flt) {
@@ -69,8 +71,11 @@  discard block
 block discarded – undo
69 71
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
70 72
 	    }
71 73
 	}
72
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
73
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
74
+	if ($filter_query_where == '' && $where) {
75
+		$filter_query_where = ' WHERE';
76
+	} elseif ($filter_query_where != '' && $and) {
77
+		$filter_query_where .= ' AND';
78
+	}
74 79
 	$filter_query = $filter_query_join.$filter_query_where;
75 80
 	return $filter_query;
76 81
     }
@@ -81,10 +86,17 @@  discard block
 block discarded – undo
81 86
 		if ($over_country == '') {
82 87
 			$Spotter = new Spotter($this->db);
83 88
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
84
-			if (!empty($data_country)) $country = $data_country['iso2'];
85
-			else $country = '';
86
-		} else $country = $over_country;
87
-		if ($airline_type === NULL) $airline_type ='';
89
+			if (!empty($data_country)) {
90
+				$country = $data_country['iso2'];
91
+			} else {
92
+				$country = '';
93
+			}
94
+		} else {
95
+			$country = $over_country;
96
+		}
97
+		if ($airline_type === NULL) {
98
+			$airline_type ='';
99
+		}
88 100
 	
89 101
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
90 102
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -587,7 +599,9 @@  discard block
 block discarded – undo
587 599
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
588 600
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
589 601
 		    $translate = $Translation->ident2icao($q_item);
590
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
602
+		    if ($translate != $q_item) {
603
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
604
+		    }
591 605
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
592 606
 		    $additional_query .= ")";
593 607
 		}
@@ -805,7 +819,9 @@  discard block
 block discarded – undo
805 819
 		date_default_timezone_set($globalTimezone);
806 820
 		$datetime = new DateTime();
807 821
 		$offset = $datetime->format('P');
808
-	    } else $offset = '+00:00';
822
+	    } else {
823
+	    	$offset = '+00:00';
824
+	    }
809 825
 
810 826
 
811 827
 	    if ($date_array[1] != "")
@@ -969,9 +985,13 @@  discard block
 block discarded – undo
969 985
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
970 986
 			}
971 987
 		}
972
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
988
+                if ($sincedate != '') {
989
+                	$query .= "AND date > '".$sincedate."' ";
990
+                }
973 991
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
974
-	if ($limit) $query .= " LIMIT 0,10";
992
+	if ($limit) {
993
+		$query .= " LIMIT 0,10";
994
+	}
975 995
       
976 996
 	
977 997
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72 74
 			}
73 75
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76
+		if ($filter_query_where == '' && $where) {
77
+			$filter_query_where = ' WHERE';
78
+		} elseif ($filter_query_where != '' && $and) {
79
+			$filter_query_where .= ' AND';
80
+		}
76 81
 		$filter_query = $filter_query_join.$filter_query_where;
77 82
 		return $filter_query;
78 83
 	}
@@ -108,7 +113,9 @@  discard block
 block discarded – undo
108 113
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
109 114
 		}
110 115
 
111
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
116
+		if (!isset($globalLiveInterval)) {
117
+			$globalLiveInterval = '200';
118
+		}
112 119
 		if ($globalDBdriver == 'mysql') {
113 120
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
114 121
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -133,7 +140,9 @@  discard block
 block discarded – undo
133 140
 
134 141
 		$filter_query = $this->getFilter($filter,true,true);
135 142
 
136
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
143
+		if (!isset($globalLiveInterval)) {
144
+			$globalLiveInterval = '200';
145
+		}
137 146
 		if ($globalDBdriver == 'mysql') {
138 147
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
139 148
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -180,7 +189,9 @@  discard block
 block discarded – undo
180 189
 
181 190
 		$filter_query = $this->getFilter($filter,true,true);
182 191
 
183
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
192
+		if (!isset($globalLiveInterval)) {
193
+			$globalLiveInterval = '200';
194
+		}
184 195
 		if ($globalDBdriver == 'mysql') {
185 196
 
186 197
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -220,7 +231,9 @@  discard block
 block discarded – undo
220 231
 		global $globalDBdriver, $globalLiveInterval;
221 232
 		$filter_query = $this->getFilter($filter,true,true);
222 233
 
223
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
234
+		if (!isset($globalLiveInterval)) {
235
+			$globalLiveInterval = '200';
236
+		}
224 237
 		if ($globalDBdriver == 'mysql') {
225 238
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
226 239
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -250,7 +263,9 @@  discard block
 block discarded – undo
250 263
 	{
251 264
 		global $globalDBdriver, $globalLiveInterval;
252 265
 		$Spotter = new Spotter($this->db);
253
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
266
+		if (!isset($globalLiveInterval)) {
267
+			$globalLiveInterval = '200';
268
+		}
254 269
 		$filter_query = $this->getFilter($filter);
255 270
 
256 271
 		if (is_array($coord)) {
@@ -258,7 +273,9 @@  discard block
 block discarded – undo
258 273
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
259 274
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
260 275
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
261
-		} else return array();
276
+		} else {
277
+			return array();
278
+		}
262 279
 		if ($globalDBdriver == 'mysql') {
263 280
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
264 281
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -449,11 +466,15 @@  discard block
 block discarded – undo
449 466
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
450 467
 		if ($globalDBdriver == 'mysql') {
451 468
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
452
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
469
+			if ($liveinterval) {
470
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
471
+			}
453 472
 			$query .= ' ORDER BY date';
454 473
 		} else {
455 474
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
456
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
475
+			if ($liveinterval) {
476
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
477
+			}
457 478
 			$query .= ' ORDER BY date';
458 479
 		}
459 480
 
@@ -548,7 +569,9 @@  discard block
 block discarded – undo
548 569
 				$i++;
549 570
 				$j++;
550 571
 				if ($j == 30) {
551
-					if ($globalDebug) echo ".";
572
+					if ($globalDebug) {
573
+						echo ".";
574
+					}
552 575
 				    	try {
553 576
 						
554 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +879,9 @@  discard block
 block discarded – undo
856 879
 			{
857 880
 				return false;
858 881
 			}
859
-		} else return '';
882
+		} else {
883
+			return '';
884
+		}
860 885
 
861 886
 		if ($longitude != '')
862 887
 		{
@@ -864,7 +889,9 @@  discard block
 block discarded – undo
864 889
 			{
865 890
 				return false;
866 891
 			}
867
-		} else return '';
892
+		} else {
893
+			return '';
894
+		}
868 895
 
869 896
 		if ($waypoints != '')
870 897
 		{
@@ -880,7 +907,9 @@  discard block
 block discarded – undo
880 907
 			{
881 908
 				return false;
882 909
 			}
883
-		} else $altitude = 0;
910
+		} else {
911
+			$altitude = 0;
912
+		}
884 913
 
885 914
 		if ($heading != '')
886 915
 		{
@@ -888,7 +917,9 @@  discard block
 block discarded – undo
888 917
 			{
889 918
 				return false;
890 919
 			}
891
-		} else $heading = 0;
920
+		} else {
921
+			$heading = 0;
922
+		}
892 923
 
893 924
 		if ($groundspeed != '')
894 925
 		{
@@ -896,9 +927,13 @@  discard block
 block discarded – undo
896 927
 			{
897 928
 				return false;
898 929
 			}
899
-		} else $groundspeed = 0;
930
+		} else {
931
+			$groundspeed = 0;
932
+		}
900 933
 		date_default_timezone_set('UTC');
901
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
934
+		if ($date == '') {
935
+			$date = date("Y-m-d H:i:s", time());
936
+		}
902 937
 
903 938
         
904 939
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -942,10 +977,18 @@  discard block
 block discarded – undo
942 977
 		$arrival_airport_country = '';
943 978
 		
944 979
             	
945
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
946
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
947
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
948
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
980
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
981
+            		$squawk = NULL;
982
+            	}
983
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
984
+            		$verticalrate = NULL;
985
+            	}
986
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
987
+            		$groundspeed = 0;
988
+            	}
989
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
990
+            		$heading = 0;
991
+            	}
949 992
             	
950 993
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
951 994
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -960,9 +1003,13 @@  discard block
 block discarded – undo
960 1003
                 	return "error : ".$e->getMessage();
961 1004
                 }
962 1005
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
963
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1006
+		    if ($globalDebug) {
1007
+		    	echo '(Add to SBS archive : ';
1008
+		    }
964 1009
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
965
-		    if ($globalDebug) echo $result.')';
1010
+		    if ($globalDebug) {
1011
+		    	echo $result.')';
1012
+		    }
966 1013
 		}
967 1014
 		return "success";
968 1015
 
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Braces   +664 added lines, -230 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
73 75
 			}
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		$filter_query = $filter_query_join.$filter_query_where;
78 83
 		return $filter_query;
79 84
 	}
@@ -93,10 +98,18 @@  discard block
 block discarded – undo
93 98
 		$Image = new Image($this->db);
94 99
 		$Schedule = new Schedule($this->db);
95 100
 		$ACARS = new ACARS($this->db);
96
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
97
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
98
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
99
-		if (!isset($globalVAM)) $globalVAM = FALSE;
101
+		if (!isset($globalIVAO)) {
102
+			$globalIVAO = FALSE;
103
+		}
104
+		if (!isset($globalVATSIM)) {
105
+			$globalVATSIM = FALSE;
106
+		}
107
+		if (!isset($globalphpVMS)) {
108
+			$globalphpVMS = FALSE;
109
+		}
110
+		if (!isset($globalVAM)) {
111
+			$globalVAM = FALSE;
112
+		}
100 113
 		date_default_timezone_set('UTC');
101 114
 		
102 115
 		if (!is_string($query))
@@ -143,21 +156,35 @@  discard block
 block discarded – undo
143 156
 			} else {
144 157
 				$temp_array['spotter_id'] = '';
145 158
 			}
146
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
147
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
159
+			if (isset($row['flightaware_id'])) {
160
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
161
+			}
162
+			if (isset($row['modes'])) {
163
+				$temp_array['modes'] = $row['modes'];
164
+			}
148 165
 			$temp_array['ident'] = $row['ident'];
149 166
 			if (isset($row['registration']) && $row['registration'] != '') {
150 167
 				$temp_array['registration'] = $row['registration'];
151 168
 			} elseif (isset($temp_array['modes'])) {
152 169
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
153
-			} else $temp_array['registration'] = '';
154
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
170
+			} else {
171
+				$temp_array['registration'] = '';
172
+			}
173
+			if (isset($row['aircraft_icao'])) {
174
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
175
+			}
155 176
 			
156 177
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
157 178
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
158
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
159
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
160
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
179
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
180
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
181
+			}
182
+			if (isset($row['latitude'])) {
183
+				$temp_array['latitude'] = $row['latitude'];
184
+			}
185
+			if (isset($row['longitude'])) {
186
+				$temp_array['longitude'] = $row['longitude'];
187
+			}
161 188
 			/*
162 189
 			if (Connection->tableExists('countries')) {
163 190
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -167,8 +194,12 @@  discard block
 block discarded – undo
167 194
 				}
168 195
 			}
169 196
 			*/
170
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
171
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
197
+			if (isset($row['waypoints'])) {
198
+				$temp_array['waypoints'] = $row['waypoints'];
199
+			}
200
+			if (isset($row['format_source'])) {
201
+				$temp_array['format_source'] = $row['format_source'];
202
+			}
172 203
 			if (isset($row['route_stop'])) {
173 204
 				$temp_array['route_stop'] = $row['route_stop'];
174 205
 				if ($row['route_stop'] != '') {
@@ -187,13 +218,19 @@  discard block
 block discarded – undo
187 218
 					}
188 219
 				}
189 220
 			}
190
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
221
+			if (isset($row['altitude'])) {
222
+				$temp_array['altitude'] = $row['altitude'];
223
+			}
191 224
 			if (isset($row['heading'])) {
192 225
 				$temp_array['heading'] = $row['heading'];
193 226
 				$heading_direction = $this->parseDirection($row['heading']);
194
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
227
+				if (isset($heading_direction[0]['direction_fullname'])) {
228
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
229
+				}
230
+			}
231
+			if (isset($row['ground_speed'])) {
232
+				$temp_array['ground_speed'] = $row['ground_speed'];
195 233
 			}
196
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
197 234
 			$temp_array['image'] = "";
198 235
 			$temp_array['image_thumbnail'] = "";
199 236
 			$temp_array['image_source'] = "";
@@ -201,7 +238,9 @@  discard block
 block discarded – undo
201 238
  
202 239
 			if (isset($row['highlight'])) {
203 240
 				$temp_array['highlight'] = $row['highlight'];
204
-			} else $temp_array['highlight'] = '';
241
+			} else {
242
+				$temp_array['highlight'] = '';
243
+			}
205 244
 			
206 245
 			if (isset($row['date'])) {
207 246
 				$dateArray = $this->parseDateString($row['date']);
@@ -249,7 +288,9 @@  discard block
 block discarded – undo
249 288
 				
250 289
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
251 290
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
252
-					} else $temp_array['aircraft_shadow'] = 'default.png';
291
+					} else {
292
+						$temp_array['aircraft_shadow'] = 'default.png';
293
+					}
253 294
                                 } else {
254 295
                             		$temp_array['aircraft_shadow'] = 'default.png';
255 296
 					$temp_array['aircraft_name'] = 'N/A';
@@ -257,11 +298,17 @@  discard block
 block discarded – undo
257 298
                             	}
258 299
 			}
259 300
 			$fromsource = NULL;
260
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
261
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
262
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
263
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
264
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
301
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
302
+				$fromsource = $globalAirlinesSource;
303
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
304
+				$fromsource = 'vatsim';
305
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
306
+				$fromsource = 'ivao';
307
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
308
+				$fromsource = 'vatsim';
309
+			} elseif (isset($globalIVAO) && $globalIVAO) {
310
+				$fromsource = 'ivao';
311
+			}
265 312
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
266 313
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
267 314
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -284,12 +331,18 @@  discard block
 block discarded – undo
284 331
 				}
285 332
 			} else {
286 333
 				$temp_array['airline_icao'] = $row['airline_icao'];
287
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
288
-				else $temp_array['airline_iata'] = 'N/A';
334
+				if (isset($row['airline_iata'])) {
335
+					$temp_array['airline_iata'] = $row['airline_iata'];
336
+				} else {
337
+					$temp_array['airline_iata'] = 'N/A';
338
+				}
289 339
 				$temp_array['airline_name'] = $row['airline_name'];
290 340
 				$temp_array['airline_country'] = $row['airline_country'];
291
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
292
-				else $temp_array['airline_callsign'] = 'N/A';
341
+				if (isset($row['airline_callsign'])) {
342
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
343
+				} else {
344
+					$temp_array['airline_callsign'] = 'N/A';
345
+				}
293 346
 				$temp_array['airline_type'] = $row['airline_type'];
294 347
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
295 348
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -316,7 +369,9 @@  discard block
 block discarded – undo
316 369
 			}
317 370
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
318 371
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
319
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
372
+				if ($owner_info['owner'] != '') {
373
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
374
+				}
320 375
 				$temp_array['aircraft_base'] = $owner_info['base'];
321 376
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
322 377
 			}
@@ -324,9 +379,14 @@  discard block
 block discarded – undo
324 379
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
325 380
 			{
326 381
 				if ($globalIVAO) {
327
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
328
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
329
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
382
+					if (isset($temp_array['airline_icao'])) {
383
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
384
+					} else {
385
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
386
+					}
387
+				} else {
388
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
389
+				}
330 390
 				if (count($image_array) > 0) {
331 391
 					$temp_array['image'] = $image_array[0]['image'];
332 392
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -377,7 +437,9 @@  discard block
 block discarded – undo
377 437
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
378 438
 			if ($row['departure_airport_icao'] != '') {
379 439
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
380
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
440
+				if (!isset($departure_airport_array[0]['name'])) {
441
+					$departure_airport_array = $this->getAllAirportInfo('NA');
442
+				}
381 443
 			/*
382 444
 			} elseif ($row['departure_airport_name'] != '') {
383 445
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -385,7 +447,9 @@  discard block
 block discarded – undo
385 447
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
386 448
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
387 449
 			*/
388
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
450
+			} else {
451
+				$departure_airport_array = $this->getAllAirportInfo('NA');
452
+			}
389 453
 			if (isset($departure_airport_array[0]['name'])) {
390 454
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
391 455
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -405,8 +469,12 @@  discard block
 block discarded – undo
405 469
 			
406 470
 			if ($row['arrival_airport_icao'] != '') {
407 471
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
408
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
409
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
472
+				if (count($arrival_airport_array) == 0) {
473
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
474
+				}
475
+			} else {
476
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
477
+			}
410 478
 			if (isset($arrival_airport_array[0]['name'])) {
411 479
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
412 480
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -422,27 +490,45 @@  discard block
 block discarded – undo
422 490
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
423 491
 			}
424 492
 			*/
425
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
426
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
427
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
428
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
429
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
493
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
494
+				$temp_array['pilot_id'] = $row['pilot_id'];
495
+			}
496
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
497
+				$temp_array['pilot_name'] = $row['pilot_name'];
498
+			}
499
+			if (isset($row['source_name']) && $row['source_name'] != '') {
500
+				$temp_array['source_name'] = $row['source_name'];
501
+			}
502
+			if (isset($row['over_country']) && $row['over_country'] != '') {
503
+				$temp_array['over_country'] = $row['over_country'];
504
+			}
505
+			if (isset($row['distance']) && $row['distance'] != '') {
506
+				$temp_array['distance'] = $row['distance'];
507
+			}
430 508
 			if (isset($row['squawk'])) {
431 509
 				$temp_array['squawk'] = $row['squawk'];
432 510
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
433 511
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
434
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
513
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
514
+					}
435 515
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
436 516
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
437
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
438
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
517
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
518
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
519
+					}
520
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
521
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
522
+				}
439 523
 			}
440 524
     			
441 525
 			$temp_array['query_number_rows'] = $num_rows;
442 526
 			
443 527
 			$spotter_array[] = $temp_array;
444 528
 		}
445
-		if ($num_rows == 0) return array();
529
+		if ($num_rows == 0) {
530
+			return array();
531
+		}
446 532
 		$spotter_array[0]['query_number_rows'] = $num_rows;
447 533
 		return $spotter_array;
448 534
 	}	
@@ -475,7 +561,9 @@  discard block
 block discarded – undo
475 561
 				foreach ($q_array as $q_item){
476 562
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
477 563
 					$additional_query .= " AND (";
478
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
564
+					if (is_int($q_item)) {
565
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
566
+					}
479 567
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
480 568
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
481 569
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -496,7 +584,9 @@  discard block
 block discarded – undo
496 584
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
497 585
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
498 586
 					$translate = $Translation->ident2icao($q_item);
499
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
587
+					if ($translate != $q_item) {
588
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
589
+					}
500 590
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
501 591
 					$additional_query .= ")";
502 592
 				}
@@ -723,7 +813,9 @@  discard block
 block discarded – undo
723 813
 				date_default_timezone_set($globalTimezone);
724 814
 				$datetime = new DateTime();
725 815
 				$offset = $datetime->format('P');
726
-			} else $offset = '+00:00';
816
+			} else {
817
+				$offset = '+00:00';
818
+			}
727 819
 
728 820
 			if ($date_array[1] != "")
729 821
 			{
@@ -755,8 +847,12 @@  discard block
 block discarded – undo
755 847
 			{
756 848
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
757 849
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
758
-			} else $limit_query = "";
759
-		} else $limit_query = "";
850
+			} else {
851
+				$limit_query = "";
852
+			}
853
+		} else {
854
+			$limit_query = "";
855
+		}
760 856
 
761 857
 
762 858
 		if ($sort != "")
@@ -824,8 +920,12 @@  discard block
 block discarded – undo
824 920
 			{
825 921
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
826 922
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
827
-			} else $limit_query = "";
828
-		} else $limit_query = "";
923
+			} else {
924
+				$limit_query = "";
925
+			}
926
+		} else {
927
+			$limit_query = "";
928
+		}
829 929
 		
830 930
 		if ($sort != "")
831 931
 		{
@@ -1149,7 +1249,9 @@  discard block
 block discarded – undo
1149 1249
 		global $global_query;
1150 1250
 		
1151 1251
 		date_default_timezone_set('UTC');
1152
-		if ($id == '') return array();
1252
+		if ($id == '') {
1253
+			return array();
1254
+		}
1153 1255
 		$additional_query = "spotter_output.spotter_id = :id";
1154 1256
 		$query_values = array(':id' => $id);
1155 1257
 
@@ -1776,7 +1878,9 @@  discard block
 block discarded – undo
1776 1878
 		{
1777 1879
 			$highlight = $row['highlight'];
1778 1880
 		}
1779
-		if (isset($highlight)) return $highlight;
1881
+		if (isset($highlight)) {
1882
+			return $highlight;
1883
+		}
1780 1884
 	}
1781 1885
 
1782 1886
 	
@@ -1804,7 +1908,9 @@  discard block
 block discarded – undo
1804 1908
 		$sth->closeCursor();
1805 1909
 		if (count($row) > 0) {
1806 1910
 			return $row['usage'];
1807
-		} else return '';
1911
+		} else {
1912
+			return '';
1913
+		}
1808 1914
 	}
1809 1915
 
1810 1916
 	/**
@@ -1829,7 +1935,9 @@  discard block
 block discarded – undo
1829 1935
 		$sth->closeCursor();
1830 1936
 		if (count($row) > 0) {
1831 1937
 			return $row['icao'];
1832
-		} else return '';
1938
+		} else {
1939
+			return '';
1940
+		}
1833 1941
 	}
1834 1942
 
1835 1943
 	/**
@@ -1857,7 +1965,9 @@  discard block
 block discarded – undo
1857 1965
 			$airport_longitude = $row['longitude'];
1858 1966
 			$Common = new Common();
1859 1967
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1860
-		} else return '';
1968
+		} else {
1969
+			return '';
1970
+		}
1861 1971
 	}
1862 1972
 	
1863 1973
 	/**
@@ -1969,7 +2079,9 @@  discard block
 block discarded – undo
1969 2079
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970 2080
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971 2081
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972
-		} else return array();
2082
+		} else {
2083
+			return array();
2084
+		}
1973 2085
 		if ($globalDBdriver == 'mysql') {
1974 2086
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1975 2087
 		} else {
@@ -2004,7 +2116,9 @@  discard block
 block discarded – undo
2004 2116
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2005 2117
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2006 2118
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2007
-		} else return array();
2119
+		} else {
2120
+			return array();
2121
+		}
2008 2122
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2009 2123
 		$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.")";
2010 2124
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2039,7 +2153,9 @@  discard block
 block discarded – undo
2039 2153
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2040 2154
 	{
2041 2155
 		global $globalUseRealAirlines;
2042
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2156
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2157
+			$fromsource = NULL;
2158
+		}
2043 2159
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2044 2160
 		if ($airline_icao == 'NA') {
2045 2161
 			$airline_array = array();
@@ -2089,7 +2205,9 @@  discard block
 block discarded – undo
2089 2205
 				$sth->execute(array(':fromsource' => $fromsource));
2090 2206
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2091 2207
 				$sth->closeCursor();
2092
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2208
+				if ($row['nb'] == 0) {
2209
+					$result = $this->getAllAirlineInfo($airline_icao);
2210
+				}
2093 2211
 			}
2094 2212
 			return $result;
2095 2213
 		}
@@ -2153,15 +2271,20 @@  discard block
 block discarded – undo
2153 2271
 				'A320-211' => 'A320',
2154 2272
 				'747-8i' => 'B748',
2155 2273
 				'A380' => 'A388');
2156
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2274
+		if (isset($all_aircraft[$aircraft_type])) {
2275
+			return $all_aircraft[$aircraft_type];
2276
+		}
2157 2277
 
2158 2278
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2159 2279
 		$aircraft_type = strtoupper($aircraft_type);
2160 2280
 		$sth = $this->db->prepare($query);
2161 2281
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2162 2282
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2163
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2164
-		else return '';
2283
+		if (isset($result[0]['icao'])) {
2284
+			return $result[0]['icao'];
2285
+		} else {
2286
+			return '';
2287
+		}
2165 2288
 	}
2166 2289
 	
2167 2290
 	/**
@@ -2184,7 +2307,9 @@  discard block
 block discarded – undo
2184 2307
 		$sth->closeCursor();
2185 2308
 		if (isset($row['icaotypecode'])) {
2186 2309
 			return $row['icaotypecode'];
2187
-		} else return '';
2310
+		} else {
2311
+			return '';
2312
+		}
2188 2313
 	}
2189 2314
 
2190 2315
 	/**
@@ -2206,7 +2331,9 @@  discard block
 block discarded – undo
2206 2331
 		$sth->closeCursor();
2207 2332
 		if (isset($row['operator_correct'])) {
2208 2333
 			return $row['operator_correct'];
2209
-		} else return $operator;
2334
+		} else {
2335
+			return $operator;
2336
+		}
2210 2337
 	}
2211 2338
 
2212 2339
 	/**
@@ -2219,7 +2346,9 @@  discard block
 block discarded – undo
2219 2346
 	public function getRouteInfo($callsign)
2220 2347
 	{
2221 2348
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2222
-                if ($callsign == '') return array();
2349
+                if ($callsign == '') {
2350
+                	return array();
2351
+                }
2223 2352
 		$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";
2224 2353
 		
2225 2354
 		$sth = $this->db->prepare($query);
@@ -2229,7 +2358,9 @@  discard block
 block discarded – undo
2229 2358
 		$sth->closeCursor();
2230 2359
 		if (count($row) > 0) {
2231 2360
 			return $row;
2232
-		} else return array();
2361
+		} else {
2362
+			return array();
2363
+		}
2233 2364
 	}
2234 2365
 	
2235 2366
 	/**
@@ -2282,7 +2413,9 @@  discard block
 block discarded – undo
2282 2413
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2283 2414
 			$sth->closeCursor();
2284 2415
 			return $result;
2285
-		} else return array();
2416
+		} else {
2417
+			return array();
2418
+		}
2286 2419
 	}
2287 2420
 	
2288 2421
   
@@ -2439,8 +2572,11 @@  discard block
 block discarded – undo
2439 2572
 		$query .= " ORDER BY spotter_output.source_name ASC";
2440 2573
 
2441 2574
 		$sth = $this->db->prepare($query);
2442
-		if (!empty($query_values)) $sth->execute($query_values);
2443
-		else $sth->execute();
2575
+		if (!empty($query_values)) {
2576
+			$sth->execute($query_values);
2577
+		} else {
2578
+			$sth->execute();
2579
+		}
2444 2580
 
2445 2581
 		$source_array = array();
2446 2582
 		$temp_array = array();
@@ -2473,9 +2609,13 @@  discard block
 block discarded – undo
2473 2609
 								WHERE spotter_output.airline_icao <> '' 
2474 2610
 								ORDER BY spotter_output.airline_name ASC";
2475 2611
 			*/
2476
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2477
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2478
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2612
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2613
+				$forsource = $globalAirlinesSource;
2614
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2615
+				$forsource = 'vatsim';
2616
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2617
+				$forsource = 'ivao';
2618
+			}
2479 2619
 			if ($forsource === NULL) {
2480 2620
 				$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";
2481 2621
 				$query_data = array();
@@ -2767,7 +2907,9 @@  discard block
 block discarded – undo
2767 2907
 			date_default_timezone_set($globalTimezone);
2768 2908
 			$datetime = new DateTime();
2769 2909
 			$offset = $datetime->format('P');
2770
-		} else $offset = '+00:00';
2910
+		} else {
2911
+			$offset = '+00:00';
2912
+		}
2771 2913
 		if ($airport_icao == '') {
2772 2914
 			if ($globalDBdriver == 'mysql') {
2773 2915
 				$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' 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";
@@ -2799,7 +2941,9 @@  discard block
 block discarded – undo
2799 2941
 			date_default_timezone_set($globalTimezone);
2800 2942
 			$datetime = new DateTime();
2801 2943
 			$offset = $datetime->format('P');
2802
-		} else $offset = '+00:00';
2944
+		} else {
2945
+			$offset = '+00:00';
2946
+		}
2803 2947
 		if ($airport_icao == '') {
2804 2948
 			if ($globalDBdriver == 'mysql') {
2805 2949
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2832,7 +2976,9 @@  discard block
 block discarded – undo
2832 2976
 			date_default_timezone_set($globalTimezone);
2833 2977
 			$datetime = new DateTime();
2834 2978
 			$offset = $datetime->format('P');
2835
-		} else $offset = '+00:00';
2979
+		} else {
2980
+			$offset = '+00:00';
2981
+		}
2836 2982
 		if ($airport_icao == '') {
2837 2983
 			if ($globalDBdriver == 'mysql') {
2838 2984
 				$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 
@@ -2871,7 +3017,9 @@  discard block
 block discarded – undo
2871 3017
 			date_default_timezone_set($globalTimezone);
2872 3018
 			$datetime = new DateTime();
2873 3019
 			$offset = $datetime->format('P');
2874
-		} else $offset = '+00:00';
3020
+		} else {
3021
+			$offset = '+00:00';
3022
+		}
2875 3023
 		if ($airport_icao == '') {
2876 3024
 			if ($globalDBdriver == 'mysql') {
2877 3025
 				$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 
@@ -2916,7 +3064,9 @@  discard block
 block discarded – undo
2916 3064
 			date_default_timezone_set($globalTimezone);
2917 3065
 			$datetime = new DateTime();
2918 3066
 			$offset = $datetime->format('P');
2919
-		} else $offset = '+00:00';
3067
+		} else {
3068
+			$offset = '+00:00';
3069
+		}
2920 3070
 		if ($airport_icao == '') {
2921 3071
 			if ($globalDBdriver == 'mysql') {
2922 3072
 				$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' 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";
@@ -2951,7 +3101,9 @@  discard block
 block discarded – undo
2951 3101
 			date_default_timezone_set($globalTimezone);
2952 3102
 			$datetime = new DateTime();
2953 3103
 			$offset = $datetime->format('P');
2954
-		} else $offset = '+00:00';
3104
+		} else {
3105
+			$offset = '+00:00';
3106
+		}
2955 3107
 		if ($airport_icao == '') {
2956 3108
 			if ($globalDBdriver == 'mysql') {
2957 3109
 				$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 
@@ -2993,7 +3145,9 @@  discard block
 block discarded – undo
2993 3145
 			date_default_timezone_set($globalTimezone);
2994 3146
 			$datetime = new DateTime();
2995 3147
 			$offset = $datetime->format('P');
2996
-		} else $offset = '+00:00';
3148
+		} else {
3149
+			$offset = '+00:00';
3150
+		}
2997 3151
 		if ($airport_icao == '') {
2998 3152
 			if ($globalDBdriver == 'mysql') {
2999 3153
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3027,7 +3181,9 @@  discard block
 block discarded – undo
3027 3181
 			date_default_timezone_set($globalTimezone);
3028 3182
 			$datetime = new DateTime();
3029 3183
 			$offset = $datetime->format('P');
3030
-		} else $offset = '+00:00';
3184
+		} else {
3185
+			$offset = '+00:00';
3186
+		}
3031 3187
 		if ($airport_icao == '') {
3032 3188
 			if ($globalDBdriver == 'mysql') {
3033 3189
 				$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 
@@ -3075,7 +3231,9 @@  discard block
 block discarded – undo
3075 3231
 			date_default_timezone_set($globalTimezone);
3076 3232
 			$datetime = new DateTime();
3077 3233
 			$offset = $datetime->format('P');
3078
-		} else $offset = '+00:00';
3234
+		} else {
3235
+			$offset = '+00:00';
3236
+		}
3079 3237
 
3080 3238
 		if ($globalDBdriver == 'mysql') {
3081 3239
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3195,7 +3353,9 @@  discard block
 block discarded – undo
3195 3353
 	*/	
3196 3354
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3197 3355
 	{
3198
-		if ($groundspeed == '') $groundspeed = NULL;
3356
+		if ($groundspeed == '') {
3357
+			$groundspeed = NULL;
3358
+		}
3199 3359
 		$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';
3200 3360
                 $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);
3201 3361
 
@@ -3245,10 +3405,18 @@  discard block
 block discarded – undo
3245 3405
 		$Image = new Image($this->db);
3246 3406
 		$Common = new Common();
3247 3407
 		
3248
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3249
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3250
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3251
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3408
+		if (!isset($globalIVAO)) {
3409
+			$globalIVAO = FALSE;
3410
+		}
3411
+		if (!isset($globalVATSIM)) {
3412
+			$globalVATSIM = FALSE;
3413
+		}
3414
+		if (!isset($globalphpVMS)) {
3415
+			$globalphpVMS = FALSE;
3416
+		}
3417
+		if (!isset($globalVAM)) {
3418
+			$globalVAM = FALSE;
3419
+		}
3252 3420
 		date_default_timezone_set('UTC');
3253 3421
 		
3254 3422
 		//getting the registration
@@ -3261,23 +3429,33 @@  discard block
 block discarded – undo
3261 3429
 				if ($ModeS != '') {
3262 3430
 					$timeelapsed = microtime(true);
3263 3431
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3264
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3432
+					if ($globalDebugTimeElapsed) {
3433
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3434
+					}
3265 3435
 				} else {
3266 3436
 					$myhex = explode('-',$flightaware_id);
3267 3437
 					if (count($myhex) > 0) {
3268 3438
 						$timeelapsed = microtime(true);
3269 3439
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3270
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3440
+						if ($globalDebugTimeElapsed) {
3441
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3442
+						}
3271 3443
 					}
3272 3444
 				}
3273 3445
 			}
3274 3446
 		}
3275 3447
 		$fromsource = NULL;
3276
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3277
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3278
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3279
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3280
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3448
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3449
+			$fromsource = $globalAirlinesSource;
3450
+		} elseif ($format_source == 'vatsimtxt') {
3451
+			$fromsource = 'vatsim';
3452
+		} elseif ($format_source == 'whazzup') {
3453
+			$fromsource = 'ivao';
3454
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3455
+			$fromsource = 'vatsim';
3456
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3457
+			$fromsource = 'ivao';
3458
+		}
3281 3459
 		//getting the airline information
3282 3460
 		if ($ident != "")
3283 3461
 		{
@@ -3301,15 +3479,21 @@  discard block
 block discarded – undo
3301 3479
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3302 3480
 						$airline_array = $this->getAllAirlineInfo("NA");
3303 3481
 					}
3304
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3482
+					if ($globalDebugTimeElapsed) {
3483
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484
+					}
3305 3485
 
3306 3486
 				} else {
3307 3487
 					$timeelapsed = microtime(true);
3308 3488
 					$airline_array = $this->getAllAirlineInfo("NA");
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					if ($globalDebugTimeElapsed) {
3490
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3491
+					}
3310 3492
 				}
3311 3493
 			}
3312
-		} else $airline_array = array();
3494
+		} else {
3495
+			$airline_array = array();
3496
+		}
3313 3497
 		
3314 3498
 		//getting the aircraft information
3315 3499
 		$aircraft_array = array();
@@ -3323,27 +3507,37 @@  discard block
 block discarded – undo
3323 3507
 				{
3324 3508
 					$timeelapsed = microtime(true);
3325 3509
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3326
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3510
+					if ($globalDebugTimeElapsed) {
3511
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3512
+					}
3327 3513
 				} else {
3328 3514
 					$timeelapsed = microtime(true);
3329 3515
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3330
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3516
+					if ($globalDebugTimeElapsed) {
3517
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3518
+					}
3331 3519
 				}
3332 3520
 			}
3333 3521
 		} else {
3334 3522
 			if ($ModeS != '') {
3335 3523
 				$timeelapsed = microtime(true);
3336 3524
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3337
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3525
+				if ($globalDebugTimeElapsed) {
3526
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3527
+				}
3338 3528
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3339 3529
 				{
3340 3530
 					$timeelapsed = microtime(true);
3341 3531
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3342
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3532
+					if ($globalDebugTimeElapsed) {
3533
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3534
+					}
3343 3535
 				} else {
3344 3536
 					$timeelapsed = microtime(true);
3345 3537
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3346
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+					if ($globalDebugTimeElapsed) {
3539
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3540
+					}
3347 3541
 				}
3348 3542
 			}
3349 3543
 		}
@@ -3358,7 +3552,9 @@  discard block
 block discarded – undo
3358 3552
 			} else {
3359 3553
 				$timeelapsed = microtime(true);
3360 3554
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3361
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3555
+				if ($globalDebugTimeElapsed) {
3556
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3557
+				}
3362 3558
 			}
3363 3559
 		}
3364 3560
 		
@@ -3372,7 +3568,9 @@  discard block
 block discarded – undo
3372 3568
 			} else {
3373 3569
 				$timeelapsed = microtime(true);
3374 3570
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3375
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3571
+				if ($globalDebugTimeElapsed) {
3572
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3573
+				}
3376 3574
 			}
3377 3575
 		}
3378 3576
 
@@ -3407,7 +3605,9 @@  discard block
 block discarded – undo
3407 3605
 			{
3408 3606
 				return false;
3409 3607
 			}
3410
-		} else $altitude = 0;
3608
+		} else {
3609
+			$altitude = 0;
3610
+		}
3411 3611
 		
3412 3612
 		if ($heading != "")
3413 3613
 		{
@@ -3436,7 +3636,9 @@  discard block
 block discarded – undo
3436 3636
 		{
3437 3637
 			$timeelapsed = microtime(true);
3438 3638
 			$image_array = $Image->getSpotterImage($registration);
3439
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3639
+			if ($globalDebugTimeElapsed) {
3640
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3641
+			}
3440 3642
 			if (!isset($image_array[0]['registration']))
3441 3643
 			{
3442 3644
 				//echo "Add image !!!! \n";
@@ -3444,14 +3646,21 @@  discard block
 block discarded – undo
3444 3646
 			}
3445 3647
 			$timeelapsed = microtime(true);
3446 3648
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3447
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3448
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3649
+			if ($globalDebugTimeElapsed) {
3650
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3651
+			}
3652
+			if ($owner_info['owner'] != '') {
3653
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3654
+			}
3449 3655
 		}
3450 3656
     
3451 3657
 		if ($globalIVAO && $aircraft_icao != '')
3452 3658
 		{
3453
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3454
-            		else $airline_icao = '';
3659
+            		if (isset($airline_array[0]['icao'])) {
3660
+            			$airline_icao = $airline_array[0]['icao'];
3661
+            		} else {
3662
+            			$airline_icao = '';
3663
+            		}
3455 3664
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3456 3665
 			if (!isset($image_array[0]['registration']))
3457 3666
 			{
@@ -3496,16 +3705,28 @@  discard block
 block discarded – undo
3496 3705
                 {
3497 3706
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3498 3707
                 }
3499
-                if ($registration == '') $registration = 'NA';
3708
+                if ($registration == '') {
3709
+                	$registration = 'NA';
3710
+                }
3500 3711
                 if ($latitude == '' && $longitude == '') {
3501 3712
             		$latitude = 0;
3502 3713
             		$longitude = 0;
3503 3714
             	}
3504
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3505
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3506
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3507
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3508
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3715
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3716
+                	$squawk = NULL;
3717
+                }
3718
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3719
+                	$verticalrate = NULL;
3720
+                }
3721
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3722
+                	$heading = 0;
3723
+                }
3724
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3725
+                	$groundspeed = 0;
3726
+                }
3727
+                if (!isset($aircraft_owner)) {
3728
+                	$aircraft_owner = NULL;
3729
+                }
3509 3730
                 $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) 
3510 3731
                 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)";
3511 3732
 
@@ -3516,9 +3737,13 @@  discard block
 block discarded – undo
3516 3737
 		if ($airline_type == '') {
3517 3738
 			$timeelapsed = microtime(true);
3518 3739
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3519
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3740
+			if ($globalDebugTimeElapsed) {
3741
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3742
+			}
3743
+		}
3744
+		if ($airline_type == null) {
3745
+			$airline_type = '';
3520 3746
 		}
3521
-		if ($airline_type == null) $airline_type = '';
3522 3747
                 $aircraft_type = $aircraft_array[0]['type'];
3523 3748
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3524 3749
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3653,7 +3878,9 @@  discard block
 block discarded – undo
3653 3878
 			}
3654 3879
 		}
3655 3880
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3656
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3881
+		if ($limit) {
3882
+			$query .= " LIMIT 10 OFFSET 0";
3883
+		}
3657 3884
 		
3658 3885
 		$sth = $this->db->prepare($query);
3659 3886
 		$sth->execute();
@@ -3698,7 +3925,9 @@  discard block
 block discarded – undo
3698 3925
 			}
3699 3926
 		}
3700 3927
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3701
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3928
+		if ($limit) {
3929
+			$query .= " LIMIT 10 OFFSET 0";
3930
+		}
3702 3931
       
3703 3932
 		
3704 3933
 		$sth = $this->db->prepare($query);
@@ -3743,7 +3972,9 @@  discard block
 block discarded – undo
3743 3972
 			}
3744 3973
 		}
3745 3974
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3746
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3975
+		if ($limit) {
3976
+			$query .= " LIMIT 10 OFFSET 0";
3977
+		}
3747 3978
       
3748 3979
 		
3749 3980
 		$sth = $this->db->prepare($query);
@@ -3790,7 +4021,9 @@  discard block
 block discarded – undo
3790 4021
 			}
3791 4022
 		}
3792 4023
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3793
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4024
+		if ($limit) {
4025
+			$query .= " LIMIT 10 OFFSET 0";
4026
+		}
3794 4027
       
3795 4028
 		
3796 4029
 		$sth = $this->db->prepare($query);
@@ -3835,7 +4068,9 @@  discard block
 block discarded – undo
3835 4068
 			}
3836 4069
 		}
3837 4070
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3838
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4071
+		if ($limit) {
4072
+			$query .= " LIMIT 10 OFFSET 0";
4073
+		}
3839 4074
       
3840 4075
 		
3841 4076
 		$sth = $this->db->prepare($query);
@@ -4078,7 +4313,9 @@  discard block
 block discarded – undo
4078 4313
 			date_default_timezone_set($globalTimezone);
4079 4314
 			$datetime = new DateTime($date);
4080 4315
 			$offset = $datetime->format('P');
4081
-		} else $offset = '+00:00';
4316
+		} else {
4317
+			$offset = '+00:00';
4318
+		}
4082 4319
 
4083 4320
 		if ($globalDBdriver == 'mysql') {
4084 4321
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4126,7 +4363,9 @@  discard block
 block discarded – undo
4126 4363
 			date_default_timezone_set($globalTimezone);
4127 4364
 			$datetime = new DateTime($date);
4128 4365
 			$offset = $datetime->format('P');
4129
-		} else $offset = '+00:00';
4366
+		} else {
4367
+			$offset = '+00:00';
4368
+		}
4130 4369
 		
4131 4370
 		if ($globalDBdriver == 'mysql') {
4132 4371
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4344,7 +4583,9 @@  discard block
 block discarded – undo
4344 4583
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4345 4584
 					GROUP BY spotter_output.airline_country
4346 4585
 					ORDER BY airline_country_count DESC";
4347
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4586
+		if ($limit) {
4587
+			$query .= " LIMIT 10 OFFSET 0";
4588
+		}
4348 4589
       
4349 4590
 		$sth = $this->db->prepare($query);
4350 4591
 		$sth->execute();
@@ -4372,7 +4613,9 @@  discard block
 block discarded – undo
4372 4613
 		global $globalDBdriver;
4373 4614
 		//$filter_query = $this->getFilter($filters,true,true);
4374 4615
 		$Connection= new Connection($this->db);
4375
-		if (!$Connection->tableExists('countries')) return array();
4616
+		if (!$Connection->tableExists('countries')) {
4617
+			return array();
4618
+		}
4376 4619
 		/*
4377 4620
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4378 4621
 					FROM countries c, spotter_output s
@@ -4397,7 +4640,9 @@  discard block
 block discarded – undo
4397 4640
 		}
4398 4641
 
4399 4642
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4400
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4643
+		if ($limit) {
4644
+			$query .= " LIMIT 10 OFFSET 0";
4645
+		}
4401 4646
       
4402 4647
 		
4403 4648
 		$sth = $this->db->prepare($query);
@@ -4447,7 +4692,9 @@  discard block
 block discarded – undo
4447 4692
 		}
4448 4693
 
4449 4694
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4450
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4695
+		if ($limit) {
4696
+			$query .= " LIMIT 10 OFFSET 0";
4697
+		}
4451 4698
  
4452 4699
 		$sth = $this->db->prepare($query);
4453 4700
 		$sth->execute();
@@ -4493,7 +4740,9 @@  discard block
 block discarded – undo
4493 4740
 		}
4494 4741
 
4495 4742
 		$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";
4496
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4743
+		if ($limit) {
4744
+			$query .= " LIMIT 10 OFFSET 0";
4745
+		}
4497 4746
  
4498 4747
 		$sth = $this->db->prepare($query);
4499 4748
 		$sth->execute();
@@ -4546,7 +4795,9 @@  discard block
 block discarded – undo
4546 4795
 			if($row['registration'] != "")
4547 4796
 			{
4548 4797
 				$image_array = $Image->getSpotterImage($row['registration']);
4549
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4798
+				if (isset($image_array[0]['image_thumbnail'])) {
4799
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4800
+				}
4550 4801
 			}
4551 4802
 			$temp_array['registration_count'] = $row['registration_count'];
4552 4803
 
@@ -4621,7 +4872,9 @@  discard block
 block discarded – undo
4621 4872
 			if($row['registration'] != "")
4622 4873
 			{
4623 4874
 				$image_array = $Image->getSpotterImage($row['registration']);
4624
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4875
+				if (isset($image_array[0]['image_thumbnail'])) {
4876
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4877
+				}
4625 4878
 			}
4626 4879
 			$temp_array['registration_count'] = $row['registration_count'];
4627 4880
 
@@ -4728,7 +4981,9 @@  discard block
 block discarded – undo
4728 4981
 			if($row['registration'] != "")
4729 4982
 			{
4730 4983
 				$image_array = $Image->getSpotterImage($row['registration']);
4731
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4984
+				if (isset($image_array[0]['image_thumbnail'])) {
4985
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4986
+				}
4732 4987
 			}
4733 4988
 			$temp_array['registration_count'] = $row['registration_count'];
4734 4989
 			$aircraft_array[] = $temp_array;
@@ -4853,7 +5108,9 @@  discard block
 block discarded – undo
4853 5108
 			date_default_timezone_set($globalTimezone);
4854 5109
 			$datetime = new DateTime($date);
4855 5110
 			$offset = $datetime->format('P');
4856
-		} else $offset = '+00:00';
5111
+		} else {
5112
+			$offset = '+00:00';
5113
+		}
4857 5114
 
4858 5115
 		if ($globalDBdriver == 'mysql') {
4859 5116
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4900,7 +5157,9 @@  discard block
 block discarded – undo
4900 5157
 			date_default_timezone_set($globalTimezone);
4901 5158
 			$datetime = new DateTime($date);
4902 5159
 			$offset = $datetime->format('P');
4903
-		} else $offset = '+00:00';
5160
+		} else {
5161
+			$offset = '+00:00';
5162
+		}
4904 5163
 
4905 5164
 		if ($globalDBdriver == 'mysql') {
4906 5165
 			$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 
@@ -4929,7 +5188,9 @@  discard block
 block discarded – undo
4929 5188
 			if($row['registration'] != "")
4930 5189
 			{
4931 5190
 				$image_array = $Image->getSpotterImage($row['registration']);
4932
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5191
+				if (isset($image_array[0]['image_thumbnail'])) {
5192
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5193
+				}
4933 5194
 			}
4934 5195
 			$temp_array['registration_count'] = $row['registration_count'];
4935 5196
  
@@ -4954,7 +5215,9 @@  discard block
 block discarded – undo
4954 5215
 			date_default_timezone_set($globalTimezone);
4955 5216
 			$datetime = new DateTime($date);
4956 5217
 			$offset = $datetime->format('P');
4957
-		} else $offset = '+00:00';
5218
+		} else {
5219
+			$offset = '+00:00';
5220
+		}
4958 5221
 
4959 5222
 		if ($globalDBdriver == 'mysql') {
4960 5223
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5052,8 +5315,11 @@  discard block
 block discarded – undo
5052 5315
 			if($row['registration'] != "")
5053 5316
 			{
5054 5317
 				$image_array = $Image->getSpotterImage($row['registration']);
5055
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5056
-				else $temp_array['image_thumbnail'] = '';
5318
+				if (isset($image_array[0]['image_thumbnail'])) {
5319
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5320
+				} else {
5321
+					$temp_array['image_thumbnail'] = '';
5322
+				}
5057 5323
 			}
5058 5324
 			$temp_array['registration_count'] = $row['registration_count'];
5059 5325
 			$aircraft_array[] = $temp_array;
@@ -5160,7 +5426,9 @@  discard block
 block discarded – undo
5160 5426
 			if($row['registration'] != "")
5161 5427
 			{
5162 5428
 				$image_array = $Image->getSpotterImage($row['registration']);
5163
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5429
+				if (isset($image_array[0]['image_thumbnail'])) {
5430
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5431
+				}
5164 5432
 			}
5165 5433
 			$temp_array['registration_count'] = $row['registration_count'];
5166 5434
           
@@ -5277,7 +5545,9 @@  discard block
 block discarded – undo
5277 5545
 			if($row['registration'] != "")
5278 5546
 			{
5279 5547
 				$image_array = $Image->getSpotterImage($row['registration']);
5280
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5548
+				if (isset($image_array[0]['image_thumbnail'])) {
5549
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5550
+				}
5281 5551
 			}
5282 5552
 			$temp_array['registration_count'] = $row['registration_count'];
5283 5553
           
@@ -5389,7 +5659,9 @@  discard block
 block discarded – undo
5389 5659
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5390 5660
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5391 5661
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5392
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5662
+		if ($limit) {
5663
+			$query .= " LIMIT 10 OFFSET 0";
5664
+		}
5393 5665
 		
5394 5666
 		$sth = $this->db->prepare($query);
5395 5667
 		$sth->execute();
@@ -5408,7 +5680,9 @@  discard block
 block discarded – undo
5408 5680
 			if($row['registration'] != "")
5409 5681
 			{
5410 5682
 				$image_array = $Image->getSpotterImage($row['registration']);
5411
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5683
+				if (isset($image_array[0]['image_thumbnail'])) {
5684
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5685
+				}
5412 5686
 			}
5413 5687
           
5414 5688
 			$aircraft_array[] = $temp_array;
@@ -5449,7 +5723,9 @@  discard block
 block discarded – undo
5449 5723
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5450 5724
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5451 5725
                 $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";
5452
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5726
+		if ($limit) {
5727
+			$query .= " LIMIT 10 OFFSET 0";
5728
+		}
5453 5729
 		
5454 5730
 		$sth = $this->db->prepare($query);
5455 5731
 		$sth->execute();
@@ -5469,7 +5745,9 @@  discard block
 block discarded – undo
5469 5745
 			if($row['registration'] != "")
5470 5746
 			{
5471 5747
 				$image_array = $Image->getSpotterImage($row['registration']);
5472
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5748
+				if (isset($image_array[0]['image_thumbnail'])) {
5749
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5750
+				}
5473 5751
 			}
5474 5752
           
5475 5753
 			$aircraft_array[] = $temp_array;
@@ -5510,7 +5788,9 @@  discard block
 block discarded – undo
5510 5788
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5511 5789
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5512 5790
 				ORDER BY airport_departure_icao_count DESC";
5513
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5791
+		if ($limit) {
5792
+			$query .= " LIMIT 10 OFFSET 0";
5793
+		}
5514 5794
       
5515 5795
 		$sth = $this->db->prepare($query);
5516 5796
 		$sth->execute();
@@ -5562,7 +5842,9 @@  discard block
 block discarded – undo
5562 5842
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5563 5843
                 $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
5564 5844
 				ORDER BY airport_departure_icao_count DESC";
5565
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5845
+		if ($limit) {
5846
+			$query .= " LIMIT 10 OFFSET 0";
5847
+		}
5566 5848
       
5567 5849
 		$sth = $this->db->prepare($query);
5568 5850
 		$sth->execute();
@@ -5614,7 +5896,9 @@  discard block
 block discarded – undo
5614 5896
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5615 5897
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5616 5898
 				ORDER BY airport_departure_icao_count DESC";
5617
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5899
+		if ($limit) {
5900
+			$query .= " LIMIT 10 OFFSET 0";
5901
+		}
5618 5902
     		//echo $query;
5619 5903
 		$sth = $this->db->prepare($query);
5620 5904
 		$sth->execute();
@@ -5666,7 +5950,9 @@  discard block
 block discarded – undo
5666 5950
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667 5951
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5668 5952
 				ORDER BY airport_departure_icao_count DESC";
5669
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5953
+		if ($limit) {
5954
+			$query .= " LIMIT 10 OFFSET 0";
5955
+		}
5670 5956
       
5671 5957
 		$sth = $this->db->prepare($query);
5672 5958
 		$sth->execute();
@@ -6061,7 +6347,9 @@  discard block
 block discarded – undo
6061 6347
 			date_default_timezone_set($globalTimezone);
6062 6348
 			$datetime = new DateTime($date);
6063 6349
 			$offset = $datetime->format('P');
6064
-		} else $offset = '+00:00';
6350
+		} else {
6351
+			$offset = '+00:00';
6352
+		}
6065 6353
 
6066 6354
 		if ($globalDBdriver == 'mysql') {
6067 6355
 			$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 
@@ -6111,7 +6399,9 @@  discard block
 block discarded – undo
6111 6399
 			date_default_timezone_set($globalTimezone);
6112 6400
 			$datetime = new DateTime($date);
6113 6401
 			$offset = $datetime->format('P');
6114
-		} else $offset = '+00:00';
6402
+		} else {
6403
+			$offset = '+00:00';
6404
+		}
6115 6405
 
6116 6406
 		if ($globalDBdriver == 'mysql') {
6117 6407
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6324,7 +6614,9 @@  discard block
 block discarded – undo
6324 6614
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6325 6615
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6326 6616
 					ORDER BY airport_arrival_icao_count DESC";
6327
-		if ($limit) $query .= " LIMIT 10";
6617
+		if ($limit) {
6618
+			$query .= " LIMIT 10";
6619
+		}
6328 6620
       
6329 6621
 		
6330 6622
 		$sth = $this->db->prepare($query);
@@ -6344,7 +6636,9 @@  discard block
 block discarded – undo
6344 6636
 			if ($icaoaskey) {
6345 6637
 				$icao = $row['arrival_airport_icao'];
6346 6638
 				$airport_array[$icao] = $temp_array;
6347
-			} else $airport_array[] = $temp_array;
6639
+			} else {
6640
+				$airport_array[] = $temp_array;
6641
+			}
6348 6642
 		}
6349 6643
 
6350 6644
 		return $airport_array;
@@ -6386,7 +6680,9 @@  discard block
 block discarded – undo
6386 6680
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6387 6681
                 $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
6388 6682
 					ORDER BY airport_arrival_icao_count DESC";
6389
-		if ($limit) $query .= " LIMIT 10";
6683
+		if ($limit) {
6684
+			$query .= " LIMIT 10";
6685
+		}
6390 6686
       
6391 6687
 		
6392 6688
 		$sth = $this->db->prepare($query);
@@ -6407,7 +6703,9 @@  discard block
 block discarded – undo
6407 6703
 			if ($icaoaskey) {
6408 6704
 				$icao = $row['arrival_airport_icao'];
6409 6705
 				$airport_array[$icao] = $temp_array;
6410
-			} else $airport_array[] = $temp_array;
6706
+			} else {
6707
+				$airport_array[] = $temp_array;
6708
+			}
6411 6709
 		}
6412 6710
 
6413 6711
 		return $airport_array;
@@ -6449,7 +6747,9 @@  discard block
 block discarded – undo
6449 6747
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450 6748
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6451 6749
 					ORDER BY airport_arrival_icao_count DESC";
6452
-		if ($limit) $query .= " LIMIT 10";
6750
+		if ($limit) {
6751
+			$query .= " LIMIT 10";
6752
+		}
6453 6753
       
6454 6754
 		
6455 6755
 		$sth = $this->db->prepare($query);
@@ -6469,7 +6769,9 @@  discard block
 block discarded – undo
6469 6769
 			if ($icaoaskey) {
6470 6770
 				$icao = $row['arrival_airport_icao'];
6471 6771
 				$airport_array[$icao] = $temp_array;
6472
-			} else $airport_array[] = $temp_array;
6772
+			} else {
6773
+				$airport_array[] = $temp_array;
6774
+			}
6473 6775
 		}
6474 6776
 
6475 6777
 		return $airport_array;
@@ -6511,7 +6813,9 @@  discard block
 block discarded – undo
6511 6813
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6512 6814
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6513 6815
 					ORDER BY airport_arrival_icao_count DESC";
6514
-		if ($limit) $query .= " LIMIT 10";
6816
+		if ($limit) {
6817
+			$query .= " LIMIT 10";
6818
+		}
6515 6819
       
6516 6820
 		
6517 6821
 		$sth = $this->db->prepare($query);
@@ -6532,7 +6836,9 @@  discard block
 block discarded – undo
6532 6836
 			if ($icaoaskey) {
6533 6837
 				$icao = $row['arrival_airport_icao'];
6534 6838
 				$airport_array[$icao] = $temp_array;
6535
-			} else $airport_array[] = $temp_array;
6839
+			} else {
6840
+				$airport_array[] = $temp_array;
6841
+			}
6536 6842
 		}
6537 6843
 
6538 6844
 		return $airport_array;
@@ -6913,7 +7219,9 @@  discard block
 block discarded – undo
6913 7219
 			date_default_timezone_set($globalTimezone);
6914 7220
 			$datetime = new DateTime($date);
6915 7221
 			$offset = $datetime->format('P');
6916
-		} else $offset = '+00:00';
7222
+		} else {
7223
+			$offset = '+00:00';
7224
+		}
6917 7225
 
6918 7226
 		if ($globalDBdriver == 'mysql') {
6919 7227
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -6963,7 +7271,9 @@  discard block
 block discarded – undo
6963 7271
 			date_default_timezone_set($globalTimezone);
6964 7272
 			$datetime = new DateTime($date);
6965 7273
 			$offset = $datetime->format('P');
6966
-		} else $offset = '+00:00';
7274
+		} else {
7275
+			$offset = '+00:00';
7276
+		}
6967 7277
 
6968 7278
 		if ($globalDBdriver == 'mysql') {
6969 7279
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7186,7 +7496,9 @@  discard block
 block discarded – undo
7186 7496
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7187 7497
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7188 7498
 					ORDER BY airport_arrival_country_count DESC";
7189
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7499
+		if ($limit) {
7500
+			$query .= " LIMIT 10 OFFSET 0";
7501
+		}
7190 7502
       
7191 7503
 		
7192 7504
 		$sth = $this->db->prepare($query);
@@ -7473,7 +7785,9 @@  discard block
 block discarded – undo
7473 7785
 			date_default_timezone_set($globalTimezone);
7474 7786
 			$datetime = new DateTime($date);
7475 7787
 			$offset = $datetime->format('P');
7476
-		} else $offset = '+00:00';
7788
+		} else {
7789
+			$offset = '+00:00';
7790
+		}
7477 7791
 		
7478 7792
 		if ($globalDBdriver == 'mysql') {
7479 7793
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7649,15 +7963,23 @@  discard block
 block discarded – undo
7649 7963
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7650 7964
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7651 7965
 		 if ($olderthanmonths > 0) {
7652
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7653
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7966
+			if ($globalDBdriver == 'mysql') {
7967
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7968
+			} else {
7969
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7970
+			}
7654 7971
 		}
7655 7972
 		if ($sincedate != '') {
7656
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7657
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7973
+			if ($globalDBdriver == 'mysql') {
7974
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7975
+			} else {
7976
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7977
+			}
7658 7978
 		}
7659 7979
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7660
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7980
+		if ($limit) {
7981
+			$query .= " LIMIT 10 OFFSET 0";
7982
+		}
7661 7983
       		
7662 7984
 		$sth = $this->db->prepare($query);
7663 7985
 		$sth->execute();
@@ -7691,15 +8013,23 @@  discard block
 block discarded – undo
7691 8013
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7692 8014
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7693 8015
 		 if ($olderthanmonths > 0) {
7694
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7695
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8016
+			if ($globalDBdriver == 'mysql') {
8017
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8018
+			} else {
8019
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8020
+			}
7696 8021
 		}
7697 8022
 		if ($sincedate != '') {
7698
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7699
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8023
+			if ($globalDBdriver == 'mysql') {
8024
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8025
+			} else {
8026
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8027
+			}
7700 8028
 		}
7701 8029
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7702
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8030
+		if ($limit) {
8031
+			$query .= " LIMIT 10 OFFSET 0";
8032
+		}
7703 8033
       		
7704 8034
 		$sth = $this->db->prepare($query);
7705 8035
 		$sth->execute();
@@ -7736,7 +8066,9 @@  discard block
 block discarded – undo
7736 8066
 			date_default_timezone_set($globalTimezone);
7737 8067
 			$datetime = new DateTime();
7738 8068
 			$offset = $datetime->format('P');
7739
-		} else $offset = '+00:00';
8069
+		} else {
8070
+			$offset = '+00:00';
8071
+		}
7740 8072
 
7741 8073
 		if ($globalDBdriver == 'mysql') {
7742 8074
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7785,7 +8117,9 @@  discard block
 block discarded – undo
7785 8117
 			date_default_timezone_set($globalTimezone);
7786 8118
 			$datetime = new DateTime();
7787 8119
 			$offset = $datetime->format('P');
7788
-		} else $offset = '+00:00';
8120
+		} else {
8121
+			$offset = '+00:00';
8122
+		}
7789 8123
 		$filter_query = $this->getFilter($filters,true,true);
7790 8124
 		if ($globalDBdriver == 'mysql') {
7791 8125
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7834,7 +8168,9 @@  discard block
 block discarded – undo
7834 8168
 			date_default_timezone_set($globalTimezone);
7835 8169
 			$datetime = new DateTime();
7836 8170
 			$offset = $datetime->format('P');
7837
-		} else $offset = '+00:00';
8171
+		} else {
8172
+			$offset = '+00:00';
8173
+		}
7838 8174
 		$filter_query = $this->getFilter($filters,true,true);
7839 8175
 		if ($globalDBdriver == 'mysql') {
7840 8176
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7880,7 +8216,9 @@  discard block
 block discarded – undo
7880 8216
 			date_default_timezone_set($globalTimezone);
7881 8217
 			$datetime = new DateTime();
7882 8218
 			$offset = $datetime->format('P');
7883
-		} else $offset = '+00:00';
8219
+		} else {
8220
+			$offset = '+00:00';
8221
+		}
7884 8222
 		$filter_query = $this->getFilter($filters,true,true);
7885 8223
 		if ($globalDBdriver == 'mysql') {
7886 8224
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7928,7 +8266,9 @@  discard block
 block discarded – undo
7928 8266
 			date_default_timezone_set($globalTimezone);
7929 8267
 			$datetime = new DateTime();
7930 8268
 			$offset = $datetime->format('P');
7931
-		} else $offset = '+00:00';
8269
+		} else {
8270
+			$offset = '+00:00';
8271
+		}
7932 8272
 		
7933 8273
 		if ($globalDBdriver == 'mysql') {
7934 8274
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7976,7 +8316,9 @@  discard block
 block discarded – undo
7976 8316
 			date_default_timezone_set($globalTimezone);
7977 8317
 			$datetime = new DateTime();
7978 8318
 			$offset = $datetime->format('P');
7979
-		} else $offset = '+00:00';
8319
+		} else {
8320
+			$offset = '+00:00';
8321
+		}
7980 8322
 
7981 8323
 		if ($globalDBdriver == 'mysql') {
7982 8324
 			$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
@@ -8023,7 +8365,9 @@  discard block
 block discarded – undo
8023 8365
 			date_default_timezone_set($globalTimezone);
8024 8366
 			$datetime = new DateTime();
8025 8367
 			$offset = $datetime->format('P');
8026
-		} else $offset = '+00:00';
8368
+		} else {
8369
+			$offset = '+00:00';
8370
+		}
8027 8371
 
8028 8372
 		if ($globalDBdriver == 'mysql') {
8029 8373
 			$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
@@ -8071,7 +8415,9 @@  discard block
 block discarded – undo
8071 8415
 			date_default_timezone_set($globalTimezone);
8072 8416
 			$datetime = new DateTime();
8073 8417
 			$offset = $datetime->format('P');
8074
-		} else $offset = '+00:00';
8418
+		} else {
8419
+			$offset = '+00:00';
8420
+		}
8075 8421
 		$filter_query = $this->getFilter($filters,true,true);
8076 8422
 		if ($globalDBdriver == 'mysql') {
8077 8423
 			$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
@@ -8116,7 +8462,9 @@  discard block
 block discarded – undo
8116 8462
 			date_default_timezone_set($globalTimezone);
8117 8463
 			$datetime = new DateTime();
8118 8464
 			$offset = $datetime->format('P');
8119
-		} else $offset = '+00:00';
8465
+		} else {
8466
+			$offset = '+00:00';
8467
+		}
8120 8468
 		$filter_query = $this->getFilter($filters,true,true);
8121 8469
 
8122 8470
 		if ($globalDBdriver == 'mysql') {
@@ -8163,7 +8511,9 @@  discard block
 block discarded – undo
8163 8511
 			date_default_timezone_set($globalTimezone);
8164 8512
 			$datetime = new DateTime();
8165 8513
 			$offset = $datetime->format('P');
8166
-		} else $offset = '+00:00';
8514
+		} else {
8515
+			$offset = '+00:00';
8516
+		}
8167 8517
 
8168 8518
 		if ($globalDBdriver == 'mysql') {
8169 8519
 			$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
@@ -8209,7 +8559,9 @@  discard block
 block discarded – undo
8209 8559
 			date_default_timezone_set($globalTimezone);
8210 8560
 			$datetime = new DateTime();
8211 8561
 			$offset = $datetime->format('P');
8212
-		} else $offset = '+00:00';
8562
+		} else {
8563
+			$offset = '+00:00';
8564
+		}
8213 8565
 		$filter_query = $this->getFilter($filters,true,true);
8214 8566
 
8215 8567
 		if ($globalDBdriver == 'mysql') {
@@ -8256,7 +8608,9 @@  discard block
 block discarded – undo
8256 8608
 			date_default_timezone_set($globalTimezone);
8257 8609
 			$datetime = new DateTime();
8258 8610
 			$offset = $datetime->format('P');
8259
-		} else $offset = '+00:00';
8611
+		} else {
8612
+			$offset = '+00:00';
8613
+		}
8260 8614
 
8261 8615
 		if ($globalDBdriver == 'mysql') {
8262 8616
 			$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
@@ -8303,7 +8657,9 @@  discard block
 block discarded – undo
8303 8657
 			date_default_timezone_set($globalTimezone);
8304 8658
 			$datetime = new DateTime();
8305 8659
 			$offset = $datetime->format('P');
8306
-		} else $offset = '+00:00';
8660
+		} else {
8661
+			$offset = '+00:00';
8662
+		}
8307 8663
 
8308 8664
 		if ($globalDBdriver == 'mysql') {
8309 8665
 			$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
@@ -8348,7 +8704,9 @@  discard block
 block discarded – undo
8348 8704
 			date_default_timezone_set($globalTimezone);
8349 8705
 			$datetime = new DateTime();
8350 8706
 			$offset = $datetime->format('P');
8351
-		} else $offset = '+00:00';
8707
+		} else {
8708
+			$offset = '+00:00';
8709
+		}
8352 8710
 		$filter_query = $this->getFilter($filters,true,true);
8353 8711
 
8354 8712
 		if ($globalDBdriver == 'mysql') {
@@ -8396,7 +8754,9 @@  discard block
 block discarded – undo
8396 8754
 			date_default_timezone_set($globalTimezone);
8397 8755
 			$datetime = new DateTime();
8398 8756
 			$offset = $datetime->format('P');
8399
-		} else $offset = '+00:00';
8757
+		} else {
8758
+			$offset = '+00:00';
8759
+		}
8400 8760
 
8401 8761
 		if ($globalDBdriver == 'mysql') {
8402 8762
 			$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
@@ -8442,7 +8802,9 @@  discard block
 block discarded – undo
8442 8802
 			date_default_timezone_set($globalTimezone);
8443 8803
 			$datetime = new DateTime();
8444 8804
 			$offset = $datetime->format('P');
8445
-		} else $offset = '+00:00';
8805
+		} else {
8806
+			$offset = '+00:00';
8807
+		}
8446 8808
 		$filter_query = $this->getFilter($filters,true,true);
8447 8809
 
8448 8810
 		if ($globalDBdriver == 'mysql') {
@@ -8490,7 +8852,9 @@  discard block
 block discarded – undo
8490 8852
 			date_default_timezone_set($globalTimezone);
8491 8853
 			$datetime = new DateTime();
8492 8854
 			$offset = $datetime->format('P');
8493
-		} else $offset = '+00:00';
8855
+		} else {
8856
+			$offset = '+00:00';
8857
+		}
8494 8858
 
8495 8859
 		if ($globalDBdriver == 'mysql') {
8496 8860
 			$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
@@ -8537,7 +8901,9 @@  discard block
 block discarded – undo
8537 8901
 			date_default_timezone_set($globalTimezone);
8538 8902
 			$datetime = new DateTime();
8539 8903
 			$offset = $datetime->format('P');
8540
-		} else $offset = '+00:00';
8904
+		} else {
8905
+			$offset = '+00:00';
8906
+		}
8541 8907
 		$filter_query = $this->getFilter($filters,true,true);
8542 8908
 		if ($globalDBdriver == 'mysql') {
8543 8909
 			$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
@@ -8586,7 +8952,9 @@  discard block
 block discarded – undo
8586 8952
 			date_default_timezone_set($globalTimezone);
8587 8953
 			$datetime = new DateTime();
8588 8954
 			$offset = $datetime->format('P');
8589
-		} else $offset = '+00:00';
8955
+		} else {
8956
+			$offset = '+00:00';
8957
+		}
8590 8958
 
8591 8959
 		$orderby_sql = '';
8592 8960
 		if ($orderby == "hour")
@@ -8652,7 +9020,9 @@  discard block
 block discarded – undo
8652 9020
 			date_default_timezone_set($globalTimezone);
8653 9021
 			$datetime = new DateTime();
8654 9022
 			$offset = $datetime->format('P');
8655
-		} else $offset = '+00:00';
9023
+		} else {
9024
+			$offset = '+00:00';
9025
+		}
8656 9026
 
8657 9027
 		$orderby_sql = '';
8658 9028
 		if ($orderby == "hour")
@@ -8719,7 +9089,9 @@  discard block
 block discarded – undo
8719 9089
 			date_default_timezone_set($globalTimezone);
8720 9090
 			$datetime = new DateTime();
8721 9091
 			$offset = $datetime->format('P');
8722
-		} else $offset = '+00:00';
9092
+		} else {
9093
+			$offset = '+00:00';
9094
+		}
8723 9095
 
8724 9096
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8725 9097
 
@@ -8770,7 +9142,9 @@  discard block
 block discarded – undo
8770 9142
 			date_default_timezone_set($globalTimezone);
8771 9143
 			$datetime = new DateTime();
8772 9144
 			$offset = $datetime->format('P');
8773
-		} else $offset = '+00:00';
9145
+		} else {
9146
+			$offset = '+00:00';
9147
+		}
8774 9148
 
8775 9149
 		if ($globalDBdriver == 'mysql') {
8776 9150
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8817,7 +9191,9 @@  discard block
 block discarded – undo
8817 9191
 			date_default_timezone_set($globalTimezone);
8818 9192
 			$datetime = new DateTime();
8819 9193
 			$offset = $datetime->format('P');
8820
-		} else $offset = '+00:00';
9194
+		} else {
9195
+			$offset = '+00:00';
9196
+		}
8821 9197
 
8822 9198
 		if ($globalDBdriver == 'mysql') {
8823 9199
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8864,7 +9240,9 @@  discard block
 block discarded – undo
8864 9240
 			date_default_timezone_set($globalTimezone);
8865 9241
 			$datetime = new DateTime();
8866 9242
 			$offset = $datetime->format('P');
8867
-		} else $offset = '+00:00';
9243
+		} else {
9244
+			$offset = '+00:00';
9245
+		}
8868 9246
 
8869 9247
 		if ($globalDBdriver == 'mysql') {
8870 9248
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8912,7 +9290,9 @@  discard block
 block discarded – undo
8912 9290
 			date_default_timezone_set($globalTimezone);
8913 9291
 			$datetime = new DateTime();
8914 9292
 			$offset = $datetime->format('P');
8915
-		} else $offset = '+00:00';
9293
+		} else {
9294
+			$offset = '+00:00';
9295
+		}
8916 9296
 
8917 9297
 		if ($globalDBdriver == 'mysql') {
8918 9298
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8960,7 +9340,9 @@  discard block
 block discarded – undo
8960 9340
 			date_default_timezone_set($globalTimezone);
8961 9341
 			$datetime = new DateTime($date);
8962 9342
 			$offset = $datetime->format('P');
8963
-		} else $offset = '+00:00';
9343
+		} else {
9344
+			$offset = '+00:00';
9345
+		}
8964 9346
 
8965 9347
 		if ($globalDBdriver == 'mysql') {
8966 9348
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9008,7 +9390,9 @@  discard block
 block discarded – undo
9008 9390
 			date_default_timezone_set($globalTimezone);
9009 9391
 			$datetime = new DateTime();
9010 9392
 			$offset = $datetime->format('P');
9011
-		} else $offset = '+00:00';
9393
+		} else {
9394
+			$offset = '+00:00';
9395
+		}
9012 9396
 
9013 9397
 		if ($globalDBdriver == 'mysql') {
9014 9398
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9058,7 +9442,9 @@  discard block
 block discarded – undo
9058 9442
 			date_default_timezone_set($globalTimezone);
9059 9443
 			$datetime = new DateTime();
9060 9444
 			$offset = $datetime->format('P');
9061
-		} else $offset = '+00:00';
9445
+		} else {
9446
+			$offset = '+00:00';
9447
+		}
9062 9448
 
9063 9449
 		if ($globalDBdriver == 'mysql') {
9064 9450
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9105,7 +9491,9 @@  discard block
 block discarded – undo
9105 9491
 			date_default_timezone_set($globalTimezone);
9106 9492
 			$datetime = new DateTime();
9107 9493
 			$offset = $datetime->format('P');
9108
-		} else $offset = '+00:00';
9494
+		} else {
9495
+			$offset = '+00:00';
9496
+		}
9109 9497
 
9110 9498
 		if ($globalDBdriver == 'mysql') {
9111 9499
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9273,7 +9661,9 @@  discard block
 block discarded – undo
9273 9661
 			date_default_timezone_set($globalTimezone);
9274 9662
 			$datetime = new DateTime();
9275 9663
 			$offset = $datetime->format('P');
9276
-		} else $offset = '+00:00';
9664
+		} else {
9665
+			$offset = '+00:00';
9666
+		}
9277 9667
 
9278 9668
 		if ($globalDBdriver == 'mysql') {
9279 9669
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9459,7 +9849,9 @@  discard block
 block discarded – undo
9459 9849
 	*/
9460 9850
 	public function parseDirection($direction = 0)
9461 9851
 	{
9462
-		if ($direction == '') $direction = 0;
9852
+		if ($direction == '') {
9853
+			$direction = 0;
9854
+		}
9463 9855
 		$direction_array = array();
9464 9856
 		$temp_array = array();
9465 9857
 
@@ -9560,7 +9952,9 @@  discard block
 block discarded – undo
9560 9952
 		if (isset($result->AirlineFlightInfoResult))
9561 9953
 		{
9562 9954
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9563
-		} else return '';
9955
+		} else {
9956
+			return '';
9957
+		}
9564 9958
 		
9565 9959
 		$registration = $this->convertAircraftRegistration($registration);
9566 9960
 		
@@ -9589,7 +9983,9 @@  discard block
 block discarded – undo
9589 9983
 		if (count($row) > 0) {
9590 9984
 		    //return $row['Registration'];
9591 9985
 		    return $row['registration'];
9592
-		} else return '';
9986
+		} else {
9987
+			return '';
9988
+		}
9593 9989
 	
9594 9990
 	}
9595 9991
 
@@ -9612,9 +10008,14 @@  discard block
 block discarded – undo
9612 10008
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9613 10009
 		$sth->closeCursor();
9614 10010
 		if (count($row) > 0) {
9615
-		    if ($row['type_flight'] == null) return '';
9616
-		    else return $row['type_flight'];
9617
-		} else return '';
10011
+		    if ($row['type_flight'] == null) {
10012
+		    	return '';
10013
+		    } else {
10014
+		    	return $row['type_flight'];
10015
+		    }
10016
+		} else {
10017
+			return '';
10018
+		}
9618 10019
 	
9619 10020
 	}
9620 10021
 
@@ -9632,7 +10033,9 @@  discard block
 block discarded – undo
9632 10033
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9633 10034
 	
9634 10035
 		$Connection = new Connection($this->db);
9635
-		if (!$Connection->tableExists('countries')) return '';
10036
+		if (!$Connection->tableExists('countries')) {
10037
+			return '';
10038
+		}
9636 10039
 	
9637 10040
 		try {
9638 10041
 			/*
@@ -9652,9 +10055,13 @@  discard block
 block discarded – undo
9652 10055
 			$sth->closeCursor();
9653 10056
 			if (count($row) > 0) {
9654 10057
 				return $row;
9655
-			} else return '';
10058
+			} else {
10059
+				return '';
10060
+			}
9656 10061
 		} catch (PDOException $e) {
9657
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10062
+			if (isset($globalDebug) && $globalDebug) {
10063
+				echo 'Error : '.$e->getMessage()."\n";
10064
+			}
9658 10065
 			return '';
9659 10066
 		}
9660 10067
 	
@@ -9802,7 +10209,9 @@  discard block
 block discarded – undo
9802 10209
 	{
9803 10210
 		global $globalBitlyAccessToken;
9804 10211
 		
9805
-		if ($globalBitlyAccessToken == '') return $url;
10212
+		if ($globalBitlyAccessToken == '') {
10213
+			return $url;
10214
+		}
9806 10215
         
9807 10216
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9808 10217
 		
@@ -9951,7 +10360,9 @@  discard block
 block discarded – undo
9951 10360
 		
9952 10361
 
9953 10362
 		// routes
9954
-		if ($globalDebug) print "Routes...\n";
10363
+		if ($globalDebug) {
10364
+			print "Routes...\n";
10365
+		}
9955 10366
 		if ($globalDBdriver == 'mysql') {
9956 10367
 			$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)";
9957 10368
 		} else {
@@ -9970,7 +10381,9 @@  discard block
 block discarded – undo
9970 10381
 			}
9971 10382
 		}
9972 10383
 		
9973
-		if ($globalDebug) print "Airlines...\n";
10384
+		if ($globalDebug) {
10385
+			print "Airlines...\n";
10386
+		}
9974 10387
 		//airlines
9975 10388
 		if ($globalDBdriver == 'mysql') {
9976 10389
 			$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)";
@@ -9984,10 +10397,15 @@  discard block
 block discarded – undo
9984 10397
 			if (is_numeric(substr($row['ident'], -1, 1)))
9985 10398
 			{
9986 10399
 				$fromsource = NULL;
9987
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9988
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9989
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9990
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10400
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10401
+					$fromsource = 'vatsim';
10402
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10403
+					$fromsource = 'ivao';
10404
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10405
+					$fromsource = 'vatsim';
10406
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10407
+					$fromsource = 'ivao';
10408
+				}
9991 10409
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9992 10410
 				if (isset($airline_array[0]['name'])) {
9993 10411
 					$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";
@@ -9997,13 +10415,17 @@  discard block
 block discarded – undo
9997 10415
 			}
9998 10416
 		}
9999 10417
 
10000
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10418
+		if ($globalDebug) {
10419
+			print "Remove Duplicate in aircraft_modes...\n";
10420
+		}
10001 10421
 		//duplicate modes
10002 10422
 		$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";
10003 10423
 		$sth = $this->db->prepare($query);
10004 10424
 		$sth->execute();
10005 10425
 		
10006
-		if ($globalDebug) print "Aircraft...\n";
10426
+		if ($globalDebug) {
10427
+			print "Aircraft...\n";
10428
+		}
10007 10429
 		//aircraft
10008 10430
 		if ($globalDBdriver == 'mysql') {
10009 10431
 			$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)";
@@ -10046,26 +10468,38 @@  discard block
 block discarded – undo
10046 10468
 				 if (isset($closestAirports[0])) {
10047 10469
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10048 10470
 						$airport_icao = $closestAirports[0]['icao'];
10049
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10471
+						if ($globalDebug) {
10472
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10473
+						}
10050 10474
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10051 10475
 						foreach ($closestAirports as $airport) {
10052 10476
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10053 10477
 								$airport_icao = $airport['icao'];
10054
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10478
+								if ($globalDebug) {
10479
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10480
+								}
10055 10481
 								break;
10056 10482
 							}
10057 10483
 						}
10058 10484
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10059 10485
 						$airport_icao = $closestAirports[0]['icao'];
10060
-						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";
10486
+						if ($globalDebug) {
10487
+							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";
10488
+						}
10061 10489
 					} else {
10062
-						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";
10490
+						if ($globalDebug) {
10491
+							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";
10492
+						}
10063 10493
 					}
10064 10494
 				} else {
10065
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10495
+					if ($globalDebug) {
10496
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10497
+					}
10066 10498
 				}
10067 10499
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10068
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10500
+					if ($globalDebug) {
10501
+						echo "Updating airport to ".$airport_icao."...\n";
10502
+					}
10069 10503
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10070 10504
 					$sthu = $this->db->prepare($update_query);
10071 10505
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.