Completed
Push — master ( aa3dba...029a3f )
by Yannick
07:55
created
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	* Get SQL query part for filter used
59 59
 	* @param Array $filter the filter
60
-	* @return Array the SQL part
60
+	* @return string the SQL part
61 61
 	*/
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -10171,6 +10171,7 @@  discard block
 block discarded – undo
10171 10171
 	/**
10172 10172
 	* Counts all hours
10173 10173
 	*
10174
+	* @param string $orderby
10174 10175
 	* @return Array the hour list
10175 10176
 	*
10176 10177
 	*/
@@ -10236,6 +10237,7 @@  discard block
 block discarded – undo
10236 10237
 	/**
10237 10238
 	* Counts all hours
10238 10239
 	*
10240
+	* @param string $orderby
10239 10241
 	* @return Array the hour list
10240 10242
 	*
10241 10243
 	*/
@@ -11288,7 +11290,7 @@  discard block
 block discarded – undo
11288 11290
 	/**
11289 11291
 	* Parses the direction degrees to working
11290 11292
 	*
11291
-	* @param Float $direction the direction in degrees
11293
+	* @param integer $direction the direction in degrees
11292 11294
 	* @return Array the direction information
11293 11295
 	*
11294 11296
 	*/
Please login to merge, or discard this patch.
Indentation   +1457 added lines, -1457 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Executes the SQL statements to get the spotter information
153
-	*
154
-	* @param String $query the SQL query
155
-	* @param Array $params parameter of the query
156
-	* @param String $limitQuery the limit query
157
-	* @return Array the spotter information
158
-	*
159
-	*/
152
+	 * Executes the SQL statements to get the spotter information
153
+	 *
154
+	 * @param String $query the SQL query
155
+	 * @param Array $params parameter of the query
156
+	 * @param String $limitQuery the limit query
157
+	 * @return Array the spotter information
158
+	 *
159
+	 */
160 160
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
161 161
 	{
162 162
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
324 324
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
325 325
 					} else $temp_array['aircraft_shadow'] = 'default.png';
326
-                                } else {
327
-                            		$temp_array['aircraft_shadow'] = 'default.png';
326
+								} else {
327
+									$temp_array['aircraft_shadow'] = 'default.png';
328 328
 					$temp_array['aircraft_name'] = 'N/A';
329 329
 					$temp_array['aircraft_manufacturer'] = 'N/A';
330
-                            	}
330
+								}
331 331
 			}
332 332
 			$fromsource = NULL;
333 333
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	
524 524
 	
525 525
 	/**
526
-	* Gets all the spotter information
527
-	*
528
-	* @return Array the spotter information
529
-	*
530
-	*/
526
+	 * Gets all the spotter information
527
+	 *
528
+	 * @return Array the spotter information
529
+	 *
530
+	 */
531 531
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
532 532
 	{
533 533
 		global $globalTimezone, $globalDBdriver;
@@ -874,11 +874,11 @@  discard block
 block discarded – undo
874 874
 	
875 875
 	
876 876
 	/**
877
-	* Gets all the spotter information based on the latest data entry
878
-	*
879
-	* @return Array the spotter information
880
-	*
881
-	*/
877
+	 * Gets all the spotter information based on the latest data entry
878
+	 *
879
+	 * @return Array the spotter information
880
+	 *
881
+	 */
882 882
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
883 883
 	{
884 884
 		global $global_query;
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 	}
918 918
     
919 919
     
920
-    /**
921
-	* Gets all the spotter information based on a user's latitude and longitude
922
-	*
923
-	* @return Array the spotter information
924
-	*
925
-	*/
920
+	/**
921
+	 * Gets all the spotter information based on a user's latitude and longitude
922
+	 *
923
+	 * @return Array the spotter information
924
+	 *
925
+	 */
926 926
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
927 927
 	{
928 928
 		date_default_timezone_set('UTC');
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 				return false;
951 951
 			}
952 952
 		}
953
-    		$additional_query = '';
953
+			$additional_query = '';
954 954
 		if ($interval != "")
955 955
 		{
956 956
 			if (!is_string($interval))
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	}
991 991
     
992 992
     
993
-    /**
994
-	* Gets all the spotter information sorted by the newest aircraft type
995
-	*
996
-	* @return Array the spotter information
997
-	*
998
-	*/
993
+	/**
994
+	 * Gets all the spotter information sorted by the newest aircraft type
995
+	 *
996
+	 * @return Array the spotter information
997
+	 *
998
+	 */
999 999
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1000 1000
 	{
1001 1001
 		global $global_query;
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
     
1037 1037
     
1038 1038
 	/**
1039
-	* Gets all the spotter information sorted by the newest aircraft registration
1040
-	*
1041
-	* @return Array the spotter information
1042
-	*
1043
-	*/
1039
+	 * Gets all the spotter information sorted by the newest aircraft registration
1040
+	 *
1041
+	 * @return Array the spotter information
1042
+	 *
1043
+	 */
1044 1044
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1045 1045
 	{
1046 1046
 		global $global_query;
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 
1082 1082
 	/**
1083
-	* Gets all the spotter information sorted by the newest airline
1084
-	*
1085
-	* @return Array the spotter information
1086
-	*
1087
-	*/
1083
+	 * Gets all the spotter information sorted by the newest airline
1084
+	 *
1085
+	 * @return Array the spotter information
1086
+	 *
1087
+	 */
1088 1088
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1089 1089
 	{
1090 1090
 		global $global_query;
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 	}
1124 1124
     
1125 1125
     
1126
-    /**
1127
-	* Gets all the spotter information sorted by the newest departure airport
1128
-	*
1129
-	* @return Array the spotter information
1130
-	*
1131
-	*/
1126
+	/**
1127
+	 * Gets all the spotter information sorted by the newest departure airport
1128
+	 *
1129
+	 * @return Array the spotter information
1130
+	 *
1131
+	 */
1132 1132
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1133 1133
 	{
1134 1134
 		global $global_query;
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 
1172 1172
 	/**
1173
-	* Gets all the spotter information sorted by the newest arrival airport
1174
-	*
1175
-	* @return Array the spotter information
1176
-	*
1177
-	*/
1173
+	 * Gets all the spotter information sorted by the newest arrival airport
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178 1178
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1179 1179
 	{
1180 1180
 		global $global_query;
@@ -1213,11 +1213,11 @@  discard block
 block discarded – undo
1213 1213
 	
1214 1214
 
1215 1215
 	/**
1216
-	* Gets all the spotter information based on the spotter id
1217
-	*
1218
-	* @return Array the spotter information
1219
-	*
1220
-	*/
1216
+	 * Gets all the spotter information based on the spotter id
1217
+	 *
1218
+	 * @return Array the spotter information
1219
+	 *
1220
+	 */
1221 1221
 	public function getSpotterDataByID($id = '')
1222 1222
 	{
1223 1223
 		global $global_query;
@@ -1239,11 +1239,11 @@  discard block
 block discarded – undo
1239 1239
 	
1240 1240
 	
1241 1241
 	/**
1242
-	* Gets all the spotter information based on the callsign
1243
-	*
1244
-	* @return Array the spotter information
1245
-	*
1246
-	*/
1242
+	 * Gets all the spotter information based on the callsign
1243
+	 *
1244
+	 * @return Array the spotter information
1245
+	 *
1246
+	 */
1247 1247
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1248 1248
 	{
1249 1249
 		global $global_query;
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
 	}
1296 1296
 	
1297 1297
 	/**
1298
-	* Gets all the spotter information based on the owner
1299
-	*
1300
-	* @return Array the spotter information
1301
-	*
1302
-	*/
1298
+	 * Gets all the spotter information based on the owner
1299
+	 *
1300
+	 * @return Array the spotter information
1301
+	 *
1302
+	 */
1303 1303
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1304 1304
 	{
1305 1305
 		global $global_query;
@@ -1352,11 +1352,11 @@  discard block
 block discarded – undo
1352 1352
 	}
1353 1353
 	
1354 1354
 	/**
1355
-	* Gets all the spotter information based on the pilot
1356
-	*
1357
-	* @return Array the spotter information
1358
-	*
1359
-	*/
1355
+	 * Gets all the spotter information based on the pilot
1356
+	 *
1357
+	 * @return Array the spotter information
1358
+	 *
1359
+	 */
1360 1360
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1361 1361
 	{
1362 1362
 		global $global_query;
@@ -1405,11 +1405,11 @@  discard block
 block discarded – undo
1405 1405
 	
1406 1406
 	
1407 1407
 	/**
1408
-	* Gets all the spotter information based on the aircraft type
1409
-	*
1410
-	* @return Array the spotter information
1411
-	*
1412
-	*/
1408
+	 * Gets all the spotter information based on the aircraft type
1409
+	 *
1410
+	 * @return Array the spotter information
1411
+	 *
1412
+	 */
1413 1413
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1414 1414
 	{
1415 1415
 		global $global_query;
@@ -1463,11 +1463,11 @@  discard block
 block discarded – undo
1463 1463
 	
1464 1464
 	
1465 1465
 	/**
1466
-	* Gets all the spotter information based on the aircraft registration
1467
-	*
1468
-	* @return Array the spotter information
1469
-	*
1470
-	*/
1466
+	 * Gets all the spotter information based on the aircraft registration
1467
+	 *
1468
+	 * @return Array the spotter information
1469
+	 *
1470
+	 */
1471 1471
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1472 1472
 	{
1473 1473
 		global $global_query;
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 	
1525 1525
 	
1526 1526
 	/**
1527
-	* Gets all the spotter information based on the airline
1528
-	*
1529
-	* @return Array the spotter information
1530
-	*
1531
-	*/
1527
+	 * Gets all the spotter information based on the airline
1528
+	 *
1529
+	 * @return Array the spotter information
1530
+	 *
1531
+	 */
1532 1532
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1533 1533
 	{
1534 1534
 		global $global_query;
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
 	
1582 1582
 	
1583 1583
 	/**
1584
-	* Gets all the spotter information based on the airport
1585
-	*
1586
-	* @return Array the spotter information
1587
-	*
1588
-	*/
1584
+	 * Gets all the spotter information based on the airport
1585
+	 *
1586
+	 * @return Array the spotter information
1587
+	 *
1588
+	 */
1589 1589
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1590 1590
 	{
1591 1591
 		global $global_query;
@@ -1639,11 +1639,11 @@  discard block
 block discarded – undo
1639 1639
 
1640 1640
 
1641 1641
 	/**
1642
-	* Gets all the spotter information based on the date
1643
-	*
1644
-	* @return Array the spotter information
1645
-	*
1646
-	*/
1642
+	 * Gets all the spotter information based on the date
1643
+	 *
1644
+	 * @return Array the spotter information
1645
+	 *
1646
+	 */
1647 1647
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1648 1648
 	{
1649 1649
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1707,11 +1707,11 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
 
1709 1709
 	/**
1710
-	* Gets all the spotter information based on the country name
1711
-	*
1712
-	* @return Array the spotter information
1713
-	*
1714
-	*/
1710
+	 * Gets all the spotter information based on the country name
1711
+	 *
1712
+	 * @return Array the spotter information
1713
+	 *
1714
+	 */
1715 1715
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1716 1716
 	{
1717 1717
 		global $global_query;
@@ -1765,11 +1765,11 @@  discard block
 block discarded – undo
1765 1765
 	
1766 1766
 	
1767 1767
 	/**
1768
-	* Gets all the spotter information based on the manufacturer name
1769
-	*
1770
-	* @return Array the spotter information
1771
-	*
1772
-	*/
1768
+	 * Gets all the spotter information based on the manufacturer name
1769
+	 *
1770
+	 * @return Array the spotter information
1771
+	 *
1772
+	 */
1773 1773
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1774 1774
 	{
1775 1775
 		global $global_query;
@@ -1825,13 +1825,13 @@  discard block
 block discarded – undo
1825 1825
   
1826 1826
   
1827 1827
 	/**
1828
-	* Gets a list of all aircraft that take a route
1829
-	*
1830
-	* @param String $departure_airport_icao ICAO code of departure airport
1831
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1832
-	* @return Array the spotter information
1833
-	*
1834
-	*/
1828
+	 * Gets a list of all aircraft that take a route
1829
+	 *
1830
+	 * @param String $departure_airport_icao ICAO code of departure airport
1831
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1832
+	 * @return Array the spotter information
1833
+	 *
1834
+	 */
1835 1835
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1836 1836
 	{
1837 1837
 		global $global_query;
@@ -1900,11 +1900,11 @@  discard block
 block discarded – undo
1900 1900
 	
1901 1901
 	
1902 1902
 	/**
1903
-	* Gets all the spotter information based on the special column in the table
1904
-	*
1905
-	* @return Array the spotter information
1906
-	*
1907
-	*/
1903
+	 * Gets all the spotter information based on the special column in the table
1904
+	 *
1905
+	 * @return Array the spotter information
1906
+	 *
1907
+	 */
1908 1908
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1909 1909
 	{
1910 1910
 		global $global_query;
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
 	}
1944 1944
 
1945 1945
 	/**
1946
-	* Gets all the highlight based on a aircraft registration
1947
-	*
1948
-	* @return String the highlight text
1949
-	*
1950
-	*/
1946
+	 * Gets all the highlight based on a aircraft registration
1947
+	 *
1948
+	 * @return String the highlight text
1949
+	 *
1950
+	 */
1951 1951
 	public function getHighlightByRegistration($registration,$filter = array())
1952 1952
 	{
1953 1953
 		global $global_query;
@@ -1969,13 +1969,13 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 	
1971 1971
 	/**
1972
-	* Gets the squawk usage from squawk code
1973
-	*
1974
-	* @param String $squawk squawk code
1975
-	* @param String $country country
1976
-	* @return String usage
1977
-	*
1978
-	*/
1972
+	 * Gets the squawk usage from squawk code
1973
+	 *
1974
+	 * @param String $squawk squawk code
1975
+	 * @param String $country country
1976
+	 * @return String usage
1977
+	 *
1978
+	 */
1979 1979
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1980 1980
 	{
1981 1981
 		
@@ -1996,12 +1996,12 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	/**
1999
-	* Gets the airport icao from the iata
2000
-	*
2001
-	* @param String $airport_iata the iata code of the airport
2002
-	* @return String airport iata
2003
-	*
2004
-	*/
1999
+	 * Gets the airport icao from the iata
2000
+	 *
2001
+	 * @param String $airport_iata the iata code of the airport
2002
+	 * @return String airport iata
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportIcao($airport_iata = '')
2006 2006
 	{
2007 2007
 		
@@ -2021,14 +2021,14 @@  discard block
 block discarded – undo
2021 2021
 	}
2022 2022
 
2023 2023
 	/**
2024
-	* Gets the airport distance
2025
-	*
2026
-	* @param String $airport_icao the icao code of the airport
2027
-	* @param Float $latitude the latitude
2028
-	* @param Float $longitude the longitude
2029
-	* @return Float distance to the airport
2030
-	*
2031
-	*/
2024
+	 * Gets the airport distance
2025
+	 *
2026
+	 * @param String $airport_icao the icao code of the airport
2027
+	 * @param Float $latitude the latitude
2028
+	 * @param Float $longitude the longitude
2029
+	 * @return Float distance to the airport
2030
+	 *
2031
+	 */
2032 2032
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2033 2033
 	{
2034 2034
 		
@@ -2049,12 +2049,12 @@  discard block
 block discarded – undo
2049 2049
 	}
2050 2050
 	
2051 2051
 	/**
2052
-	* Gets the airport info based on the icao
2053
-	*
2054
-	* @param String $airport the icao code of the airport
2055
-	* @return Array airport information
2056
-	*
2057
-	*/
2052
+	 * Gets the airport info based on the icao
2053
+	 *
2054
+	 * @param String $airport the icao code of the airport
2055
+	 * @return Array airport information
2056
+	 *
2057
+	 */
2058 2058
 	public function getAllAirportInfo($airport = '')
2059 2059
 	{
2060 2060
 		
@@ -2100,12 +2100,12 @@  discard block
 block discarded – undo
2100 2100
 	}
2101 2101
 	
2102 2102
 	/**
2103
-	* Gets the airport info based on the country
2104
-	*
2105
-	* @param Array $countries Airports countries
2106
-	* @return Array airport information
2107
-	*
2108
-	*/
2103
+	 * Gets the airport info based on the country
2104
+	 *
2105
+	 * @param Array $countries Airports countries
2106
+	 * @return Array airport information
2107
+	 *
2108
+	 */
2109 2109
 	public function getAllAirportInfobyCountry($countries)
2110 2110
 	{
2111 2111
 		$lst_countries = '';
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 	
2145 2145
 	/**
2146
-	* Gets airports info based on the coord
2147
-	*
2148
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
-	* @return Array airport information
2150
-	*
2151
-	*/
2146
+	 * Gets airports info based on the coord
2147
+	 *
2148
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
+	 * @return Array airport information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAllAirportInfobyCoord($coord)
2153 2153
 	{
2154 2154
 		global $globalDBdriver;
@@ -2179,12 +2179,12 @@  discard block
 block discarded – undo
2179 2179
 	}
2180 2180
 
2181 2181
 	/**
2182
-	* Gets waypoints info based on the coord
2183
-	*
2184
-	* @param Array $coord waypoints coord
2185
-	* @return Array airport information
2186
-	*
2187
-	*/
2182
+	 * Gets waypoints info based on the coord
2183
+	 *
2184
+	 * @param Array $coord waypoints coord
2185
+	 * @return Array airport information
2186
+	 *
2187
+	 */
2188 2188
 	public function getAllWaypointsInfobyCoord($coord)
2189 2189
 	{
2190 2190
 		if (is_array($coord)) {
@@ -2218,12 +2218,12 @@  discard block
 block discarded – undo
2218 2218
 	
2219 2219
 	
2220 2220
 	/**
2221
-	* Gets the airline info based on the icao code or iata code
2222
-	*
2223
-	* @param String $airline_icao the iata code of the airport
2224
-	* @return Array airport information
2225
-	*
2226
-	*/
2221
+	 * Gets the airline info based on the icao code or iata code
2222
+	 *
2223
+	 * @param String $airline_icao the iata code of the airport
2224
+	 * @return Array airport information
2225
+	 *
2226
+	 */
2227 2227
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2228 2228
 	{
2229 2229
 		global $globalUseRealAirlines;
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
 			} else {
2255 2255
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2256 2256
 			}
2257
-                        /*
2257
+						/*
2258 2258
 			$airline_array = array();
2259 2259
 			$temp_array = array();
2260 2260
 		
@@ -2287,12 +2287,12 @@  discard block
 block discarded – undo
2287 2287
 	}
2288 2288
 	
2289 2289
 	/**
2290
-	* Gets the airline info based on the airline name
2291
-	*
2292
-	* @param String $airline_name the name of the airline
2293
-	* @return Array airline information
2294
-	*
2295
-	*/
2290
+	 * Gets the airline info based on the airline name
2291
+	 *
2292
+	 * @param String $airline_name the name of the airline
2293
+	 * @return Array airline information
2294
+	 *
2295
+	 */
2296 2296
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2297 2297
 	{
2298 2298
 		global $globalUseRealAirlines;
@@ -2320,12 +2320,12 @@  discard block
 block discarded – undo
2320 2320
 	
2321 2321
 	
2322 2322
 	/**
2323
-	* Gets the aircraft info based on the aircraft type
2324
-	*
2325
-	* @param String $aircraft_type the aircraft type
2326
-	* @return Array aircraft information
2327
-	*
2328
-	*/
2323
+	 * Gets the aircraft info based on the aircraft type
2324
+	 *
2325
+	 * @param String $aircraft_type the aircraft type
2326
+	 * @return Array aircraft information
2327
+	 *
2328
+	 */
2329 2329
 	public function getAllAircraftInfo($aircraft_type)
2330 2330
 	{
2331 2331
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2357,12 +2357,12 @@  discard block
 block discarded – undo
2357 2357
 	}
2358 2358
 
2359 2359
 	/**
2360
-	* Gets the aircraft icao based on the aircraft name/type
2361
-	*
2362
-	* @param String $aircraft_type the aircraft type
2363
-	* @return String aircraft information
2364
-	*
2365
-	*/
2360
+	 * Gets the aircraft icao based on the aircraft name/type
2361
+	 *
2362
+	 * @param String $aircraft_type the aircraft type
2363
+	 * @return String aircraft information
2364
+	 *
2365
+	 */
2366 2366
 	public function getAircraftIcao($aircraft_type)
2367 2367
 	{
2368 2368
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2387,12 +2387,12 @@  discard block
 block discarded – undo
2387 2387
 	}
2388 2388
 	
2389 2389
 	/**
2390
-	* Gets the aircraft info based on the aircraft modes
2391
-	*
2392
-	* @param String $aircraft_modes the aircraft ident (hex)
2393
-	* @return String aircraft type
2394
-	*
2395
-	*/
2390
+	 * Gets the aircraft info based on the aircraft modes
2391
+	 *
2392
+	 * @param String $aircraft_modes the aircraft ident (hex)
2393
+	 * @return String aircraft type
2394
+	 *
2395
+	 */
2396 2396
 	public function getAllAircraftType($aircraft_modes)
2397 2397
 	{
2398 2398
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2412,12 +2412,12 @@  discard block
 block discarded – undo
2412 2412
 	}
2413 2413
 
2414 2414
 	/**
2415
-	* Gets the aircraft info based on the aircraft registration
2416
-	*
2417
-	* @param String $registration the aircraft registration
2418
-	* @return String aircraft type
2419
-	*
2420
-	*/
2415
+	 * Gets the aircraft info based on the aircraft registration
2416
+	 *
2417
+	 * @param String $registration the aircraft registration
2418
+	 * @return String aircraft type
2419
+	 *
2420
+	 */
2421 2421
 	public function getAllAircraftTypeByRegistration($registration)
2422 2422
 	{
2423 2423
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2435,12 +2435,12 @@  discard block
 block discarded – undo
2435 2435
 	}
2436 2436
 
2437 2437
 	/**
2438
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2439
-	*
2440
-	* @param String $registration the aircraft registration
2441
-	* @return Array spotter_id and flightaware_id
2442
-	*
2443
-	*/
2438
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2439
+	 *
2440
+	 * @param String $registration the aircraft registration
2441
+	 * @return Array spotter_id and flightaware_id
2442
+	 *
2443
+	 */
2444 2444
 	public function getAllIDByRegistration($registration)
2445 2445
 	{
2446 2446
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2459,12 +2459,12 @@  discard block
 block discarded – undo
2459 2459
 	}
2460 2460
 
2461 2461
 	/**
2462
-	* Gets correct aircraft operator code
2463
-	*
2464
-	* @param String $operator the aircraft operator code (callsign)
2465
-	* @return String aircraft operator code
2466
-	*
2467
-	*/
2462
+	 * Gets correct aircraft operator code
2463
+	 *
2464
+	 * @param String $operator the aircraft operator code (callsign)
2465
+	 * @return String aircraft operator code
2466
+	 *
2467
+	 */
2468 2468
 	public function getOperator($operator)
2469 2469
 	{
2470 2470
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2481,16 +2481,16 @@  discard block
 block discarded – undo
2481 2481
 	}
2482 2482
 
2483 2483
 	/**
2484
-	* Gets the aircraft route based on the aircraft callsign
2485
-	*
2486
-	* @param String $callsign the aircraft callsign
2487
-	* @return Array aircraft type
2488
-	*
2489
-	*/
2484
+	 * Gets the aircraft route based on the aircraft callsign
2485
+	 *
2486
+	 * @param String $callsign the aircraft callsign
2487
+	 * @return Array aircraft type
2488
+	 *
2489
+	 */
2490 2490
 	public function getRouteInfo($callsign)
2491 2491
 	{
2492 2492
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2493
-                if ($callsign == '') return array();
2493
+				if ($callsign == '') return array();
2494 2494
 		$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";
2495 2495
 		
2496 2496
 		$sth = $this->db->prepare($query);
@@ -2504,12 +2504,12 @@  discard block
 block discarded – undo
2504 2504
 	}
2505 2505
 	
2506 2506
 	/**
2507
-	* Gets the aircraft info based on the aircraft registration
2508
-	*
2509
-	* @param String $registration the aircraft registration
2510
-	* @return Array aircraft information
2511
-	*
2512
-	*/
2507
+	 * Gets the aircraft info based on the aircraft registration
2508
+	 *
2509
+	 * @param String $registration the aircraft registration
2510
+	 * @return Array aircraft information
2511
+	 *
2512
+	 */
2513 2513
 	public function getAircraftInfoByRegistration($registration)
2514 2514
 	{
2515 2515
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2536,12 +2536,12 @@  discard block
 block discarded – undo
2536 2536
 	}
2537 2537
 	
2538 2538
 	/**
2539
-	* Gets the aircraft owner & base based on the aircraft registration
2540
-	*
2541
-	* @param String $registration the aircraft registration
2542
-	* @return Array aircraft information
2543
-	*
2544
-	*/
2539
+	 * Gets the aircraft owner & base based on the aircraft registration
2540
+	 *
2541
+	 * @param String $registration the aircraft registration
2542
+	 * @return Array aircraft information
2543
+	 *
2544
+	 */
2545 2545
 	public function getAircraftOwnerByRegistration($registration)
2546 2546
 	{
2547 2547
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2558,11 +2558,11 @@  discard block
 block discarded – undo
2558 2558
 	
2559 2559
   
2560 2560
   /**
2561
-	* Gets all flights (but with only little info)
2562
-	*
2563
-	* @return Array basic flight information
2564
-	*
2565
-	*/
2561
+   * Gets all flights (but with only little info)
2562
+   *
2563
+   * @return Array basic flight information
2564
+   *
2565
+   */
2566 2566
 	public function getAllFlightsforSitemap()
2567 2567
 	{
2568 2568
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 		
2571 2571
 		$sth = $this->db->prepare($query);
2572 2572
 		$sth->execute();
2573
-                  /*
2573
+				  /*
2574 2574
 		$flight_array = array();
2575 2575
 		$temp_array = array();
2576 2576
 		
@@ -2592,11 +2592,11 @@  discard block
 block discarded – undo
2592 2592
 	}
2593 2593
   
2594 2594
 	/**
2595
-	* Gets a list of all aircraft manufacturers
2596
-	*
2597
-	* @return Array list of aircraft types
2598
-	*
2599
-	*/
2595
+	 * Gets a list of all aircraft manufacturers
2596
+	 *
2597
+	 * @return Array list of aircraft types
2598
+	 *
2599
+	 */
2600 2600
 	public function getAllManufacturers()
2601 2601
 	{
2602 2602
 		/*
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
   
2626 2626
   
2627 2627
   /**
2628
-	* Gets a list of all aircraft types
2629
-	*
2630
-	* @return Array list of aircraft types
2631
-	*
2632
-	*/
2628
+   * Gets a list of all aircraft types
2629
+   *
2630
+   * @return Array list of aircraft types
2631
+   *
2632
+   */
2633 2633
 	public function getAllAircraftTypes($filters = array())
2634 2634
 	{
2635 2635
 		/*
@@ -2664,11 +2664,11 @@  discard block
 block discarded – undo
2664 2664
 	
2665 2665
 	
2666 2666
 	/**
2667
-	* Gets a list of all aircraft registrations
2668
-	*
2669
-	* @return Array list of aircraft registrations
2670
-	*
2671
-	*/
2667
+	 * Gets a list of all aircraft registrations
2668
+	 *
2669
+	 * @return Array list of aircraft registrations
2670
+	 *
2671
+	 */
2672 2672
 	public function getAllAircraftRegistrations($filters = array())
2673 2673
 	{
2674 2674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2693,12 +2693,12 @@  discard block
 block discarded – undo
2693 2693
 	}
2694 2694
 
2695 2695
 	/**
2696
-	* Gets all source name
2697
-	*
2698
-	* @param String type format of source
2699
-	* @return Array list of source name
2700
-	*
2701
-	*/
2696
+	 * Gets all source name
2697
+	 *
2698
+	 * @param String type format of source
2699
+	 * @return Array list of source name
2700
+	 *
2701
+	 */
2702 2702
 	public function getAllSourceName($type = '',$filters = array())
2703 2703
 	{
2704 2704
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2729,11 +2729,11 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
 
2731 2731
 	/**
2732
-	* Gets a list of all airline names
2733
-	*
2734
-	* @return Array list of airline names
2735
-	*
2736
-	*/
2732
+	 * Gets a list of all airline names
2733
+	 *
2734
+	 * @return Array list of airline names
2735
+	 *
2736
+	 */
2737 2737
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2738 2738
 	{
2739 2739
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2782,11 +2782,11 @@  discard block
 block discarded – undo
2782 2782
 	}
2783 2783
 	
2784 2784
 	/**
2785
-	* Gets a list of all alliance names
2786
-	*
2787
-	* @return Array list of alliance names
2788
-	*
2789
-	*/
2785
+	 * Gets a list of all alliance names
2786
+	 *
2787
+	 * @return Array list of alliance names
2788
+	 *
2789
+	 */
2790 2790
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2791 2791
 	{
2792 2792
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2811,11 +2811,11 @@  discard block
 block discarded – undo
2811 2811
 	}
2812 2812
 	
2813 2813
 	/**
2814
-	* Gets a list of all airline countries
2815
-	*
2816
-	* @return Array list of airline countries
2817
-	*
2818
-	*/
2814
+	 * Gets a list of all airline countries
2815
+	 *
2816
+	 * @return Array list of airline countries
2817
+	 *
2818
+	 */
2819 2819
 	public function getAllAirlineCountries($filters = array())
2820 2820
 	{
2821 2821
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2843,11 +2843,11 @@  discard block
 block discarded – undo
2843 2843
 	
2844 2844
 	
2845 2845
 	/**
2846
-	* Gets a list of all departure & arrival names
2847
-	*
2848
-	* @return Array list of airport names
2849
-	*
2850
-	*/
2846
+	 * Gets a list of all departure & arrival names
2847
+	 *
2848
+	 * @return Array list of airport names
2849
+	 *
2850
+	 */
2851 2851
 	public function getAllAirportNames($filters = array())
2852 2852
 	{
2853 2853
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2895,11 +2895,11 @@  discard block
 block discarded – undo
2895 2895
 	} 
2896 2896
 
2897 2897
 	/**
2898
-	* Gets a list of all owner names
2899
-	*
2900
-	* @return Array list of owner names
2901
-	*
2902
-	*/
2898
+	 * Gets a list of all owner names
2899
+	 *
2900
+	 * @return Array list of owner names
2901
+	 *
2902
+	 */
2903 2903
 	public function getAllOwnerNames($filters = array())
2904 2904
 	{
2905 2905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2913,11 +2913,11 @@  discard block
 block discarded – undo
2913 2913
 	} 
2914 2914
 
2915 2915
 	/**
2916
-	* Gets a list of all pilot names and pilot ids
2917
-	*
2918
-	* @return Array list of pilot names and pilot ids
2919
-	*
2920
-	*/
2916
+	 * Gets a list of all pilot names and pilot ids
2917
+	 *
2918
+	 * @return Array list of pilot names and pilot ids
2919
+	 *
2920
+	 */
2921 2921
 	public function getAllPilotNames($filters = array())
2922 2922
 	{
2923 2923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2932,11 +2932,11 @@  discard block
 block discarded – undo
2932 2932
 	
2933 2933
 	
2934 2934
 	/**
2935
-	* Gets a list of all departure & arrival airport countries
2936
-	*
2937
-	* @return Array list of airport countries
2938
-	*
2939
-	*/
2935
+	 * Gets a list of all departure & arrival airport countries
2936
+	 *
2937
+	 * @return Array list of airport countries
2938
+	 *
2939
+	 */
2940 2940
 	public function getAllAirportCountries($filters = array())
2941 2941
 	{
2942 2942
 		$airport_array = array();
@@ -2984,11 +2984,11 @@  discard block
 block discarded – undo
2984 2984
 	
2985 2985
 	
2986 2986
 	/**
2987
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2988
-	*
2989
-	* @return Array list of countries
2990
-	*
2991
-	*/
2987
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2988
+	 *
2989
+	 * @return Array list of countries
2990
+	 *
2991
+	 */
2992 2992
 	public function getAllCountries($filters = array())
2993 2993
 	{
2994 2994
 		$Connection= new Connection($this->db);
@@ -3065,11 +3065,11 @@  discard block
 block discarded – undo
3065 3065
 	
3066 3066
 	
3067 3067
 	/**
3068
-	* Gets a list of all idents/callsigns
3069
-	*
3070
-	* @return Array list of ident/callsign names
3071
-	*
3072
-	*/
3068
+	 * Gets a list of all idents/callsigns
3069
+	 *
3070
+	 * @return Array list of ident/callsign names
3071
+	 *
3072
+	 */
3073 3073
 	public function getAllIdents($filters = array())
3074 3074
 	{
3075 3075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3093,9 +3093,9 @@  discard block
 block discarded – undo
3093 3093
 	}
3094 3094
 
3095 3095
 	/**
3096
-	* Get a list of flights from airport since 7 days
3097
-	* @return Array number, icao, name and city of airports
3098
-	*/
3096
+	 * Get a list of flights from airport since 7 days
3097
+	 * @return Array number, icao, name and city of airports
3098
+	 */
3099 3099
 
3100 3100
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3101 3101
 		global $globalTimezone, $globalDBdriver;
@@ -3126,9 +3126,9 @@  discard block
 block discarded – undo
3126 3126
 	}
3127 3127
 
3128 3128
 	/**
3129
-	* Get a list of flights from airport since 7 days
3130
-	* @return Array number, icao, name and city of airports
3131
-	*/
3129
+	 * Get a list of flights from airport since 7 days
3130
+	 * @return Array number, icao, name and city of airports
3131
+	 */
3132 3132
 
3133 3133
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3134 3134
 		global $globalTimezone, $globalDBdriver;
@@ -3158,9 +3158,9 @@  discard block
 block discarded – undo
3158 3158
 	}
3159 3159
 
3160 3160
 	/**
3161
-	* Get a list of flights from detected airport since 7 days
3162
-	* @return Array number, icao, name and city of airports
3163
-	*/
3161
+	 * Get a list of flights from detected airport since 7 days
3162
+	 * @return Array number, icao, name and city of airports
3163
+	 */
3164 3164
 
3165 3165
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3166 3166
 		global $globalTimezone, $globalDBdriver;
@@ -3198,9 +3198,9 @@  discard block
 block discarded – undo
3198 3198
 	}
3199 3199
 
3200 3200
 	/**
3201
-	* Get a list of flights from detected airport since 7 days
3202
-	* @return Array number, icao, name and city of airports
3203
-	*/
3201
+	 * Get a list of flights from detected airport since 7 days
3202
+	 * @return Array number, icao, name and city of airports
3203
+	 */
3204 3204
 
3205 3205
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3206 3206
 		global $globalTimezone, $globalDBdriver;
@@ -3242,9 +3242,9 @@  discard block
 block discarded – undo
3242 3242
 
3243 3243
 
3244 3244
 	/**
3245
-	* Get a list of flights to airport since 7 days
3246
-	* @return Array number, icao, name and city of airports
3247
-	*/
3245
+	 * Get a list of flights to airport since 7 days
3246
+	 * @return Array number, icao, name and city of airports
3247
+	 */
3248 3248
 
3249 3249
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3250 3250
 		global $globalTimezone, $globalDBdriver;
@@ -3277,9 +3277,9 @@  discard block
 block discarded – undo
3277 3277
 
3278 3278
 
3279 3279
 	/**
3280
-	* Get a list of flights detected to airport since 7 days
3281
-	* @return Array number, icao, name and city of airports
3282
-	*/
3280
+	 * Get a list of flights detected to airport since 7 days
3281
+	 * @return Array number, icao, name and city of airports
3282
+	 */
3283 3283
 
3284 3284
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3285 3285
 		global $globalTimezone, $globalDBdriver;
@@ -3320,9 +3320,9 @@  discard block
 block discarded – undo
3320 3320
 
3321 3321
 
3322 3322
 	/**
3323
-	* Get a list of flights to airport since 7 days
3324
-	* @return Array number, icao, name and city of airports
3325
-	*/
3323
+	 * Get a list of flights to airport since 7 days
3324
+	 * @return Array number, icao, name and city of airports
3325
+	 */
3326 3326
 
3327 3327
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3328 3328
 		global $globalTimezone, $globalDBdriver;
@@ -3354,9 +3354,9 @@  discard block
 block discarded – undo
3354 3354
 
3355 3355
 
3356 3356
 	/**
3357
-	* Get a list of flights detected to airport since 7 days
3358
-	* @return Array number, icao, name and city of airports
3359
-	*/
3357
+	 * Get a list of flights detected to airport since 7 days
3358
+	 * @return Array number, icao, name and city of airports
3359
+	 */
3360 3360
 
3361 3361
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3362 3362
 		global $globalTimezone, $globalDBdriver;
@@ -3400,11 +3400,11 @@  discard block
 block discarded – undo
3400 3400
 
3401 3401
 
3402 3402
 	/**
3403
-	* Gets a list of all dates
3404
-	*
3405
-	* @return Array list of date names
3406
-	*
3407
-	*/
3403
+	 * Gets a list of all dates
3404
+	 *
3405
+	 * @return Array list of date names
3406
+	 *
3407
+	 */
3408 3408
 	public function getAllDates()
3409 3409
 	{
3410 3410
 		global $globalTimezone, $globalDBdriver;
@@ -3445,11 +3445,11 @@  discard block
 block discarded – undo
3445 3445
 	
3446 3446
 	
3447 3447
 	/**
3448
-	* Gets all route combinations
3449
-	*
3450
-	* @return Array the route list
3451
-	*
3452
-	*/
3448
+	 * Gets all route combinations
3449
+	 *
3450
+	 * @return Array the route list
3451
+	 *
3452
+	 */
3453 3453
 	public function getAllRoutes()
3454 3454
 	{
3455 3455
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3475,13 +3475,13 @@  discard block
 block discarded – undo
3475 3475
 	}
3476 3476
 
3477 3477
 	/**
3478
-	* Update ident spotter data
3479
-	*
3480
-	* @param String $flightaware_id the ID from flightaware
3481
-	* @param String $ident the flight ident
3482
-	* @return String success or false
3483
-	*
3484
-	*/	
3478
+	 * Update ident spotter data
3479
+	 *
3480
+	 * @param String $flightaware_id the ID from flightaware
3481
+	 * @param String $ident the flight ident
3482
+	 * @return String success or false
3483
+	 *
3484
+	 */	
3485 3485
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3486 3486
 	{
3487 3487
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3502,14 +3502,14 @@  discard block
 block discarded – undo
3502 3502
 		} else {
3503 3503
 			$airline_array = $this->getAllAirlineInfo("NA");
3504 3504
 		}
3505
-                $airline_name = $airline_array[0]['name'];
3506
-                $airline_icao = $airline_array[0]['icao'];
3507
-                $airline_country = $airline_array[0]['country'];
3508
-                $airline_type = $airline_array[0]['type'];
3505
+				$airline_name = $airline_array[0]['name'];
3506
+				$airline_icao = $airline_array[0]['icao'];
3507
+				$airline_country = $airline_array[0]['country'];
3508
+				$airline_type = $airline_array[0]['type'];
3509 3509
 
3510 3510
 
3511 3511
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3512
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3512
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
 
3523 3523
 	}
3524 3524
 	/**
3525
-	* Update latest spotter data
3526
-	*
3527
-	* @param String $flightaware_id the ID from flightaware
3528
-	* @param String $ident the flight ident
3529
-	* @param String $arrival_airport_icao the arrival airport
3530
-	* @return String success or false
3531
-	*
3532
-	*/	
3525
+	 * Update latest spotter data
3526
+	 *
3527
+	 * @param String $flightaware_id the ID from flightaware
3528
+	 * @param String $ident the flight ident
3529
+	 * @param String $arrival_airport_icao the arrival airport
3530
+	 * @return String success or false
3531
+	 *
3532
+	 */	
3533 3533
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3534 3534
 	{
3535 3535
 		if ($groundspeed == '') $groundspeed = NULL;
3536 3536
 		$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';
3537
-                $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);
3537
+				$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);
3538 3538
 
3539 3539
 		try {
3540 3540
 			$sth = $this->db->prepare($query);
@@ -3548,32 +3548,32 @@  discard block
 block discarded – undo
3548 3548
 	}
3549 3549
 
3550 3550
 	/**
3551
-	* Adds a new spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $aircraft_icao the aircraft type
3556
-	* @param String $departure_airport_icao the departure airport
3557
-	* @param String $arrival_airport_icao the arrival airport
3558
-	* @param String $latitude latitude of flight
3559
-	* @param String $longitude latitude of flight
3560
-	* @param String $waypoints waypoints of flight
3561
-	* @param String $altitude altitude of flight
3562
-	* @param String $heading heading of flight
3563
-	* @param String $groundspeed speed of flight
3564
-	* @param String $date date of flight
3565
-	* @param String $departure_airport_time departure time of flight
3566
-	* @param String $arrival_airport_time arrival time of flight
3567
-	* @param String $squawk squawk code of flight
3568
-	* @param String $route_stop route stop of flight
3569
-	* @param String $highlight highlight or not
3570
-	* @param String $ModeS ModesS code of flight
3571
-	* @param String $registration registration code of flight
3572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3574
-	* @param String $verticalrate vertival rate of flight
3575
-	* @return String success or false
3576
-	*/
3551
+	 * Adds a new spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $aircraft_icao the aircraft type
3556
+	 * @param String $departure_airport_icao the departure airport
3557
+	 * @param String $arrival_airport_icao the arrival airport
3558
+	 * @param String $latitude latitude of flight
3559
+	 * @param String $longitude latitude of flight
3560
+	 * @param String $waypoints waypoints of flight
3561
+	 * @param String $altitude altitude of flight
3562
+	 * @param String $heading heading of flight
3563
+	 * @param String $groundspeed speed of flight
3564
+	 * @param String $date date of flight
3565
+	 * @param String $departure_airport_time departure time of flight
3566
+	 * @param String $arrival_airport_time arrival time of flight
3567
+	 * @param String $squawk squawk code of flight
3568
+	 * @param String $route_stop route stop of flight
3569
+	 * @param String $highlight highlight or not
3570
+	 * @param String $ModeS ModesS code of flight
3571
+	 * @param String $registration registration code of flight
3572
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3573
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3574
+	 * @param String $verticalrate vertival rate of flight
3575
+	 * @return String success or false
3576
+	 */
3577 3577
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3578 3578
 	{
3579 3579
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3788,8 +3788,8 @@  discard block
 block discarded – undo
3788 3788
     
3789 3789
 		if ($globalIVAO && $aircraft_icao != '')
3790 3790
 		{
3791
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
-            		else $airline_icao = '';
3791
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
+					else $airline_icao = '';
3793 3793
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3794 3794
 			if (!isset($image_array[0]['registration']))
3795 3795
 			{
@@ -3820,53 +3820,53 @@  discard block
 block discarded – undo
3820 3820
 	
3821 3821
 		if (count($airline_array) == 0) 
3822 3822
 		{
3823
-                        $airline_array = $this->getAllAirlineInfo('NA');
3824
-                }
3825
-                if (count($aircraft_array) == 0) 
3826
-                {
3827
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3828
-                }
3829
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
-                {
3831
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3832
-                }
3833
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
-                {
3835
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3836
-                }
3837
-                if ($registration == '') $registration = 'NA';
3838
-                if ($latitude == '' && $longitude == '') {
3839
-            		$latitude = 0;
3840
-            		$longitude = 0;
3841
-            	}
3842
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
-                $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) 
3823
+						$airline_array = $this->getAllAirlineInfo('NA');
3824
+				}
3825
+				if (count($aircraft_array) == 0) 
3826
+				{
3827
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3828
+				}
3829
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
+				{
3831
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3832
+				}
3833
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
+				{
3835
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3836
+				}
3837
+				if ($registration == '') $registration = 'NA';
3838
+				if ($latitude == '' && $longitude == '') {
3839
+					$latitude = 0;
3840
+					$longitude = 0;
3841
+				}
3842
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
+				$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) 
3848 3848
                 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)";
3849 3849
 
3850
-                $airline_name = $airline_array[0]['name'];
3851
-                $airline_icao = $airline_array[0]['icao'];
3852
-                $airline_country = $airline_array[0]['country'];
3853
-                $airline_type = $airline_array[0]['type'];
3850
+				$airline_name = $airline_array[0]['name'];
3851
+				$airline_icao = $airline_array[0]['icao'];
3852
+				$airline_country = $airline_array[0]['country'];
3853
+				$airline_type = $airline_array[0]['type'];
3854 3854
 		if ($airline_type == '') {
3855 3855
 			$timeelapsed = microtime(true);
3856 3856
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857 3857
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858 3858
 		}
3859 3859
 		if ($airline_type == null) $airline_type = '';
3860
-                $aircraft_type = $aircraft_array[0]['type'];
3861
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
-                $departure_airport_name = $departure_airport_array[0]['name'];
3863
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3864
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3860
+				$aircraft_type = $aircraft_array[0]['type'];
3861
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
+				$departure_airport_name = $departure_airport_array[0]['name'];
3863
+			$departure_airport_city = $departure_airport_array[0]['city'];
3864
+				$departure_airport_country = $departure_airport_array[0]['country'];
3865 3865
                 
3866
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3867
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3868
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3869
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3866
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3867
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3868
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3869
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3870 3870
 
3871 3871
 		try {
3872 3872
 		        
@@ -3874,7 +3874,7 @@  discard block
 block discarded – undo
3874 3874
 			$sth->execute($query_values);
3875 3875
 			$this->db = null;
3876 3876
 		} catch (PDOException $e) {
3877
-		    return "error : ".$e->getMessage();
3877
+			return "error : ".$e->getMessage();
3878 3878
 		}
3879 3879
 		
3880 3880
 		return "success";
@@ -3883,11 +3883,11 @@  discard block
 block discarded – undo
3883 3883
 	
3884 3884
   
3885 3885
 	/**
3886
-	* Gets the aircraft ident within the last hour
3887
-	*
3888
-	* @return String the ident
3889
-	*
3890
-	*/
3886
+	 * Gets the aircraft ident within the last hour
3887
+	 *
3888
+	 * @return String the ident
3889
+	 *
3890
+	 */
3891 3891
 	public function getIdentFromLastHour($ident)
3892 3892
 	{
3893 3893
 		global $globalDBdriver, $globalTimezone;
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3904 3904
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3905 3905
 			$query_data = array(':ident' => $ident);
3906
-    		}
3906
+			}
3907 3907
 		
3908 3908
 		$sth = $this->db->prepare($query);
3909 3909
 		$sth->execute($query_data);
3910
-    		$ident_result='';
3910
+			$ident_result='';
3911 3911
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3912 3912
 		{
3913 3913
 			$ident_result = $row['ident'];
@@ -3918,11 +3918,11 @@  discard block
 block discarded – undo
3918 3918
 	
3919 3919
 	
3920 3920
 	/**
3921
-	* Gets the aircraft data from the last 20 seconds
3922
-	*
3923
-	* @return Array the spotter data
3924
-	*
3925
-	*/
3921
+	 * Gets the aircraft data from the last 20 seconds
3922
+	 *
3923
+	 * @return Array the spotter data
3924
+	 *
3925
+	 */
3926 3926
 	public function getRealTimeData($q = '')
3927 3927
 	{
3928 3928
 		global $globalDBdriver;
@@ -3966,11 +3966,11 @@  discard block
 block discarded – undo
3966 3966
 	
3967 3967
 	
3968 3968
 	 /**
3969
-	* Gets all airlines that have flown over
3970
-	*
3971
-	* @return Array the airline list
3972
-	*
3973
-	*/
3969
+	  * Gets all airlines that have flown over
3970
+	  *
3971
+	  * @return Array the airline list
3972
+	  *
3973
+	  */
3974 3974
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3975 3975
 	{
3976 3976
 		global $globalDBdriver;
@@ -3984,7 +3984,7 @@  discard block
 block discarded – undo
3984 3984
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3985 3985
 			}
3986 3986
 		}
3987
-                if ($sincedate != '') {
3987
+				if ($sincedate != '') {
3988 3988
 			if ($globalDBdriver == 'mysql') {
3989 3989
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3990 3990
 			} else {
@@ -4038,26 +4038,26 @@  discard block
 block discarded – undo
4038 4038
 	}
4039 4039
 
4040 4040
 	 /**
4041
-	* Gets all pilots that have flown over
4042
-	*
4043
-	* @return Array the pilots list
4044
-	*
4045
-	*/
4041
+	  * Gets all pilots that have flown over
4042
+	  *
4043
+	  * @return Array the pilots list
4044
+	  *
4045
+	  */
4046 4046
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4047 4047
 	{
4048 4048
 		global $globalDBdriver;
4049 4049
 		$filter_query = $this->getFilter($filters,true,true);
4050 4050
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4051 4051
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4052
-                if ($olderthanmonths > 0) {
4053
-            		if ($globalDBdriver == 'mysql') {
4052
+				if ($olderthanmonths > 0) {
4053
+					if ($globalDBdriver == 'mysql') {
4054 4054
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4055 4055
 			} else {
4056 4056
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4057 4057
 			}
4058 4058
 		}
4059
-                if ($sincedate != '') {
4060
-            		if ($globalDBdriver == 'mysql') {
4059
+				if ($sincedate != '') {
4060
+					if ($globalDBdriver == 'mysql') {
4061 4061
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4062 4062
 			} else {
4063 4063
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4112,25 +4112,25 @@  discard block
 block discarded – undo
4112 4112
 	}
4113 4113
 	
4114 4114
 	/**
4115
-	* Gets all pilots that have flown over
4116
-	*
4117
-	* @return Array the pilots list
4118
-	*
4119
-	*/
4115
+	 * Gets all pilots that have flown over
4116
+	 *
4117
+	 * @return Array the pilots list
4118
+	 *
4119
+	 */
4120 4120
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4121 4121
 	{
4122 4122
 		global $globalDBdriver;
4123 4123
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4124 4124
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4125
-                if ($olderthanmonths > 0) {
4126
-            		if ($globalDBdriver == 'mysql') {
4125
+				if ($olderthanmonths > 0) {
4126
+					if ($globalDBdriver == 'mysql') {
4127 4127
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4128 4128
 			} else {
4129 4129
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4130 4130
 			}
4131 4131
 		}
4132
-                if ($sincedate != '') {
4133
-            		if ($globalDBdriver == 'mysql') {
4132
+				if ($sincedate != '') {
4133
+					if ($globalDBdriver == 'mysql') {
4134 4134
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4135 4135
 			} else {
4136 4136
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4159,26 +4159,26 @@  discard block
 block discarded – undo
4159 4159
 	}
4160 4160
 	
4161 4161
 	 /**
4162
-	* Gets all owner that have flown over
4163
-	*
4164
-	* @return Array the pilots list
4165
-	*
4166
-	*/
4162
+	  * Gets all owner that have flown over
4163
+	  *
4164
+	  * @return Array the pilots list
4165
+	  *
4166
+	  */
4167 4167
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4168 4168
 	{
4169 4169
 		global $globalDBdriver;
4170 4170
 		$filter_query = $this->getFilter($filters,true,true);
4171 4171
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4172 4172
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4173
-                if ($olderthanmonths > 0) {
4174
-            		if ($globalDBdriver == 'mysql') {
4173
+				if ($olderthanmonths > 0) {
4174
+					if ($globalDBdriver == 'mysql') {
4175 4175
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4176 4176
 			} else {
4177 4177
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4178 4178
 			}
4179 4179
 		}
4180
-                if ($sincedate != '') {
4181
-            		if ($globalDBdriver == 'mysql') {
4180
+				if ($sincedate != '') {
4181
+					if ($globalDBdriver == 'mysql') {
4182 4182
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4183 4183
 			} else {
4184 4184
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4229,26 +4229,26 @@  discard block
 block discarded – undo
4229 4229
 	}
4230 4230
 	
4231 4231
 	 /**
4232
-	* Gets all owner that have flown over
4233
-	*
4234
-	* @return Array the pilots list
4235
-	*
4236
-	*/
4232
+	  * Gets all owner that have flown over
4233
+	  *
4234
+	  * @return Array the pilots list
4235
+	  *
4236
+	  */
4237 4237
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4238 4238
 	{
4239 4239
 		global $globalDBdriver;
4240 4240
 		$filter_query = $this->getFilter($filters,true,true);
4241 4241
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4242 4242
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4243
-                if ($olderthanmonths > 0) {
4244
-            		if ($globalDBdriver == 'mysql') {
4243
+				if ($olderthanmonths > 0) {
4244
+					if ($globalDBdriver == 'mysql') {
4245 4245
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4246 4246
 			} else {
4247 4247
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4248 4248
 			}
4249 4249
 		}
4250
-                if ($sincedate != '') {
4251
-            		if ($globalDBdriver == 'mysql') {
4250
+				if ($sincedate != '') {
4251
+					if ($globalDBdriver == 'mysql') {
4252 4252
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4253 4253
 			} else {
4254 4254
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4275,11 +4275,11 @@  discard block
 block discarded – undo
4275 4275
 	}
4276 4276
 
4277 4277
 	/**
4278
-	* Gets all airlines that have flown over by aircraft
4279
-	*
4280
-	* @return Array the airline list
4281
-	*
4282
-	*/
4278
+	 * Gets all airlines that have flown over by aircraft
4279
+	 *
4280
+	 * @return Array the airline list
4281
+	 *
4282
+	 */
4283 4283
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4284 4284
 	{
4285 4285
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4311,11 +4311,11 @@  discard block
 block discarded – undo
4311 4311
 
4312 4312
 
4313 4313
 	/**
4314
-	* Gets all airline countries that have flown over by aircraft
4315
-	*
4316
-	* @return Array the airline country list
4317
-	*
4318
-	*/
4314
+	 * Gets all airline countries that have flown over by aircraft
4315
+	 *
4316
+	 * @return Array the airline country list
4317
+	 *
4318
+	 */
4319 4319
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4320 4320
 	{
4321 4321
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4347,11 +4347,11 @@  discard block
 block discarded – undo
4347 4347
 	
4348 4348
 	
4349 4349
 	/**
4350
-	* Gets all airlines that have flown over by airport
4351
-	*
4352
-	* @return Array the airline list
4353
-	*
4354
-	*/
4350
+	 * Gets all airlines that have flown over by airport
4351
+	 *
4352
+	 * @return Array the airline list
4353
+	 *
4354
+	 */
4355 4355
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4356 4356
 	{
4357 4357
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4382,11 +4382,11 @@  discard block
 block discarded – undo
4382 4382
 
4383 4383
 
4384 4384
 	/**
4385
-	* Gets all airline countries that have flown over by airport icao
4386
-	*
4387
-	* @return Array the airline country list
4388
-	*
4389
-	*/
4385
+	 * Gets all airline countries that have flown over by airport icao
4386
+	 *
4387
+	 * @return Array the airline country list
4388
+	 *
4389
+	 */
4390 4390
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4391 4391
 	{
4392 4392
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4416,11 +4416,11 @@  discard block
 block discarded – undo
4416 4416
 
4417 4417
 
4418 4418
 	/**
4419
-	* Gets all airlines that have flown over by aircraft manufacturer
4420
-	*
4421
-	* @return Array the airline list
4422
-	*
4423
-	*/
4419
+	 * Gets all airlines that have flown over by aircraft manufacturer
4420
+	 *
4421
+	 * @return Array the airline list
4422
+	 *
4423
+	 */
4424 4424
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4425 4425
 	{
4426 4426
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4451,11 +4451,11 @@  discard block
 block discarded – undo
4451 4451
 
4452 4452
 
4453 4453
 	/**
4454
-	* Gets all airline countries that have flown over by aircraft manufacturer
4455
-	*
4456
-	* @return Array the airline country list
4457
-	*
4458
-	*/
4454
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4455
+	 *
4456
+	 * @return Array the airline country list
4457
+	 *
4458
+	 */
4459 4459
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4460 4460
 	{
4461 4461
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4484,11 +4484,11 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 
4486 4486
 	/**
4487
-	* Gets all airlines that have flown over by date
4488
-	*
4489
-	* @return Array the airline list
4490
-	*
4491
-	*/
4487
+	 * Gets all airlines that have flown over by date
4488
+	 *
4489
+	 * @return Array the airline list
4490
+	 *
4491
+	 */
4492 4492
 	public function countAllAirlinesByDate($date,$filters = array())
4493 4493
 	{
4494 4494
 		global $globalTimezone, $globalDBdriver;
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 	
4533 4533
 	
4534 4534
 	/**
4535
-	* Gets all airline countries that have flown over by date
4536
-	*
4537
-	* @return Array the airline country list
4538
-	*
4539
-	*/
4535
+	 * Gets all airline countries that have flown over by date
4536
+	 *
4537
+	 * @return Array the airline country list
4538
+	 *
4539
+	 */
4540 4540
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4541 4541
 	{
4542 4542
 		global $globalTimezone, $globalDBdriver;
@@ -4579,11 +4579,11 @@  discard block
 block discarded – undo
4579 4579
 
4580 4580
 
4581 4581
 	/**
4582
-	* Gets all airlines that have flown over by ident/callsign
4583
-	*
4584
-	* @return Array the airline list
4585
-	*
4586
-	*/
4582
+	 * Gets all airlines that have flown over by ident/callsign
4583
+	 *
4584
+	 * @return Array the airline list
4585
+	 *
4586
+	 */
4587 4587
 	public function countAllAirlinesByIdent($ident,$filters = array())
4588 4588
 	{
4589 4589
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4600,11 +4600,11 @@  discard block
 block discarded – undo
4600 4600
 	}
4601 4601
 
4602 4602
 	/**
4603
-	* Gets all airlines by owner
4604
-	*
4605
-	* @return Array the airline list
4606
-	*
4607
-	*/
4603
+	 * Gets all airlines by owner
4604
+	 *
4605
+	 * @return Array the airline list
4606
+	 *
4607
+	 */
4608 4608
 	public function countAllAirlinesByOwner($owner,$filters = array())
4609 4609
 	{
4610 4610
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4621,11 +4621,11 @@  discard block
 block discarded – undo
4621 4621
 	}
4622 4622
 
4623 4623
 	/**
4624
-	* Gets flight duration by owner
4625
-	*
4626
-	* @return String Duration of all flights
4627
-	*
4628
-	*/
4624
+	 * Gets flight duration by owner
4625
+	 *
4626
+	 * @return String Duration of all flights
4627
+	 *
4628
+	 */
4629 4629
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4630 4630
 	{
4631 4631
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4669,11 +4669,11 @@  discard block
 block discarded – undo
4669 4669
 	}
4670 4670
 
4671 4671
 	/**
4672
-	* Count flights by owner
4673
-	*
4674
-	* @return String Duration of all flights
4675
-	*
4676
-	*/
4672
+	 * Count flights by owner
4673
+	 *
4674
+	 * @return String Duration of all flights
4675
+	 *
4676
+	 */
4677 4677
 	public function countFlightsByOwner($owner,$filters = array())
4678 4678
 	{
4679 4679
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4689,11 +4689,11 @@  discard block
 block discarded – undo
4689 4689
 	}
4690 4690
 
4691 4691
 	/**
4692
-	* Count flights by pilot
4693
-	*
4694
-	* @return String Duration of all flights
4695
-	*
4696
-	*/
4692
+	 * Count flights by pilot
4693
+	 *
4694
+	 * @return String Duration of all flights
4695
+	 *
4696
+	 */
4697 4697
 	public function countFlightsByPilot($pilot,$filters = array())
4698 4698
 	{
4699 4699
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4709,11 +4709,11 @@  discard block
 block discarded – undo
4709 4709
 	}
4710 4710
 
4711 4711
 	/**
4712
-	* Gets flight duration by pilot
4713
-	*
4714
-	* @return String Duration of all flights
4715
-	*
4716
-	*/
4712
+	 * Gets flight duration by pilot
4713
+	 *
4714
+	 * @return String Duration of all flights
4715
+	 *
4716
+	 */
4717 4717
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4718 4718
 	{
4719 4719
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4757,11 +4757,11 @@  discard block
 block discarded – undo
4757 4757
 	}
4758 4758
 
4759 4759
 	/**
4760
-	* Gets all airlines used by pilot
4761
-	*
4762
-	* @return Array the airline list
4763
-	*
4764
-	*/
4760
+	 * Gets all airlines used by pilot
4761
+	 *
4762
+	 * @return Array the airline list
4763
+	 *
4764
+	 */
4765 4765
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4766 4766
 	{
4767 4767
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4778,11 +4778,11 @@  discard block
 block discarded – undo
4778 4778
 	}
4779 4779
 
4780 4780
 	/**
4781
-	* Gets all airlines that have flown over by route
4782
-	*
4783
-	* @return Array the airline list
4784
-	*
4785
-	*/
4781
+	 * Gets all airlines that have flown over by route
4782
+	 *
4783
+	 * @return Array the airline list
4784
+	 *
4785
+	 */
4786 4786
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4787 4787
 	{
4788 4788
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4814,11 +4814,11 @@  discard block
 block discarded – undo
4814 4814
 	}
4815 4815
 
4816 4816
 	/**
4817
-	* Gets all airline countries that have flown over by route
4818
-	*
4819
-	* @return Array the airline country list
4820
-	*
4821
-	*/
4817
+	 * Gets all airline countries that have flown over by route
4818
+	 *
4819
+	 * @return Array the airline country list
4820
+	 *
4821
+	 */
4822 4822
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4823 4823
 	{
4824 4824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4850,11 +4850,11 @@  discard block
 block discarded – undo
4850 4850
 
4851 4851
 
4852 4852
 	/**
4853
-	* Gets all airlines that have flown over by country
4854
-	*
4855
-	* @return Array the airline list
4856
-	*
4857
-	*/
4853
+	 * Gets all airlines that have flown over by country
4854
+	 *
4855
+	 * @return Array the airline list
4856
+	 *
4857
+	 */
4858 4858
 	public function countAllAirlinesByCountry($country,$filters = array())
4859 4859
 	{
4860 4860
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4884,11 +4884,11 @@  discard block
 block discarded – undo
4884 4884
 
4885 4885
 
4886 4886
 	/**
4887
-	* Gets all airline countries that have flown over by country
4888
-	*
4889
-	* @return Array the airline country list
4890
-	*
4891
-	*/
4887
+	 * Gets all airline countries that have flown over by country
4888
+	 *
4889
+	 * @return Array the airline country list
4890
+	 *
4891
+	 */
4892 4892
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4893 4893
 	{
4894 4894
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4917,11 +4917,11 @@  discard block
 block discarded – undo
4917 4917
 
4918 4918
 
4919 4919
 	/**
4920
-	* Gets all airlines countries
4921
-	*
4922
-	* @return Array the airline country list
4923
-	*
4924
-	*/
4920
+	 * Gets all airlines countries
4921
+	 *
4922
+	 * @return Array the airline country list
4923
+	 *
4924
+	 */
4925 4925
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4926 4926
 	{
4927 4927
 		global $globalDBdriver;
@@ -4976,11 +4976,11 @@  discard block
 block discarded – undo
4976 4976
 	}
4977 4977
 
4978 4978
 	/**
4979
-	* Gets all number of flight over countries
4980
-	*
4981
-	* @return Array the airline country list
4982
-	*
4983
-	*/
4979
+	 * Gets all number of flight over countries
4980
+	 *
4981
+	 * @return Array the airline country list
4982
+	 *
4983
+	 */
4984 4984
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4985 4985
 	{
4986 4986
 		global $globalDBdriver;
@@ -5002,15 +5002,15 @@  discard block
 block discarded – undo
5002 5002
 		$SpotterLive = new SpotterLive();
5003 5003
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5004 5004
 		$filter_query .= ' over_country IS NOT NULL';
5005
-                if ($olderthanmonths > 0) {
5005
+				if ($olderthanmonths > 0) {
5006 5006
 			if ($globalDBdriver == 'mysql') {
5007 5007
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5008 5008
 			} else {
5009 5009
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5010 5010
 			}
5011 5011
 		}
5012
-                if ($sincedate != '') {
5013
-            		if ($globalDBdriver == 'mysql') {
5012
+				if ($sincedate != '') {
5013
+					if ($globalDBdriver == 'mysql') {
5014 5014
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5015 5015
 			} else {
5016 5016
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5040,11 +5040,11 @@  discard block
 block discarded – undo
5040 5040
 	
5041 5041
 	
5042 5042
 	/**
5043
-	* Gets all aircraft types that have flown over
5044
-	*
5045
-	* @return Array the aircraft list
5046
-	*
5047
-	*/
5043
+	 * Gets all aircraft types that have flown over
5044
+	 *
5045
+	 * @return Array the aircraft list
5046
+	 *
5047
+	 */
5048 5048
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5049 5049
 	{
5050 5050
 		global $globalDBdriver;
@@ -5114,11 +5114,11 @@  discard block
 block discarded – undo
5114 5114
 	}
5115 5115
 
5116 5116
 	/**
5117
-	* Gets all aircraft types that have flown over by airline
5118
-	*
5119
-	* @return Array the aircraft list
5120
-	*
5121
-	*/
5117
+	 * Gets all aircraft types that have flown over by airline
5118
+	 *
5119
+	 * @return Array the aircraft list
5120
+	 *
5121
+	 */
5122 5122
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5123 5123
 	{
5124 5124
 		global $globalDBdriver;
@@ -5189,11 +5189,11 @@  discard block
 block discarded – undo
5189 5189
 	}
5190 5190
 
5191 5191
 	/**
5192
-	* Gets all aircraft types that have flown over by months
5193
-	*
5194
-	* @return Array the aircraft list
5195
-	*
5196
-	*/
5192
+	 * Gets all aircraft types that have flown over by months
5193
+	 *
5194
+	 * @return Array the aircraft list
5195
+	 *
5196
+	 */
5197 5197
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5198 5198
 	{
5199 5199
 		global $globalDBdriver;
@@ -5237,11 +5237,11 @@  discard block
 block discarded – undo
5237 5237
 
5238 5238
 
5239 5239
 	/**
5240
-	* Gets all aircraft registration that have flown over by aircaft icao
5241
-	*
5242
-	* @return Array the aircraft list
5243
-	*
5244
-	*/
5240
+	 * Gets all aircraft registration that have flown over by aircaft icao
5241
+	 *
5242
+	 * @return Array the aircraft list
5243
+	 *
5244
+	 */
5245 5245
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5246 5246
 	{
5247 5247
 		$Image = new Image($this->db);
@@ -5280,11 +5280,11 @@  discard block
 block discarded – undo
5280 5280
 
5281 5281
 
5282 5282
 	/**
5283
-	* Gets all aircraft types that have flown over by airline icao
5284
-	*
5285
-	* @return Array the aircraft list
5286
-	*
5287
-	*/
5283
+	 * Gets all aircraft types that have flown over by airline icao
5284
+	 *
5285
+	 * @return Array the aircraft list
5286
+	 *
5287
+	 */
5288 5288
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5289 5289
 	{
5290 5290
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5313,11 +5313,11 @@  discard block
 block discarded – undo
5313 5313
 
5314 5314
 
5315 5315
 	/**
5316
-	* Gets all aircraft registration that have flown over by airline icao
5317
-	*
5318
-	* @return Array the aircraft list
5319
-	*
5320
-	*/
5316
+	 * Gets all aircraft registration that have flown over by airline icao
5317
+	 *
5318
+	 * @return Array the aircraft list
5319
+	 *
5320
+	 */
5321 5321
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5322 5322
 	{
5323 5323
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5355,11 +5355,11 @@  discard block
 block discarded – undo
5355 5355
 
5356 5356
 
5357 5357
 	/**
5358
-	* Gets all aircraft manufacturer that have flown over by airline icao
5359
-	*
5360
-	* @return Array the aircraft list
5361
-	*
5362
-	*/
5358
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5359
+	 *
5360
+	 * @return Array the aircraft list
5361
+	 *
5362
+	 */
5363 5363
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5364 5364
 	{
5365 5365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5387,11 +5387,11 @@  discard block
 block discarded – undo
5387 5387
 
5388 5388
 
5389 5389
 	/**
5390
-	* Gets all aircraft types that have flown over by airline icao
5391
-	*
5392
-	* @return Array the aircraft list
5393
-	*
5394
-	*/
5390
+	 * Gets all aircraft types that have flown over by airline icao
5391
+	 *
5392
+	 * @return Array the aircraft list
5393
+	 *
5394
+	 */
5395 5395
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5396 5396
 	{
5397 5397
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5420,11 +5420,11 @@  discard block
 block discarded – undo
5420 5420
 
5421 5421
 
5422 5422
 	/**
5423
-	* Gets all aircraft registration that have flown over by airport icao
5424
-	*
5425
-	* @return Array the aircraft list
5426
-	*
5427
-	*/
5423
+	 * Gets all aircraft registration that have flown over by airport icao
5424
+	 *
5425
+	 * @return Array the aircraft list
5426
+	 *
5427
+	 */
5428 5428
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5429 5429
 	{
5430 5430
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5461,11 +5461,11 @@  discard block
 block discarded – undo
5461 5461
 	
5462 5462
 	
5463 5463
 	/**
5464
-	* Gets all aircraft manufacturer that have flown over by airport icao
5465
-	*
5466
-	* @return Array the aircraft list
5467
-	*
5468
-	*/
5464
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5465
+	 *
5466
+	 * @return Array the aircraft list
5467
+	 *
5468
+	 */
5469 5469
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5470 5470
 	{
5471 5471
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5491,11 +5491,11 @@  discard block
 block discarded – undo
5491 5491
 	}
5492 5492
 
5493 5493
 	/**
5494
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5495
-	*
5496
-	* @return Array the aircraft list
5497
-	*
5498
-	*/
5494
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5495
+	 *
5496
+	 * @return Array the aircraft list
5497
+	 *
5498
+	 */
5499 5499
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5500 5500
 	{
5501 5501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5522,11 +5522,11 @@  discard block
 block discarded – undo
5522 5522
 
5523 5523
 
5524 5524
 	/**
5525
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5526
-	*
5527
-	* @return Array the aircraft list
5528
-	*
5529
-	*/
5525
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5526
+	 *
5527
+	 * @return Array the aircraft list
5528
+	 *
5529
+	 */
5530 5530
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5531 5531
 	{
5532 5532
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5562,11 +5562,11 @@  discard block
 block discarded – undo
5562 5562
 	}
5563 5563
 
5564 5564
 	/**
5565
-	* Gets all aircraft types that have flown over by date
5566
-	*
5567
-	* @return Array the aircraft list
5568
-	*
5569
-	*/
5565
+	 * Gets all aircraft types that have flown over by date
5566
+	 *
5567
+	 * @return Array the aircraft list
5568
+	 *
5569
+	 */
5570 5570
 	public function countAllAircraftTypesByDate($date,$filters = array())
5571 5571
 	{
5572 5572
 		global $globalTimezone, $globalDBdriver;
@@ -5608,11 +5608,11 @@  discard block
 block discarded – undo
5608 5608
 
5609 5609
 
5610 5610
 	/**
5611
-	* Gets all aircraft registration that have flown over by date
5612
-	*
5613
-	* @return Array the aircraft list
5614
-	*
5615
-	*/
5611
+	 * Gets all aircraft registration that have flown over by date
5612
+	 *
5613
+	 * @return Array the aircraft list
5614
+	 *
5615
+	 */
5616 5616
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5617 5617
 	{
5618 5618
 		global $globalTimezone, $globalDBdriver;
@@ -5663,11 +5663,11 @@  discard block
 block discarded – undo
5663 5663
 
5664 5664
 
5665 5665
 	/**
5666
-	* Gets all aircraft manufacturer that have flown over by date
5667
-	*
5668
-	* @return Array the aircraft manufacturer list
5669
-	*
5670
-	*/
5666
+	 * Gets all aircraft manufacturer that have flown over by date
5667
+	 *
5668
+	 * @return Array the aircraft manufacturer list
5669
+	 *
5670
+	 */
5671 5671
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5672 5672
 	{
5673 5673
 		global $globalTimezone, $globalDBdriver;
@@ -5709,11 +5709,11 @@  discard block
 block discarded – undo
5709 5709
 
5710 5710
 
5711 5711
 	/**
5712
-	* Gets all aircraft types that have flown over by ident/callsign
5713
-	*
5714
-	* @return Array the aircraft list
5715
-	*
5716
-	*/
5712
+	 * Gets all aircraft types that have flown over by ident/callsign
5713
+	 *
5714
+	 * @return Array the aircraft list
5715
+	 *
5716
+	 */
5717 5717
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5718 5718
 	{
5719 5719
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5741,11 +5741,11 @@  discard block
 block discarded – undo
5741 5741
 	}
5742 5742
 
5743 5743
 	/**
5744
-	* Gets all aircraft types that have flown over by pilot
5745
-	*
5746
-	* @return Array the aircraft list
5747
-	*
5748
-	*/
5744
+	 * Gets all aircraft types that have flown over by pilot
5745
+	 *
5746
+	 * @return Array the aircraft list
5747
+	 *
5748
+	 */
5749 5749
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5750 5750
 	{
5751 5751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5790,11 +5790,11 @@  discard block
 block discarded – undo
5790 5790
 	}
5791 5791
 
5792 5792
 	/**
5793
-	* Gets all aircraft types that have flown over by owner
5794
-	*
5795
-	* @return Array the aircraft list
5796
-	*
5797
-	*/
5793
+	 * Gets all aircraft types that have flown over by owner
5794
+	 *
5795
+	 * @return Array the aircraft list
5796
+	 *
5797
+	 */
5798 5798
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5799 5799
 	{
5800 5800
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5838,11 +5838,11 @@  discard block
 block discarded – undo
5838 5838
 	}
5839 5839
 
5840 5840
 	/**
5841
-	* Gets all aircraft registration that have flown over by ident/callsign
5842
-	*
5843
-	* @return Array the aircraft list
5844
-	*
5845
-	*/
5841
+	 * Gets all aircraft registration that have flown over by ident/callsign
5842
+	 *
5843
+	 * @return Array the aircraft list
5844
+	 *
5845
+	 */
5846 5846
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5847 5847
 	{
5848 5848
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5881,11 +5881,11 @@  discard block
 block discarded – undo
5881 5881
 	}
5882 5882
 
5883 5883
 	/**
5884
-	* Gets all aircraft registration that have flown over by owner
5885
-	*
5886
-	* @return Array the aircraft list
5887
-	*
5888
-	*/
5884
+	 * Gets all aircraft registration that have flown over by owner
5885
+	 *
5886
+	 * @return Array the aircraft list
5887
+	 *
5888
+	 */
5889 5889
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5890 5890
 	{
5891 5891
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5955,11 +5955,11 @@  discard block
 block discarded – undo
5955 5955
 	}
5956 5956
 
5957 5957
 	/**
5958
-	* Gets all aircraft registration that have flown over by pilot
5959
-	*
5960
-	* @return Array the aircraft list
5961
-	*
5962
-	*/
5958
+	 * Gets all aircraft registration that have flown over by pilot
5959
+	 *
5960
+	 * @return Array the aircraft list
5961
+	 *
5962
+	 */
5963 5963
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5964 5964
 	{
5965 5965
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6030,11 +6030,11 @@  discard block
 block discarded – undo
6030 6030
 
6031 6031
 
6032 6032
 	/**
6033
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6034
-	*
6035
-	* @return Array the aircraft manufacturer list
6036
-	*
6037
-	*/
6033
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6034
+	 *
6035
+	 * @return Array the aircraft manufacturer list
6036
+	 *
6037
+	 */
6038 6038
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6039 6039
 	{
6040 6040
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6059,11 +6059,11 @@  discard block
 block discarded – undo
6059 6059
 	}
6060 6060
 
6061 6061
 	/**
6062
-	* Gets all aircraft manufacturer that have flown over by owner
6063
-	*
6064
-	* @return Array the aircraft manufacturer list
6065
-	*
6066
-	*/
6062
+	 * Gets all aircraft manufacturer that have flown over by owner
6063
+	 *
6064
+	 * @return Array the aircraft manufacturer list
6065
+	 *
6066
+	 */
6067 6067
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6068 6068
 	{
6069 6069
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6110,11 +6110,11 @@  discard block
 block discarded – undo
6110 6110
 	}
6111 6111
 
6112 6112
 	/**
6113
-	* Gets all aircraft manufacturer that have flown over by pilot
6114
-	*
6115
-	* @return Array the aircraft manufacturer list
6116
-	*
6117
-	*/
6113
+	 * Gets all aircraft manufacturer that have flown over by pilot
6114
+	 *
6115
+	 * @return Array the aircraft manufacturer list
6116
+	 *
6117
+	 */
6118 6118
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6119 6119
 	{
6120 6120
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6162,11 +6162,11 @@  discard block
 block discarded – undo
6162 6162
 
6163 6163
 
6164 6164
 	/**
6165
-	* Gets all aircraft types that have flown over by route
6166
-	*
6167
-	* @return Array the aircraft list
6168
-	*
6169
-	*/
6165
+	 * Gets all aircraft types that have flown over by route
6166
+	 *
6167
+	 * @return Array the aircraft list
6168
+	 *
6169
+	 */
6170 6170
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6171 6171
 	{
6172 6172
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6195,11 +6195,11 @@  discard block
 block discarded – undo
6195 6195
 	}
6196 6196
 
6197 6197
 	/**
6198
-	* Gets all aircraft registration that have flown over by route
6199
-	*
6200
-	* @return Array the aircraft list
6201
-	*
6202
-	*/
6198
+	 * Gets all aircraft registration that have flown over by route
6199
+	 *
6200
+	 * @return Array the aircraft list
6201
+	 *
6202
+	 */
6203 6203
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6204 6204
 	{
6205 6205
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6241,11 +6241,11 @@  discard block
 block discarded – undo
6241 6241
 	
6242 6242
 	
6243 6243
 	/**
6244
-	* Gets all aircraft manufacturer that have flown over by route
6245
-	*
6246
-	* @return Array the aircraft manufacturer list
6247
-	*
6248
-	*/
6244
+	 * Gets all aircraft manufacturer that have flown over by route
6245
+	 *
6246
+	 * @return Array the aircraft manufacturer list
6247
+	 *
6248
+	 */
6249 6249
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6250 6250
 	{
6251 6251
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6279,11 +6279,11 @@  discard block
 block discarded – undo
6279 6279
 	
6280 6280
 	
6281 6281
 	/**
6282
-	* Gets all aircraft types that have flown over by country
6283
-	*
6284
-	* @return Array the aircraft list
6285
-	*
6286
-	*/
6282
+	 * Gets all aircraft types that have flown over by country
6283
+	 *
6284
+	 * @return Array the aircraft list
6285
+	 *
6286
+	 */
6287 6287
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6288 6288
 	{
6289 6289
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6314,11 +6314,11 @@  discard block
 block discarded – undo
6314 6314
 
6315 6315
 
6316 6316
 	/**
6317
-	* Gets all aircraft registration that have flown over by country
6318
-	*
6319
-	* @return Array the aircraft list
6320
-	*
6321
-	*/
6317
+	 * Gets all aircraft registration that have flown over by country
6318
+	 *
6319
+	 * @return Array the aircraft list
6320
+	 *
6321
+	 */
6322 6322
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6323 6323
 	{
6324 6324
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6358,11 +6358,11 @@  discard block
 block discarded – undo
6358 6358
 	
6359 6359
 	
6360 6360
 	/**
6361
-	* Gets all aircraft manufacturer that have flown over by country
6362
-	*
6363
-	* @return Array the aircraft manufacturer list
6364
-	*
6365
-	*/
6361
+	 * Gets all aircraft manufacturer that have flown over by country
6362
+	 *
6363
+	 * @return Array the aircraft manufacturer list
6364
+	 *
6365
+	 */
6366 6366
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6367 6367
 	{
6368 6368
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6393,18 +6393,18 @@  discard block
 block discarded – undo
6393 6393
 	
6394 6394
 	
6395 6395
 	/**
6396
-	* Gets all aircraft manufacturers that have flown over
6397
-	*
6398
-	* @return Array the aircraft list
6399
-	*
6400
-	*/
6396
+	 * Gets all aircraft manufacturers that have flown over
6397
+	 *
6398
+	 * @return Array the aircraft list
6399
+	 *
6400
+	 */
6401 6401
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404 6404
 		$filter_query = $this->getFilter($filters,true,true);
6405 6405
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6406 6406
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6407
-                $query_values = array();
6407
+				$query_values = array();
6408 6408
 		if ($year != '') {
6409 6409
 			if ($globalDBdriver == 'mysql') {
6410 6410
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6457,11 +6457,11 @@  discard block
 block discarded – undo
6457 6457
 	
6458 6458
 	
6459 6459
 	/**
6460
-	* Gets all aircraft registrations that have flown over
6461
-	*
6462
-	* @return Array the aircraft list
6463
-	*
6464
-	*/
6460
+	 * Gets all aircraft registrations that have flown over
6461
+	 *
6462
+	 * @return Array the aircraft list
6463
+	 *
6464
+	 */
6465 6465
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6466 6466
 	{
6467 6467
 		global $globalDBdriver;
@@ -6469,15 +6469,15 @@  discard block
 block discarded – undo
6469 6469
 		$filter_query = $this->getFilter($filters,true,true);
6470 6470
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6471 6471
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6472
-                if ($olderthanmonths > 0) {
6473
-            		if ($globalDBdriver == 'mysql') {
6472
+				if ($olderthanmonths > 0) {
6473
+					if ($globalDBdriver == 'mysql') {
6474 6474
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6475 6475
 			} else {
6476 6476
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6477 6477
 			}
6478 6478
 		}
6479
-                if ($sincedate != '') {
6480
-            		if ($globalDBdriver == 'mysql') {
6479
+				if ($sincedate != '') {
6480
+					if ($globalDBdriver == 'mysql') {
6481 6481
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6482 6482
 			} else {
6483 6483
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6542,11 +6542,11 @@  discard block
 block discarded – undo
6542 6542
 
6543 6543
 
6544 6544
 	/**
6545
-	* Gets all aircraft registrations that have flown over
6546
-	*
6547
-	* @return Array the aircraft list
6548
-	*
6549
-	*/
6545
+	 * Gets all aircraft registrations that have flown over
6546
+	 *
6547
+	 * @return Array the aircraft list
6548
+	 *
6549
+	 */
6550 6550
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6551 6551
 	{
6552 6552
 		global $globalDBdriver;
@@ -6554,15 +6554,15 @@  discard block
 block discarded – undo
6554 6554
 		$Image = new Image($this->db);
6555 6555
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6556 6556
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6557
-                if ($olderthanmonths > 0) {
6558
-            		if ($globalDBdriver == 'mysql') {
6557
+				if ($olderthanmonths > 0) {
6558
+					if ($globalDBdriver == 'mysql') {
6559 6559
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6560 6560
 			} else {
6561 6561
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6562 6562
 			}
6563 6563
 		}
6564
-                if ($sincedate != '') {
6565
-            		if ($globalDBdriver == 'mysql') {
6564
+				if ($sincedate != '') {
6565
+					if ($globalDBdriver == 'mysql') {
6566 6566
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6567 6567
 			} else {
6568 6568
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6571,7 +6571,7 @@  discard block
 block discarded – undo
6571 6571
 
6572 6572
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6573 6573
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6574
-                $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";
6574
+				$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";
6575 6575
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6576 6576
 		
6577 6577
 		$sth = $this->db->prepare($query);
@@ -6603,26 +6603,26 @@  discard block
 block discarded – undo
6603 6603
 	
6604 6604
 	
6605 6605
 	/**
6606
-	* Gets all departure airports of the airplanes that have flown over
6607
-	*
6608
-	* @return Array the airport list
6609
-	*
6610
-	*/
6606
+	 * Gets all departure airports of the airplanes that have flown over
6607
+	 *
6608
+	 * @return Array the airport list
6609
+	 *
6610
+	 */
6611 6611
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6612 6612
 	{
6613 6613
 		global $globalDBdriver;
6614 6614
 		$filter_query = $this->getFilter($filters,true,true);
6615 6615
 		$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 
6616 6616
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6617
-                if ($olderthanmonths > 0) {
6618
-            		if ($globalDBdriver == 'mysql') {
6617
+				if ($olderthanmonths > 0) {
6618
+					if ($globalDBdriver == 'mysql') {
6619 6619
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6620 6620
 			} else {
6621 6621
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6622 6622
 			}
6623
-                }
6624
-                if ($sincedate != '') {
6625
-            		if ($globalDBdriver == 'mysql') {
6623
+				}
6624
+				if ($sincedate != '') {
6625
+					if ($globalDBdriver == 'mysql') {
6626 6626
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6627 6627
 			} else {
6628 6628
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6656,7 +6656,7 @@  discard block
 block discarded – undo
6656 6656
 				$query_values = array_merge($query_values,array(':day' => $day));
6657 6657
 			}
6658 6658
 		}
6659
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6659
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6660 6660
 				ORDER BY airport_departure_icao_count DESC";
6661 6661
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6662 6662
 
@@ -6679,35 +6679,35 @@  discard block
 block discarded – undo
6679 6679
 	}
6680 6680
 
6681 6681
 	/**
6682
-	* Gets all departure airports of the airplanes that have flown over
6683
-	*
6684
-	* @return Array the airport list
6685
-	*
6686
-	*/
6682
+	 * Gets all departure airports of the airplanes that have flown over
6683
+	 *
6684
+	 * @return Array the airport list
6685
+	 *
6686
+	 */
6687 6687
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6688 6688
 	{
6689 6689
 		global $globalDBdriver;
6690 6690
 		$filter_query = $this->getFilter($filters,true,true);
6691 6691
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, 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 
6692 6692
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6693
-                if ($olderthanmonths > 0) {
6694
-            		if ($globalDBdriver == 'mysql') {
6693
+				if ($olderthanmonths > 0) {
6694
+					if ($globalDBdriver == 'mysql') {
6695 6695
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6696 6696
 			} else {
6697 6697
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6698 6698
 			}
6699
-                }
6700
-                if ($sincedate != '') {
6701
-            		if ($globalDBdriver == 'mysql') {
6699
+				}
6700
+				if ($sincedate != '') {
6701
+					if ($globalDBdriver == 'mysql') {
6702 6702
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6703 6703
 			} else {
6704 6704
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6705 6705
 			}
6706 6706
 		}
6707 6707
 
6708
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6709
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6710
-                $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
6708
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6709
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6710
+				$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
6711 6711
 				ORDER BY airport_departure_icao_count DESC";
6712 6712
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6713 6713
       
@@ -6732,26 +6732,26 @@  discard block
 block discarded – undo
6732 6732
 	}
6733 6733
 
6734 6734
 	/**
6735
-	* Gets all detected departure airports of the airplanes that have flown over
6736
-	*
6737
-	* @return Array the airport list
6738
-	*
6739
-	*/
6735
+	 * Gets all detected departure airports of the airplanes that have flown over
6736
+	 *
6737
+	 * @return Array the airport list
6738
+	 *
6739
+	 */
6740 6740
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6741 6741
 	{
6742 6742
 		global $globalDBdriver;
6743 6743
 		$filter_query = $this->getFilter($filters,true,true);
6744 6744
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6745 6745
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6746
-                if ($olderthanmonths > 0) {
6747
-            		if ($globalDBdriver == 'mysql') {
6746
+				if ($olderthanmonths > 0) {
6747
+					if ($globalDBdriver == 'mysql') {
6748 6748
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6749 6749
 			} else {
6750 6750
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6751 6751
 			}
6752
-                }
6753
-                if ($sincedate != '') {
6754
-            		if ($globalDBdriver == 'mysql') {
6752
+				}
6753
+				if ($sincedate != '') {
6754
+					if ($globalDBdriver == 'mysql') {
6755 6755
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6756 6756
 			} else {
6757 6757
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6785,10 +6785,10 @@  discard block
 block discarded – undo
6785 6785
 				$query_values = array_merge($query_values,array(':day' => $day));
6786 6786
 			}
6787 6787
 		}
6788
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6788
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6789 6789
 				ORDER BY airport_departure_icao_count DESC";
6790 6790
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6791
-    		//echo $query;
6791
+			//echo $query;
6792 6792
 		$sth = $this->db->prepare($query);
6793 6793
 		$sth->execute($query_values);
6794 6794
       
@@ -6809,35 +6809,35 @@  discard block
 block discarded – undo
6809 6809
 	}
6810 6810
 	
6811 6811
 	/**
6812
-	* Gets all detected departure airports of the airplanes that have flown over
6813
-	*
6814
-	* @return Array the airport list
6815
-	*
6816
-	*/
6812
+	 * Gets all detected departure airports of the airplanes that have flown over
6813
+	 *
6814
+	 * @return Array the airport list
6815
+	 *
6816
+	 */
6817 6817
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6818 6818
 	{
6819 6819
 		global $globalDBdriver;
6820 6820
 		$filter_query = $this->getFilter($filters,true,true);
6821 6821
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6822 6822
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6823
-                if ($olderthanmonths > 0) {
6824
-            		if ($globalDBdriver == 'mysql') {
6823
+				if ($olderthanmonths > 0) {
6824
+					if ($globalDBdriver == 'mysql') {
6825 6825
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6826 6826
 			} else {
6827 6827
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6828 6828
 			}
6829
-                }
6830
-                if ($sincedate != '') {
6831
-            		if ($globalDBdriver == 'mysql') {
6829
+				}
6830
+				if ($sincedate != '') {
6831
+					if ($globalDBdriver == 'mysql') {
6832 6832
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6833 6833
 			} else {
6834 6834
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6835 6835
 			}
6836 6836
 		}
6837 6837
 
6838
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6839
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6840
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6838
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6839
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6840
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6841 6841
 				ORDER BY airport_departure_icao_count DESC";
6842 6842
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6843 6843
       
@@ -6862,11 +6862,11 @@  discard block
 block discarded – undo
6862 6862
 	}	
6863 6863
 	
6864 6864
 	/**
6865
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6866
-	*
6867
-	* @return Array the airport list
6868
-	*
6869
-	*/
6865
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6866
+	 *
6867
+	 * @return Array the airport list
6868
+	 *
6869
+	 */
6870 6870
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6871 6871
 	{
6872 6872
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6900,11 +6900,11 @@  discard block
 block discarded – undo
6900 6900
 	
6901 6901
 	
6902 6902
 	/**
6903
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6904
-	*
6905
-	* @return Array the airport list
6906
-	*
6907
-	*/
6903
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6904
+	 *
6905
+	 * @return Array the airport list
6906
+	 *
6907
+	 */
6908 6908
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6909 6909
 	{
6910 6910
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6935,11 +6935,11 @@  discard block
 block discarded – undo
6935 6935
 	
6936 6936
 	
6937 6937
 	/**
6938
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6939
-	*
6940
-	* @return Array the airport list
6941
-	*
6942
-	*/
6938
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6939
+	 *
6940
+	 * @return Array the airport list
6941
+	 *
6942
+	 */
6943 6943
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6944 6944
 	{
6945 6945
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	
6973 6973
 	
6974 6974
 	/**
6975
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6976
-	*
6977
-	* @return Array the airport list
6978
-	*
6979
-	*/
6975
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6976
+	 *
6977
+	 * @return Array the airport list
6978
+	 *
6979
+	 */
6980 6980
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6981 6981
 	{
6982 6982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7006,11 +7006,11 @@  discard block
 block discarded – undo
7006 7006
 	
7007 7007
 	
7008 7008
 	/**
7009
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7010
-	*
7011
-	* @return Array the airport list
7012
-	*
7013
-	*/
7009
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7010
+	 *
7011
+	 * @return Array the airport list
7012
+	 *
7013
+	 */
7014 7014
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7015 7015
 	{
7016 7016
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7043,11 +7043,11 @@  discard block
 block discarded – undo
7043 7043
 	
7044 7044
 	
7045 7045
 	/**
7046
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7047
-	*
7048
-	* @return Array the airport list
7049
-	*
7050
-	*/
7046
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7047
+	 *
7048
+	 * @return Array the airport list
7049
+	 *
7050
+	 */
7051 7051
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7052 7052
 	{
7053 7053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7077,11 +7077,11 @@  discard block
 block discarded – undo
7077 7077
 	
7078 7078
 	
7079 7079
 	/**
7080
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7081
-	*
7082
-	* @return Array the airport list
7083
-	*
7084
-	*/
7080
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7081
+	 *
7082
+	 * @return Array the airport list
7083
+	 *
7084
+	 */
7085 7085
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7086 7086
 	{
7087 7087
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7114,11 +7114,11 @@  discard block
 block discarded – undo
7114 7114
 	
7115 7115
 	
7116 7116
 	/**
7117
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7118
-	*
7119
-	* @return Array the airport list
7120
-	*
7121
-	*/
7117
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7118
+	 *
7119
+	 * @return Array the airport list
7120
+	 *
7121
+	 */
7122 7122
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7123 7123
 	{
7124 7124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7149,11 +7149,11 @@  discard block
 block discarded – undo
7149 7149
 	
7150 7150
 	
7151 7151
 	/**
7152
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7153
-	*
7154
-	* @return Array the airport list
7155
-	*
7156
-	*/
7152
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7153
+	 *
7154
+	 * @return Array the airport list
7155
+	 *
7156
+	 */
7157 7157
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7158 7158
 	{
7159 7159
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7186,11 +7186,11 @@  discard block
 block discarded – undo
7186 7186
 	
7187 7187
 	
7188 7188
 	/**
7189
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7190
-	*
7191
-	* @return Array the airport list
7192
-	*
7193
-	*/
7189
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7190
+	 *
7191
+	 * @return Array the airport list
7192
+	 *
7193
+	 */
7194 7194
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7195 7195
 	{
7196 7196
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7220,11 +7220,11 @@  discard block
 block discarded – undo
7220 7220
 	
7221 7221
 	
7222 7222
 	/**
7223
-	* Gets all departure airports of the airplanes that have flown over based on a date
7224
-	*
7225
-	* @return Array the airport list
7226
-	*
7227
-	*/
7223
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7224
+	 *
7225
+	 * @return Array the airport list
7226
+	 *
7227
+	 */
7228 7228
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7229 7229
 	{
7230 7230
 		global $globalTimezone, $globalDBdriver;
@@ -7270,11 +7270,11 @@  discard block
 block discarded – undo
7270 7270
 	
7271 7271
 	
7272 7272
 	/**
7273
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7274
-	*
7275
-	* @return Array the airport list
7276
-	*
7277
-	*/
7273
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7274
+	 *
7275
+	 * @return Array the airport list
7276
+	 *
7277
+	 */
7278 7278
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7279 7279
 	{
7280 7280
 		global $globalTimezone, $globalDBdriver;
@@ -7317,11 +7317,11 @@  discard block
 block discarded – undo
7317 7317
 	
7318 7318
 	
7319 7319
 	/**
7320
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7321
-	*
7322
-	* @return Array the airport list
7323
-	*
7324
-	*/
7320
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7321
+	 *
7322
+	 * @return Array the airport list
7323
+	 *
7324
+	 */
7325 7325
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7326 7326
 	{
7327 7327
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7353,11 +7353,11 @@  discard block
 block discarded – undo
7353 7353
 	}
7354 7354
 	
7355 7355
 	/**
7356
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7357
-	*
7358
-	* @return Array the airport list
7359
-	*
7360
-	*/
7356
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7357
+	 *
7358
+	 * @return Array the airport list
7359
+	 *
7360
+	 */
7361 7361
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7362 7362
 	{
7363 7363
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7389,11 +7389,11 @@  discard block
 block discarded – undo
7389 7389
 	}
7390 7390
 	
7391 7391
 	/**
7392
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7393
-	*
7394
-	* @return Array the airport list
7395
-	*
7396
-	*/
7392
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7393
+	 *
7394
+	 * @return Array the airport list
7395
+	 *
7396
+	 */
7397 7397
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7398 7398
 	{
7399 7399
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7426,11 +7426,11 @@  discard block
 block discarded – undo
7426 7426
 	
7427 7427
 	
7428 7428
 	/**
7429
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7430
-	*
7431
-	* @return Array the airport list
7432
-	*
7433
-	*/
7429
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7430
+	 *
7431
+	 * @return Array the airport list
7432
+	 *
7433
+	 */
7434 7434
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7435 7435
 	{
7436 7436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7459,11 +7459,11 @@  discard block
 block discarded – undo
7459 7459
 	}
7460 7460
 	
7461 7461
 	/**
7462
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7463
-	*
7464
-	* @return Array the airport list
7465
-	*
7466
-	*/
7462
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7463
+	 *
7464
+	 * @return Array the airport list
7465
+	 *
7466
+	 */
7467 7467
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7468 7468
 	{
7469 7469
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7479,11 +7479,11 @@  discard block
 block discarded – undo
7479 7479
 	}
7480 7480
 	
7481 7481
 	/**
7482
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7483
-	*
7484
-	* @return Array the airport list
7485
-	*
7486
-	*/
7482
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7483
+	 *
7484
+	 * @return Array the airport list
7485
+	 *
7486
+	 */
7487 7487
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7488 7488
 	{
7489 7489
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7501,11 +7501,11 @@  discard block
 block discarded – undo
7501 7501
 	
7502 7502
 	
7503 7503
 	/**
7504
-	* Gets all departure airports of the airplanes that have flown over based on a country
7505
-	*
7506
-	* @return Array the airport list
7507
-	*
7508
-	*/
7504
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7505
+	 *
7506
+	 * @return Array the airport list
7507
+	 *
7508
+	 */
7509 7509
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7510 7510
 	{
7511 7511
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7539,11 +7539,11 @@  discard block
 block discarded – undo
7539 7539
 
7540 7540
 
7541 7541
 	/**
7542
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7543
-	*
7544
-	* @return Array the airport list
7545
-	*
7546
-	*/
7542
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7543
+	 *
7544
+	 * @return Array the airport list
7545
+	 *
7546
+	 */
7547 7547
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7548 7548
 	{
7549 7549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7573,31 +7573,31 @@  discard block
 block discarded – undo
7573 7573
 	
7574 7574
 
7575 7575
 	/**
7576
-	* Gets all arrival airports of the airplanes that have flown over
7577
-	*
7578
-	* @param Boolean $limit Limit result to 10 or not
7579
-	* @param Integer $olderthanmonths Only show result older than x months
7580
-	* @param String $sincedate Only show result since x date
7581
-	* @param Boolean $icaoaskey Show result by ICAO
7582
-	* @param Array $filters Filter used here
7583
-	* @return Array the airport list
7584
-	*
7585
-	*/
7576
+	 * Gets all arrival airports of the airplanes that have flown over
7577
+	 *
7578
+	 * @param Boolean $limit Limit result to 10 or not
7579
+	 * @param Integer $olderthanmonths Only show result older than x months
7580
+	 * @param String $sincedate Only show result since x date
7581
+	 * @param Boolean $icaoaskey Show result by ICAO
7582
+	 * @param Array $filters Filter used here
7583
+	 * @return Array the airport list
7584
+	 *
7585
+	 */
7586 7586
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7587 7587
 	{
7588 7588
 		global $globalDBdriver;
7589 7589
 		$filter_query = $this->getFilter($filters,true,true);
7590 7590
 		$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 
7591 7591
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7592
-                if ($olderthanmonths > 0) {
7593
-            		if ($globalDBdriver == 'mysql') {
7592
+				if ($olderthanmonths > 0) {
7593
+					if ($globalDBdriver == 'mysql') {
7594 7594
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7595 7595
 			} else {
7596 7596
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7597 7597
 			}
7598 7598
 		}
7599
-                if ($sincedate != '') {
7600
-            		if ($globalDBdriver == 'mysql') {
7599
+				if ($sincedate != '') {
7600
+					if ($globalDBdriver == 'mysql') {
7601 7601
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7602 7602
 			} else {
7603 7603
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7631,7 +7631,7 @@  discard block
 block discarded – undo
7631 7631
 				$query_values = array_merge($query_values,array(':day' => $day));
7632 7632
 			}
7633 7633
 		}
7634
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7634
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7635 7635
 					ORDER BY airport_arrival_icao_count DESC";
7636 7636
 		if ($limit) $query .= " LIMIT 10";
7637 7637
       
@@ -7660,35 +7660,35 @@  discard block
 block discarded – undo
7660 7660
 	}
7661 7661
 
7662 7662
 	/**
7663
-	* Gets all arrival airports of the airplanes that have flown over
7664
-	*
7665
-	* @return Array the airport list
7666
-	*
7667
-	*/
7663
+	 * Gets all arrival airports of the airplanes that have flown over
7664
+	 *
7665
+	 * @return Array the airport list
7666
+	 *
7667
+	 */
7668 7668
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7669 7669
 	{
7670 7670
 		global $globalDBdriver;
7671 7671
 		$filter_query = $this->getFilter($filters,true,true);
7672 7672
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, 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 
7673 7673
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7674
-                if ($olderthanmonths > 0) {
7675
-            		if ($globalDBdriver == 'mysql') {
7674
+				if ($olderthanmonths > 0) {
7675
+					if ($globalDBdriver == 'mysql') {
7676 7676
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7677 7677
 			} else {
7678 7678
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7679 7679
 			}
7680 7680
 		}
7681
-                if ($sincedate != '') {
7682
-            		if ($globalDBdriver == 'mysql') {
7681
+				if ($sincedate != '') {
7682
+					if ($globalDBdriver == 'mysql') {
7683 7683
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7684 7684
 			} else {
7685 7685
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7686 7686
 			}
7687 7687
 		}
7688 7688
 
7689
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7690
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7691
-                $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
7689
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7690
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7691
+				$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
7692 7692
 					ORDER BY airport_arrival_icao_count DESC";
7693 7693
 		if ($limit) $query .= " LIMIT 10";
7694 7694
       
@@ -7719,26 +7719,26 @@  discard block
 block discarded – undo
7719 7719
 
7720 7720
 
7721 7721
 	/**
7722
-	* Gets all detected arrival airports of the airplanes that have flown over
7723
-	*
7724
-	* @return Array the airport list
7725
-	*
7726
-	*/
7722
+	 * Gets all detected arrival airports of the airplanes that have flown over
7723
+	 *
7724
+	 * @return Array the airport list
7725
+	 *
7726
+	 */
7727 7727
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7728 7728
 	{
7729 7729
 		global $globalDBdriver;
7730 7730
 		$filter_query = $this->getFilter($filters,true,true);
7731 7731
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7732 7732
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7733
-                if ($olderthanmonths > 0) {
7734
-            		if ($globalDBdriver == 'mysql') {
7733
+				if ($olderthanmonths > 0) {
7734
+					if ($globalDBdriver == 'mysql') {
7735 7735
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7736 7736
 			} else {
7737 7737
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7738 7738
 			}
7739 7739
 		}
7740
-                if ($sincedate != '') {
7741
-            		if ($globalDBdriver == 'mysql') {
7740
+				if ($sincedate != '') {
7741
+					if ($globalDBdriver == 'mysql') {
7742 7742
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7743 7743
 			} else {
7744 7744
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7772,7 +7772,7 @@  discard block
 block discarded – undo
7772 7772
 				$query_values = array_merge($query_values,array(':day' => $day));
7773 7773
 			}
7774 7774
 		}
7775
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7775
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7776 7776
 					ORDER BY airport_arrival_icao_count DESC";
7777 7777
 		if ($limit) $query .= " LIMIT 10";
7778 7778
       
@@ -7800,35 +7800,35 @@  discard block
 block discarded – undo
7800 7800
 	}
7801 7801
 	
7802 7802
 	/**
7803
-	* Gets all detected arrival airports of the airplanes that have flown over
7804
-	*
7805
-	* @return Array the airport list
7806
-	*
7807
-	*/
7803
+	 * Gets all detected arrival airports of the airplanes that have flown over
7804
+	 *
7805
+	 * @return Array the airport list
7806
+	 *
7807
+	 */
7808 7808
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7809 7809
 	{
7810 7810
 		global $globalDBdriver;
7811 7811
 		$filter_query = $this->getFilter($filters,true,true);
7812 7812
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7813 7813
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7814
-                if ($olderthanmonths > 0) {
7815
-            		if ($globalDBdriver == 'mysql') {
7814
+				if ($olderthanmonths > 0) {
7815
+					if ($globalDBdriver == 'mysql') {
7816 7816
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7817 7817
 			} else {
7818 7818
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7819 7819
 			}
7820 7820
 		}
7821
-                if ($sincedate != '') {
7822
-            		if ($globalDBdriver == 'mysql') {
7821
+				if ($sincedate != '') {
7822
+					if ($globalDBdriver == 'mysql') {
7823 7823
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7824 7824
 			} else {
7825 7825
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7826 7826
 			}
7827 7827
 		}
7828 7828
 
7829
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7830
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7831
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7829
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7830
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7831
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7832 7832
 					ORDER BY airport_arrival_icao_count DESC";
7833 7833
 		if ($limit) $query .= " LIMIT 10";
7834 7834
       
@@ -7858,11 +7858,11 @@  discard block
 block discarded – undo
7858 7858
 	}	
7859 7859
 	
7860 7860
 	/**
7861
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7862
-	*
7863
-	* @return Array the airport list
7864
-	*
7865
-	*/
7861
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7862
+	 *
7863
+	 * @return Array the airport list
7864
+	 *
7865
+	 */
7866 7866
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7867 7867
 	{
7868 7868
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7894,11 +7894,11 @@  discard block
 block discarded – undo
7894 7894
 	
7895 7895
 	
7896 7896
 	/**
7897
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7898
-	*
7899
-	* @return Array the airport list
7900
-	*
7901
-	*/
7897
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7898
+	 *
7899
+	 * @return Array the airport list
7900
+	 *
7901
+	 */
7902 7902
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7903 7903
 	{
7904 7904
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7929,11 +7929,11 @@  discard block
 block discarded – undo
7929 7929
 	
7930 7930
 	
7931 7931
 	/**
7932
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7933
-	*
7934
-	* @return Array the airport list
7935
-	*
7936
-	*/
7932
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7933
+	 *
7934
+	 * @return Array the airport list
7935
+	 *
7936
+	 */
7937 7937
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7938 7938
 	{
7939 7939
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7967,11 +7967,11 @@  discard block
 block discarded – undo
7967 7967
 	
7968 7968
 	
7969 7969
 	/**
7970
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7971
-	*
7972
-	* @return Array the airport list
7973
-	*
7974
-	*/
7970
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7971
+	 *
7972
+	 * @return Array the airport list
7973
+	 *
7974
+	 */
7975 7975
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7976 7976
 	{
7977 7977
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8001,11 +8001,11 @@  discard block
 block discarded – undo
8001 8001
 	
8002 8002
 	
8003 8003
 	/**
8004
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8005
-	*
8006
-	* @return Array the airport list
8007
-	*
8008
-	*/
8004
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8005
+	 *
8006
+	 * @return Array the airport list
8007
+	 *
8008
+	 */
8009 8009
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8010 8010
 	{
8011 8011
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8039,11 +8039,11 @@  discard block
 block discarded – undo
8039 8039
 	
8040 8040
 	
8041 8041
 	/**
8042
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8043
-	*
8044
-	* @return Array the airport list
8045
-	*
8046
-	*/
8042
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8043
+	 *
8044
+	 * @return Array the airport list
8045
+	 *
8046
+	 */
8047 8047
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8048 8048
 	{
8049 8049
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8074,11 +8074,11 @@  discard block
 block discarded – undo
8074 8074
 	
8075 8075
 	
8076 8076
 	/**
8077
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8078
-	*
8079
-	* @return Array the airport list
8080
-	*
8081
-	*/
8077
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8078
+	 *
8079
+	 * @return Array the airport list
8080
+	 *
8081
+	 */
8082 8082
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8083 8083
 	{
8084 8084
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8111,11 +8111,11 @@  discard block
 block discarded – undo
8111 8111
 	
8112 8112
 	
8113 8113
 	/**
8114
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8115
-	*
8116
-	* @return Array the airport list
8117
-	*
8118
-	*/
8114
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8115
+	 *
8116
+	 * @return Array the airport list
8117
+	 *
8118
+	 */
8119 8119
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8120 8120
 	{
8121 8121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8145,11 +8145,11 @@  discard block
 block discarded – undo
8145 8145
 	
8146 8146
 	
8147 8147
 	/**
8148
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8149
-	*
8150
-	* @return Array the airport list
8151
-	*
8152
-	*/
8148
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8149
+	 *
8150
+	 * @return Array the airport list
8151
+	 *
8152
+	 */
8153 8153
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8154 8154
 	{
8155 8155
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8183,11 +8183,11 @@  discard block
 block discarded – undo
8183 8183
 	
8184 8184
 	
8185 8185
 	/**
8186
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8187
-	*
8188
-	* @return Array the airport list
8189
-	*
8190
-	*/
8186
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8187
+	 *
8188
+	 * @return Array the airport list
8189
+	 *
8190
+	 */
8191 8191
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8192 8192
 	{
8193 8193
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8218,11 +8218,11 @@  discard block
 block discarded – undo
8218 8218
 	
8219 8219
 	
8220 8220
 	/**
8221
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8222
-	*
8223
-	* @return Array the airport list
8224
-	*
8225
-	*/
8221
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8222
+	 *
8223
+	 * @return Array the airport list
8224
+	 *
8225
+	 */
8226 8226
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8227 8227
 	{
8228 8228
 		global $globalTimezone, $globalDBdriver;
@@ -8268,11 +8268,11 @@  discard block
 block discarded – undo
8268 8268
 	
8269 8269
 	
8270 8270
 	/**
8271
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8272
-	*
8273
-	* @return Array the airport list
8274
-	*
8275
-	*/
8271
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8272
+	 *
8273
+	 * @return Array the airport list
8274
+	 *
8275
+	 */
8276 8276
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8277 8277
 	{
8278 8278
 		global $globalTimezone, $globalDBdriver;
@@ -8315,11 +8315,11 @@  discard block
 block discarded – undo
8315 8315
 	
8316 8316
 	
8317 8317
 	/**
8318
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8319
-	*
8320
-	* @return Array the airport list
8321
-	*
8322
-	*/
8318
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8319
+	 *
8320
+	 * @return Array the airport list
8321
+	 *
8322
+	 */
8323 8323
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8324 8324
 	{
8325 8325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8351,11 +8351,11 @@  discard block
 block discarded – undo
8351 8351
 	}
8352 8352
 	
8353 8353
 	/**
8354
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8355
-	*
8356
-	* @return Array the airport list
8357
-	*
8358
-	*/
8354
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8355
+	 *
8356
+	 * @return Array the airport list
8357
+	 *
8358
+	 */
8359 8359
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8360 8360
 	{
8361 8361
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8386,11 +8386,11 @@  discard block
 block discarded – undo
8386 8386
 	}
8387 8387
 
8388 8388
 	/**
8389
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8390
-	*
8391
-	* @return Array the airport list
8392
-	*
8393
-	*/
8389
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8390
+	 *
8391
+	 * @return Array the airport list
8392
+	 *
8393
+	 */
8394 8394
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8395 8395
 	{
8396 8396
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8421,11 +8421,11 @@  discard block
 block discarded – undo
8421 8421
 	}
8422 8422
 	
8423 8423
 	/**
8424
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8425
-	*
8426
-	* @return Array the airport list
8427
-	*
8428
-	*/
8424
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8425
+	 *
8426
+	 * @return Array the airport list
8427
+	 *
8428
+	 */
8429 8429
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8430 8430
 	{
8431 8431
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8454,11 +8454,11 @@  discard block
 block discarded – undo
8454 8454
 	}
8455 8455
 	
8456 8456
 	/**
8457
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8458
-	*
8459
-	* @return Array the airport list
8460
-	*
8461
-	*/
8457
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8458
+	 *
8459
+	 * @return Array the airport list
8460
+	 *
8461
+	 */
8462 8462
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8463 8463
 	{
8464 8464
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8474,11 +8474,11 @@  discard block
 block discarded – undo
8474 8474
 	}
8475 8475
 	
8476 8476
 	/**
8477
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8478
-	*
8479
-	* @return Array the airport list
8480
-	*
8481
-	*/
8477
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8478
+	 *
8479
+	 * @return Array the airport list
8480
+	 *
8481
+	 */
8482 8482
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8483 8483
 	{
8484 8484
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8496,11 +8496,11 @@  discard block
 block discarded – undo
8496 8496
 	
8497 8497
 	
8498 8498
 	/**
8499
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8500
-	*
8501
-	* @return Array the airport list
8502
-	*
8503
-	*/
8499
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8500
+	 *
8501
+	 * @return Array the airport list
8502
+	 *
8503
+	 */
8504 8504
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8505 8505
 	{
8506 8506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8533,11 +8533,11 @@  discard block
 block discarded – undo
8533 8533
 	
8534 8534
 	
8535 8535
 	/**
8536
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8537
-	*
8538
-	* @return Array the airport list
8539
-	*
8540
-	*/
8536
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8537
+	 *
8538
+	 * @return Array the airport list
8539
+	 *
8540
+	 */
8541 8541
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8542 8542
 	{
8543 8543
 		global $globalDBdriver;
@@ -8569,11 +8569,11 @@  discard block
 block discarded – undo
8569 8569
 
8570 8570
 
8571 8571
 	/**
8572
-	* Counts all airport departure countries
8573
-	*
8574
-	* @return Array the airport departure list
8575
-	*
8576
-	*/
8572
+	 * Counts all airport departure countries
8573
+	 *
8574
+	 * @return Array the airport departure list
8575
+	 *
8576
+	 */
8577 8577
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8578 8578
 	{
8579 8579
 		global $globalDBdriver;
@@ -8632,11 +8632,11 @@  discard block
 block discarded – undo
8632 8632
 	
8633 8633
 	
8634 8634
 	/**
8635
-	* Counts all airport arrival countries
8636
-	*
8637
-	* @return Array the airport arrival list
8638
-	*
8639
-	*/
8635
+	 * Counts all airport arrival countries
8636
+	 *
8637
+	 * @return Array the airport arrival list
8638
+	 *
8639
+	 */
8640 8640
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8641 8641
 	{
8642 8642
 		global $globalDBdriver;
@@ -8698,11 +8698,11 @@  discard block
 block discarded – undo
8698 8698
 
8699 8699
 
8700 8700
 	/**
8701
-	* Gets all route combinations
8702
-	*
8703
-	* @return Array the route list
8704
-	*
8705
-	*/
8701
+	 * Gets all route combinations
8702
+	 *
8703
+	 * @return Array the route list
8704
+	 *
8705
+	 */
8706 8706
 	public function countAllRoutes($filters = array())
8707 8707
 	{
8708 8708
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8741,11 +8741,11 @@  discard block
 block discarded – undo
8741 8741
 	
8742 8742
 	
8743 8743
 	/**
8744
-	* Gets all route combinations based on an aircraft
8745
-	*
8746
-	* @return Array the route list
8747
-	*
8748
-	*/
8744
+	 * Gets all route combinations based on an aircraft
8745
+	 *
8746
+	 * @return Array the route list
8747
+	 *
8748
+	 */
8749 8749
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8750 8750
 	{
8751 8751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8781,11 +8781,11 @@  discard block
 block discarded – undo
8781 8781
 	
8782 8782
 	
8783 8783
 	/**
8784
-	* Gets all route combinations based on an aircraft registration
8785
-	*
8786
-	* @return Array the route list
8787
-	*
8788
-	*/
8784
+	 * Gets all route combinations based on an aircraft registration
8785
+	 *
8786
+	 * @return Array the route list
8787
+	 *
8788
+	 */
8789 8789
 	public function countAllRoutesByRegistration($registration, $filters = array())
8790 8790
 	{
8791 8791
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8823,11 +8823,11 @@  discard block
 block discarded – undo
8823 8823
 	
8824 8824
 	
8825 8825
 	/**
8826
-	* Gets all route combinations based on an airline
8827
-	*
8828
-	* @return Array the route list
8829
-	*
8830
-	*/
8826
+	 * Gets all route combinations based on an airline
8827
+	 *
8828
+	 * @return Array the route list
8829
+	 *
8830
+	 */
8831 8831
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8832 8832
 	{
8833 8833
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8865,11 +8865,11 @@  discard block
 block discarded – undo
8865 8865
 	
8866 8866
 	
8867 8867
 	/**
8868
-	* Gets all route combinations based on an airport
8869
-	*
8870
-	* @return Array the route list
8871
-	*
8872
-	*/
8868
+	 * Gets all route combinations based on an airport
8869
+	 *
8870
+	 * @return Array the route list
8871
+	 *
8872
+	 */
8873 8873
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8874 8874
 	{
8875 8875
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8906,11 +8906,11 @@  discard block
 block discarded – undo
8906 8906
 	
8907 8907
 	
8908 8908
 	/**
8909
-	* Gets all route combinations based on an country
8910
-	*
8911
-	* @return Array the route list
8912
-	*
8913
-	*/
8909
+	 * Gets all route combinations based on an country
8910
+	 *
8911
+	 * @return Array the route list
8912
+	 *
8913
+	 */
8914 8914
 	public function countAllRoutesByCountry($country, $filters = array())
8915 8915
 	{
8916 8916
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8946,11 +8946,11 @@  discard block
 block discarded – undo
8946 8946
 
8947 8947
 
8948 8948
 	/**
8949
-	* Gets all route combinations based on an date
8950
-	*
8951
-	* @return Array the route list
8952
-	*
8953
-	*/
8949
+	 * Gets all route combinations based on an date
8950
+	 *
8951
+	 * @return Array the route list
8952
+	 *
8953
+	 */
8954 8954
 	public function countAllRoutesByDate($date, $filters = array())
8955 8955
 	{
8956 8956
 		global $globalTimezone, $globalDBdriver;
@@ -9000,11 +9000,11 @@  discard block
 block discarded – undo
9000 9000
 	
9001 9001
 	
9002 9002
 	/**
9003
-	* Gets all route combinations based on an ident/callsign
9004
-	*
9005
-	* @return Array the route list
9006
-	*
9007
-	*/
9003
+	 * Gets all route combinations based on an ident/callsign
9004
+	 *
9005
+	 * @return Array the route list
9006
+	 *
9007
+	 */
9008 9008
 	public function countAllRoutesByIdent($ident, $filters = array())
9009 9009
 	{
9010 9010
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9040,11 +9040,11 @@  discard block
 block discarded – undo
9040 9040
 	}
9041 9041
 	
9042 9042
 	/**
9043
-	* Gets all route combinations based on an owner
9044
-	*
9045
-	* @return Array the route list
9046
-	*
9047
-	*/
9043
+	 * Gets all route combinations based on an owner
9044
+	 *
9045
+	 * @return Array the route list
9046
+	 *
9047
+	 */
9048 9048
 	public function countAllRoutesByOwner($owner,$filters = array())
9049 9049
 	{
9050 9050
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9080,11 +9080,11 @@  discard block
 block discarded – undo
9080 9080
 	}
9081 9081
 	
9082 9082
 	/**
9083
-	* Gets all route combinations based on a pilot
9084
-	*
9085
-	* @return Array the route list
9086
-	*
9087
-	*/
9083
+	 * Gets all route combinations based on a pilot
9084
+	 *
9085
+	 * @return Array the route list
9086
+	 *
9087
+	 */
9088 9088
 	public function countAllRoutesByPilot($pilot,$filters = array())
9089 9089
 	{
9090 9090
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9121,11 +9121,11 @@  discard block
 block discarded – undo
9121 9121
 	
9122 9122
 	
9123 9123
 	/**
9124
-	* Gets all route combinations based on an manufacturer
9125
-	*
9126
-	* @return Array the route list
9127
-	*
9128
-	*/
9124
+	 * Gets all route combinations based on an manufacturer
9125
+	 *
9126
+	 * @return Array the route list
9127
+	 *
9128
+	 */
9129 9129
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9130 9130
 	{
9131 9131
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9163,11 +9163,11 @@  discard block
 block discarded – undo
9163 9163
 	
9164 9164
 	
9165 9165
 	/**
9166
-	* Gets all route combinations with waypoints
9167
-	*
9168
-	* @return Array the route list
9169
-	*
9170
-	*/
9166
+	 * Gets all route combinations with waypoints
9167
+	 *
9168
+	 * @return Array the route list
9169
+	 *
9170
+	 */
9171 9171
 	public function countAllRoutesWithWaypoints($filters = array())
9172 9172
 	{
9173 9173
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9204,11 +9204,11 @@  discard block
 block discarded – undo
9204 9204
 	}
9205 9205
 	
9206 9206
 	/**
9207
-	* Gets all callsigns that have flown over
9208
-	*
9209
-	* @return Array the callsign list
9210
-	*
9211
-	*/
9207
+	 * Gets all callsigns that have flown over
9208
+	 *
9209
+	 * @return Array the callsign list
9210
+	 *
9211
+	 */
9212 9212
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9213 9213
 	{
9214 9214
 		global $globalDBdriver;
@@ -9274,11 +9274,11 @@  discard block
 block discarded – undo
9274 9274
 	}
9275 9275
 
9276 9276
 	/**
9277
-	* Gets all callsigns that have flown over
9278
-	*
9279
-	* @return Array the callsign list
9280
-	*
9281
-	*/
9277
+	 * Gets all callsigns that have flown over
9278
+	 *
9279
+	 * @return Array the callsign list
9280
+	 *
9281
+	 */
9282 9282
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9283 9283
 	{
9284 9284
 		global $globalDBdriver;
@@ -9319,11 +9319,11 @@  discard block
 block discarded – undo
9319 9319
 
9320 9320
 
9321 9321
 	/**
9322
-	* Counts all dates
9323
-	*
9324
-	* @return Array the date list
9325
-	*
9326
-	*/
9322
+	 * Counts all dates
9323
+	 *
9324
+	 * @return Array the date list
9325
+	 *
9326
+	 */
9327 9327
 	public function countAllDates($filters = array())
9328 9328
 	{
9329 9329
 		global $globalTimezone, $globalDBdriver;
@@ -9368,11 +9368,11 @@  discard block
 block discarded – undo
9368 9368
 	}
9369 9369
 	
9370 9370
 	/**
9371
-	* Counts all dates
9372
-	*
9373
-	* @return Array the date list
9374
-	*
9375
-	*/
9371
+	 * Counts all dates
9372
+	 *
9373
+	 * @return Array the date list
9374
+	 *
9375
+	 */
9376 9376
 	public function countAllDatesByAirlines($filters = array())
9377 9377
 	{
9378 9378
 		global $globalTimezone, $globalDBdriver;
@@ -9417,11 +9417,11 @@  discard block
 block discarded – undo
9417 9417
 	}	
9418 9418
 	
9419 9419
 	/**
9420
-	* Counts all dates during the last 7 days
9421
-	*
9422
-	* @return Array the date list
9423
-	*
9424
-	*/
9420
+	 * Counts all dates during the last 7 days
9421
+	 *
9422
+	 * @return Array the date list
9423
+	 *
9424
+	 */
9425 9425
 	public function countAllDatesLast7Days($filters = array())
9426 9426
 	{
9427 9427
 		global $globalTimezone, $globalDBdriver;
@@ -9443,7 +9443,7 @@  discard block
 block discarded – undo
9443 9443
 			$query .= " GROUP BY date_name 
9444 9444
 								ORDER BY date_name ASC";
9445 9445
 			$query_data = array(':offset' => $offset);
9446
-    		}
9446
+			}
9447 9447
 		
9448 9448
 		$sth = $this->db->prepare($query);
9449 9449
 		$sth->execute($query_data);
@@ -9463,11 +9463,11 @@  discard block
 block discarded – undo
9463 9463
 	}
9464 9464
 
9465 9465
 	/**
9466
-	* Counts all dates during the last month
9467
-	*
9468
-	* @return Array the date list
9469
-	*
9470
-	*/
9466
+	 * Counts all dates during the last month
9467
+	 *
9468
+	 * @return Array the date list
9469
+	 *
9470
+	 */
9471 9471
 	public function countAllDatesLastMonth($filters = array())
9472 9472
 	{
9473 9473
 		global $globalTimezone, $globalDBdriver;
@@ -9489,7 +9489,7 @@  discard block
 block discarded – undo
9489 9489
 			$query .= " GROUP BY date_name 
9490 9490
 								ORDER BY date_name ASC";
9491 9491
 			$query_data = array(':offset' => $offset);
9492
-    		}
9492
+			}
9493 9493
 		
9494 9494
 		$sth = $this->db->prepare($query);
9495 9495
 		$sth->execute($query_data);
@@ -9510,11 +9510,11 @@  discard block
 block discarded – undo
9510 9510
 
9511 9511
 
9512 9512
 	/**
9513
-	* Counts all dates during the last month
9514
-	*
9515
-	* @return Array the date list
9516
-	*
9517
-	*/
9513
+	 * Counts all dates during the last month
9514
+	 *
9515
+	 * @return Array the date list
9516
+	 *
9517
+	 */
9518 9518
 	public function countAllDatesLastMonthByAirlines($filters = array())
9519 9519
 	{
9520 9520
 		global $globalTimezone, $globalDBdriver;
@@ -9537,7 +9537,7 @@  discard block
 block discarded – undo
9537 9537
 								GROUP BY spotter_output.airline_icao, date_name 
9538 9538
 								ORDER BY date_name ASC";
9539 9539
 			$query_data = array(':offset' => $offset);
9540
-    		}
9540
+			}
9541 9541
 		
9542 9542
 		$sth = $this->db->prepare($query);
9543 9543
 		$sth->execute($query_data);
@@ -9559,11 +9559,11 @@  discard block
 block discarded – undo
9559 9559
 	
9560 9560
 
9561 9561
 	/**
9562
-	* Counts all month
9563
-	*
9564
-	* @return Array the month list
9565
-	*
9566
-	*/
9562
+	 * Counts all month
9563
+	 *
9564
+	 * @return Array the month list
9565
+	 *
9566
+	 */
9567 9567
 	public function countAllMonths($filters = array())
9568 9568
 	{
9569 9569
 		global $globalTimezone, $globalDBdriver;
@@ -9605,11 +9605,11 @@  discard block
 block discarded – undo
9605 9605
 	}
9606 9606
 
9607 9607
 	/**
9608
-	* Counts all month
9609
-	*
9610
-	* @return Array the month list
9611
-	*
9612
-	*/
9608
+	 * Counts all month
9609
+	 *
9610
+	 * @return Array the month list
9611
+	 *
9612
+	 */
9613 9613
 	public function countAllMonthsByAirlines($filters = array())
9614 9614
 	{
9615 9615
 		global $globalTimezone, $globalDBdriver;
@@ -9654,11 +9654,11 @@  discard block
 block discarded – undo
9654 9654
 	}
9655 9655
 
9656 9656
 	/**
9657
-	* Counts all military month
9658
-	*
9659
-	* @return Array the month list
9660
-	*
9661
-	*/
9657
+	 * Counts all military month
9658
+	 *
9659
+	 * @return Array the month list
9660
+	 *
9661
+	 */
9662 9662
 	public function countAllMilitaryMonths($filters = array())
9663 9663
 	{
9664 9664
 		global $globalTimezone, $globalDBdriver;
@@ -9699,11 +9699,11 @@  discard block
 block discarded – undo
9699 9699
 	}
9700 9700
 	
9701 9701
 	/**
9702
-	* Counts all month owners
9703
-	*
9704
-	* @return Array the month list
9705
-	*
9706
-	*/
9702
+	 * Counts all month owners
9703
+	 *
9704
+	 * @return Array the month list
9705
+	 *
9706
+	 */
9707 9707
 	public function countAllMonthsOwners($filters = array())
9708 9708
 	{
9709 9709
 		global $globalTimezone, $globalDBdriver;
@@ -9745,11 +9745,11 @@  discard block
 block discarded – undo
9745 9745
 	}
9746 9746
 	
9747 9747
 	/**
9748
-	* Counts all month owners
9749
-	*
9750
-	* @return Array the month list
9751
-	*
9752
-	*/
9748
+	 * Counts all month owners
9749
+	 *
9750
+	 * @return Array the month list
9751
+	 *
9752
+	 */
9753 9753
 	public function countAllMonthsOwnersByAirlines($filters = array())
9754 9754
 	{
9755 9755
 		global $globalTimezone, $globalDBdriver;
@@ -9792,11 +9792,11 @@  discard block
 block discarded – undo
9792 9792
 	}
9793 9793
 
9794 9794
 	/**
9795
-	* Counts all month pilot
9796
-	*
9797
-	* @return Array the month list
9798
-	*
9799
-	*/
9795
+	 * Counts all month pilot
9796
+	 *
9797
+	 * @return Array the month list
9798
+	 *
9799
+	 */
9800 9800
 	public function countAllMonthsPilots($filters = array())
9801 9801
 	{
9802 9802
 		global $globalTimezone, $globalDBdriver;
@@ -9838,11 +9838,11 @@  discard block
 block discarded – undo
9838 9838
 	}
9839 9839
 	
9840 9840
 	/**
9841
-	* Counts all month pilot
9842
-	*
9843
-	* @return Array the month list
9844
-	*
9845
-	*/
9841
+	 * Counts all month pilot
9842
+	 *
9843
+	 * @return Array the month list
9844
+	 *
9845
+	 */
9846 9846
 	public function countAllMonthsPilotsByAirlines($filters = array())
9847 9847
 	{
9848 9848
 		global $globalTimezone, $globalDBdriver;
@@ -9885,11 +9885,11 @@  discard block
 block discarded – undo
9885 9885
 	}
9886 9886
 
9887 9887
 	/**
9888
-	* Counts all month airline
9889
-	*
9890
-	* @return Array the month list
9891
-	*
9892
-	*/
9888
+	 * Counts all month airline
9889
+	 *
9890
+	 * @return Array the month list
9891
+	 *
9892
+	 */
9893 9893
 	public function countAllMonthsAirlines($filters = array())
9894 9894
 	{
9895 9895
 		global $globalTimezone, $globalDBdriver;
@@ -9931,11 +9931,11 @@  discard block
 block discarded – undo
9931 9931
 	}
9932 9932
 	
9933 9933
 	/**
9934
-	* Counts all month aircraft
9935
-	*
9936
-	* @return Array the month list
9937
-	*
9938
-	*/
9934
+	 * Counts all month aircraft
9935
+	 *
9936
+	 * @return Array the month list
9937
+	 *
9938
+	 */
9939 9939
 	public function countAllMonthsAircrafts($filters = array())
9940 9940
 	{
9941 9941
 		global $globalTimezone, $globalDBdriver;
@@ -9978,11 +9978,11 @@  discard block
 block discarded – undo
9978 9978
 	
9979 9979
 
9980 9980
 	/**
9981
-	* Counts all month aircraft
9982
-	*
9983
-	* @return Array the month list
9984
-	*
9985
-	*/
9981
+	 * Counts all month aircraft
9982
+	 *
9983
+	 * @return Array the month list
9984
+	 *
9985
+	 */
9986 9986
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9987 9987
 	{
9988 9988
 		global $globalTimezone, $globalDBdriver;
@@ -10025,11 +10025,11 @@  discard block
 block discarded – undo
10025 10025
 	}
10026 10026
 
10027 10027
 	/**
10028
-	* Counts all month real arrival
10029
-	*
10030
-	* @return Array the month list
10031
-	*
10032
-	*/
10028
+	 * Counts all month real arrival
10029
+	 *
10030
+	 * @return Array the month list
10031
+	 *
10032
+	 */
10033 10033
 	public function countAllMonthsRealArrivals($filters = array())
10034 10034
 	{
10035 10035
 		global $globalTimezone, $globalDBdriver;
@@ -10072,11 +10072,11 @@  discard block
 block discarded – undo
10072 10072
 	
10073 10073
 
10074 10074
 	/**
10075
-	* Counts all month real arrival
10076
-	*
10077
-	* @return Array the month list
10078
-	*
10079
-	*/
10075
+	 * Counts all month real arrival
10076
+	 *
10077
+	 * @return Array the month list
10078
+	 *
10079
+	 */
10080 10080
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10081 10081
 	{
10082 10082
 		global $globalTimezone, $globalDBdriver;
@@ -10120,11 +10120,11 @@  discard block
 block discarded – undo
10120 10120
 	
10121 10121
 
10122 10122
 	/**
10123
-	* Counts all dates during the last year
10124
-	*
10125
-	* @return Array the date list
10126
-	*
10127
-	*/
10123
+	 * Counts all dates during the last year
10124
+	 *
10125
+	 * @return Array the date list
10126
+	 *
10127
+	 */
10128 10128
 	public function countAllMonthsLastYear($filters)
10129 10129
 	{
10130 10130
 		global $globalTimezone, $globalDBdriver;
@@ -10146,7 +10146,7 @@  discard block
 block discarded – undo
10146 10146
 			$query .= " GROUP BY year_name, month_name
10147 10147
 								ORDER BY year_name, month_name ASC";
10148 10148
 			$query_data = array(':offset' => $offset);
10149
-    		}
10149
+			}
10150 10150
 		
10151 10151
 		$sth = $this->db->prepare($query);
10152 10152
 		$sth->execute($query_data);
@@ -10169,11 +10169,11 @@  discard block
 block discarded – undo
10169 10169
 	
10170 10170
 	
10171 10171
 	/**
10172
-	* Counts all hours
10173
-	*
10174
-	* @return Array the hour list
10175
-	*
10176
-	*/
10172
+	 * Counts all hours
10173
+	 *
10174
+	 * @return Array the hour list
10175
+	 *
10176
+	 */
10177 10177
 	public function countAllHours($orderby,$filters = array())
10178 10178
 	{
10179 10179
 		global $globalTimezone, $globalDBdriver;
@@ -10234,11 +10234,11 @@  discard block
 block discarded – undo
10234 10234
 	}
10235 10235
 	
10236 10236
 	/**
10237
-	* Counts all hours
10238
-	*
10239
-	* @return Array the hour list
10240
-	*
10241
-	*/
10237
+	 * Counts all hours
10238
+	 *
10239
+	 * @return Array the hour list
10240
+	 *
10241
+	 */
10242 10242
 	public function countAllHoursByAirlines($orderby, $filters = array())
10243 10243
 	{
10244 10244
 		global $globalTimezone, $globalDBdriver;
@@ -10301,11 +10301,11 @@  discard block
 block discarded – undo
10301 10301
 
10302 10302
 
10303 10303
 	/**
10304
-	* Counts all hours by airline
10305
-	*
10306
-	* @return Array the hour list
10307
-	*
10308
-	*/
10304
+	 * Counts all hours by airline
10305
+	 *
10306
+	 * @return Array the hour list
10307
+	 *
10308
+	 */
10309 10309
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10310 10310
 	{
10311 10311
 		global $globalTimezone, $globalDBdriver;
@@ -10351,11 +10351,11 @@  discard block
 block discarded – undo
10351 10351
 	
10352 10352
 	
10353 10353
 	/**
10354
-	* Counts all hours by aircraft
10355
-	*
10356
-	* @return Array the hour list
10357
-	*
10358
-	*/
10354
+	 * Counts all hours by aircraft
10355
+	 *
10356
+	 * @return Array the hour list
10357
+	 *
10358
+	 */
10359 10359
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10360 10360
 	{
10361 10361
 		global $globalTimezone, $globalDBdriver;
@@ -10398,11 +10398,11 @@  discard block
 block discarded – undo
10398 10398
 	
10399 10399
 	
10400 10400
 	/**
10401
-	* Counts all hours by aircraft registration
10402
-	*
10403
-	* @return Array the hour list
10404
-	*
10405
-	*/
10401
+	 * Counts all hours by aircraft registration
10402
+	 *
10403
+	 * @return Array the hour list
10404
+	 *
10405
+	 */
10406 10406
 	public function countAllHoursByRegistration($registration, $filters = array())
10407 10407
 	{
10408 10408
 		global $globalTimezone, $globalDBdriver;
@@ -10445,11 +10445,11 @@  discard block
 block discarded – undo
10445 10445
 	
10446 10446
 	
10447 10447
 	/**
10448
-	* Counts all hours by airport
10449
-	*
10450
-	* @return Array the hour list
10451
-	*
10452
-	*/
10448
+	 * Counts all hours by airport
10449
+	 *
10450
+	 * @return Array the hour list
10451
+	 *
10452
+	 */
10453 10453
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10454 10454
 	{
10455 10455
 		global $globalTimezone, $globalDBdriver;
@@ -10493,11 +10493,11 @@  discard block
 block discarded – undo
10493 10493
 	
10494 10494
 	
10495 10495
 	/**
10496
-	* Counts all hours by manufacturer
10497
-	*
10498
-	* @return Array the hour list
10499
-	*
10500
-	*/
10496
+	 * Counts all hours by manufacturer
10497
+	 *
10498
+	 * @return Array the hour list
10499
+	 *
10500
+	 */
10501 10501
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10502 10502
 	{
10503 10503
 		global $globalTimezone, $globalDBdriver;
@@ -10541,11 +10541,11 @@  discard block
 block discarded – undo
10541 10541
 	
10542 10542
 	
10543 10543
 	/**
10544
-	* Counts all hours by date
10545
-	*
10546
-	* @return Array the hour list
10547
-	*
10548
-	*/
10544
+	 * Counts all hours by date
10545
+	 *
10546
+	 * @return Array the hour list
10547
+	 *
10548
+	 */
10549 10549
 	public function countAllHoursByDate($date, $filters = array())
10550 10550
 	{
10551 10551
 		global $globalTimezone, $globalDBdriver;
@@ -10589,11 +10589,11 @@  discard block
 block discarded – undo
10589 10589
 	
10590 10590
 	
10591 10591
 	/**
10592
-	* Counts all hours by a ident/callsign
10593
-	*
10594
-	* @return Array the hour list
10595
-	*
10596
-	*/
10592
+	 * Counts all hours by a ident/callsign
10593
+	 *
10594
+	 * @return Array the hour list
10595
+	 *
10596
+	 */
10597 10597
 	public function countAllHoursByIdent($ident, $filters = array())
10598 10598
 	{
10599 10599
 		global $globalTimezone, $globalDBdriver;
@@ -10636,11 +10636,11 @@  discard block
 block discarded – undo
10636 10636
 	}
10637 10637
 	
10638 10638
 	/**
10639
-	* Counts all hours by a owner
10640
-	*
10641
-	* @return Array the hour list
10642
-	*
10643
-	*/
10639
+	 * Counts all hours by a owner
10640
+	 *
10641
+	 * @return Array the hour list
10642
+	 *
10643
+	 */
10644 10644
 	public function countAllHoursByOwner($owner, $filters = array())
10645 10645
 	{
10646 10646
 		global $globalTimezone, $globalDBdriver;
@@ -10683,11 +10683,11 @@  discard block
 block discarded – undo
10683 10683
 	}
10684 10684
 	
10685 10685
 	/**
10686
-	* Counts all hours by a pilot
10687
-	*
10688
-	* @return Array the hour list
10689
-	*
10690
-	*/
10686
+	 * Counts all hours by a pilot
10687
+	 *
10688
+	 * @return Array the hour list
10689
+	 *
10690
+	 */
10691 10691
 	public function countAllHoursByPilot($pilot, $filters = array())
10692 10692
 	{
10693 10693
 		global $globalTimezone, $globalDBdriver;
@@ -10732,11 +10732,11 @@  discard block
 block discarded – undo
10732 10732
 	
10733 10733
 	
10734 10734
 	/**
10735
-	* Counts all hours by route
10736
-	*
10737
-	* @return Array the hour list
10738
-	*
10739
-	*/
10735
+	 * Counts all hours by route
10736
+	 *
10737
+	 * @return Array the hour list
10738
+	 *
10739
+	 */
10740 10740
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10741 10741
 	{
10742 10742
 		global $globalTimezone, $globalDBdriver;
@@ -10780,11 +10780,11 @@  discard block
 block discarded – undo
10780 10780
 	
10781 10781
 	
10782 10782
 	/**
10783
-	* Counts all hours by country
10784
-	*
10785
-	* @return Array the hour list
10786
-	*
10787
-	*/
10783
+	 * Counts all hours by country
10784
+	 *
10785
+	 * @return Array the hour list
10786
+	 *
10787
+	 */
10788 10788
 	public function countAllHoursByCountry($country, $filters = array())
10789 10789
 	{
10790 10790
 		global $globalTimezone, $globalDBdriver;
@@ -10829,11 +10829,11 @@  discard block
 block discarded – undo
10829 10829
 
10830 10830
 
10831 10831
 	/**
10832
-	* Counts all aircraft that have flown over
10833
-	*
10834
-	* @return Integer the number of aircrafts
10835
-	*
10836
-	*/
10832
+	 * Counts all aircraft that have flown over
10833
+	 *
10834
+	 * @return Integer the number of aircrafts
10835
+	 *
10836
+	 */
10837 10837
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10838 10838
 	{
10839 10839
 		global $globalDBdriver;
@@ -10866,11 +10866,11 @@  discard block
 block discarded – undo
10866 10866
 	}
10867 10867
 
10868 10868
 	/**
10869
-	* Counts all flight that really arrival
10870
-	*
10871
-	* @return Integer the number of aircrafts
10872
-	*
10873
-	*/
10869
+	 * Counts all flight that really arrival
10870
+	 *
10871
+	 * @return Integer the number of aircrafts
10872
+	 *
10873
+	 */
10874 10874
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
@@ -10903,11 +10903,11 @@  discard block
 block discarded – undo
10903 10903
 	}
10904 10904
 
10905 10905
 	/**
10906
-	* Counts all pilots that have flown over
10907
-	*
10908
-	* @return Integer the number of pilots
10909
-	*
10910
-	*/
10906
+	 * Counts all pilots that have flown over
10907
+	 *
10908
+	 * @return Integer the number of pilots
10909
+	 *
10910
+	 */
10911 10911
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
@@ -10939,11 +10939,11 @@  discard block
 block discarded – undo
10939 10939
 	}
10940 10940
 
10941 10941
 	/**
10942
-	* Counts all owners that have flown over
10943
-	*
10944
-	* @return Integer the number of owners
10945
-	*
10946
-	*/
10942
+	 * Counts all owners that have flown over
10943
+	 *
10944
+	 * @return Integer the number of owners
10945
+	 *
10946
+	 */
10947 10947
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10948 10948
 	{
10949 10949
 		global $globalDBdriver;
@@ -10976,11 +10976,11 @@  discard block
 block discarded – undo
10976 10976
 	
10977 10977
 	
10978 10978
 	/**
10979
-	* Counts all flights that have flown over
10980
-	*
10981
-	* @return Integer the number of flights
10982
-	*
10983
-	*/
10979
+	 * Counts all flights that have flown over
10980
+	 *
10981
+	 * @return Integer the number of flights
10982
+	 *
10983
+	 */
10984 10984
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
@@ -11014,11 +11014,11 @@  discard block
 block discarded – undo
11014 11014
 	}
11015 11015
 	
11016 11016
 	/**
11017
-	* Counts all military flights that have flown over
11018
-	*
11019
-	* @return Integer the number of flights
11020
-	*
11021
-	*/
11017
+	 * Counts all military flights that have flown over
11018
+	 *
11019
+	 * @return Integer the number of flights
11020
+	 *
11021
+	 */
11022 11022
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11023 11023
 	{
11024 11024
 		global $globalDBdriver;
@@ -11053,11 +11053,11 @@  discard block
 block discarded – undo
11053 11053
 	
11054 11054
 	
11055 11055
 	/**
11056
-	* Counts all airlines that have flown over
11057
-	*
11058
-	* @return Integer the number of airlines
11059
-	*
11060
-	*/
11056
+	 * Counts all airlines that have flown over
11057
+	 *
11058
+	 * @return Integer the number of airlines
11059
+	 *
11060
+	 */
11061 11061
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11062 11062
 	{
11063 11063
 		global $globalDBdriver;
@@ -11084,8 +11084,8 @@  discard block
 block discarded – undo
11084 11084
 				$query_values = array_merge($query_values,array(':month' => $month));
11085 11085
 			}
11086 11086
 		}
11087
-                if ($query == '') $queryi .= $this->getFilter($filters);
11088
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11087
+				if ($query == '') $queryi .= $this->getFilter($filters);
11088
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11089 11089
 
11090 11090
 
11091 11091
 		$sth = $this->db->prepare($queryi);
@@ -11095,11 +11095,11 @@  discard block
 block discarded – undo
11095 11095
 
11096 11096
   
11097 11097
 	/**
11098
-	* Counts all hours of today
11099
-	*
11100
-	* @return Array the hour list
11101
-	*
11102
-	*/
11098
+	 * Counts all hours of today
11099
+	 *
11100
+	 * @return Array the hour list
11101
+	 *
11102
+	 */
11103 11103
 	public function countAllHoursFromToday($filters = array())
11104 11104
 	{
11105 11105
 		global $globalTimezone, $globalDBdriver;
@@ -11139,11 +11139,11 @@  discard block
 block discarded – undo
11139 11139
 	}
11140 11140
     
11141 11141
 	/**
11142
-	* Gets all the spotter information based on calculated upcoming flights
11143
-	*
11144
-	* @return Array the spotter information
11145
-	*
11146
-	*/
11142
+	 * Gets all the spotter information based on calculated upcoming flights
11143
+	 *
11144
+	 * @return Array the spotter information
11145
+	 *
11146
+	 */
11147 11147
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11148 11148
 	{
11149 11149
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11218,12 +11218,12 @@  discard block
 block discarded – undo
11218 11218
 	}
11219 11219
     
11220 11220
     
11221
-     /**
11222
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11223
-	*
11224
-	* @return Integer the Barrie Spotter ID
11221
+	 /**
11222
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11223
+	  *
11224
+	  * @return Integer the Barrie Spotter ID
11225 11225
 q	*
11226
-	*/
11226
+	  */
11227 11227
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11228 11228
 	{
11229 11229
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11244,13 +11244,13 @@  discard block
 block discarded – undo
11244 11244
   
11245 11245
  
11246 11246
 	/**
11247
-	* Parses a date string
11248
-	*
11249
-	* @param String $dateString the date string
11250
-	* @param String $timezone the timezone of a user
11251
-	* @return Array the time information
11252
-	*
11253
-	*/
11247
+	 * Parses a date string
11248
+	 *
11249
+	 * @param String $dateString the date string
11250
+	 * @param String $timezone the timezone of a user
11251
+	 * @return Array the time information
11252
+	 *
11253
+	 */
11254 11254
 	public function parseDateString($dateString, $timezone = '')
11255 11255
 	{
11256 11256
 		$time_array = array();
@@ -11286,12 +11286,12 @@  discard block
 block discarded – undo
11286 11286
 	
11287 11287
 	
11288 11288
 	/**
11289
-	* Parses the direction degrees to working
11290
-	*
11291
-	* @param Float $direction the direction in degrees
11292
-	* @return Array the direction information
11293
-	*
11294
-	*/
11289
+	 * Parses the direction degrees to working
11290
+	 *
11291
+	 * @param Float $direction the direction in degrees
11292
+	 * @return Array the direction information
11293
+	 *
11294
+	 */
11295 11295
 	public function parseDirection($direction = 0)
11296 11296
 	{
11297 11297
 		if ($direction == '') $direction = 0;
@@ -11370,12 +11370,12 @@  discard block
 block discarded – undo
11370 11370
 	
11371 11371
 	
11372 11372
 	/**
11373
-	* Gets the aircraft registration
11374
-	*
11375
-	* @param String $flightaware_id the flight aware id
11376
-	* @return String the aircraft registration
11377
-	*
11378
-	*/
11373
+	 * Gets the aircraft registration
11374
+	 *
11375
+	 * @param String $flightaware_id the flight aware id
11376
+	 * @return String the aircraft registration
11377
+	 *
11378
+	 */
11379 11379
 	
11380 11380
 	public function getAircraftRegistration($flightaware_id)
11381 11381
 	{
@@ -11404,12 +11404,12 @@  discard block
 block discarded – undo
11404 11404
 
11405 11405
 
11406 11406
 	/**
11407
-	* Gets the aircraft registration from ModeS
11408
-	*
11409
-	* @param String $aircraft_modes the flight ModeS in hex
11410
-	* @return String the aircraft registration
11411
-	*
11412
-	*/
11407
+	 * Gets the aircraft registration from ModeS
11408
+	 *
11409
+	 * @param String $aircraft_modes the flight ModeS in hex
11410
+	 * @return String the aircraft registration
11411
+	 *
11412
+	 */
11413 11413
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11414 11414
 	{
11415 11415
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11422,19 +11422,19 @@  discard block
 block discarded – undo
11422 11422
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11423 11423
 		$sth->closeCursor();
11424 11424
 		if (count($row) > 0) {
11425
-		    //return $row['Registration'];
11426
-		    return $row['registration'];
11425
+			//return $row['Registration'];
11426
+			return $row['registration'];
11427 11427
 		} else return '';
11428 11428
 	
11429 11429
 	}
11430 11430
 
11431 11431
 	/**
11432
-	* Gets the aircraft type from ModeS
11433
-	*
11434
-	* @param String $aircraft_modes the flight ModeS in hex
11435
-	* @return String the aircraft type
11436
-	*
11437
-	*/
11432
+	 * Gets the aircraft type from ModeS
11433
+	 *
11434
+	 * @param String $aircraft_modes the flight ModeS in hex
11435
+	 * @return String the aircraft type
11436
+	 *
11437
+	 */
11438 11438
 	public function getAircraftTypeBymodeS($aircraft_modes)
11439 11439
 	{
11440 11440
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11447,19 +11447,19 @@  discard block
 block discarded – undo
11447 11447
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11448 11448
 		$sth->closeCursor();
11449 11449
 		if (count($row) > 0) {
11450
-		    if ($row['type_flight'] == null) return '';
11451
-		    else return $row['type_flight'];
11450
+			if ($row['type_flight'] == null) return '';
11451
+			else return $row['type_flight'];
11452 11452
 		} else return '';
11453 11453
 	
11454 11454
 	}
11455 11455
 
11456 11456
 	/**
11457
-	* Gets Country from latitude/longitude
11458
-	*
11459
-	* @param Float $latitude latitute of the flight
11460
-	* @param Float $longitude longitute of the flight
11461
-	* @return String the countrie
11462
-	*/
11457
+	 * Gets Country from latitude/longitude
11458
+	 *
11459
+	 * @param Float $latitude latitute of the flight
11460
+	 * @param Float $longitude longitute of the flight
11461
+	 * @return String the countrie
11462
+	 */
11463 11463
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11464 11464
 	{
11465 11465
 		global $globalDBdriver, $globalDebug;
@@ -11496,11 +11496,11 @@  discard block
 block discarded – undo
11496 11496
 	}
11497 11497
 
11498 11498
 	/**
11499
-	* Gets Country from iso2
11500
-	*
11501
-	* @param String $iso2 ISO2 country code
11502
-	* @return String the countrie
11503
-	*/
11499
+	 * Gets Country from iso2
11500
+	 *
11501
+	 * @param String $iso2 ISO2 country code
11502
+	 * @return String the countrie
11503
+	 */
11504 11504
 	public function getCountryFromISO2($iso2)
11505 11505
 	{
11506 11506
 		global $globalDBdriver, $globalDebug;
@@ -11528,12 +11528,12 @@  discard block
 block discarded – undo
11528 11528
 	}
11529 11529
 
11530 11530
 	/**
11531
-	* converts the registration code using the country prefix
11532
-	*
11533
-	* @param String $registration the aircraft registration
11534
-	* @return String the aircraft registration
11535
-	*
11536
-	*/
11531
+	 * converts the registration code using the country prefix
11532
+	 *
11533
+	 * @param String $registration the aircraft registration
11534
+	 * @return String the aircraft registration
11535
+	 *
11536
+	 */
11537 11537
 	public function convertAircraftRegistration($registration)
11538 11538
 	{
11539 11539
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11585,12 +11585,12 @@  discard block
 block discarded – undo
11585 11585
 	}
11586 11586
 
11587 11587
 	/**
11588
-	* Country from the registration code
11589
-	*
11590
-	* @param String $registration the aircraft registration
11591
-	* @return String the country
11592
-	*
11593
-	*/
11588
+	 * Country from the registration code
11589
+	 *
11590
+	 * @param String $registration the aircraft registration
11591
+	 * @return String the country
11592
+	 *
11593
+	 */
11594 11594
 	public function countryFromAircraftRegistration($registration)
11595 11595
 	{
11596 11596
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11609,8 +11609,8 @@  discard block
 block discarded – undo
11609 11609
 				$country = $row['country'];
11610 11610
 			}
11611 11611
 		} else {
11612
-    			$registration_1 = substr($registration, 0, 1);
11613
-		        $registration_2 = substr($registration, 0, 2);
11612
+				$registration_1 = substr($registration, 0, 1);
11613
+				$registration_2 = substr($registration, 0, 2);
11614 11614
 
11615 11615
 			$country = '';
11616 11616
 			//first get the prefix based on two characters
@@ -11646,12 +11646,12 @@  discard block
 block discarded – undo
11646 11646
 	}
11647 11647
 
11648 11648
 	/**
11649
-	* Registration prefix from the registration code
11650
-	*
11651
-	* @param String $registration the aircraft registration
11652
-	* @return String the registration prefix
11653
-	*
11654
-	*/
11649
+	 * Registration prefix from the registration code
11650
+	 *
11651
+	 * @param String $registration the aircraft registration
11652
+	 * @return String the registration prefix
11653
+	 *
11654
+	 */
11655 11655
 	public function registrationPrefixFromAircraftRegistration($registration)
11656 11656
 	{
11657 11657
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11670,8 +11670,8 @@  discard block
 block discarded – undo
11670 11670
 				//$country = $row['country'];
11671 11671
 			}
11672 11672
 		} else {
11673
-    			$registration_1 = substr($registration, 0, 1);
11674
-		        $registration_2 = substr($registration, 0, 2);
11673
+				$registration_1 = substr($registration, 0, 1);
11674
+				$registration_2 = substr($registration, 0, 2);
11675 11675
 
11676 11676
 			//first get the prefix based on two characters
11677 11677
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11707,12 +11707,12 @@  discard block
 block discarded – undo
11707 11707
 
11708 11708
 
11709 11709
 	/**
11710
-	* Country from the registration code
11711
-	*
11712
-	* @param String $registration the aircraft registration
11713
-	* @return String the country
11714
-	*
11715
-	*/
11710
+	 * Country from the registration code
11711
+	 *
11712
+	 * @param String $registration the aircraft registration
11713
+	 * @return String the country
11714
+	 *
11715
+	 */
11716 11716
 	public function countryFromAircraftRegistrationCode($registration)
11717 11717
 	{
11718 11718
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11729,11 +11729,11 @@  discard block
 block discarded – undo
11729 11729
 	}
11730 11730
 	
11731 11731
 	/**
11732
-	* Set a new highlight value for a flight
11733
-	*
11734
-	* @param String $flightaware_id flightaware_id from spotter_output table
11735
-	* @param String $highlight New highlight value
11736
-	*/
11732
+	 * Set a new highlight value for a flight
11733
+	 *
11734
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11735
+	 * @param String $highlight New highlight value
11736
+	 */
11737 11737
 	public function setHighlightFlight($flightaware_id,$highlight) {
11738 11738
 		
11739 11739
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11742,12 +11742,12 @@  discard block
 block discarded – undo
11742 11742
 	}
11743 11743
 
11744 11744
 	/**
11745
-	* Set a new highlight value for a flight by Registration
11746
-	*
11747
-	* @param String $registration Registration of the aircraft
11748
-	* @param String $date Date of spotted aircraft
11749
-	* @param String $highlight New highlight value
11750
-	*/
11745
+	 * Set a new highlight value for a flight by Registration
11746
+	 *
11747
+	 * @param String $registration Registration of the aircraft
11748
+	 * @param String $date Date of spotted aircraft
11749
+	 * @param String $highlight New highlight value
11750
+	 */
11751 11751
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11752 11752
 		if ($date == '') {
11753 11753
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11761,12 +11761,12 @@  discard block
 block discarded – undo
11761 11761
 	}
11762 11762
 	
11763 11763
 	/**
11764
-	* Gets the short url from bit.ly
11765
-	*
11766
-	* @param String $url the full url
11767
-	* @return String the bit.ly url
11768
-	*
11769
-	*/
11764
+	 * Gets the short url from bit.ly
11765
+	 *
11766
+	 * @param String $url the full url
11767
+	 * @return String the bit.ly url
11768
+	 *
11769
+	 */
11770 11770
 	public function getBitlyURL($url)
11771 11771
 	{
11772 11772
 		global $globalBitlyAccessToken;
@@ -12055,11 +12055,11 @@  discard block
 block discarded – undo
12055 12055
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12056 12056
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12057 12057
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12058
-                } else {
12058
+				} else {
12059 12059
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12060 12060
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12061 12061
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12062
-    		}
12062
+			}
12063 12063
 		$sth = $this->db->prepare($query);
12064 12064
 		$sth->execute();
12065 12065
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1343 added lines, -1343 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,45 +59,45 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
100
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
110
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if (isset($filter['year']) && $filter['year'] != '') {
122 122
 			if ($globalDBdriver == 'mysql') {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
143 143
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
144 144
 		if ($filter_query_where != '') {
145
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
145
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
146 146
 		}
147 147
 		$filter_query = $filter_query_join.$filter_query_where;
148 148
 		return $filter_query;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	* @return Array the spotter information
158 158
 	*
159 159
 	*/
160
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
160
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
161 161
 	{
162 162
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
163 163
 		$Image = new Image($this->db);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			$sth = $this->db->prepare($query.$limitQuery);
188 188
 			$sth->execute($params);
189 189
 		} catch (PDOException $e) {
190
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
190
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
191 191
 			exit();
192 192
 		}
193 193
 		
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$spotter_array = array();
198 198
 		
199 199
 
200
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
200
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
201 201
 		{
202 202
 			$num_rows++;
203 203
 			$temp_array = array();
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
242 242
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
243 243
 				$temp_array['route_stop'] = $row['route_stop'];
244
-				$allroute = explode(' ',$row['route_stop']);
244
+				$allroute = explode(' ', $row['route_stop']);
245 245
 				foreach ($allroute as $route) {
246 246
 					$route_airport_array = $this->getAllAirportInfo($route);
247 247
 					if (isset($route_airport_array[0]['name'])) {
@@ -294,16 +294,16 @@  discard block
 block discarded – undo
294 294
 				{
295 295
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
296 296
 				} else {
297
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
297
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
298 298
 				}
299 299
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
300
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
301
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
300
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
301
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
302 302
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
303 303
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
304 304
 					$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
305
-					$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
306
-					$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
305
+					$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
306
+					$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
307 307
 					$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
308 308
 				}
309 309
 			}
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
339 339
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
340 340
 					if (is_numeric(substr($row['ident'], 2, 1))) {
341
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
341
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
342 342
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
343
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
343
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
344 344
 					} else {
345 345
 						$airline_array = $this->getAllAirlineInfo('NA');
346 346
 					}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 				}
378 378
 			}
379 379
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
380
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
380
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
381 381
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
382 382
 				if (count($acars_array) > 0) {
383 383
 					$temp_array['acars'] = $acars_array;
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
395 395
 			}
396 396
 
397
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
397
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
398 398
 			{
399 399
 				if ($globalIVAO) {
400
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
401
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
400
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
401
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
402 402
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
403 403
 				if (count($image_array) > 0) {
404 404
 					$temp_array['image'] = $image_array[0]['image'];
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
423 423
 			}
424 424
 			
425
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
425
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
426 426
 				if ($schedules === true) {
427 427
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
428 428
 					//print_r($schedule_array);
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 			if (isset($row['squawk'])) {
505 505
 				$temp_array['squawk'] = $row['squawk'];
506 506
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
507
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
508
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
507
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
508
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
509 509
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
510
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
511
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
510
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
511
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
512
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
513 513
 			}
514 514
     			
515 515
 			$temp_array['query_number_rows'] = $num_rows;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	* @return Array the spotter information
529 529
 	*
530 530
 	*/
531
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
531
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
532 532
 	{
533 533
 		global $globalTimezone, $globalDBdriver;
534 534
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 		$query_values = array();
540 540
 		$additional_query = '';
541
-		$filter_query = $this->getFilter($filters,true,true);
541
+		$filter_query = $this->getFilter($filters, true, true);
542 542
 		if ($q != "")
543 543
 		{
544 544
 			if (!is_string($q))
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 				return false;
547 547
 			} else {
548 548
 				$q_array = explode(" ", $q);
549
-				foreach ($q_array as $q_item){
550
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
549
+				foreach ($q_array as $q_item) {
550
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
551 551
 					$additional_query .= " AND (";
552 552
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
553 553
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -579,37 +579,37 @@  discard block
 block discarded – undo
579 579
 
580 580
 		if ($registration != "")
581 581
 		{
582
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
582
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
583 583
 			if (!is_string($registration))
584 584
 			{
585 585
 				return false;
586 586
 			} else {
587 587
 				$additional_query .= " AND spotter_output.registration = :registration";
588
-				$query_values = array_merge($query_values,array(':registration' => $registration));
588
+				$query_values = array_merge($query_values, array(':registration' => $registration));
589 589
 			}
590 590
 		}
591 591
 
592 592
 		if ($aircraft_icao != "")
593 593
 		{
594
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
594
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
595 595
 			if (!is_string($aircraft_icao))
596 596
 			{
597 597
 				return false;
598 598
 			} else {
599 599
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
600
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
600
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
601 601
 			}
602 602
 		}
603 603
 
604 604
 		if ($aircraft_manufacturer != "")
605 605
 		{
606
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
606
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
607 607
 			if (!is_string($aircraft_manufacturer))
608 608
 			{
609 609
 				return false;
610 610
 			} else {
611 611
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
612
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
612
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
613 613
 			}
614 614
 		}
615 615
 
@@ -625,25 +625,25 @@  discard block
 block discarded – undo
625 625
 
626 626
 		if ($airline_icao != "")
627 627
 		{
628
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
628
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
629 629
 			if (!is_string($airline_icao))
630 630
 			{
631 631
 				return false;
632 632
 			} else {
633 633
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
634
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
634
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
635 635
 			}
636 636
 		}
637 637
 
638 638
 		if ($airline_country != "")
639 639
 		{
640
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
640
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
641 641
 			if (!is_string($airline_country))
642 642
 			{
643 643
 				return false;
644 644
 			} else {
645 645
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
646
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
646
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
647 647
 			}
648 648
 		}
649 649
 
@@ -670,31 +670,31 @@  discard block
 block discarded – undo
670 670
 
671 671
 		if ($airport != "")
672 672
 		{
673
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
673
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
674 674
 			if (!is_string($airport))
675 675
 			{
676 676
 				return false;
677 677
 			} else {
678 678
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
679
-				$query_values = array_merge($query_values,array(':airport' => $airport));
679
+				$query_values = array_merge($query_values, array(':airport' => $airport));
680 680
 			}
681 681
 		}
682 682
 
683 683
 		if ($airport_country != "")
684 684
 		{
685
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
685
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
686 686
 			if (!is_string($airport_country))
687 687
 			{
688 688
 				return false;
689 689
 			} else {
690 690
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
691
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
691
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
692 692
 			}
693 693
 		}
694 694
     
695 695
 		if ($callsign != "")
696 696
 		{
697
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
697
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
698 698
 			if (!is_string($callsign))
699 699
 			{
700 700
 				return false;
@@ -702,79 +702,79 @@  discard block
 block discarded – undo
702 702
 				$translate = $Translation->ident2icao($callsign);
703 703
 				if ($translate != $callsign) {
704 704
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
705
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
705
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
706 706
 				} else {
707 707
 					$additional_query .= " AND spotter_output.ident = :callsign";
708
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
708
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
709 709
 				}
710 710
 			}
711 711
 		}
712 712
 
713 713
 		if ($owner != "")
714 714
 		{
715
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
715
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
716 716
 			if (!is_string($owner))
717 717
 			{
718 718
 				return false;
719 719
 			} else {
720 720
 				$additional_query .= " AND spotter_output.owner_name = :owner";
721
-				$query_values = array_merge($query_values,array(':owner' => $owner));
721
+				$query_values = array_merge($query_values, array(':owner' => $owner));
722 722
 			}
723 723
 		}
724 724
 
725 725
 		if ($pilot_name != "")
726 726
 		{
727
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
727
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
728 728
 			if (!is_string($pilot_name))
729 729
 			{
730 730
 				return false;
731 731
 			} else {
732 732
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
733
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
733
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
734 734
 			}
735 735
 		}
736 736
 
737 737
 		if ($pilot_id != "")
738 738
 		{
739
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
739
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
740 740
 			if (!is_string($pilot_id))
741 741
 			{
742 742
 				return false;
743 743
 			} else {
744 744
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
745
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
745
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
746 746
 			}
747 747
 		}
748 748
 
749 749
 		if ($departure_airport_route != "")
750 750
 		{
751
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
751
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
752 752
 			if (!is_string($departure_airport_route))
753 753
 			{
754 754
 				return false;
755 755
 			} else {
756 756
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
757
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
757
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
758 758
 			}
759 759
 		}
760 760
 
761 761
 		if ($arrival_airport_route != "")
762 762
 		{
763
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
763
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
764 764
 			if (!is_string($arrival_airport_route))
765 765
 			{
766 766
 				return false;
767 767
 			} else {
768 768
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
769
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
769
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
770 770
 			}
771 771
 		}
772 772
 
773 773
 		if ($altitude != "")
774 774
 		{
775 775
 			$altitude_array = explode(",", $altitude);
776
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
777
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
776
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
777
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
778 778
 
779 779
 			if ($altitude_array[1] != "")
780 780
 			{                
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 		if ($date_posted != "")
791 791
 		{
792 792
 			$date_array = explode(",", $date_posted);
793
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
794
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
793
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
794
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
795 795
 
796 796
 			if ($globalTimezone != '') {
797 797
 				date_default_timezone_set($globalTimezone);
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 		{
823 823
 			$limit_array = explode(",", $limit);
824 824
 			
825
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
826
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
825
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
826
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
827 827
 			
828 828
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
829 829
 			{
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 
853 853
 
854 854
 		if ($origLat != "" && $origLon != "" && $dist != "") {
855
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
855
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
856 856
 
857 857
 			if ($globalDBdriver == 'mysql') {
858
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
858
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
859 859
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
860 860
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
861 861
 			} else {
862
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
862
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
863 863
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
864 864
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
865 865
 			}
866 866
 		} else {		
867
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
867
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
868 868
 					".$additional_query."
869 869
 					".$orderby_query;
870 870
 		}
871
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
871
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
872 872
 		return $spotter_array;
873 873
 	}
874 874
 	
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
 		{
892 892
 			$limit_array = explode(",", $limit);
893 893
 			
894
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
895
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
894
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
895
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
896 896
 			
897 897
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
898 898
 			{
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 			$orderby_query = " ORDER BY spotter_output.date DESC";
910 910
 		}
911 911
 
912
-		$query  = $global_query.$filter_query." ".$orderby_query;
912
+		$query = $global_query.$filter_query." ".$orderby_query;
913 913
 
914
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
914
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
915 915
 
916 916
 		return $spotter_array;
917 917
 	}
@@ -957,34 +957,34 @@  discard block
 block discarded – undo
957 957
 			{
958 958
 				return false;
959 959
 			} else {
960
-				if ($interval == "30m"){
960
+				if ($interval == "30m") {
961 961
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
962
-				} else if ($interval == "1h"){
962
+				} else if ($interval == "1h") {
963 963
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
964
-				} else if ($interval == "3h"){
964
+				} else if ($interval == "3h") {
965 965
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
966
-				} else if ($interval == "6h"){
966
+				} else if ($interval == "6h") {
967 967
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
968
-				} else if ($interval == "12h"){
968
+				} else if ($interval == "12h") {
969 969
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
970
-				} else if ($interval == "24h"){
970
+				} else if ($interval == "24h") {
971 971
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
972
-				} else if ($interval == "7d"){
972
+				} else if ($interval == "7d") {
973 973
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
974
-				} else if ($interval == "30d"){
974
+				} else if ($interval == "30d") {
975 975
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
976 976
 				} 
977 977
 			}
978 978
 		}
979 979
 
980
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
980
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
981 981
                    WHERE spotter_output.latitude <> '' 
982 982
 				   AND spotter_output.longitude <> '' 
983 983
                    ".$additional_query."
984 984
                    HAVING distance < :radius  
985 985
 				   ORDER BY distance";
986 986
 
987
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
987
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
988 988
 
989 989
 		return $spotter_array;
990 990
 	}
@@ -996,21 +996,21 @@  discard block
 block discarded – undo
996 996
 	* @return Array the spotter information
997 997
 	*
998 998
 	*/
999
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
999
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1000 1000
 	{
1001 1001
 		global $global_query;
1002 1002
 		
1003 1003
 		date_default_timezone_set('UTC');
1004 1004
 
1005
-		$filter_query = $this->getFilter($filter,true,true);
1005
+		$filter_query = $this->getFilter($filter, true, true);
1006 1006
 
1007 1007
 		$limit_query = '';
1008 1008
 		if ($limit != "")
1009 1009
 		{
1010 1010
 			$limit_array = explode(",", $limit);
1011 1011
 			
1012
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1013
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1012
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1013
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1014 1014
 			
1015 1015
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1016 1016
 			{
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1028 1028
 		}
1029 1029
 
1030
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1030
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1031 1031
 
1032 1032
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1033 1033
 
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
 		global $global_query;
1047 1047
 		
1048 1048
 		date_default_timezone_set('UTC');
1049
-		$filter_query = $this->getFilter($filter,true,true);
1049
+		$filter_query = $this->getFilter($filter, true, true);
1050 1050
 
1051 1051
 		$limit_query = '';
1052 1052
 		if ($limit != "")
1053 1053
 		{
1054 1054
 			$limit_array = explode(",", $limit);
1055 1055
 			
1056
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1057
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1056
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1057
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1058 1058
 			
1059 1059
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1060 1060
 			{
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1072 1072
 		}
1073 1073
 
1074
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1074
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1075 1075
 
1076 1076
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1077 1077
 
@@ -1085,20 +1085,20 @@  discard block
 block discarded – undo
1085 1085
 	* @return Array the spotter information
1086 1086
 	*
1087 1087
 	*/
1088
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1088
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1089 1089
 	{
1090 1090
 		global $global_query;
1091 1091
 		
1092 1092
 		date_default_timezone_set('UTC');
1093
-		$filter_query = $this->getFilter($filter,true,true);
1093
+		$filter_query = $this->getFilter($filter, true, true);
1094 1094
 		
1095 1095
 		$limit_query = '';
1096 1096
 		if ($limit != "")
1097 1097
 		{
1098 1098
 			$limit_array = explode(",", $limit);
1099 1099
 			
1100
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1101
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1100
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1101
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1102 1102
 			
1103 1103
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1104 1104
 			{
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1116 1116
 		}
1117 1117
 
1118
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1118
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1119 1119
 
1120 1120
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1121 1121
 
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 		
1136 1136
 		date_default_timezone_set('UTC');
1137 1137
 		
1138
-		$filter_query = $this->getFilter($filter,true,true);
1138
+		$filter_query = $this->getFilter($filter, true, true);
1139 1139
 		
1140 1140
 		$limit_query = '';
1141 1141
 		
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		{
1144 1144
 			$limit_array = explode(",", $limit);
1145 1145
 			
1146
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1147
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1146
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1147
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1148 1148
 			
1149 1149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1150 1150
 			{
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1162 1162
 		}
1163 1163
 
1164
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1164
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1165 1165
 
1166 1166
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1167 1167
 
@@ -1180,14 +1180,14 @@  discard block
 block discarded – undo
1180 1180
 		global $global_query;
1181 1181
 		
1182 1182
 		date_default_timezone_set('UTC');
1183
-		$filter_query = $this->getFilter($filter,true,true);
1183
+		$filter_query = $this->getFilter($filter, true, true);
1184 1184
 		$limit_query = '';
1185 1185
 		if ($limit != "")
1186 1186
 		{
1187 1187
 			$limit_array = explode(",", $limit);
1188 1188
 			
1189
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1190
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1189
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1190
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1191 1191
 			
1192 1192
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1193 1193
 			{
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1205 1205
 		}
1206 1206
 
1207
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1207
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1208 1208
 
1209 1209
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1210 1210
 
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
 		$query_values = array(':id' => $id);
1229 1229
 
1230 1230
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1231
-		$query  = $global_query." WHERE ".$additional_query." ";
1231
+		$query = $global_query." WHERE ".$additional_query." ";
1232 1232
 
1233
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1233
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1234 1234
 
1235 1235
 		return $spotter_array;
1236 1236
 	}
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		$query_values = array();
1254 1254
 		$limit_query = '';
1255 1255
 		$additional_query = '';
1256
-		$filter_query = $this->getFilter($filter,true,true);
1256
+		$filter_query = $this->getFilter($filter, true, true);
1257 1257
 		if ($ident != "")
1258 1258
 		{
1259 1259
 			if (!is_string($ident))
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
 		{
1270 1270
 			$limit_array = explode(",", $limit);
1271 1271
 			
1272
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1273
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1272
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1273
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1274 1274
 			
1275 1275
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1276 1276
 			{
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 		$query_values = array();
1310 1310
 		$limit_query = '';
1311 1311
 		$additional_query = '';
1312
-		$filter_query = $this->getFilter($filter,true,true);
1312
+		$filter_query = $this->getFilter($filter, true, true);
1313 1313
 		if ($owner != "")
1314 1314
 		{
1315 1315
 			if (!is_string($owner))
@@ -1325,8 +1325,8 @@  discard block
 block discarded – undo
1325 1325
 		{
1326 1326
 			$limit_array = explode(",", $limit);
1327 1327
 			
1328
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1329
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1328
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1329
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1330 1330
 			
1331 1331
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1332 1332
 			{
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 		$query_values = array();
1367 1367
 		$limit_query = '';
1368 1368
 		$additional_query = '';
1369
-		$filter_query = $this->getFilter($filter,true,true);
1369
+		$filter_query = $this->getFilter($filter, true, true);
1370 1370
 		if ($pilot != "")
1371 1371
 		{
1372 1372
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 		{
1378 1378
 			$limit_array = explode(",", $limit);
1379 1379
 			
1380
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1381
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1380
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1381
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1382 1382
 			
1383 1383
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1384 1384
 			{
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		$query_values = array();
1420 1420
 		$limit_query = '';
1421 1421
 		$additional_query = '';
1422
-		$filter_query = $this->getFilter($filter,true,true);
1422
+		$filter_query = $this->getFilter($filter, true, true);
1423 1423
 		
1424 1424
 		if ($aircraft_type != "")
1425 1425
 		{
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
 		{
1437 1437
 			$limit_array = explode(",", $limit);
1438 1438
 			
1439
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1440
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1439
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1440
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1441 1441
 			
1442 1442
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1443 1443
 			{
@@ -1493,8 +1493,8 @@  discard block
 block discarded – undo
1493 1493
 		{
1494 1494
 			$limit_array = explode(",", $limit);
1495 1495
 			
1496
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1497
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1496
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1497
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1498 1498
 			
1499 1499
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1500 1500
 			{
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 		} else {
1511 1511
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1512 1512
 		}
1513
-		$filter_query = $this->getFilter($filter,true,true);
1513
+		$filter_query = $this->getFilter($filter, true, true);
1514 1514
 
1515 1515
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1516 1516
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 	* @return Array the spotter information
1530 1530
 	*
1531 1531
 	*/
1532
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1532
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1533 1533
 	{
1534 1534
 		global $global_query;
1535 1535
 		
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 		$query_values = array();
1539 1539
 		$limit_query = '';
1540 1540
 		$additional_query = '';
1541
-		$filter_query = $this->getFilter($filters,true,true);
1541
+		$filter_query = $this->getFilter($filters, true, true);
1542 1542
 		
1543 1543
 		if ($airline != "")
1544 1544
 		{
@@ -1555,8 +1555,8 @@  discard block
 block discarded – undo
1555 1555
 		{
1556 1556
 			$limit_array = explode(",", $limit);
1557 1557
 			
1558
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1559
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1558
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1559
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1560 1560
 			
1561 1561
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1562 1562
 			{
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 	* @return Array the spotter information
1587 1587
 	*
1588 1588
 	*/
1589
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1589
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1590 1590
 	{
1591 1591
 		global $global_query;
1592 1592
 		
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 		$query_values = array();
1595 1595
 		$limit_query = '';
1596 1596
 		$additional_query = '';
1597
-		$filter_query = $this->getFilter($filters,true,true);
1597
+		$filter_query = $this->getFilter($filters, true, true);
1598 1598
 		
1599 1599
 		if ($airport != "")
1600 1600
 		{
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
 		{
1612 1612
 			$limit_array = explode(",", $limit);
1613 1613
 			
1614
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1615
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1614
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1615
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1616 1616
 			
1617 1617
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1618 1618
 			{
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
 	* @return Array the spotter information
1645 1645
 	*
1646 1646
 	*/
1647
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1647
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1648 1648
 	{
1649 1649
 		global $global_query, $globalTimezone, $globalDBdriver;
1650 1650
 		
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 		$limit_query = '';
1653 1653
 		$additional_query = '';
1654 1654
 
1655
-		$filter_query = $this->getFilter($filter,true,true);
1655
+		$filter_query = $this->getFilter($filter, true, true);
1656 1656
 		
1657 1657
 		if ($date != "")
1658 1658
 		{
@@ -1681,8 +1681,8 @@  discard block
 block discarded – undo
1681 1681
 		{
1682 1682
 			$limit_array = explode(",", $limit);
1683 1683
 			
1684
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1685
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1684
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1685
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1686 1686
 			
1687 1687
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1688 1688
 			{
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 	* @return Array the spotter information
1713 1713
 	*
1714 1714
 	*/
1715
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1715
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1716 1716
 	{
1717 1717
 		global $global_query;
1718 1718
 		
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 		$query_values = array();
1722 1722
 		$limit_query = '';
1723 1723
 		$additional_query = '';
1724
-		$filter_query = $this->getFilter($filters,true,true);
1724
+		$filter_query = $this->getFilter($filters, true, true);
1725 1725
 		if ($country != "")
1726 1726
 		{
1727 1727
 			if (!is_string($country))
@@ -1738,8 +1738,8 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			$limit_array = explode(",", $limit);
1740 1740
 			
1741
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1742
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1741
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1742
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1743 1743
 			
1744 1744
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1745 1745
 			{
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 		$query_values = array();
1780 1780
 		$additional_query = '';
1781 1781
 		$limit_query = '';
1782
-		$filter_query = $this->getFilter($filters,true,true);
1782
+		$filter_query = $this->getFilter($filters, true, true);
1783 1783
 		
1784 1784
 		if ($aircraft_manufacturer != "")
1785 1785
 		{
@@ -1796,8 +1796,8 @@  discard block
 block discarded – undo
1796 1796
 		{
1797 1797
 			$limit_array = explode(",", $limit);
1798 1798
 			
1799
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1800
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1799
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1800
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1801 1801
 			
1802 1802
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1803 1803
 			{
@@ -1839,14 +1839,14 @@  discard block
 block discarded – undo
1839 1839
 		$query_values = array();
1840 1840
 		$additional_query = '';
1841 1841
 		$limit_query = '';
1842
-		$filter_query = $this->getFilter($filters,true,true);
1842
+		$filter_query = $this->getFilter($filters, true, true);
1843 1843
 		if ($departure_airport_icao != "")
1844 1844
 		{
1845 1845
 			if (!is_string($departure_airport_icao))
1846 1846
 			{
1847 1847
 				return false;
1848 1848
 			} else {
1849
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1849
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1850 1850
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1851 1851
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1852 1852
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1859,10 +1859,10 @@  discard block
 block discarded – undo
1859 1859
 			{
1860 1860
 				return false;
1861 1861
 			} else {
1862
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1862
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1863 1863
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1864 1864
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1865
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1865
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1866 1866
 			}
1867 1867
 		}
1868 1868
 		
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
 		{
1871 1871
 			$limit_array = explode(",", $limit);
1872 1872
 			
1873
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1874
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1873
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1874
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1875 1875
 			
1876 1876
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1877 1877
 			{
@@ -1910,15 +1910,15 @@  discard block
 block discarded – undo
1910 1910
 		global $global_query;
1911 1911
 		
1912 1912
 		date_default_timezone_set('UTC');
1913
-		$filter_query = $this->getFilter($filter,true,true);
1913
+		$filter_query = $this->getFilter($filter, true, true);
1914 1914
 		$limit_query = '';
1915 1915
 		
1916 1916
 		if ($limit != "")
1917 1917
 		{
1918 1918
 			$limit_array = explode(",", $limit);
1919 1919
 			
1920
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1921
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1920
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1921
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1922 1922
 			
1923 1923
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1924 1924
 			{
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1936 1936
 		}
1937 1937
 
1938
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1938
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1939 1939
 
1940 1940
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1941 1941
 
@@ -1948,19 +1948,19 @@  discard block
 block discarded – undo
1948 1948
 	* @return String the highlight text
1949 1949
 	*
1950 1950
 	*/
1951
-	public function getHighlightByRegistration($registration,$filter = array())
1951
+	public function getHighlightByRegistration($registration, $filter = array())
1952 1952
 	{
1953 1953
 		global $global_query;
1954 1954
 		
1955 1955
 		date_default_timezone_set('UTC');
1956
-		$filter_query = $this->getFilter($filter,true,true);
1957
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1956
+		$filter_query = $this->getFilter($filter, true, true);
1957
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1958 1958
 		
1959
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1959
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1960 1960
 		$sth = $this->db->prepare($query);
1961 1961
 		$sth->execute(array(':registration' => $registration));
1962 1962
 
1963
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1963
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1964 1964
 		{
1965 1965
 			$highlight = $row['highlight'];
1966 1966
 		}
@@ -1976,14 +1976,14 @@  discard block
 block discarded – undo
1976 1976
 	* @return String usage
1977 1977
 	*
1978 1978
 	*/
1979
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1979
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1980 1980
 	{
1981 1981
 		
1982
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1983
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1982
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1983
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1984 1984
 
1985 1985
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1986
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1986
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1987 1987
 		
1988 1988
 		$sth = $this->db->prepare($query);
1989 1989
 		$sth->execute($query_values);
@@ -2005,9 +2005,9 @@  discard block
 block discarded – undo
2005 2005
 	public function getAirportIcao($airport_iata = '')
2006 2006
 	{
2007 2007
 		
2008
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2008
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2009 2009
 
2010
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2010
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2011 2011
 		$query_values = array(':airport' => $airport_iata);
2012 2012
 		
2013 2013
 		$sth = $this->db->prepare($query);
@@ -2029,12 +2029,12 @@  discard block
 block discarded – undo
2029 2029
 	* @return Float distance to the airport
2030 2030
 	*
2031 2031
 	*/
2032
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2032
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2033 2033
 	{
2034 2034
 		
2035
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2035
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2036 2036
 
2037
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2037
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2038 2038
 		$query_values = array(':airport' => $airport_icao);
2039 2039
 		$sth = $this->db->prepare($query);
2040 2040
 		$sth->execute($query_values);
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 			$airport_latitude = $row['latitude'];
2045 2045
 			$airport_longitude = $row['longitude'];
2046 2046
 			$Common = new Common();
2047
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2047
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2048 2048
 		} else return '';
2049 2049
 	}
2050 2050
 	
@@ -2058,11 +2058,11 @@  discard block
 block discarded – undo
2058 2058
 	public function getAllAirportInfo($airport = '')
2059 2059
 	{
2060 2060
 		
2061
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2061
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2062 2062
 
2063 2063
 		$query_values = array();
2064 2064
 		if ($airport == 'NA') {
2065
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
2065
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
2066 2066
 		} elseif ($airport == '') {
2067 2067
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
2068 2068
 		} else {
@@ -2110,14 +2110,14 @@  discard block
 block discarded – undo
2110 2110
 	{
2111 2111
 		$lst_countries = '';
2112 2112
 		foreach ($countries as $country) {
2113
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2113
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2114 2114
 			if ($lst_countries == '') {
2115 2115
 				$lst_countries = "'".$country."'";
2116 2116
 			} else {
2117 2117
 				$lst_countries .= ",'".$country."'";
2118 2118
 			}
2119 2119
 		}
2120
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2120
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2121 2121
 		
2122 2122
 		$sth = $this->db->prepare($query);
2123 2123
 		$sth->execute();
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
 		$airport_array = array();
2126 2126
 		$temp_array = array();
2127 2127
 		
2128
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2128
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2129 2129
 		{
2130 2130
 			$temp_array['name'] = $row['name'];
2131 2131
 			$temp_array['city'] = $row['city'];
@@ -2153,10 +2153,10 @@  discard block
 block discarded – undo
2153 2153
 	{
2154 2154
 		global $globalDBdriver;
2155 2155
 		if (is_array($coord)) {
2156
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2157
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2158
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2159
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2156
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2157
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2158
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2159
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2160 2160
 		} else return array();
2161 2161
 		if ($globalDBdriver == 'mysql') {
2162 2162
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
     
2169 2169
 		$airport_array = array();
2170 2170
 		
2171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2172 2172
 		{
2173 2173
 			$temp_array = $row;
2174 2174
 
@@ -2188,13 +2188,13 @@  discard block
 block discarded – undo
2188 2188
 	public function getAllWaypointsInfobyCoord($coord)
2189 2189
 	{
2190 2190
 		if (is_array($coord)) {
2191
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2192
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2193
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2194
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2191
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2192
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2193
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2194
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2195 2195
 		} else return array();
2196 2196
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2197
-		$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.")";
2197
+		$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.")";
2198 2198
 		//$query  = "SELECT waypoints.* FROM waypoints";
2199 2199
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2200 2200
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
     
2207 2207
 		$waypoints_array = array();
2208 2208
 		
2209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2210 2210
 		{
2211 2211
 			$temp_array = $row;
2212 2212
 
@@ -2228,10 +2228,10 @@  discard block
 block discarded – undo
2228 2228
 	{
2229 2229
 		global $globalUseRealAirlines;
2230 2230
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2231
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2231
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2232 2232
 		if ($airline_icao == 'NA') {
2233 2233
 			$airline_array = array();
2234
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2234
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2235 2235
 			return $airline_array;
2236 2236
 		} else {
2237 2237
 			if (strlen($airline_icao) == 2) {
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
 			if ($fromsource === NULL) {
2253 2253
 				$sth->execute(array(':airline_icao' => $airline_icao));
2254 2254
 			} else {
2255
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2255
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2256 2256
 			}
2257 2257
                         /*
2258 2258
 			$airline_array = array();
@@ -2297,13 +2297,13 @@  discard block
 block discarded – undo
2297 2297
 	{
2298 2298
 		global $globalUseRealAirlines;
2299 2299
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2300
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2301
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2300
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2301
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2302 2302
 		$sth = $this->db->prepare($query);
2303 2303
 		if ($fromsource === NULL) {
2304 2304
 			$sth->execute(array(':airline_name' => $airline_name));
2305 2305
 		} else {
2306
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2306
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2307 2307
 		}
2308 2308
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2309 2309
 		if (empty($result) && $fromsource !== NULL) {
@@ -2328,12 +2328,12 @@  discard block
 block discarded – undo
2328 2328
 	*/
2329 2329
 	public function getAllAircraftInfo($aircraft_type)
2330 2330
 	{
2331
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2331
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2332 2332
 
2333 2333
 		if ($aircraft_type == 'NA') {
2334
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2334
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2335 2335
 		}
2336
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2336
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2337 2337
 		
2338 2338
 		$sth = $this->db->prepare($query);
2339 2339
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 	*/
2366 2366
 	public function getAircraftIcao($aircraft_type)
2367 2367
 	{
2368
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2368
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2369 2369
 		$all_aircraft = array('737-300' => 'B733',
2370 2370
 				'777-200' => 'B772',
2371 2371
 				'777-200ER' => 'B772',
@@ -2377,10 +2377,10 @@  discard block
 block discarded – undo
2377 2377
 				'A380' => 'A388');
2378 2378
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2379 2379
 
2380
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2380
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2381 2381
 		$aircraft_type = strtoupper($aircraft_type);
2382 2382
 		$sth = $this->db->prepare($query);
2383
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2383
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2384 2384
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2385 2385
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2386 2386
 		else return '';
@@ -2395,9 +2395,9 @@  discard block
 block discarded – undo
2395 2395
 	*/
2396 2396
 	public function getAllAircraftType($aircraft_modes)
2397 2397
 	{
2398
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2398
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2399 2399
 
2400
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2400
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2401 2401
 		
2402 2402
 		$sth = $this->db->prepare($query);
2403 2403
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2420,9 +2420,9 @@  discard block
 block discarded – undo
2420 2420
 	*/
2421 2421
 	public function getAllAircraftTypeByRegistration($registration)
2422 2422
 	{
2423
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2423
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2424 2424
 
2425
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2425
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2426 2426
 		
2427 2427
 		$sth = $this->db->prepare($query);
2428 2428
 		$sth->execute(array(':registration' => $registration));
@@ -2443,9 +2443,9 @@  discard block
 block discarded – undo
2443 2443
 	*/
2444 2444
 	public function getAllIDByRegistration($registration)
2445 2445
 	{
2446
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2446
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2447 2447
 
2448
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2448
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2449 2449
 		
2450 2450
 		$sth = $this->db->prepare($query);
2451 2451
 		$sth->execute(array(':registration' => $registration));
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 		$idarray = array();
2454 2454
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2455 2455
 			$date = $row['date'];
2456
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2456
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2457 2457
 		}
2458 2458
 		return $idarray;
2459 2459
 	}
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 	*/
2468 2468
 	public function getOperator($operator)
2469 2469
 	{
2470
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2471
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2470
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2471
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2472 2472
 		
2473 2473
 		$sth = $this->db->prepare($query);
2474 2474
 		$sth->execute(array(':operator' => $operator));
@@ -2489,9 +2489,9 @@  discard block
 block discarded – undo
2489 2489
 	*/
2490 2490
 	public function getRouteInfo($callsign)
2491 2491
 	{
2492
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2492
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2493 2493
                 if ($callsign == '') return array();
2494
-		$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";
2494
+		$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";
2495 2495
 		
2496 2496
 		$sth = $this->db->prepare($query);
2497 2497
 		$sth->execute(array(':callsign' => $callsign));
@@ -2512,9 +2512,9 @@  discard block
 block discarded – undo
2512 2512
 	*/
2513 2513
 	public function getAircraftInfoByRegistration($registration)
2514 2514
 	{
2515
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2515
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2516 2516
 
2517
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2517
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2518 2518
 		
2519 2519
 		$sth = $this->db->prepare($query);
2520 2520
 		$sth->execute(array(':registration' => $registration));
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
 		$aircraft_array = array();
2523 2523
 		$temp_array = array();
2524 2524
 		
2525
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2525
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2526 2526
 		{
2527 2527
 			$temp_array['airline_icao'] = $row['airline_icao'];
2528 2528
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
 	*/
2545 2545
 	public function getAircraftOwnerByRegistration($registration)
2546 2546
 	{
2547
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2547
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2548 2548
 		$Connection = new Connection($this->db);
2549 2549
 		if ($Connection->tableExists('aircraft_owner')) {
2550 2550
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
 	public function getAllFlightsforSitemap()
2567 2567
 	{
2568 2568
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2569
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2569
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2570 2570
 		
2571 2571
 		$sth = $this->db->prepare($query);
2572 2572
 		$sth->execute();
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
 		$manufacturer_array = array();
2614 2614
 		$temp_array = array();
2615 2615
 		
2616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2617 2617
 		{
2618 2618
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2619 2619
 
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 		$aircraft_array = array();
2651 2651
 		$temp_array = array();
2652 2652
 		
2653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2654 2654
 		{
2655 2655
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2656 2656
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2671,8 +2671,8 @@  discard block
 block discarded – undo
2671 2671
 	*/
2672 2672
 	public function getAllAircraftRegistrations($filters = array())
2673 2673
 	{
2674
-		$filter_query = $this->getFilter($filters,true,true);
2675
-		$query  = "SELECT DISTINCT spotter_output.registration 
2674
+		$filter_query = $this->getFilter($filters, true, true);
2675
+		$query = "SELECT DISTINCT spotter_output.registration 
2676 2676
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2677 2677
 				ORDER BY spotter_output.registration ASC";
2678 2678
 
@@ -2682,7 +2682,7 @@  discard block
 block discarded – undo
2682 2682
 		$aircraft_array = array();
2683 2683
 		$temp_array = array();
2684 2684
 		
2685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2686 2686
 		{
2687 2687
 			$temp_array['registration'] = $row['registration'];
2688 2688
 
@@ -2699,11 +2699,11 @@  discard block
 block discarded – undo
2699 2699
 	* @return Array list of source name
2700 2700
 	*
2701 2701
 	*/
2702
-	public function getAllSourceName($type = '',$filters = array())
2702
+	public function getAllSourceName($type = '', $filters = array())
2703 2703
 	{
2704
-		$filter_query = $this->getFilter($filters,true,true);
2704
+		$filter_query = $this->getFilter($filters, true, true);
2705 2705
 		$query_values = array();
2706
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2706
+		$query = "SELECT DISTINCT spotter_output.source_name 
2707 2707
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2708 2708
 		if ($type != '') {
2709 2709
 			$query_values = array(':type' => $type);
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 		$source_array = array();
2719 2719
 		$temp_array = array();
2720 2720
 		
2721
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2721
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2722 2722
 		{
2723 2723
 			$temp_array['source_name'] = $row['source_name'];
2724 2724
 			$source_array[] = $temp_array;
@@ -2734,11 +2734,11 @@  discard block
 block discarded – undo
2734 2734
 	* @return Array list of airline names
2735 2735
 	*
2736 2736
 	*/
2737
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2737
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2738 2738
 	{
2739
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2740
-		$filter_query = $this->getFilter($filters,true,true);
2741
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2739
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2740
+		$filter_query = $this->getFilter($filters, true, true);
2741
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2742 2742
 		if ($airline_type == '' || $airline_type == 'all') {
2743 2743
 			/*
2744 2744
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
 				$query_data = array(':forsource' => $forsource);
2758 2758
 			}
2759 2759
 		} else {
2760
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2760
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2761 2761
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2762 2762
 					AND spotter_output.airline_type = :airline_type 
2763 2763
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2770,7 +2770,7 @@  discard block
 block discarded – undo
2770 2770
 		$airline_array = array();
2771 2771
 		$temp_array = array();
2772 2772
 		
2773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2774 2774
 		{
2775 2775
 			$temp_array['airline_icao'] = $row['airline_icao'];
2776 2776
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2787,10 +2787,10 @@  discard block
 block discarded – undo
2787 2787
 	* @return Array list of alliance names
2788 2788
 	*
2789 2789
 	*/
2790
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2790
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2791 2791
 	{
2792
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2793
-		$filter_query = $this->getFilter($filters,true,true);
2792
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2793
+		$filter_query = $this->getFilter($filters, true, true);
2794 2794
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2795 2795
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2796 2796
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
 	*/
2819 2819
 	public function getAllAirlineCountries($filters = array())
2820 2820
 	{
2821
-		$filter_query = $this->getFilter($filters,true,true);
2822
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2821
+		$filter_query = $this->getFilter($filters, true, true);
2822
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2823 2823
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2824 2824
 				ORDER BY spotter_output.airline_country ASC";
2825 2825
 		
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
 		$airline_array = array();
2831 2831
 		$temp_array = array();
2832 2832
 		
2833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2834 2834
 		{
2835 2835
 			$temp_array['airline_country'] = $row['airline_country'];
2836 2836
 
@@ -2850,9 +2850,9 @@  discard block
 block discarded – undo
2850 2850
 	*/
2851 2851
 	public function getAllAirportNames($filters = array())
2852 2852
 	{
2853
-		$filter_query = $this->getFilter($filters,true,true);
2853
+		$filter_query = $this->getFilter($filters, true, true);
2854 2854
 		$airport_array = array();
2855
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2855
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2856 2856
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2857 2857
 				ORDER BY spotter_output.departure_airport_city ASC";
2858 2858
 		
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 		$sth->execute();
2862 2862
 
2863 2863
 		$temp_array = array();
2864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2865 2865
 		{
2866 2866
 			$temp_array['airport_icao'] = $row['airport_icao'];
2867 2867
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2871,14 +2871,14 @@  discard block
 block discarded – undo
2871 2871
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2872 2872
 		}
2873 2873
 
2874
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2874
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2875 2875
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2876 2876
 								ORDER BY spotter_output.arrival_airport_city ASC";
2877 2877
 					
2878 2878
 		$sth = $this->db->prepare($query);
2879 2879
 		$sth->execute();
2880 2880
 
2881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2882 2882
 			{
2883 2883
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2884 2884
 		//	{
@@ -2902,8 +2902,8 @@  discard block
 block discarded – undo
2902 2902
 	*/
2903 2903
 	public function getAllOwnerNames($filters = array())
2904 2904
 	{
2905
-		$filter_query = $this->getFilter($filters,true,true);
2906
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2905
+		$filter_query = $this->getFilter($filters, true, true);
2906
+		$query = "SELECT DISTINCT spotter_output.owner_name
2907 2907
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2908 2908
 				ORDER BY spotter_output.owner_name ASC";
2909 2909
 		
@@ -2920,8 +2920,8 @@  discard block
 block discarded – undo
2920 2920
 	*/
2921 2921
 	public function getAllPilotNames($filters = array())
2922 2922
 	{
2923
-		$filter_query = $this->getFilter($filters,true,true);
2924
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2923
+		$filter_query = $this->getFilter($filters, true, true);
2924
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2925 2925
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2926 2926
 				ORDER BY spotter_output.pilot_name ASC";
2927 2927
 		
@@ -2954,21 +2954,21 @@  discard block
 block discarded – undo
2954 2954
    
2955 2955
 		$temp_array = array();
2956 2956
 		
2957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2958 2958
 		{
2959 2959
 			$temp_array['airport_country'] = $row['airport_country'];
2960 2960
 
2961 2961
 			$airport_array[$row['airport_country']] = $temp_array;
2962 2962
 		}
2963
-		$filter_query = $this->getFilter($filters,true,true);
2964
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2963
+		$filter_query = $this->getFilter($filters, true, true);
2964
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2965 2965
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2966 2966
 								ORDER BY spotter_output.arrival_airport_country ASC";
2967 2967
 					
2968 2968
 		$sth = $this->db->prepare($query);
2969 2969
 		$sth->execute();
2970 2970
 		
2971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2972 2972
 		{
2973 2973
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2974 2974
 			{
@@ -2991,9 +2991,9 @@  discard block
 block discarded – undo
2991 2991
 	*/
2992 2992
 	public function getAllCountries($filters = array())
2993 2993
 	{
2994
-		$Connection= new Connection($this->db);
2994
+		$Connection = new Connection($this->db);
2995 2995
 		if ($Connection->tableExists('countries')) {
2996
-			$query  = "SELECT countries.name AS airport_country
2996
+			$query = "SELECT countries.name AS airport_country
2997 2997
 				FROM countries
2998 2998
 				ORDER BY countries.name ASC";
2999 2999
 			$sth = $this->db->prepare($query);
@@ -3002,14 +3002,14 @@  discard block
 block discarded – undo
3002 3002
 			$temp_array = array();
3003 3003
 			$country_array = array();
3004 3004
 		
3005
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3005
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3006 3006
 			{
3007 3007
 				$temp_array['country'] = $row['airport_country'];
3008 3008
 				$country_array[$row['airport_country']] = $temp_array;
3009 3009
 			}
3010 3010
 		} else {
3011
-			$filter_query = $this->getFilter($filters,true,true);
3012
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3011
+			$filter_query = $this->getFilter($filters, true, true);
3012
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3013 3013
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3014 3014
 								ORDER BY spotter_output.departure_airport_country ASC";
3015 3015
 
@@ -3018,20 +3018,20 @@  discard block
 block discarded – undo
3018 3018
    
3019 3019
 			$temp_array = array();
3020 3020
 			$country_array = array();
3021
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3021
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3022 3022
 			{
3023 3023
 				$temp_array['country'] = $row['airport_country'];
3024 3024
 				$country_array[$row['airport_country']] = $temp_array;
3025 3025
 			}
3026 3026
 
3027
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3027
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3028 3028
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3029 3029
 								ORDER BY spotter_output.arrival_airport_country ASC";
3030 3030
 					
3031 3031
 		$sth = $this->db->prepare($query);
3032 3032
 		$sth->execute();
3033 3033
 		
3034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3035 3035
 		{
3036 3036
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3037 3037
 			{
@@ -3041,14 +3041,14 @@  discard block
 block discarded – undo
3041 3041
 			}
3042 3042
 		}
3043 3043
 		
3044
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3044
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3045 3045
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3046 3046
 								ORDER BY spotter_output.airline_country ASC";
3047 3047
 					
3048 3048
 		$sth = $this->db->prepare($query);
3049 3049
 		$sth->execute();
3050 3050
 		
3051
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3051
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3052 3052
 		{
3053 3053
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3054 3054
 			{
@@ -3072,8 +3072,8 @@  discard block
 block discarded – undo
3072 3072
 	*/
3073 3073
 	public function getAllIdents($filters = array())
3074 3074
 	{
3075
-		$filter_query = $this->getFilter($filters,true,true);
3076
-		$query  = "SELECT DISTINCT spotter_output.ident
3075
+		$filter_query = $this->getFilter($filters, true, true);
3076
+		$query = "SELECT DISTINCT spotter_output.ident
3077 3077
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3078 3078
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3079 3079
 
@@ -3083,7 +3083,7 @@  discard block
 block discarded – undo
3083 3083
 		$ident_array = array();
3084 3084
 		$temp_array = array();
3085 3085
 		
3086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3087 3087
 		{
3088 3088
 			$temp_array['ident'] = $row['ident'];
3089 3089
 			$ident_array[] = $temp_array;
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
 	* @return Array number, icao, name and city of airports
3098 3098
 	*/
3099 3099
 
3100
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3100
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3101 3101
 		global $globalTimezone, $globalDBdriver;
3102
-		$filter_query = $this->getFilter($filters,true,true);
3102
+		$filter_query = $this->getFilter($filters, true, true);
3103 3103
 		if ($globalTimezone != '') {
3104 3104
 			date_default_timezone_set($globalTimezone);
3105 3105
 			$datetime = new DateTime();
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 
3165 3165
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3166 3166
 		global $globalTimezone, $globalDBdriver;
3167
-		$filter_query = $this->getFilter($filters,true,true);
3167
+		$filter_query = $this->getFilter($filters, true, true);
3168 3168
 		if ($globalTimezone != '') {
3169 3169
 			date_default_timezone_set($globalTimezone);
3170 3170
 			$datetime = new DateTime();
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
 
3249 3249
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3250 3250
 		global $globalTimezone, $globalDBdriver;
3251
-		$filter_query = $this->getFilter($filters,true,true);
3251
+		$filter_query = $this->getFilter($filters, true, true);
3252 3252
 		if ($globalTimezone != '') {
3253 3253
 			date_default_timezone_set($globalTimezone);
3254 3254
 			$datetime = new DateTime();
@@ -3281,9 +3281,9 @@  discard block
 block discarded – undo
3281 3281
 	* @return Array number, icao, name and city of airports
3282 3282
 	*/
3283 3283
 
3284
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3284
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3285 3285
 		global $globalTimezone, $globalDBdriver;
3286
-		$filter_query = $this->getFilter($filters,true,true);
3286
+		$filter_query = $this->getFilter($filters, true, true);
3287 3287
 		if ($globalTimezone != '') {
3288 3288
 			date_default_timezone_set($globalTimezone);
3289 3289
 			$datetime = new DateTime();
@@ -3415,12 +3415,12 @@  discard block
 block discarded – undo
3415 3415
 		} else $offset = '+00:00';
3416 3416
 
3417 3417
 		if ($globalDBdriver == 'mysql') {
3418
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3418
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3419 3419
 								FROM spotter_output
3420 3420
 								WHERE spotter_output.date <> '' 
3421 3421
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3422 3422
 		} else {
3423
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3423
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3424 3424
 								FROM spotter_output
3425 3425
 								WHERE spotter_output.date <> '' 
3426 3426
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
 		$date_array = array();
3433 3433
 		$temp_array = array();
3434 3434
 		
3435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3436 3436
 		{
3437 3437
 			$temp_array['date'] = $row['date'];
3438 3438
 
@@ -3452,7 +3452,7 @@  discard block
 block discarded – undo
3452 3452
 	*/
3453 3453
 	public function getAllRoutes()
3454 3454
 	{
3455
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3455
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3456 3456
 				FROM spotter_output
3457 3457
 				WHERE spotter_output.ident <> '' 
3458 3458
 				GROUP BY route
@@ -3463,7 +3463,7 @@  discard block
 block discarded – undo
3463 3463
 
3464 3464
 		$routes_array = array();
3465 3465
 		$temp_array = array();
3466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3467 3467
 		{
3468 3468
 			$temp_array['route'] = $row['route'];
3469 3469
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3482,21 +3482,21 @@  discard block
 block discarded – undo
3482 3482
 	* @return String success or false
3483 3483
 	*
3484 3484
 	*/	
3485
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3485
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3486 3486
 	{
3487 3487
 		if (!is_numeric(substr($ident, 0, 3)))
3488 3488
 		{
3489 3489
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3490
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3490
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3491 3491
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3492
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3492
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3493 3493
 			} else {
3494 3494
 				$airline_array = $this->getAllAirlineInfo("NA");
3495 3495
 			}
3496 3496
 			if (count($airline_array) == 0) {
3497 3497
 				$airline_array = $this->getAllAirlineInfo("NA");
3498 3498
 			}
3499
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3499
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3500 3500
 				$airline_array = $this->getAllAirlineInfo("NA");
3501 3501
 			}
3502 3502
 		} else {
@@ -3509,7 +3509,7 @@  discard block
 block discarded – undo
3509 3509
 
3510 3510
 
3511 3511
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3512
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3512
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3530,11 +3530,11 @@  discard block
 block discarded – undo
3530 3530
 	* @return String success or false
3531 3531
 	*
3532 3532
 	*/	
3533
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3533
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3534 3534
 	{
3535 3535
 		if ($groundspeed == '') $groundspeed = NULL;
3536 3536
 		$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';
3537
-                $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);
3537
+                $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);
3538 3538
 
3539 3539
 		try {
3540 3540
 			$sth = $this->db->prepare($query);
@@ -3574,7 +3574,7 @@  discard block
 block discarded – undo
3574 3574
 	* @param String $verticalrate vertival rate of flight
3575 3575
 	* @return String success or false
3576 3576
 	*/
3577
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3577
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3578 3578
 	{
3579 3579
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3580 3580
 		
@@ -3598,13 +3598,13 @@  discard block
 block discarded – undo
3598 3598
 				if ($ModeS != '') {
3599 3599
 					$timeelapsed = microtime(true);
3600 3600
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3601
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3601
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3602 3602
 				} else {
3603
-					$myhex = explode('-',$flightaware_id);
3603
+					$myhex = explode('-', $flightaware_id);
3604 3604
 					if (count($myhex) > 0) {
3605 3605
 						$timeelapsed = microtime(true);
3606 3606
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3607
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3607
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3608 3608
 					}
3609 3609
 				}
3610 3610
 			}
@@ -3626,24 +3626,24 @@  discard block
 block discarded – undo
3626 3626
 				{
3627 3627
 					$timeelapsed = microtime(true);
3628 3628
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3629
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3629
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3630 3630
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3631
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3631
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3632 3632
 					} else {
3633 3633
 						$airline_array = $this->getAllAirlineInfo("NA");
3634 3634
 					}
3635 3635
 					if (count($airline_array) == 0) {
3636 3636
 						$airline_array = $this->getAllAirlineInfo("NA");
3637 3637
 					}
3638
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3638
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3639 3639
 						$airline_array = $this->getAllAirlineInfo("NA");
3640 3640
 					}
3641
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3641
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3642 3642
 
3643 3643
 				} else {
3644 3644
 					$timeelapsed = microtime(true);
3645 3645
 					$airline_array = $this->getAllAirlineInfo("NA");
3646
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3647 3647
 				}
3648 3648
 			}
3649 3649
 		} else $airline_array = array();
@@ -3660,27 +3660,27 @@  discard block
 block discarded – undo
3660 3660
 				{
3661 3661
 					$timeelapsed = microtime(true);
3662 3662
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3663
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3663
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3664 3664
 				} else {
3665 3665
 					$timeelapsed = microtime(true);
3666 3666
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3667
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3668 3668
 				}
3669 3669
 			}
3670 3670
 		} else {
3671 3671
 			if ($ModeS != '') {
3672 3672
 				$timeelapsed = microtime(true);
3673 3673
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3674
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3674
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3675 3675
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3676 3676
 				{
3677 3677
 					$timeelapsed = microtime(true);
3678 3678
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3679
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3680 3680
 				} else {
3681 3681
 					$timeelapsed = microtime(true);
3682 3682
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3683
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3683
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3684 3684
 				}
3685 3685
 			}
3686 3686
 		}
@@ -3696,7 +3696,7 @@  discard block
 block discarded – undo
3696 3696
 			} else {
3697 3697
 				$timeelapsed = microtime(true);
3698 3698
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3699
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3699
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3700 3700
 			}
3701 3701
 		}
3702 3702
 		
@@ -3711,7 +3711,7 @@  discard block
 block discarded – undo
3711 3711
 			} else {
3712 3712
 				$timeelapsed = microtime(true);
3713 3713
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3714
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3714
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3715 3715
 			}
3716 3716
 		}
3717 3717
 
@@ -3764,7 +3764,7 @@  discard block
 block discarded – undo
3764 3764
 		}
3765 3765
 
3766 3766
     
3767
-		if ($date == "" || strtotime($date) < time()-20*60)
3767
+		if ($date == "" || strtotime($date) < time() - 20*60)
3768 3768
 		{
3769 3769
 			$date = date("Y-m-d H:i:s", time());
3770 3770
 		}
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 		{
3775 3775
 			$timeelapsed = microtime(true);
3776 3776
 			$image_array = $Image->getSpotterImage($registration);
3777
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3777
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3778 3778
 			if (!isset($image_array[0]['registration']))
3779 3779
 			{
3780 3780
 				//echo "Add image !!!! \n";
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
 			}
3783 3783
 			$timeelapsed = microtime(true);
3784 3784
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3785
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3785
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3786 3786
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3787 3787
 		}
3788 3788
     
@@ -3790,33 +3790,33 @@  discard block
 block discarded – undo
3790 3790
 		{
3791 3791
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792 3792
             		else $airline_icao = '';
3793
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3793
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3794 3794
 			if (!isset($image_array[0]['registration']))
3795 3795
 			{
3796 3796
 				//echo "Add image !!!! \n";
3797
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3797
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3798 3798
 			}
3799 3799
 		}
3800 3800
     
3801
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3802
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3803
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3804
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3805
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3806
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3807
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3808
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3809
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3810
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3811
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3812
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3813
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3814
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3815
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3816
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3817
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3818
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3819
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3801
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3802
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3803
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3804
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3805
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3806
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3807
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3808
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3809
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3810
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3811
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3812
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3813
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3814
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3815
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3816
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3817
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3818
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3819
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3820 3820
 	
3821 3821
 		if (count($airline_array) == 0) 
3822 3822
 		{
@@ -3844,7 +3844,7 @@  discard block
 block discarded – undo
3844 3844
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845 3845
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846 3846
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
-                $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) 
3847
+                $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) 
3848 3848
                 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)";
3849 3849
 
3850 3850
                 $airline_name = $airline_array[0]['name'];
@@ -3854,7 +3854,7 @@  discard block
 block discarded – undo
3854 3854
 		if ($airline_type == '') {
3855 3855
 			$timeelapsed = microtime(true);
3856 3856
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3857
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3858 3858
 		}
3859 3859
 		if ($airline_type == null) $airline_type = '';
3860 3860
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3867 3867
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3868 3868
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3869
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3869
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3870 3870
 
3871 3871
 		try {
3872 3872
 		        
@@ -3892,13 +3892,13 @@  discard block
 block discarded – undo
3892 3892
 	{
3893 3893
 		global $globalDBdriver, $globalTimezone;
3894 3894
 		if ($globalDBdriver == 'mysql') {
3895
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3895
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3896 3896
 								WHERE spotter_output.ident = :ident 
3897 3897
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3898 3898
 								AND spotter_output.date < UTC_TIMESTAMP()";
3899 3899
 			$query_data = array(':ident' => $ident);
3900 3900
 		} else {
3901
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3901
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3902 3902
 								WHERE spotter_output.ident = :ident 
3903 3903
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3904 3904
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3907,8 +3907,8 @@  discard block
 block discarded – undo
3907 3907
 		
3908 3908
 		$sth = $this->db->prepare($query);
3909 3909
 		$sth->execute($query_data);
3910
-    		$ident_result='';
3911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3910
+    		$ident_result = '';
3911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3912 3912
 		{
3913 3913
 			$ident_result = $row['ident'];
3914 3914
 		}
@@ -3934,8 +3934,8 @@  discard block
 block discarded – undo
3934 3934
 				return false;
3935 3935
 			} else {
3936 3936
 				$q_array = explode(" ", $q);
3937
-				foreach ($q_array as $q_item){
3938
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3937
+				foreach ($q_array as $q_item) {
3938
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3939 3939
 					$additional_query .= " AND (";
3940 3940
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3941 3941
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3950,11 +3950,11 @@  discard block
 block discarded – undo
3950 3950
 			}
3951 3951
 		}
3952 3952
 		if ($globalDBdriver == 'mysql') {
3953
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3953
+			$query = "SELECT spotter_output.* FROM spotter_output 
3954 3954
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3955 3955
 				AND spotter_output.date < UTC_TIMESTAMP()";
3956 3956
 		} else {
3957
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3957
+			$query = "SELECT spotter_output.* FROM spotter_output 
3958 3958
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3959 3959
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3960 3960
 		}
@@ -3971,11 +3971,11 @@  discard block
 block discarded – undo
3971 3971
 	* @return Array the airline list
3972 3972
 	*
3973 3973
 	*/
3974
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3974
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3975 3975
 	{
3976 3976
 		global $globalDBdriver;
3977
-		$filter_query = $this->getFilter($filters,true,true);
3978
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3977
+		$filter_query = $this->getFilter($filters, true, true);
3978
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3979 3979
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3980 3980
 		if ($olderthanmonths > 0) {
3981 3981
 			if ($globalDBdriver == 'mysql') {
@@ -3995,28 +3995,28 @@  discard block
 block discarded – undo
3995 3995
 		if ($year != '') {
3996 3996
 			if ($globalDBdriver == 'mysql') {
3997 3997
 				$query .= " AND YEAR(spotter_output.date) = :year";
3998
-				$query_values = array_merge($query_values,array(':year' => $year));
3998
+				$query_values = array_merge($query_values, array(':year' => $year));
3999 3999
 			} else {
4000 4000
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4001
-				$query_values = array_merge($query_values,array(':year' => $year));
4001
+				$query_values = array_merge($query_values, array(':year' => $year));
4002 4002
 			}
4003 4003
 		}
4004 4004
 		if ($month != '') {
4005 4005
 			if ($globalDBdriver == 'mysql') {
4006 4006
 				$query .= " AND MONTH(spotter_output.date) = :month";
4007
-				$query_values = array_merge($query_values,array(':month' => $month));
4007
+				$query_values = array_merge($query_values, array(':month' => $month));
4008 4008
 			} else {
4009 4009
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4010
-				$query_values = array_merge($query_values,array(':month' => $month));
4010
+				$query_values = array_merge($query_values, array(':month' => $month));
4011 4011
 			}
4012 4012
 		}
4013 4013
 		if ($day != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND DAY(spotter_output.date) = :day";
4016
-				$query_values = array_merge($query_values,array(':day' => $day));
4016
+				$query_values = array_merge($query_values, array(':day' => $day));
4017 4017
 			} else {
4018 4018
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4019
-				$query_values = array_merge($query_values,array(':day' => $day));
4019
+				$query_values = array_merge($query_values, array(':day' => $day));
4020 4020
 			}
4021 4021
 		}
4022 4022
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4026,7 +4026,7 @@  discard block
 block discarded – undo
4026 4026
 		$sth->execute($query_values);
4027 4027
 		$airline_array = array();
4028 4028
 		$temp_array = array();
4029
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4029
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4030 4030
 		{
4031 4031
 			$temp_array['airline_name'] = $row['airline_name'];
4032 4032
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4043,11 +4043,11 @@  discard block
 block discarded – undo
4043 4043
 	* @return Array the pilots list
4044 4044
 	*
4045 4045
 	*/
4046
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4046
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4047 4047
 	{
4048 4048
 		global $globalDBdriver;
4049
-		$filter_query = $this->getFilter($filters,true,true);
4050
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4049
+		$filter_query = $this->getFilter($filters, true, true);
4050
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4051 4051
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4052 4052
                 if ($olderthanmonths > 0) {
4053 4053
             		if ($globalDBdriver == 'mysql') {
@@ -4067,28 +4067,28 @@  discard block
 block discarded – undo
4067 4067
 		if ($year != '') {
4068 4068
 			if ($globalDBdriver == 'mysql') {
4069 4069
 				$query .= " AND YEAR(spotter_output.date) = :year";
4070
-				$query_values = array_merge($query_values,array(':year' => $year));
4070
+				$query_values = array_merge($query_values, array(':year' => $year));
4071 4071
 			} else {
4072 4072
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4073
-				$query_values = array_merge($query_values,array(':year' => $year));
4073
+				$query_values = array_merge($query_values, array(':year' => $year));
4074 4074
 			}
4075 4075
 		}
4076 4076
 		if ($month != '') {
4077 4077
 			if ($globalDBdriver == 'mysql') {
4078 4078
 				$query .= " AND MONTH(spotter_output.date) = :month";
4079
-				$query_values = array_merge($query_values,array(':month' => $month));
4079
+				$query_values = array_merge($query_values, array(':month' => $month));
4080 4080
 			} else {
4081 4081
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4082
-				$query_values = array_merge($query_values,array(':month' => $month));
4082
+				$query_values = array_merge($query_values, array(':month' => $month));
4083 4083
 			}
4084 4084
 		}
4085 4085
 		if ($day != '') {
4086 4086
 			if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND DAY(spotter_output.date) = :day";
4088
-				$query_values = array_merge($query_values,array(':day' => $day));
4088
+				$query_values = array_merge($query_values, array(':day' => $day));
4089 4089
 			} else {
4090 4090
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4091
-				$query_values = array_merge($query_values,array(':day' => $day));
4091
+				$query_values = array_merge($query_values, array(':day' => $day));
4092 4092
 			}
4093 4093
 		}
4094 4094
 		
@@ -4100,7 +4100,7 @@  discard block
 block discarded – undo
4100 4100
 		$sth->execute($query_values);
4101 4101
 		$airline_array = array();
4102 4102
 		$temp_array = array();
4103
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4103
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4104 4104
 		{
4105 4105
 			$temp_array['pilot_name'] = $row['pilot_name'];
4106 4106
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4120,7 +4120,7 @@  discard block
 block discarded – undo
4120 4120
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4121 4121
 	{
4122 4122
 		global $globalDBdriver;
4123
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4123
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4124 4124
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4125 4125
                 if ($olderthanmonths > 0) {
4126 4126
             		if ($globalDBdriver == 'mysql') {
@@ -4146,7 +4146,7 @@  discard block
 block discarded – undo
4146 4146
 		$airline_array = array();
4147 4147
 		$temp_array = array();
4148 4148
         
4149
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4149
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4150 4150
 		{
4151 4151
 			$temp_array['pilot_name'] = $row['pilot_name'];
4152 4152
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4164,11 +4164,11 @@  discard block
 block discarded – undo
4164 4164
 	* @return Array the pilots list
4165 4165
 	*
4166 4166
 	*/
4167
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4167
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4168 4168
 	{
4169 4169
 		global $globalDBdriver;
4170
-		$filter_query = $this->getFilter($filters,true,true);
4171
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4170
+		$filter_query = $this->getFilter($filters, true, true);
4171
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4172 4172
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4173 4173
                 if ($olderthanmonths > 0) {
4174 4174
             		if ($globalDBdriver == 'mysql') {
@@ -4188,28 +4188,28 @@  discard block
 block discarded – undo
4188 4188
 		if ($year != '') {
4189 4189
 			if ($globalDBdriver == 'mysql') {
4190 4190
 				$query .= " AND YEAR(spotter_output.date) = :year";
4191
-				$query_values = array_merge($query_values,array(':year' => $year));
4191
+				$query_values = array_merge($query_values, array(':year' => $year));
4192 4192
 			} else {
4193 4193
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4194
-				$query_values = array_merge($query_values,array(':year' => $year));
4194
+				$query_values = array_merge($query_values, array(':year' => $year));
4195 4195
 			}
4196 4196
 		}
4197 4197
 		if ($month != '') {
4198 4198
 			if ($globalDBdriver == 'mysql') {
4199 4199
 				$query .= " AND MONTH(spotter_output.date) = :month";
4200
-				$query_values = array_merge($query_values,array(':month' => $month));
4200
+				$query_values = array_merge($query_values, array(':month' => $month));
4201 4201
 			} else {
4202 4202
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4203
-				$query_values = array_merge($query_values,array(':month' => $month));
4203
+				$query_values = array_merge($query_values, array(':month' => $month));
4204 4204
 			}
4205 4205
 		}
4206 4206
 		if ($day != '') {
4207 4207
 			if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND DAY(spotter_output.date) = :day";
4209
-				$query_values = array_merge($query_values,array(':day' => $day));
4209
+				$query_values = array_merge($query_values, array(':day' => $day));
4210 4210
 			} else {
4211 4211
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4212
-				$query_values = array_merge($query_values,array(':day' => $day));
4212
+				$query_values = array_merge($query_values, array(':day' => $day));
4213 4213
 			}
4214 4214
 		}
4215 4215
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4219,7 +4219,7 @@  discard block
 block discarded – undo
4219 4219
 		$sth->execute($query_values);
4220 4220
 		$airline_array = array();
4221 4221
 		$temp_array = array();
4222
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4222
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4223 4223
 		{
4224 4224
 			$temp_array['owner_name'] = $row['owner_name'];
4225 4225
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4234,11 +4234,11 @@  discard block
 block discarded – undo
4234 4234
 	* @return Array the pilots list
4235 4235
 	*
4236 4236
 	*/
4237
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4237
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4238 4238
 	{
4239 4239
 		global $globalDBdriver;
4240
-		$filter_query = $this->getFilter($filters,true,true);
4241
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4240
+		$filter_query = $this->getFilter($filters, true, true);
4241
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4242 4242
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4243 4243
                 if ($olderthanmonths > 0) {
4244 4244
             		if ($globalDBdriver == 'mysql') {
@@ -4264,7 +4264,7 @@  discard block
 block discarded – undo
4264 4264
 		$airline_array = array();
4265 4265
 		$temp_array = array();
4266 4266
         
4267
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4267
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4268 4268
 		{
4269 4269
 			$temp_array['owner_name'] = $row['owner_name'];
4270 4270
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4280,11 +4280,11 @@  discard block
 block discarded – undo
4280 4280
 	* @return Array the airline list
4281 4281
 	*
4282 4282
 	*/
4283
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4283
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4284 4284
 	{
4285
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4286
-		$filter_query = $this->getFilter($filters,true,true);
4287
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4285
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4286
+		$filter_query = $this->getFilter($filters, true, true);
4287
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4288 4288
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4289 4289
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4290 4290
 			    ORDER BY airline_count DESC";
@@ -4296,7 +4296,7 @@  discard block
 block discarded – undo
4296 4296
 		$airline_array = array();
4297 4297
 		$temp_array = array();
4298 4298
         
4299
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4299
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4300 4300
 		{
4301 4301
 			$temp_array['airline_name'] = $row['airline_name'];
4302 4302
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4316,11 +4316,11 @@  discard block
 block discarded – undo
4316 4316
 	* @return Array the airline country list
4317 4317
 	*
4318 4318
 	*/
4319
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4319
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4320 4320
 	{
4321
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4322
-		$filter_query = $this->getFilter($filters,true,true);
4323
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4321
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4322
+		$filter_query = $this->getFilter($filters, true, true);
4323
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4324 4324
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4325 4325
                     GROUP BY spotter_output.airline_country
4326 4326
 					ORDER BY airline_country_count DESC
@@ -4333,7 +4333,7 @@  discard block
 block discarded – undo
4333 4333
 		$airline_country_array = array();
4334 4334
 		$temp_array = array();
4335 4335
         
4336
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4336
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4337 4337
 		{
4338 4338
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4339 4339
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4352,11 +4352,11 @@  discard block
 block discarded – undo
4352 4352
 	* @return Array the airline list
4353 4353
 	*
4354 4354
 	*/
4355
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4355
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4356 4356
 	{
4357
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4358
-		$filter_query = $this->getFilter($filters,true,true);
4359
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4357
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4358
+		$filter_query = $this->getFilter($filters, true, true);
4359
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4360 4360
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4361 4361
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4362 4362
 		    ORDER BY airline_count DESC";
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
 		$airline_array = array();
4369 4369
 		$temp_array = array();
4370 4370
         
4371
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4371
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4372 4372
 		{
4373 4373
 			$temp_array['airline_name'] = $row['airline_name'];
4374 4374
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4387,11 +4387,11 @@  discard block
 block discarded – undo
4387 4387
 	* @return Array the airline country list
4388 4388
 	*
4389 4389
 	*/
4390
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4390
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4391 4391
 	{
4392
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4393
-		$filter_query = $this->getFilter($filters,true,true);
4394
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4392
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4393
+		$filter_query = $this->getFilter($filters, true, true);
4394
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4395 4395
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4396 4396
 					GROUP BY spotter_output.airline_country
4397 4397
 					ORDER BY airline_country_count DESC
@@ -4404,7 +4404,7 @@  discard block
 block discarded – undo
4404 4404
 		$airline_country_array = array();
4405 4405
 		$temp_array = array();
4406 4406
         
4407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4408 4408
 		{
4409 4409
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4410 4410
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4421,11 +4421,11 @@  discard block
 block discarded – undo
4421 4421
 	* @return Array the airline list
4422 4422
 	*
4423 4423
 	*/
4424
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4424
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4425 4425
 	{
4426
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4427
-		$filter_query = $this->getFilter($filters,true,true);
4428
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4426
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4427
+		$filter_query = $this->getFilter($filters, true, true);
4428
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4429 4429
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4430 4430
 					GROUP BY spotter_output.airline_name
4431 4431
 					ORDER BY airline_count DESC";
@@ -4436,7 +4436,7 @@  discard block
 block discarded – undo
4436 4436
 		$airline_array = array();
4437 4437
 		$temp_array = array();
4438 4438
         
4439
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4439
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4440 4440
 		{
4441 4441
 			$temp_array['airline_name'] = $row['airline_name'];
4442 4442
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4456,11 +4456,11 @@  discard block
 block discarded – undo
4456 4456
 	* @return Array the airline country list
4457 4457
 	*
4458 4458
 	*/
4459
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4459
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4460 4460
 	{
4461
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4462
-		$filter_query = $this->getFilter($filters,true,true);
4463
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4461
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4462
+		$filter_query = $this->getFilter($filters, true, true);
4463
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4464 4464
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4465 4465
 					GROUP BY spotter_output.airline_country
4466 4466
 					ORDER BY airline_country_count DESC
@@ -4473,7 +4473,7 @@  discard block
 block discarded – undo
4473 4473
 		$airline_country_array = array();
4474 4474
 		$temp_array = array();
4475 4475
         
4476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4477 4477
 		{
4478 4478
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4479 4479
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4489,11 +4489,11 @@  discard block
 block discarded – undo
4489 4489
 	* @return Array the airline list
4490 4490
 	*
4491 4491
 	*/
4492
-	public function countAllAirlinesByDate($date,$filters = array())
4492
+	public function countAllAirlinesByDate($date, $filters = array())
4493 4493
 	{
4494 4494
 		global $globalTimezone, $globalDBdriver;
4495
-		$filter_query = $this->getFilter($filters,true,true);
4496
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4495
+		$filter_query = $this->getFilter($filters, true, true);
4496
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4497 4497
 		if ($globalTimezone != '') {
4498 4498
 			date_default_timezone_set($globalTimezone);
4499 4499
 			$datetime = new DateTime($date);
@@ -4501,12 +4501,12 @@  discard block
 block discarded – undo
4501 4501
 		} else $offset = '+00:00';
4502 4502
 
4503 4503
 		if ($globalDBdriver == 'mysql') {
4504
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4504
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4505 4505
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4506 4506
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4507 4507
 					ORDER BY airline_count DESC";
4508 4508
 		} else {
4509
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4509
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4510 4510
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4511 4511
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4512 4512
 					ORDER BY airline_count DESC";
@@ -4517,7 +4517,7 @@  discard block
 block discarded – undo
4517 4517
 
4518 4518
 		$airline_array = array();
4519 4519
 		$temp_array = array();
4520
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4520
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4521 4521
 		{
4522 4522
 			$temp_array['airline_name'] = $row['airline_name'];
4523 4523
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
 	* @return Array the airline country list
4538 4538
 	*
4539 4539
 	*/
4540
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4540
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4541 4541
 	{
4542 4542
 		global $globalTimezone, $globalDBdriver;
4543
-		$filter_query = $this->getFilter($filters,true,true);
4544
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4543
+		$filter_query = $this->getFilter($filters, true, true);
4544
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4545 4545
 		if ($globalTimezone != '') {
4546 4546
 			date_default_timezone_set($globalTimezone);
4547 4547
 			$datetime = new DateTime($date);
@@ -4549,13 +4549,13 @@  discard block
 block discarded – undo
4549 4549
 		} else $offset = '+00:00';
4550 4550
 		
4551 4551
 		if ($globalDBdriver == 'mysql') {
4552
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4552
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4553 4553
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4554 4554
 					GROUP BY spotter_output.airline_country
4555 4555
 					ORDER BY airline_country_count DESC
4556 4556
 					LIMIT 10 OFFSET 0";
4557 4557
 		} else {
4558
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4558
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4559 4559
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4560 4560
 					GROUP BY spotter_output.airline_country
4561 4561
 					ORDER BY airline_country_count DESC
@@ -4567,7 +4567,7 @@  discard block
 block discarded – undo
4567 4567
  
4568 4568
 		$airline_country_array = array();
4569 4569
 		$temp_array = array();
4570
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4570
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4571 4571
 		{
4572 4572
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4573 4573
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4584,11 +4584,11 @@  discard block
 block discarded – undo
4584 4584
 	* @return Array the airline list
4585 4585
 	*
4586 4586
 	*/
4587
-	public function countAllAirlinesByIdent($ident,$filters = array())
4587
+	public function countAllAirlinesByIdent($ident, $filters = array())
4588 4588
 	{
4589
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4590
-		$filter_query = $this->getFilter($filters,true,true);
4591
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4589
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4590
+		$filter_query = $this->getFilter($filters, true, true);
4591
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4592 4592
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4593 4593
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4594 4594
 				ORDER BY airline_count DESC";
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 	* @return Array the airline list
4606 4606
 	*
4607 4607
 	*/
4608
-	public function countAllAirlinesByOwner($owner,$filters = array())
4608
+	public function countAllAirlinesByOwner($owner, $filters = array())
4609 4609
 	{
4610
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4611
-		$filter_query = $this->getFilter($filters,true,true);
4612
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4610
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4611
+		$filter_query = $this->getFilter($filters, true, true);
4612
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4613 4613
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4614 4614
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4615 4615
 				ORDER BY airline_count DESC";
@@ -4626,45 +4626,45 @@  discard block
 block discarded – undo
4626 4626
 	* @return String Duration of all flights
4627 4627
 	*
4628 4628
 	*/
4629
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4629
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4630 4630
 	{
4631
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4632
-		$filter_query = $this->getFilter($filters,true,true);
4633
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4631
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4632
+		$filter_query = $this->getFilter($filters, true, true);
4633
+		$query = "SELECT SUM(last_seen - date) AS duration 
4634 4634
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4635 4635
 		$query_values = array();
4636 4636
 		if ($year != '') {
4637 4637
 			if ($globalDBdriver == 'mysql') {
4638 4638
 				$query .= " AND YEAR(spotter_output.date) = :year";
4639
-				$query_values = array_merge($query_values,array(':year' => $year));
4639
+				$query_values = array_merge($query_values, array(':year' => $year));
4640 4640
 			} else {
4641 4641
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4642
-				$query_values = array_merge($query_values,array(':year' => $year));
4642
+				$query_values = array_merge($query_values, array(':year' => $year));
4643 4643
 			}
4644 4644
 		}
4645 4645
 		if ($month != '') {
4646 4646
 			if ($globalDBdriver == 'mysql') {
4647 4647
 				$query .= " AND MONTH(spotter_output.date) = :month";
4648
-				$query_values = array_merge($query_values,array(':month' => $month));
4648
+				$query_values = array_merge($query_values, array(':month' => $month));
4649 4649
 			} else {
4650 4650
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4651
-				$query_values = array_merge($query_values,array(':month' => $month));
4651
+				$query_values = array_merge($query_values, array(':month' => $month));
4652 4652
 			}
4653 4653
 		}
4654 4654
 		if ($day != '') {
4655 4655
 			if ($globalDBdriver == 'mysql') {
4656 4656
 				$query .= " AND DAY(spotter_output.date) = :day";
4657
-				$query_values = array_merge($query_values,array(':day' => $day));
4657
+				$query_values = array_merge($query_values, array(':day' => $day));
4658 4658
 			} else {
4659 4659
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4660
-				$query_values = array_merge($query_values,array(':day' => $day));
4660
+				$query_values = array_merge($query_values, array(':day' => $day));
4661 4661
 			}
4662 4662
 		}
4663
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4663
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4664 4664
 		$sth = $this->db->prepare($query);
4665 4665
 		$sth->execute($query_values);
4666 4666
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4667
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4667
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4668 4668
 		else return $result[0]['duration'];
4669 4669
 	}
4670 4670
 
@@ -4674,14 +4674,14 @@  discard block
 block discarded – undo
4674 4674
 	* @return String Duration of all flights
4675 4675
 	*
4676 4676
 	*/
4677
-	public function countFlightsByOwner($owner,$filters = array())
4677
+	public function countFlightsByOwner($owner, $filters = array())
4678 4678
 	{
4679
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4680
-		$filter_query = $this->getFilter($filters,true,true);
4681
-		$query  = "SELECT COUNT(*) AS nb 
4679
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4680
+		$filter_query = $this->getFilter($filters, true, true);
4681
+		$query = "SELECT COUNT(*) AS nb 
4682 4682
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4683 4683
 		$query_values = array();
4684
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4684
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4685 4685
 		$sth = $this->db->prepare($query);
4686 4686
 		$sth->execute($query_values);
4687 4687
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4694,14 +4694,14 @@  discard block
 block discarded – undo
4694 4694
 	* @return String Duration of all flights
4695 4695
 	*
4696 4696
 	*/
4697
-	public function countFlightsByPilot($pilot,$filters = array())
4697
+	public function countFlightsByPilot($pilot, $filters = array())
4698 4698
 	{
4699
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4700
-		$filter_query = $this->getFilter($filters,true,true);
4701
-		$query  = "SELECT COUNT(*) AS nb 
4699
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4700
+		$filter_query = $this->getFilter($filters, true, true);
4701
+		$query = "SELECT COUNT(*) AS nb 
4702 4702
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4703 4703
 		$query_values = array();
4704
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4704
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4705 4705
 		$sth = $this->db->prepare($query);
4706 4706
 		$sth->execute($query_values);
4707 4707
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4714,45 +4714,45 @@  discard block
 block discarded – undo
4714 4714
 	* @return String Duration of all flights
4715 4715
 	*
4716 4716
 	*/
4717
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4717
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4718 4718
 	{
4719
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4720
-		$filter_query = $this->getFilter($filters,true,true);
4721
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4719
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4720
+		$filter_query = $this->getFilter($filters, true, true);
4721
+		$query = "SELECT SUM(last_seen - date) AS duration 
4722 4722
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
4723 4723
 		$query_values = array();
4724 4724
 		if ($year != '') {
4725 4725
 			if ($globalDBdriver == 'mysql') {
4726 4726
 				$query .= " AND YEAR(spotter_output.date) = :year";
4727
-				$query_values = array_merge($query_values,array(':year' => $year));
4727
+				$query_values = array_merge($query_values, array(':year' => $year));
4728 4728
 			} else {
4729 4729
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4730
-				$query_values = array_merge($query_values,array(':year' => $year));
4730
+				$query_values = array_merge($query_values, array(':year' => $year));
4731 4731
 			}
4732 4732
 		}
4733 4733
 		if ($month != '') {
4734 4734
 			if ($globalDBdriver == 'mysql') {
4735 4735
 				$query .= " AND MONTH(spotter_output.date) = :month";
4736
-				$query_values = array_merge($query_values,array(':month' => $month));
4736
+				$query_values = array_merge($query_values, array(':month' => $month));
4737 4737
 			} else {
4738 4738
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4739
-				$query_values = array_merge($query_values,array(':month' => $month));
4739
+				$query_values = array_merge($query_values, array(':month' => $month));
4740 4740
 			}
4741 4741
 		}
4742 4742
 		if ($day != '') {
4743 4743
 			if ($globalDBdriver == 'mysql') {
4744 4744
 				$query .= " AND DAY(spotter_output.date) = :day";
4745
-				$query_values = array_merge($query_values,array(':day' => $day));
4745
+				$query_values = array_merge($query_values, array(':day' => $day));
4746 4746
 			} else {
4747 4747
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4748
-				$query_values = array_merge($query_values,array(':day' => $day));
4748
+				$query_values = array_merge($query_values, array(':day' => $day));
4749 4749
 			}
4750 4750
 		}
4751
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4751
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4752 4752
 		$sth = $this->db->prepare($query);
4753 4753
 		$sth->execute($query_values);
4754 4754
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4755
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4755
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4756 4756
 		else return $result[0]['duration'];
4757 4757
 	}
4758 4758
 
@@ -4762,11 +4762,11 @@  discard block
 block discarded – undo
4762 4762
 	* @return Array the airline list
4763 4763
 	*
4764 4764
 	*/
4765
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4765
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4766 4766
 	{
4767
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4768
-		$filter_query = $this->getFilter($filters,true,true);
4769
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4767
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4768
+		$filter_query = $this->getFilter($filters, true, true);
4769
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4770 4770
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4771 4771
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4772 4772
 				ORDER BY airline_count DESC";
@@ -4783,25 +4783,25 @@  discard block
 block discarded – undo
4783 4783
 	* @return Array the airline list
4784 4784
 	*
4785 4785
 	*/
4786
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4786
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4787 4787
 	{
4788
-		$filter_query = $this->getFilter($filters,true,true);
4789
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4790
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4788
+		$filter_query = $this->getFilter($filters, true, true);
4789
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4790
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4791 4791
 
4792
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4792
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4793 4793
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4794 4794
 					GROUP BY spotter_output.airline_name
4795 4795
 					ORDER BY airline_count DESC";
4796 4796
       
4797 4797
 		
4798 4798
 		$sth = $this->db->prepare($query);
4799
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4799
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4800 4800
       
4801 4801
 		$airline_array = array();
4802 4802
 		$temp_array = array();
4803 4803
         
4804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4805 4805
 		{
4806 4806
 			$temp_array['airline_name'] = $row['airline_name'];
4807 4807
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4819,13 +4819,13 @@  discard block
 block discarded – undo
4819 4819
 	* @return Array the airline country list
4820 4820
 	*
4821 4821
 	*/
4822
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4822
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4823 4823
 	{
4824
-		$filter_query = $this->getFilter($filters,true,true);
4825
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4826
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4824
+		$filter_query = $this->getFilter($filters, true, true);
4825
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4826
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4827 4827
       
4828
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4828
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4829 4829
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4830 4830
 				GROUP BY spotter_output.airline_country
4831 4831
 				ORDER BY airline_country_count DESC
@@ -4833,11 +4833,11 @@  discard block
 block discarded – undo
4833 4833
       
4834 4834
 		
4835 4835
 		$sth = $this->db->prepare($query);
4836
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4836
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4837 4837
       
4838 4838
 		$airline_country_array = array();
4839 4839
 		$temp_array = array();
4840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4841 4841
 		{
4842 4842
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4843 4843
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4855,11 +4855,11 @@  discard block
 block discarded – undo
4855 4855
 	* @return Array the airline list
4856 4856
 	*
4857 4857
 	*/
4858
-	public function countAllAirlinesByCountry($country,$filters = array())
4858
+	public function countAllAirlinesByCountry($country, $filters = array())
4859 4859
 	{
4860
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4861
-		$filter_query = $this->getFilter($filters,true,true);
4862
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4860
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4861
+		$filter_query = $this->getFilter($filters, true, true);
4862
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4863 4863
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4864 4864
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4865 4865
 			    ORDER BY airline_count DESC";
@@ -4870,7 +4870,7 @@  discard block
 block discarded – undo
4870 4870
 
4871 4871
 		$airline_array = array();
4872 4872
 		$temp_array = array();
4873
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4873
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4874 4874
 		{
4875 4875
 			$temp_array['airline_name'] = $row['airline_name'];
4876 4876
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4889,11 +4889,11 @@  discard block
 block discarded – undo
4889 4889
 	* @return Array the airline country list
4890 4890
 	*
4891 4891
 	*/
4892
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4892
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4893 4893
 	{
4894
-		$filter_query = $this->getFilter($filters,true,true);
4895
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4896
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4894
+		$filter_query = $this->getFilter($filters, true, true);
4895
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4896
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4897 4897
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4898 4898
 				GROUP BY spotter_output.airline_country
4899 4899
 				ORDER BY airline_country_count DESC
@@ -4905,7 +4905,7 @@  discard block
 block discarded – undo
4905 4905
 
4906 4906
 		$airline_country_array = array();
4907 4907
 		$temp_array = array();
4908
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4908
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4909 4909
 		{
4910 4910
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4911 4911
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4925,35 +4925,35 @@  discard block
 block discarded – undo
4925 4925
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4926 4926
 	{
4927 4927
 		global $globalDBdriver;
4928
-		$filter_query = $this->getFilter($filters,true,true);
4929
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4928
+		$filter_query = $this->getFilter($filters, true, true);
4929
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4930 4930
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4931 4931
 		$query_values = array();
4932 4932
 		if ($year != '') {
4933 4933
 			if ($globalDBdriver == 'mysql') {
4934 4934
 				$query .= " AND YEAR(spotter_output.date) = :year";
4935
-				$query_values = array_merge($query_values,array(':year' => $year));
4935
+				$query_values = array_merge($query_values, array(':year' => $year));
4936 4936
 			} else {
4937 4937
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4938
-				$query_values = array_merge($query_values,array(':year' => $year));
4938
+				$query_values = array_merge($query_values, array(':year' => $year));
4939 4939
 			}
4940 4940
 		}
4941 4941
 		if ($month != '') {
4942 4942
 			if ($globalDBdriver == 'mysql') {
4943 4943
 				$query .= " AND MONTH(spotter_output.date) = :month";
4944
-				$query_values = array_merge($query_values,array(':month' => $month));
4944
+				$query_values = array_merge($query_values, array(':month' => $month));
4945 4945
 			} else {
4946 4946
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4947
-				$query_values = array_merge($query_values,array(':month' => $month));
4947
+				$query_values = array_merge($query_values, array(':month' => $month));
4948 4948
 			}
4949 4949
 		}
4950 4950
 		if ($day != '') {
4951 4951
 			if ($globalDBdriver == 'mysql') {
4952 4952
 				$query .= " AND DAY(spotter_output.date) = :day";
4953
-				$query_values = array_merge($query_values,array(':day' => $day));
4953
+				$query_values = array_merge($query_values, array(':day' => $day));
4954 4954
 			} else {
4955 4955
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4956
-				$query_values = array_merge($query_values,array(':day' => $day));
4956
+				$query_values = array_merge($query_values, array(':day' => $day));
4957 4957
 			}
4958 4958
 		}
4959 4959
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4965,7 +4965,7 @@  discard block
 block discarded – undo
4965 4965
 
4966 4966
 		$airline_array = array();
4967 4967
 		$temp_array = array();
4968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4969 4969
 		{
4970 4970
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4971 4971
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4981,11 +4981,11 @@  discard block
 block discarded – undo
4981 4981
 	* @return Array the airline country list
4982 4982
 	*
4983 4983
 	*/
4984
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4984
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4985 4985
 	{
4986 4986
 		global $globalDBdriver;
4987 4987
 		//$filter_query = $this->getFilter($filters,true,true);
4988
-		$Connection= new Connection($this->db);
4988
+		$Connection = new Connection($this->db);
4989 4989
 		if (!$Connection->tableExists('countries')) return array();
4990 4990
 		/*
4991 4991
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5000,7 +5000,7 @@  discard block
 block discarded – undo
5000 5000
 */
5001 5001
 		require_once('class.SpotterLive.php');
5002 5002
 		$SpotterLive = new SpotterLive();
5003
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5003
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5004 5004
 		$filter_query .= ' over_country IS NOT NULL';
5005 5005
                 if ($olderthanmonths > 0) {
5006 5006
 			if ($globalDBdriver == 'mysql') {
@@ -5027,7 +5027,7 @@  discard block
 block discarded – undo
5027 5027
 		$flight_array = array();
5028 5028
 		$temp_array = array();
5029 5029
         
5030
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5030
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5031 5031
 		{
5032 5032
 			$temp_array['flight_count'] = $row['nb'];
5033 5033
 			$temp_array['flight_country'] = $row['name'];
@@ -5045,11 +5045,11 @@  discard block
 block discarded – undo
5045 5045
 	* @return Array the aircraft list
5046 5046
 	*
5047 5047
 	*/
5048
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5048
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5049 5049
 	{
5050 5050
 		global $globalDBdriver;
5051
-		$filter_query = $this->getFilter($filters,true,true);
5052
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5051
+		$filter_query = $this->getFilter($filters, true, true);
5052
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5053 5053
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5054 5054
 		if ($olderthanmonths > 0) {
5055 5055
 			if ($globalDBdriver == 'mysql') {
@@ -5069,28 +5069,28 @@  discard block
 block discarded – undo
5069 5069
 		if ($year != '') {
5070 5070
 			if ($globalDBdriver == 'mysql') {
5071 5071
 				$query .= " AND YEAR(spotter_output.date) = :year";
5072
-				$query_values = array_merge($query_values,array(':year' => $year));
5072
+				$query_values = array_merge($query_values, array(':year' => $year));
5073 5073
 			} else {
5074 5074
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5075
-				$query_values = array_merge($query_values,array(':year' => $year));
5075
+				$query_values = array_merge($query_values, array(':year' => $year));
5076 5076
 			}
5077 5077
 		}
5078 5078
 		if ($month != '') {
5079 5079
 			if ($globalDBdriver == 'mysql') {
5080 5080
 				$query .= " AND MONTH(spotter_output.date) = :month";
5081
-				$query_values = array_merge($query_values,array(':month' => $month));
5081
+				$query_values = array_merge($query_values, array(':month' => $month));
5082 5082
 			} else {
5083 5083
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5084
-				$query_values = array_merge($query_values,array(':month' => $month));
5084
+				$query_values = array_merge($query_values, array(':month' => $month));
5085 5085
 			}
5086 5086
 		}
5087 5087
 		if ($day != '') {
5088 5088
 			if ($globalDBdriver == 'mysql') {
5089 5089
 				$query .= " AND DAY(spotter_output.date) = :day";
5090
-				$query_values = array_merge($query_values,array(':day' => $day));
5090
+				$query_values = array_merge($query_values, array(':day' => $day));
5091 5091
 			} else {
5092 5092
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5093
-				$query_values = array_merge($query_values,array(':day' => $day));
5093
+				$query_values = array_merge($query_values, array(':day' => $day));
5094 5094
 			}
5095 5095
 		}
5096 5096
 
@@ -5102,7 +5102,7 @@  discard block
 block discarded – undo
5102 5102
 
5103 5103
 		$aircraft_array = array();
5104 5104
 		$temp_array = array();
5105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5106 5106
 		{
5107 5107
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5108 5108
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5119,11 +5119,11 @@  discard block
 block discarded – undo
5119 5119
 	* @return Array the aircraft list
5120 5120
 	*
5121 5121
 	*/
5122
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5122
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5123 5123
 	{
5124 5124
 		global $globalDBdriver;
5125
-		$filter_query = $this->getFilter($filters,true,true);
5126
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5125
+		$filter_query = $this->getFilter($filters, true, true);
5126
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5127 5127
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA'";
5128 5128
 		if ($olderthanmonths > 0) {
5129 5129
 			if ($globalDBdriver == 'mysql') {
@@ -5143,28 +5143,28 @@  discard block
 block discarded – undo
5143 5143
 		if ($year != '') {
5144 5144
 			if ($globalDBdriver == 'mysql') {
5145 5145
 				$query .= " AND YEAR(spotter_output.date) = :year";
5146
-				$query_values = array_merge($query_values,array(':year' => $year));
5146
+				$query_values = array_merge($query_values, array(':year' => $year));
5147 5147
 			} else {
5148 5148
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5149
-				$query_values = array_merge($query_values,array(':year' => $year));
5149
+				$query_values = array_merge($query_values, array(':year' => $year));
5150 5150
 			}
5151 5151
 		}
5152 5152
 		if ($month != '') {
5153 5153
 			if ($globalDBdriver == 'mysql') {
5154 5154
 				$query .= " AND MONTH(spotter_output.date) = :month";
5155
-				$query_values = array_merge($query_values,array(':month' => $month));
5155
+				$query_values = array_merge($query_values, array(':month' => $month));
5156 5156
 			} else {
5157 5157
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5158
-				$query_values = array_merge($query_values,array(':month' => $month));
5158
+				$query_values = array_merge($query_values, array(':month' => $month));
5159 5159
 			}
5160 5160
 		}
5161 5161
 		if ($day != '') {
5162 5162
 			if ($globalDBdriver == 'mysql') {
5163 5163
 				$query .= " AND DAY(spotter_output.date) = :day";
5164
-				$query_values = array_merge($query_values,array(':day' => $day));
5164
+				$query_values = array_merge($query_values, array(':day' => $day));
5165 5165
 			} else {
5166 5166
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5167
-				$query_values = array_merge($query_values,array(':day' => $day));
5167
+				$query_values = array_merge($query_values, array(':day' => $day));
5168 5168
 			}
5169 5169
 		}
5170 5170
 
@@ -5176,7 +5176,7 @@  discard block
 block discarded – undo
5176 5176
 
5177 5177
 		$aircraft_array = array();
5178 5178
 		$temp_array = array();
5179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5180 5180
 		{
5181 5181
 			$temp_array['airline_icao'] = $row['airline_icao'];
5182 5182
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5194,11 +5194,11 @@  discard block
 block discarded – undo
5194 5194
 	* @return Array the aircraft list
5195 5195
 	*
5196 5196
 	*/
5197
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5197
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5198 5198
 	{
5199 5199
 		global $globalDBdriver;
5200
-		$filter_query = $this->getFilter($filters,true,true);
5201
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5200
+		$filter_query = $this->getFilter($filters, true, true);
5201
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5202 5202
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
5203 5203
 		if ($olderthanmonths > 0) {
5204 5204
 			if ($globalDBdriver == 'mysql') {
@@ -5223,7 +5223,7 @@  discard block
 block discarded – undo
5223 5223
 
5224 5224
 		$aircraft_array = array();
5225 5225
 		$temp_array = array();
5226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5227 5227
 		{
5228 5228
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5229 5229
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5242,13 +5242,13 @@  discard block
 block discarded – undo
5242 5242
 	* @return Array the aircraft list
5243 5243
 	*
5244 5244
 	*/
5245
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5245
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5246 5246
 	{
5247 5247
 		$Image = new Image($this->db);
5248
-		$filter_query = $this->getFilter($filters,true,true);
5249
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5248
+		$filter_query = $this->getFilter($filters, true, true);
5249
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5250 5250
 
5251
-		$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  
5251
+		$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  
5252 5252
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5253 5253
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5254 5254
 				ORDER BY registration_count DESC";
@@ -5259,14 +5259,14 @@  discard block
 block discarded – undo
5259 5259
 		$aircraft_array = array();
5260 5260
 		$temp_array = array();
5261 5261
         
5262
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5262
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5263 5263
 		{
5264 5264
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5265 5265
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5266 5266
 			$temp_array['registration'] = $row['registration'];
5267 5267
 			$temp_array['airline_name'] = $row['airline_name'];
5268 5268
 			$temp_array['image_thumbnail'] = "";
5269
-			if($row['registration'] != "")
5269
+			if ($row['registration'] != "")
5270 5270
 			{
5271 5271
 				$image_array = $Image->getSpotterImage($row['registration']);
5272 5272
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5285,11 +5285,11 @@  discard block
 block discarded – undo
5285 5285
 	* @return Array the aircraft list
5286 5286
 	*
5287 5287
 	*/
5288
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5288
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5289 5289
 	{
5290
-		$filter_query = $this->getFilter($filters,true,true);
5291
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5292
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5290
+		$filter_query = $this->getFilter($filters, true, true);
5291
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5292
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5293 5293
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5294 5294
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5295 5295
 			    ORDER BY aircraft_icao_count DESC";
@@ -5300,7 +5300,7 @@  discard block
 block discarded – undo
5300 5300
 		$aircraft_array = array();
5301 5301
 		$temp_array = array();
5302 5302
 
5303
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5303
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5304 5304
 		{
5305 5305
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5306 5306
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5318,13 +5318,13 @@  discard block
 block discarded – undo
5318 5318
 	* @return Array the aircraft list
5319 5319
 	*
5320 5320
 	*/
5321
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5321
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5322 5322
 	{
5323
-		$filter_query = $this->getFilter($filters,true,true);
5323
+		$filter_query = $this->getFilter($filters, true, true);
5324 5324
 		$Image = new Image($this->db);
5325
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5325
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5326 5326
 
5327
-		$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 
5327
+		$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 
5328 5328
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5329 5329
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5330 5330
 			    ORDER BY registration_count DESC";
@@ -5334,14 +5334,14 @@  discard block
 block discarded – undo
5334 5334
 
5335 5335
 		$aircraft_array = array();
5336 5336
 		$temp_array = array();
5337
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5337
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5338 5338
 		{
5339 5339
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5340 5340
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5341 5341
 			$temp_array['registration'] = $row['registration'];
5342 5342
 			$temp_array['airline_name'] = $row['airline_name'];
5343 5343
 			$temp_array['image_thumbnail'] = "";
5344
-			if($row['registration'] != "")
5344
+			if ($row['registration'] != "")
5345 5345
 			{
5346 5346
 				$image_array = $Image->getSpotterImage($row['registration']);
5347 5347
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5360,11 +5360,11 @@  discard block
 block discarded – undo
5360 5360
 	* @return Array the aircraft list
5361 5361
 	*
5362 5362
 	*/
5363
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5363
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5364 5364
 	{
5365
-		$filter_query = $this->getFilter($filters,true,true);
5366
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5367
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5365
+		$filter_query = $this->getFilter($filters, true, true);
5366
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5367
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5368 5368
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5369 5369
 				GROUP BY spotter_output.aircraft_manufacturer 
5370 5370
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5375,7 +5375,7 @@  discard block
 block discarded – undo
5375 5375
 		$aircraft_array = array();
5376 5376
 		$temp_array = array();
5377 5377
 
5378
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5378
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5379 5379
 		{
5380 5380
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5381 5381
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5392,12 +5392,12 @@  discard block
 block discarded – undo
5392 5392
 	* @return Array the aircraft list
5393 5393
 	*
5394 5394
 	*/
5395
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5395
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5396 5396
 	{
5397
-		$filter_query = $this->getFilter($filters,true,true);
5398
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5397
+		$filter_query = $this->getFilter($filters, true, true);
5398
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5399 5399
 
5400
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5400
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5401 5401
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
5402 5402
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5403 5403
 				ORDER BY aircraft_icao_count DESC";
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
 
5408 5408
 		$aircraft_array = array();
5409 5409
 		$temp_array = array();
5410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5411 5411
 		{
5412 5412
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5413 5413
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5425,13 +5425,13 @@  discard block
 block discarded – undo
5425 5425
 	* @return Array the aircraft list
5426 5426
 	*
5427 5427
 	*/
5428
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5428
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5429 5429
 	{
5430
-		$filter_query = $this->getFilter($filters,true,true);
5430
+		$filter_query = $this->getFilter($filters, true, true);
5431 5431
 		$Image = new Image($this->db);
5432
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5432
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5433 5433
 
5434
-		$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  
5434
+		$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  
5435 5435
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5436 5436
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5437 5437
 		    ORDER BY registration_count DESC";
@@ -5441,14 +5441,14 @@  discard block
 block discarded – undo
5441 5441
 
5442 5442
 		$aircraft_array = array();
5443 5443
 		$temp_array = array();
5444
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5444
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5445 5445
 		{
5446 5446
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5447 5447
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5448 5448
 			$temp_array['registration'] = $row['registration'];
5449 5449
 			$temp_array['airline_name'] = $row['airline_name'];
5450 5450
 			$temp_array['image_thumbnail'] = "";
5451
-			if($row['registration'] != "")
5451
+			if ($row['registration'] != "")
5452 5452
 			{
5453 5453
 				$image_array = $Image->getSpotterImage($row['registration']);
5454 5454
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5466,11 +5466,11 @@  discard block
 block discarded – undo
5466 5466
 	* @return Array the aircraft list
5467 5467
 	*
5468 5468
 	*/
5469
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5469
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5470 5470
 	{
5471
-		$filter_query = $this->getFilter($filters,true,true);
5472
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5473
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5471
+		$filter_query = $this->getFilter($filters, true, true);
5472
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5473
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5474 5474
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
5475 5475
                     GROUP BY spotter_output.aircraft_manufacturer 
5476 5476
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5481,7 +5481,7 @@  discard block
 block discarded – undo
5481 5481
 
5482 5482
 		$aircraft_array = array();
5483 5483
 		$temp_array = array();
5484
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5484
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5485 5485
 		{
5486 5486
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5487 5487
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5496,12 +5496,12 @@  discard block
 block discarded – undo
5496 5496
 	* @return Array the aircraft list
5497 5497
 	*
5498 5498
 	*/
5499
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5499
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5500 5500
 	{
5501
-		$filter_query = $this->getFilter($filters,true,true);
5502
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5501
+		$filter_query = $this->getFilter($filters, true, true);
5502
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5503 5503
 
5504
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5504
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5505 5505
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5506 5506
                     GROUP BY spotter_output.aircraft_name 
5507 5507
 					ORDER BY aircraft_icao_count DESC";
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5511 5511
 		$aircraft_array = array();
5512 5512
 		$temp_array = array();
5513
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5513
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5514 5514
 		{
5515 5515
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5516 5516
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5529,11 +5529,11 @@  discard block
 block discarded – undo
5529 5529
 	*/
5530 5530
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5531 5531
 	{
5532
-		$filter_query = $this->getFilter($filters,true,true);
5532
+		$filter_query = $this->getFilter($filters, true, true);
5533 5533
 		$Image = new Image($this->db);
5534
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5534
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5535 5535
 
5536
-		$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   
5536
+		$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   
5537 5537
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5538 5538
                     GROUP BY spotter_output.registration 
5539 5539
 					ORDER BY registration_count DESC";
@@ -5543,14 +5543,14 @@  discard block
 block discarded – undo
5543 5543
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5544 5544
 		$aircraft_array = array();
5545 5545
 		$temp_array = array();
5546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5547 5547
 		{
5548 5548
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5549 5549
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5550 5550
 			$temp_array['registration'] = $row['registration'];
5551 5551
 			$temp_array['airline_name'] = $row['airline_name'];
5552 5552
 			$temp_array['image_thumbnail'] = "";
5553
-			if($row['registration'] != "")
5553
+			if ($row['registration'] != "")
5554 5554
 			{
5555 5555
 				$image_array = $Image->getSpotterImage($row['registration']);
5556 5556
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5567,11 +5567,11 @@  discard block
 block discarded – undo
5567 5567
 	* @return Array the aircraft list
5568 5568
 	*
5569 5569
 	*/
5570
-	public function countAllAircraftTypesByDate($date,$filters = array())
5570
+	public function countAllAircraftTypesByDate($date, $filters = array())
5571 5571
 	{
5572 5572
 		global $globalTimezone, $globalDBdriver;
5573
-		$filter_query = $this->getFilter($filters,true,true);
5574
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5573
+		$filter_query = $this->getFilter($filters, true, true);
5574
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5575 5575
 		if ($globalTimezone != '') {
5576 5576
 			date_default_timezone_set($globalTimezone);
5577 5577
 			$datetime = new DateTime($date);
@@ -5579,12 +5579,12 @@  discard block
 block discarded – undo
5579 5579
 		} else $offset = '+00:00';
5580 5580
 
5581 5581
 		if ($globalDBdriver == 'mysql') {
5582
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5582
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5583 5583
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5584 5584
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5585 5585
 					ORDER BY aircraft_icao_count DESC";
5586 5586
 		} else {
5587
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5587
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5588 5588
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5589 5589
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5590 5590
 					ORDER BY aircraft_icao_count DESC";
@@ -5595,7 +5595,7 @@  discard block
 block discarded – undo
5595 5595
 
5596 5596
 		$aircraft_array = array();
5597 5597
 		$temp_array = array();
5598
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5598
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5599 5599
 		{
5600 5600
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5601 5601
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5613,12 +5613,12 @@  discard block
 block discarded – undo
5613 5613
 	* @return Array the aircraft list
5614 5614
 	*
5615 5615
 	*/
5616
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5616
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5617 5617
 	{
5618 5618
 		global $globalTimezone, $globalDBdriver;
5619
-		$filter_query = $this->getFilter($filters,true,true);
5619
+		$filter_query = $this->getFilter($filters, true, true);
5620 5620
 		$Image = new Image($this->db);
5621
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5621
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5622 5622
 		if ($globalTimezone != '') {
5623 5623
 			date_default_timezone_set($globalTimezone);
5624 5624
 			$datetime = new DateTime($date);
@@ -5626,12 +5626,12 @@  discard block
 block discarded – undo
5626 5626
 		} else $offset = '+00:00';
5627 5627
 
5628 5628
 		if ($globalDBdriver == 'mysql') {
5629
-			$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 
5629
+			$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 
5630 5630
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5631 5631
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5632 5632
 					ORDER BY registration_count DESC";
5633 5633
 		} else {
5634
-			$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    
5634
+			$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    
5635 5635
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5636 5636
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5637 5637
 					ORDER BY registration_count DESC";
@@ -5642,14 +5642,14 @@  discard block
 block discarded – undo
5642 5642
 
5643 5643
 		$aircraft_array = array();
5644 5644
 		$temp_array = array();
5645
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5645
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5646 5646
 		{
5647 5647
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5648 5648
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5649 5649
 			$temp_array['registration'] = $row['registration'];
5650 5650
 			$temp_array['airline_name'] = $row['airline_name'];
5651 5651
 			$temp_array['image_thumbnail'] = "";
5652
-			if($row['registration'] != "")
5652
+			if ($row['registration'] != "")
5653 5653
 			{
5654 5654
 				$image_array = $Image->getSpotterImage($row['registration']);
5655 5655
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5668,11 +5668,11 @@  discard block
 block discarded – undo
5668 5668
 	* @return Array the aircraft manufacturer list
5669 5669
 	*
5670 5670
 	*/
5671
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5671
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5672 5672
 	{
5673 5673
 		global $globalTimezone, $globalDBdriver;
5674
-		$filter_query = $this->getFilter($filters,true,true);
5675
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5674
+		$filter_query = $this->getFilter($filters, true, true);
5675
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5676 5676
 		if ($globalTimezone != '') {
5677 5677
 			date_default_timezone_set($globalTimezone);
5678 5678
 			$datetime = new DateTime($date);
@@ -5680,12 +5680,12 @@  discard block
 block discarded – undo
5680 5680
 		} else $offset = '+00:00';
5681 5681
 
5682 5682
 		if ($globalDBdriver == 'mysql') {
5683
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5683
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5684 5684
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5685 5685
 				GROUP BY spotter_output.aircraft_manufacturer 
5686 5686
 				ORDER BY aircraft_manufacturer_count DESC";
5687 5687
 		} else {
5688
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5688
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5689 5689
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5690 5690
 				GROUP BY spotter_output.aircraft_manufacturer 
5691 5691
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5697,7 +5697,7 @@  discard block
 block discarded – undo
5697 5697
 		$aircraft_array = array();
5698 5698
 		$temp_array = array();
5699 5699
 
5700
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5700
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5701 5701
 		{
5702 5702
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5703 5703
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5714,11 +5714,11 @@  discard block
 block discarded – undo
5714 5714
 	* @return Array the aircraft list
5715 5715
 	*
5716 5716
 	*/
5717
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5717
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5718 5718
 	{
5719
-		$filter_query = $this->getFilter($filters,true,true);
5720
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5721
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5719
+		$filter_query = $this->getFilter($filters, true, true);
5720
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5721
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5722 5722
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5723 5723
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5724 5724
 				ORDER BY aircraft_icao_count DESC";
@@ -5729,7 +5729,7 @@  discard block
 block discarded – undo
5729 5729
 		$aircraft_array = array();
5730 5730
 		$temp_array = array();
5731 5731
 
5732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5733 5733
 		{
5734 5734
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5735 5735
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5746,44 +5746,44 @@  discard block
 block discarded – undo
5746 5746
 	* @return Array the aircraft list
5747 5747
 	*
5748 5748
 	*/
5749
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5749
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5750 5750
 	{
5751
-		$filter_query = $this->getFilter($filters,true,true);
5752
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5753
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5751
+		$filter_query = $this->getFilter($filters, true, true);
5752
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5753
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5754 5754
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5755 5755
 		$query_values = array();
5756 5756
 		if ($year != '') {
5757 5757
 			if ($globalDBdriver == 'mysql') {
5758 5758
 				$query .= " AND YEAR(spotter_output.date) = :year";
5759
-				$query_values = array_merge($query_values,array(':year' => $year));
5759
+				$query_values = array_merge($query_values, array(':year' => $year));
5760 5760
 			} else {
5761 5761
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5762
-				$query_values = array_merge($query_values,array(':year' => $year));
5762
+				$query_values = array_merge($query_values, array(':year' => $year));
5763 5763
 			}
5764 5764
 		}
5765 5765
 		if ($month != '') {
5766 5766
 			if ($globalDBdriver == 'mysql') {
5767 5767
 				$query .= " AND MONTH(spotter_output.date) = :month";
5768
-				$query_values = array_merge($query_values,array(':month' => $month));
5768
+				$query_values = array_merge($query_values, array(':month' => $month));
5769 5769
 			} else {
5770 5770
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5771
-				$query_values = array_merge($query_values,array(':month' => $month));
5771
+				$query_values = array_merge($query_values, array(':month' => $month));
5772 5772
 			}
5773 5773
 		}
5774 5774
 		if ($day != '') {
5775 5775
 			if ($globalDBdriver == 'mysql') {
5776 5776
 				$query .= " AND DAY(spotter_output.date) = :day";
5777
-				$query_values = array_merge($query_values,array(':day' => $day));
5777
+				$query_values = array_merge($query_values, array(':day' => $day));
5778 5778
 			} else {
5779 5779
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5780
-				$query_values = array_merge($query_values,array(':day' => $day));
5780
+				$query_values = array_merge($query_values, array(':day' => $day));
5781 5781
 			}
5782 5782
 		}
5783 5783
 
5784 5784
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5785 5785
 				ORDER BY aircraft_icao_count DESC";
5786
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5786
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5787 5787
 		$sth = $this->db->prepare($query);
5788 5788
 		$sth->execute($query_values);
5789 5789
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5795,43 +5795,43 @@  discard block
 block discarded – undo
5795 5795
 	* @return Array the aircraft list
5796 5796
 	*
5797 5797
 	*/
5798
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5798
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5799 5799
 	{
5800
-		$filter_query = $this->getFilter($filters,true,true);
5801
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5802
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5800
+		$filter_query = $this->getFilter($filters, true, true);
5801
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5802
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5803 5803
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5804 5804
 		$query_values = array();
5805 5805
 		if ($year != '') {
5806 5806
 			if ($globalDBdriver == 'mysql') {
5807 5807
 				$query .= " AND YEAR(spotter_output.date) = :year";
5808
-				$query_values = array_merge($query_values,array(':year' => $year));
5808
+				$query_values = array_merge($query_values, array(':year' => $year));
5809 5809
 			} else {
5810 5810
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5811
-				$query_values = array_merge($query_values,array(':year' => $year));
5811
+				$query_values = array_merge($query_values, array(':year' => $year));
5812 5812
 			}
5813 5813
 		}
5814 5814
 		if ($month != '') {
5815 5815
 			if ($globalDBdriver == 'mysql') {
5816 5816
 				$query .= " AND MONTH(spotter_output.date) = :month";
5817
-				$query_values = array_merge($query_values,array(':month' => $month));
5817
+				$query_values = array_merge($query_values, array(':month' => $month));
5818 5818
 			} else {
5819 5819
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5820
-				$query_values = array_merge($query_values,array(':month' => $month));
5820
+				$query_values = array_merge($query_values, array(':month' => $month));
5821 5821
 			}
5822 5822
 		}
5823 5823
 		if ($day != '') {
5824 5824
 			if ($globalDBdriver == 'mysql') {
5825 5825
 				$query .= " AND DAY(spotter_output.date) = :day";
5826
-				$query_values = array_merge($query_values,array(':day' => $day));
5826
+				$query_values = array_merge($query_values, array(':day' => $day));
5827 5827
 			} else {
5828 5828
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5829
-				$query_values = array_merge($query_values,array(':day' => $day));
5829
+				$query_values = array_merge($query_values, array(':day' => $day));
5830 5830
 			}
5831 5831
 		}
5832 5832
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5833 5833
 				ORDER BY aircraft_icao_count DESC";
5834
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5834
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5835 5835
 		$sth = $this->db->prepare($query);
5836 5836
 		$sth->execute($query_values);
5837 5837
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5843,13 +5843,13 @@  discard block
 block discarded – undo
5843 5843
 	* @return Array the aircraft list
5844 5844
 	*
5845 5845
 	*/
5846
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5846
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5847 5847
 	{
5848
-		$filter_query = $this->getFilter($filters,true,true);
5848
+		$filter_query = $this->getFilter($filters, true, true);
5849 5849
 		$Image = new Image($this->db);
5850
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5850
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5851 5851
 
5852
-		$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  
5852
+		$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  
5853 5853
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5854 5854
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5855 5855
 		    ORDER BY registration_count DESC";
@@ -5861,14 +5861,14 @@  discard block
 block discarded – undo
5861 5861
 		$aircraft_array = array();
5862 5862
 		$temp_array = array();
5863 5863
         
5864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5865 5865
 		{
5866 5866
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5867 5867
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5868 5868
 			$temp_array['registration'] = $row['registration'];
5869 5869
 			$temp_array['airline_name'] = $row['airline_name'];
5870 5870
 			$temp_array['image_thumbnail'] = "";
5871
-			if($row['registration'] != "")
5871
+			if ($row['registration'] != "")
5872 5872
 			{
5873 5873
 				$image_array = $Image->getSpotterImage($row['registration']);
5874 5874
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5886,43 +5886,43 @@  discard block
 block discarded – undo
5886 5886
 	* @return Array the aircraft list
5887 5887
 	*
5888 5888
 	*/
5889
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5889
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5890 5890
 	{
5891
-		$filter_query = $this->getFilter($filters,true,true);
5891
+		$filter_query = $this->getFilter($filters, true, true);
5892 5892
 		$Image = new Image($this->db);
5893
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5893
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5894 5894
 
5895
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5895
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5896 5896
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5897 5897
 		$query_values = array();
5898 5898
 		if ($year != '') {
5899 5899
 			if ($globalDBdriver == 'mysql') {
5900 5900
 				$query .= " AND YEAR(spotter_output.date) = :year";
5901
-				$query_values = array_merge($query_values,array(':year' => $year));
5901
+				$query_values = array_merge($query_values, array(':year' => $year));
5902 5902
 			} else {
5903 5903
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5904
-				$query_values = array_merge($query_values,array(':year' => $year));
5904
+				$query_values = array_merge($query_values, array(':year' => $year));
5905 5905
 			}
5906 5906
 		}
5907 5907
 		if ($month != '') {
5908 5908
 			if ($globalDBdriver == 'mysql') {
5909 5909
 				$query .= " AND MONTH(spotter_output.date) = :month";
5910
-				$query_values = array_merge($query_values,array(':month' => $month));
5910
+				$query_values = array_merge($query_values, array(':month' => $month));
5911 5911
 			} else {
5912 5912
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5913
-				$query_values = array_merge($query_values,array(':month' => $month));
5913
+				$query_values = array_merge($query_values, array(':month' => $month));
5914 5914
 			}
5915 5915
 		}
5916 5916
 		if ($day != '') {
5917 5917
 			if ($globalDBdriver == 'mysql') {
5918 5918
 				$query .= " AND DAY(spotter_output.date) = :day";
5919
-				$query_values = array_merge($query_values,array(':day' => $day));
5919
+				$query_values = array_merge($query_values, array(':day' => $day));
5920 5920
 			} else {
5921 5921
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5922
-				$query_values = array_merge($query_values,array(':day' => $day));
5922
+				$query_values = array_merge($query_values, array(':day' => $day));
5923 5923
 			}
5924 5924
 		}
5925
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5925
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5926 5926
 
5927 5927
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5928 5928
 		    ORDER BY registration_count DESC";
@@ -5934,7 +5934,7 @@  discard block
 block discarded – undo
5934 5934
 		$aircraft_array = array();
5935 5935
 		$temp_array = array();
5936 5936
         
5937
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5937
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5938 5938
 		{
5939 5939
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5940 5940
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5942,7 +5942,7 @@  discard block
 block discarded – undo
5942 5942
 			$temp_array['registration'] = $row['registration'];
5943 5943
 			$temp_array['airline_name'] = $row['airline_name'];
5944 5944
 			$temp_array['image_thumbnail'] = "";
5945
-			if($row['registration'] != "")
5945
+			if ($row['registration'] != "")
5946 5946
 			{
5947 5947
 				$image_array = $Image->getSpotterImage($row['registration']);
5948 5948
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5960,43 +5960,43 @@  discard block
 block discarded – undo
5960 5960
 	* @return Array the aircraft list
5961 5961
 	*
5962 5962
 	*/
5963
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5963
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5964 5964
 	{
5965
-		$filter_query = $this->getFilter($filters,true,true);
5965
+		$filter_query = $this->getFilter($filters, true, true);
5966 5966
 		$Image = new Image($this->db);
5967
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5967
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5968 5968
 
5969
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5969
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5970 5970
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
5971 5971
 		$query_values = array();
5972 5972
 		if ($year != '') {
5973 5973
 			if ($globalDBdriver == 'mysql') {
5974 5974
 				$query .= " AND YEAR(spotter_output.date) = :year";
5975
-				$query_values = array_merge($query_values,array(':year' => $year));
5975
+				$query_values = array_merge($query_values, array(':year' => $year));
5976 5976
 			} else {
5977 5977
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5978
-				$query_values = array_merge($query_values,array(':year' => $year));
5978
+				$query_values = array_merge($query_values, array(':year' => $year));
5979 5979
 			}
5980 5980
 		}
5981 5981
 		if ($month != '') {
5982 5982
 			if ($globalDBdriver == 'mysql') {
5983 5983
 				$query .= " AND MONTH(spotter_output.date) = :month";
5984
-				$query_values = array_merge($query_values,array(':month' => $month));
5984
+				$query_values = array_merge($query_values, array(':month' => $month));
5985 5985
 			} else {
5986 5986
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5987
-				$query_values = array_merge($query_values,array(':month' => $month));
5987
+				$query_values = array_merge($query_values, array(':month' => $month));
5988 5988
 			}
5989 5989
 		}
5990 5990
 		if ($day != '') {
5991 5991
 			if ($globalDBdriver == 'mysql') {
5992 5992
 				$query .= " AND DAY(spotter_output.date) = :day";
5993
-				$query_values = array_merge($query_values,array(':day' => $day));
5993
+				$query_values = array_merge($query_values, array(':day' => $day));
5994 5994
 			} else {
5995 5995
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5996
-				$query_values = array_merge($query_values,array(':day' => $day));
5996
+				$query_values = array_merge($query_values, array(':day' => $day));
5997 5997
 			}
5998 5998
 		}
5999
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5999
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6000 6000
 
6001 6001
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6002 6002
 		    ORDER BY registration_count DESC";
@@ -6008,7 +6008,7 @@  discard block
 block discarded – undo
6008 6008
 		$aircraft_array = array();
6009 6009
 		$temp_array = array();
6010 6010
         
6011
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6011
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6012 6012
 		{
6013 6013
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6014 6014
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6016,7 +6016,7 @@  discard block
 block discarded – undo
6016 6016
 			$temp_array['registration'] = $row['registration'];
6017 6017
 			$temp_array['airline_name'] = $row['airline_name'];
6018 6018
 			$temp_array['image_thumbnail'] = "";
6019
-			if($row['registration'] != "")
6019
+			if ($row['registration'] != "")
6020 6020
 			{
6021 6021
 				$image_array = $Image->getSpotterImage($row['registration']);
6022 6022
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6035,11 +6035,11 @@  discard block
 block discarded – undo
6035 6035
 	* @return Array the aircraft manufacturer list
6036 6036
 	*
6037 6037
 	*/
6038
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6038
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6039 6039
 	{
6040
-		$filter_query = $this->getFilter($filters,true,true);
6041
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6042
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6040
+		$filter_query = $this->getFilter($filters, true, true);
6041
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6042
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6043 6043
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6044 6044
                     GROUP BY spotter_output.aircraft_manufacturer 
6045 6045
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6049,7 +6049,7 @@  discard block
 block discarded – undo
6049 6049
 		$sth->execute(array(':ident' => $ident));
6050 6050
 		$aircraft_array = array();
6051 6051
 		$temp_array = array();
6052
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6052
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6053 6053
 		{
6054 6054
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6055 6055
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6064,41 +6064,41 @@  discard block
 block discarded – undo
6064 6064
 	* @return Array the aircraft manufacturer list
6065 6065
 	*
6066 6066
 	*/
6067
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6067
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6068 6068
 	{
6069
-		$filter_query = $this->getFilter($filters,true,true);
6070
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6071
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6069
+		$filter_query = $this->getFilter($filters, true, true);
6070
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6071
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6072 6072
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6073 6073
 		$query_values = array();
6074 6074
 		if ($year != '') {
6075 6075
 			if ($globalDBdriver == 'mysql') {
6076 6076
 				$query .= " AND YEAR(spotter_output.date) = :year";
6077
-				$query_values = array_merge($query_values,array(':year' => $year));
6077
+				$query_values = array_merge($query_values, array(':year' => $year));
6078 6078
 			} else {
6079 6079
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6080
-				$query_values = array_merge($query_values,array(':year' => $year));
6080
+				$query_values = array_merge($query_values, array(':year' => $year));
6081 6081
 			}
6082 6082
 		}
6083 6083
 		if ($month != '') {
6084 6084
 			if ($globalDBdriver == 'mysql') {
6085 6085
 				$query .= " AND MONTH(spotter_output.date) = :month";
6086
-				$query_values = array_merge($query_values,array(':month' => $month));
6086
+				$query_values = array_merge($query_values, array(':month' => $month));
6087 6087
 			} else {
6088 6088
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6089
-				$query_values = array_merge($query_values,array(':month' => $month));
6089
+				$query_values = array_merge($query_values, array(':month' => $month));
6090 6090
 			}
6091 6091
 		}
6092 6092
 		if ($day != '') {
6093 6093
 			if ($globalDBdriver == 'mysql') {
6094 6094
 				$query .= " AND DAY(spotter_output.date) = :day";
6095
-				$query_values = array_merge($query_values,array(':day' => $day));
6095
+				$query_values = array_merge($query_values, array(':day' => $day));
6096 6096
 			} else {
6097 6097
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6098
-				$query_values = array_merge($query_values,array(':day' => $day));
6098
+				$query_values = array_merge($query_values, array(':day' => $day));
6099 6099
 			}
6100 6100
 		}
6101
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6101
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6102 6102
 
6103 6103
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6104 6104
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6115,41 +6115,41 @@  discard block
 block discarded – undo
6115 6115
 	* @return Array the aircraft manufacturer list
6116 6116
 	*
6117 6117
 	*/
6118
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6118
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6119 6119
 	{
6120
-		$filter_query = $this->getFilter($filters,true,true);
6121
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6122
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6120
+		$filter_query = $this->getFilter($filters, true, true);
6121
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6122
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6123 6123
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6124 6124
 		$query_values = array();
6125 6125
 		if ($year != '') {
6126 6126
 			if ($globalDBdriver == 'mysql') {
6127 6127
 				$query .= " AND YEAR(spotter_output.date) = :year";
6128
-				$query_values = array_merge($query_values,array(':year' => $year));
6128
+				$query_values = array_merge($query_values, array(':year' => $year));
6129 6129
 			} else {
6130 6130
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6131
-				$query_values = array_merge($query_values,array(':year' => $year));
6131
+				$query_values = array_merge($query_values, array(':year' => $year));
6132 6132
 			}
6133 6133
 		}
6134 6134
 		if ($month != '') {
6135 6135
 			if ($globalDBdriver == 'mysql') {
6136 6136
 				$query .= " AND MONTH(spotter_output.date) = :month";
6137
-				$query_values = array_merge($query_values,array(':month' => $month));
6137
+				$query_values = array_merge($query_values, array(':month' => $month));
6138 6138
 			} else {
6139 6139
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6140
-				$query_values = array_merge($query_values,array(':month' => $month));
6140
+				$query_values = array_merge($query_values, array(':month' => $month));
6141 6141
 			}
6142 6142
 		}
6143 6143
 		if ($day != '') {
6144 6144
 			if ($globalDBdriver == 'mysql') {
6145 6145
 				$query .= " AND DAY(spotter_output.date) = :day";
6146
-				$query_values = array_merge($query_values,array(':day' => $day));
6146
+				$query_values = array_merge($query_values, array(':day' => $day));
6147 6147
 			} else {
6148 6148
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6149
-				$query_values = array_merge($query_values,array(':day' => $day));
6149
+				$query_values = array_merge($query_values, array(':day' => $day));
6150 6150
 			}
6151 6151
 		}
6152
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6152
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6153 6153
 
6154 6154
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6155 6155
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6167,24 +6167,24 @@  discard block
 block discarded – undo
6167 6167
 	* @return Array the aircraft list
6168 6168
 	*
6169 6169
 	*/
6170
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6170
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6171 6171
 	{
6172
-		$filter_query = $this->getFilter($filters,true,true);
6173
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6174
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6172
+		$filter_query = $this->getFilter($filters, true, true);
6173
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6174
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6175 6175
 		
6176 6176
 
6177
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6177
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6178 6178
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6179 6179
                     GROUP BY spotter_output.aircraft_name 
6180 6180
 					ORDER BY aircraft_icao_count DESC";
6181 6181
  
6182 6182
 		
6183 6183
 		$sth = $this->db->prepare($query);
6184
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6184
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6185 6185
 		$aircraft_array = array();
6186 6186
 		$temp_array = array();
6187
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6187
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6188 6188
 		{
6189 6189
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6190 6190
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6200,33 +6200,33 @@  discard block
 block discarded – undo
6200 6200
 	* @return Array the aircraft list
6201 6201
 	*
6202 6202
 	*/
6203
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6203
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6204 6204
 	{
6205
-		$filter_query = $this->getFilter($filters,true,true);
6205
+		$filter_query = $this->getFilter($filters, true, true);
6206 6206
 		$Image = new Image($this->db);
6207
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6208
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6207
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6208
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6209 6209
 
6210
-		$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   
6210
+		$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   
6211 6211
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
6212 6212
                     GROUP BY spotter_output.registration 
6213 6213
 					ORDER BY registration_count DESC";
6214 6214
 
6215 6215
 		
6216 6216
 		$sth = $this->db->prepare($query);
6217
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6217
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6218 6218
       
6219 6219
 		$aircraft_array = array();
6220 6220
 		$temp_array = array();
6221 6221
         
6222
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6222
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6223 6223
 		{
6224 6224
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6225 6225
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6226 6226
 			$temp_array['registration'] = $row['registration'];
6227 6227
 			$temp_array['airline_name'] = $row['airline_name'];
6228 6228
 			$temp_array['image_thumbnail'] = "";
6229
-			if($row['registration'] != "")
6229
+			if ($row['registration'] != "")
6230 6230
 			{
6231 6231
 				$image_array = $Image->getSpotterImage($row['registration']);
6232 6232
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6246,25 +6246,25 @@  discard block
 block discarded – undo
6246 6246
 	* @return Array the aircraft manufacturer list
6247 6247
 	*
6248 6248
 	*/
6249
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6249
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6250 6250
 	{
6251
-		$filter_query = $this->getFilter($filters,true,true);
6252
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6253
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6251
+		$filter_query = $this->getFilter($filters, true, true);
6252
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6253
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6254 6254
 
6255
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6255
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6256 6256
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
6257 6257
                     GROUP BY spotter_output.aircraft_manufacturer 
6258 6258
 					ORDER BY aircraft_manufacturer_count DESC";
6259 6259
 
6260 6260
 		
6261 6261
 		$sth = $this->db->prepare($query);
6262
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6262
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6263 6263
       
6264 6264
 		$aircraft_array = array();
6265 6265
 		$temp_array = array();
6266 6266
         
6267
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6267
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6268 6268
 		{
6269 6269
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6270 6270
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6284,11 +6284,11 @@  discard block
 block discarded – undo
6284 6284
 	* @return Array the aircraft list
6285 6285
 	*
6286 6286
 	*/
6287
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6287
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6288 6288
 	{
6289
-		$filter_query = $this->getFilter($filters,true,true);
6290
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6291
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6289
+		$filter_query = $this->getFilter($filters, true, true);
6290
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6291
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6292 6292
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6293 6293
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6294 6294
 			    ORDER BY aircraft_icao_count DESC";
@@ -6300,7 +6300,7 @@  discard block
 block discarded – undo
6300 6300
 		$aircraft_array = array();
6301 6301
 		$temp_array = array();
6302 6302
         
6303
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6303
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6304 6304
 		{
6305 6305
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6306 6306
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6319,12 +6319,12 @@  discard block
 block discarded – undo
6319 6319
 	* @return Array the aircraft list
6320 6320
 	*
6321 6321
 	*/
6322
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6322
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6323 6323
 	{
6324
-		$filter_query = $this->getFilter($filters,true,true);
6324
+		$filter_query = $this->getFilter($filters, true, true);
6325 6325
 		$Image = new Image($this->db);
6326
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6327
-		$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 
6326
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6327
+		$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 
6328 6328
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
6329 6329
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6330 6330
 			    ORDER BY registration_count DESC";
@@ -6336,14 +6336,14 @@  discard block
 block discarded – undo
6336 6336
 		$aircraft_array = array();
6337 6337
 		$temp_array = array();
6338 6338
         
6339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6340 6340
 		{
6341 6341
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6342 6342
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6343 6343
 			$temp_array['registration'] = $row['registration'];
6344 6344
 			$temp_array['airline_name'] = $row['airline_name'];
6345 6345
 			$temp_array['image_thumbnail'] = "";
6346
-			if($row['registration'] != "")
6346
+			if ($row['registration'] != "")
6347 6347
 			{
6348 6348
 				$image_array = $Image->getSpotterImage($row['registration']);
6349 6349
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6363,11 +6363,11 @@  discard block
 block discarded – undo
6363 6363
 	* @return Array the aircraft manufacturer list
6364 6364
 	*
6365 6365
 	*/
6366
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6366
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6367 6367
 	{
6368
-		$filter_query = $this->getFilter($filters,true,true);
6369
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6370
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6368
+		$filter_query = $this->getFilter($filters, true, true);
6369
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6370
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6371 6371
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
6372 6372
                     GROUP BY spotter_output.aircraft_manufacturer 
6373 6373
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6379,7 +6379,7 @@  discard block
 block discarded – undo
6379 6379
 		$aircraft_array = array();
6380 6380
 		$temp_array = array();
6381 6381
         
6382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6383 6383
 		{
6384 6384
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6385 6385
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6398,38 +6398,38 @@  discard block
 block discarded – undo
6398 6398
 	* @return Array the aircraft list
6399 6399
 	*
6400 6400
 	*/
6401
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6401
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404
-		$filter_query = $this->getFilter($filters,true,true);
6405
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6404
+		$filter_query = $this->getFilter($filters, true, true);
6405
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6406 6406
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6407 6407
                 $query_values = array();
6408 6408
 		if ($year != '') {
6409 6409
 			if ($globalDBdriver == 'mysql') {
6410 6410
 				$query .= " AND YEAR(spotter_output.date) = :year";
6411
-				$query_values = array_merge($query_values,array(':year' => $year));
6411
+				$query_values = array_merge($query_values, array(':year' => $year));
6412 6412
 			} else {
6413 6413
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6414
-				$query_values = array_merge($query_values,array(':year' => $year));
6414
+				$query_values = array_merge($query_values, array(':year' => $year));
6415 6415
 			}
6416 6416
 		}
6417 6417
 		if ($month != '') {
6418 6418
 			if ($globalDBdriver == 'mysql') {
6419 6419
 				$query .= " AND MONTH(spotter_output.date) = :month";
6420
-				$query_values = array_merge($query_values,array(':month' => $month));
6420
+				$query_values = array_merge($query_values, array(':month' => $month));
6421 6421
 			} else {
6422 6422
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6423
-				$query_values = array_merge($query_values,array(':month' => $month));
6423
+				$query_values = array_merge($query_values, array(':month' => $month));
6424 6424
 			}
6425 6425
 		}
6426 6426
 		if ($day != '') {
6427 6427
 			if ($globalDBdriver == 'mysql') {
6428 6428
 				$query .= " AND DAY(spotter_output.date) = :day";
6429
-				$query_values = array_merge($query_values,array(':day' => $day));
6429
+				$query_values = array_merge($query_values, array(':day' => $day));
6430 6430
 			} else {
6431 6431
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6432
-				$query_values = array_merge($query_values,array(':day' => $day));
6432
+				$query_values = array_merge($query_values, array(':day' => $day));
6433 6433
 			}
6434 6434
 		}
6435 6435
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6443,7 +6443,7 @@  discard block
 block discarded – undo
6443 6443
 		$manufacturer_array = array();
6444 6444
 		$temp_array = array();
6445 6445
         
6446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6447 6447
 		{
6448 6448
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6449 6449
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6462,12 +6462,12 @@  discard block
 block discarded – undo
6462 6462
 	* @return Array the aircraft list
6463 6463
 	*
6464 6464
 	*/
6465
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6465
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6466 6466
 	{
6467 6467
 		global $globalDBdriver;
6468 6468
 		$Image = new Image($this->db);
6469
-		$filter_query = $this->getFilter($filters,true,true);
6470
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6469
+		$filter_query = $this->getFilter($filters, true, true);
6470
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6471 6471
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6472 6472
                 if ($olderthanmonths > 0) {
6473 6473
             		if ($globalDBdriver == 'mysql') {
@@ -6487,28 +6487,28 @@  discard block
 block discarded – undo
6487 6487
 		if ($year != '') {
6488 6488
 			if ($globalDBdriver == 'mysql') {
6489 6489
 				$query .= " AND YEAR(spotter_output.date) = :year";
6490
-				$query_values = array_merge($query_values,array(':year' => $year));
6490
+				$query_values = array_merge($query_values, array(':year' => $year));
6491 6491
 			} else {
6492 6492
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6493
-				$query_values = array_merge($query_values,array(':year' => $year));
6493
+				$query_values = array_merge($query_values, array(':year' => $year));
6494 6494
 			}
6495 6495
 		}
6496 6496
 		if ($month != '') {
6497 6497
 			if ($globalDBdriver == 'mysql') {
6498 6498
 				$query .= " AND MONTH(spotter_output.date) = :month";
6499
-				$query_values = array_merge($query_values,array(':month' => $month));
6499
+				$query_values = array_merge($query_values, array(':month' => $month));
6500 6500
 			} else {
6501 6501
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6502
-				$query_values = array_merge($query_values,array(':month' => $month));
6502
+				$query_values = array_merge($query_values, array(':month' => $month));
6503 6503
 			}
6504 6504
 		}
6505 6505
 		if ($day != '') {
6506 6506
 			if ($globalDBdriver == 'mysql') {
6507 6507
 				$query .= " AND DAY(spotter_output.date) = :day";
6508
-				$query_values = array_merge($query_values,array(':day' => $day));
6508
+				$query_values = array_merge($query_values, array(':day' => $day));
6509 6509
 			} else {
6510 6510
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6511
-				$query_values = array_merge($query_values,array(':day' => $day));
6511
+				$query_values = array_merge($query_values, array(':day' => $day));
6512 6512
 			}
6513 6513
 		}
6514 6514
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6520,7 +6520,7 @@  discard block
 block discarded – undo
6520 6520
 		$aircraft_array = array();
6521 6521
 		$temp_array = array();
6522 6522
         
6523
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6523
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6524 6524
 		{
6525 6525
 			$temp_array['registration'] = $row['registration'];
6526 6526
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6528,7 +6528,7 @@  discard block
 block discarded – undo
6528 6528
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6529 6529
 			$temp_array['airline_name'] = $row['airline_name'];
6530 6530
 			$temp_array['image_thumbnail'] = "";
6531
-			if($row['registration'] != "")
6531
+			if ($row['registration'] != "")
6532 6532
 			{
6533 6533
 				$image_array = $Image->getSpotterImage($row['registration']);
6534 6534
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6547,12 +6547,12 @@  discard block
 block discarded – undo
6547 6547
 	* @return Array the aircraft list
6548 6548
 	*
6549 6549
 	*/
6550
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6550
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6551 6551
 	{
6552 6552
 		global $globalDBdriver;
6553
-		$filter_query = $this->getFilter($filters,true,true);
6553
+		$filter_query = $this->getFilter($filters, true, true);
6554 6554
 		$Image = new Image($this->db);
6555
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6555
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6556 6556
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6557 6557
                 if ($olderthanmonths > 0) {
6558 6558
             		if ($globalDBdriver == 'mysql') {
@@ -6580,7 +6580,7 @@  discard block
 block discarded – undo
6580 6580
 		$aircraft_array = array();
6581 6581
 		$temp_array = array();
6582 6582
         
6583
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6583
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6584 6584
 		{
6585 6585
 			$temp_array['registration'] = $row['registration'];
6586 6586
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6589,7 +6589,7 @@  discard block
 block discarded – undo
6589 6589
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6590 6590
 			$temp_array['airline_name'] = $row['airline_name'];
6591 6591
 			$temp_array['image_thumbnail'] = "";
6592
-			if($row['registration'] != "")
6592
+			if ($row['registration'] != "")
6593 6593
 			{
6594 6594
 				$image_array = $Image->getSpotterImage($row['registration']);
6595 6595
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6608,11 +6608,11 @@  discard block
 block discarded – undo
6608 6608
 	* @return Array the airport list
6609 6609
 	*
6610 6610
 	*/
6611
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6611
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6612 6612
 	{
6613 6613
 		global $globalDBdriver;
6614
-		$filter_query = $this->getFilter($filters,true,true);
6615
-		$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 
6614
+		$filter_query = $this->getFilter($filters, true, true);
6615
+		$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 
6616 6616
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6617 6617
                 if ($olderthanmonths > 0) {
6618 6618
             		if ($globalDBdriver == 'mysql') {
@@ -6632,28 +6632,28 @@  discard block
 block discarded – undo
6632 6632
 		if ($year != '') {
6633 6633
 			if ($globalDBdriver == 'mysql') {
6634 6634
 				$query .= " AND YEAR(spotter_output.date) = :year";
6635
-				$query_values = array_merge($query_values,array(':year' => $year));
6635
+				$query_values = array_merge($query_values, array(':year' => $year));
6636 6636
 			} else {
6637 6637
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6638
-				$query_values = array_merge($query_values,array(':year' => $year));
6638
+				$query_values = array_merge($query_values, array(':year' => $year));
6639 6639
 			}
6640 6640
 		}
6641 6641
 		if ($month != '') {
6642 6642
 			if ($globalDBdriver == 'mysql') {
6643 6643
 				$query .= " AND MONTH(spotter_output.date) = :month";
6644
-				$query_values = array_merge($query_values,array(':month' => $month));
6644
+				$query_values = array_merge($query_values, array(':month' => $month));
6645 6645
 			} else {
6646 6646
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6647
-				$query_values = array_merge($query_values,array(':month' => $month));
6647
+				$query_values = array_merge($query_values, array(':month' => $month));
6648 6648
 			}
6649 6649
 		}
6650 6650
 		if ($day != '') {
6651 6651
 			if ($globalDBdriver == 'mysql') {
6652 6652
 				$query .= " AND DAY(spotter_output.date) = :day";
6653
-				$query_values = array_merge($query_values,array(':day' => $day));
6653
+				$query_values = array_merge($query_values, array(':day' => $day));
6654 6654
 			} else {
6655 6655
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6656
-				$query_values = array_merge($query_values,array(':day' => $day));
6656
+				$query_values = array_merge($query_values, array(':day' => $day));
6657 6657
 			}
6658 6658
 		}
6659 6659
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6665,7 +6665,7 @@  discard block
 block discarded – undo
6665 6665
 
6666 6666
 		$airport_array = array();
6667 6667
 		$temp_array = array();
6668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6669 6669
 		{
6670 6670
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6671 6671
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	* @return Array the airport list
6685 6685
 	*
6686 6686
 	*/
6687
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6687
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6688 6688
 	{
6689 6689
 		global $globalDBdriver;
6690
-		$filter_query = $this->getFilter($filters,true,true);
6691
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, 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 
6690
+		$filter_query = $this->getFilter($filters, true, true);
6691
+		$query = "SELECT DISTINCT spotter_output.airline_icao, 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 
6692 6692
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6693 6693
                 if ($olderthanmonths > 0) {
6694 6694
             		if ($globalDBdriver == 'mysql') {
@@ -6717,7 +6717,7 @@  discard block
 block discarded – undo
6717 6717
 		$airport_array = array();
6718 6718
 		$temp_array = array();
6719 6719
         
6720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6721 6721
 		{
6722 6722
 			$temp_array['airline_icao'] = $row['airline_icao'];
6723 6723
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6737,11 +6737,11 @@  discard block
 block discarded – undo
6737 6737
 	* @return Array the airport list
6738 6738
 	*
6739 6739
 	*/
6740
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6740
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6741 6741
 	{
6742 6742
 		global $globalDBdriver;
6743
-		$filter_query = $this->getFilter($filters,true,true);
6744
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6743
+		$filter_query = $this->getFilter($filters, true, true);
6744
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6745 6745
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6746 6746
                 if ($olderthanmonths > 0) {
6747 6747
             		if ($globalDBdriver == 'mysql') {
@@ -6761,28 +6761,28 @@  discard block
 block discarded – undo
6761 6761
 		if ($year != '') {
6762 6762
 			if ($globalDBdriver == 'mysql') {
6763 6763
 				$query .= " AND YEAR(spotter_output.date) = :year";
6764
-				$query_values = array_merge($query_values,array(':year' => $year));
6764
+				$query_values = array_merge($query_values, array(':year' => $year));
6765 6765
 			} else {
6766 6766
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6767
-				$query_values = array_merge($query_values,array(':year' => $year));
6767
+				$query_values = array_merge($query_values, array(':year' => $year));
6768 6768
 			}
6769 6769
 		}
6770 6770
 		if ($month != '') {
6771 6771
 			if ($globalDBdriver == 'mysql') {
6772 6772
 				$query .= " AND MONTH(spotter_output.date) = :month";
6773
-				$query_values = array_merge($query_values,array(':month' => $month));
6773
+				$query_values = array_merge($query_values, array(':month' => $month));
6774 6774
 			} else {
6775 6775
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6776
-				$query_values = array_merge($query_values,array(':month' => $month));
6776
+				$query_values = array_merge($query_values, array(':month' => $month));
6777 6777
 			}
6778 6778
 		}
6779 6779
 		if ($day != '') {
6780 6780
 			if ($globalDBdriver == 'mysql') {
6781 6781
 				$query .= " AND DAY(spotter_output.date) = :day";
6782
-				$query_values = array_merge($query_values,array(':day' => $day));
6782
+				$query_values = array_merge($query_values, array(':day' => $day));
6783 6783
 			} else {
6784 6784
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6785
-				$query_values = array_merge($query_values,array(':day' => $day));
6785
+				$query_values = array_merge($query_values, array(':day' => $day));
6786 6786
 			}
6787 6787
 		}
6788 6788
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
 		$airport_array = array();
6796 6796
 		$temp_array = array();
6797 6797
         
6798
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6798
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6799 6799
 		{
6800 6800
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6801 6801
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6814,11 +6814,11 @@  discard block
 block discarded – undo
6814 6814
 	* @return Array the airport list
6815 6815
 	*
6816 6816
 	*/
6817
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6817
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6818 6818
 	{
6819 6819
 		global $globalDBdriver;
6820
-		$filter_query = $this->getFilter($filters,true,true);
6821
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6820
+		$filter_query = $this->getFilter($filters, true, true);
6821
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6822 6822
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6823 6823
                 if ($olderthanmonths > 0) {
6824 6824
             		if ($globalDBdriver == 'mysql') {
@@ -6847,7 +6847,7 @@  discard block
 block discarded – undo
6847 6847
 		$airport_array = array();
6848 6848
 		$temp_array = array();
6849 6849
         
6850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6851 6851
 		{
6852 6852
 			$temp_array['airline_icao'] = $row['airline_icao'];
6853 6853
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6867,11 +6867,11 @@  discard block
 block discarded – undo
6867 6867
 	* @return Array the airport list
6868 6868
 	*
6869 6869
 	*/
6870
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6870
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6871 6871
 	{
6872
-		$filter_query = $this->getFilter($filters,true,true);
6873
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6874
-		$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 
6872
+		$filter_query = $this->getFilter($filters, true, true);
6873
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6874
+		$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 
6875 6875
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6876 6876
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6877 6877
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6883,7 +6883,7 @@  discard block
 block discarded – undo
6883 6883
 		$airport_array = array();
6884 6884
 		$temp_array = array();
6885 6885
         
6886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6887 6887
 		{
6888 6888
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6889 6889
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6905,11 +6905,11 @@  discard block
 block discarded – undo
6905 6905
 	* @return Array the airport list
6906 6906
 	*
6907 6907
 	*/
6908
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6908
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6909 6909
 	{
6910
-		$filter_query = $this->getFilter($filters,true,true);
6911
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6912
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6910
+		$filter_query = $this->getFilter($filters, true, true);
6911
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6912
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6913 6913
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6914 6914
                     GROUP BY spotter_output.departure_airport_country
6915 6915
 					ORDER BY airport_departure_country_count DESC";
@@ -6921,7 +6921,7 @@  discard block
 block discarded – undo
6921 6921
 		$airport_array = array();
6922 6922
 		$temp_array = array();
6923 6923
         
6924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6925 6925
 		{
6926 6926
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6927 6927
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6940,11 +6940,11 @@  discard block
 block discarded – undo
6940 6940
 	* @return Array the airport list
6941 6941
 	*
6942 6942
 	*/
6943
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6943
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6944 6944
 	{
6945
-		$filter_query = $this->getFilter($filters,true,true);
6946
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6947
-		$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 
6945
+		$filter_query = $this->getFilter($filters, true, true);
6946
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6947
+		$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 
6948 6948
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6949 6949
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6950 6950
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6956,7 +6956,7 @@  discard block
 block discarded – undo
6956 6956
 		$airport_array = array();
6957 6957
 		$temp_array = array();
6958 6958
         
6959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6960 6960
 		{
6961 6961
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6962 6962
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6977,11 +6977,11 @@  discard block
 block discarded – undo
6977 6977
 	* @return Array the airport list
6978 6978
 	*
6979 6979
 	*/
6980
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6980
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6981 6981
 	{
6982
-		$filter_query = $this->getFilter($filters,true,true);
6983
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6984
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6982
+		$filter_query = $this->getFilter($filters, true, true);
6983
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6984
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6985 6985
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6986 6986
                     GROUP BY spotter_output.departure_airport_country
6987 6987
 					ORDER BY airport_departure_country_count DESC";
@@ -6993,7 +6993,7 @@  discard block
 block discarded – undo
6993 6993
 		$airport_array = array();
6994 6994
 		$temp_array = array();
6995 6995
         
6996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6997 6997
 		{
6998 6998
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6999 6999
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7011,11 +7011,11 @@  discard block
 block discarded – undo
7011 7011
 	* @return Array the airport list
7012 7012
 	*
7013 7013
 	*/
7014
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7014
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7015 7015
 	{
7016
-		$filter_query = $this->getFilter($filters,true,true);
7017
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7018
-		$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 
7016
+		$filter_query = $this->getFilter($filters, true, true);
7017
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7018
+		$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 
7019 7019
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
7020 7020
                     GROUP BY spotter_output.departure_airport_icao
7021 7021
 					ORDER BY airport_departure_icao_count DESC";
@@ -7027,7 +7027,7 @@  discard block
 block discarded – undo
7027 7027
 		$airport_array = array();
7028 7028
 		$temp_array = array();
7029 7029
         
7030
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7030
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7031 7031
 		{
7032 7032
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7033 7033
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7048,11 +7048,11 @@  discard block
 block discarded – undo
7048 7048
 	* @return Array the airport list
7049 7049
 	*
7050 7050
 	*/
7051
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7051
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7052 7052
 	{
7053
-		$filter_query = $this->getFilter($filters,true,true);
7054
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7055
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7053
+		$filter_query = $this->getFilter($filters, true, true);
7054
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7055
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7056 7056
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7057 7057
                     GROUP BY spotter_output.departure_airport_country
7058 7058
 					ORDER BY airport_departure_country_count DESC";
@@ -7064,7 +7064,7 @@  discard block
 block discarded – undo
7064 7064
 		$airport_array = array();
7065 7065
 		$temp_array = array();
7066 7066
         
7067
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7067
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7068 7068
 		{
7069 7069
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7070 7070
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7082,11 +7082,11 @@  discard block
 block discarded – undo
7082 7082
 	* @return Array the airport list
7083 7083
 	*
7084 7084
 	*/
7085
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7085
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7086 7086
 	{
7087
-		$filter_query = $this->getFilter($filters,true,true);
7088
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7089
-		$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 
7087
+		$filter_query = $this->getFilter($filters, true, true);
7088
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7089
+		$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 
7090 7090
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
7091 7091
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7092 7092
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7098,7 +7098,7 @@  discard block
 block discarded – undo
7098 7098
 		$airport_array = array();
7099 7099
 		$temp_array = array();
7100 7100
         
7101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7102 7102
 		{
7103 7103
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7104 7104
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7119,11 +7119,11 @@  discard block
 block discarded – undo
7119 7119
 	* @return Array the airport list
7120 7120
 	*
7121 7121
 	*/
7122
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7122
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7123 7123
 	{
7124
-		$filter_query = $this->getFilter($filters,true,true);
7125
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7126
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7124
+		$filter_query = $this->getFilter($filters, true, true);
7125
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7126
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7127 7127
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7128 7128
                     GROUP BY spotter_output.departure_airport_country
7129 7129
 					ORDER BY airport_departure_country_count DESC";
@@ -7135,7 +7135,7 @@  discard block
 block discarded – undo
7135 7135
 		$airport_array = array();
7136 7136
 		$temp_array = array();
7137 7137
         
7138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7139 7139
 		{
7140 7140
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7141 7141
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7154,11 +7154,11 @@  discard block
 block discarded – undo
7154 7154
 	* @return Array the airport list
7155 7155
 	*
7156 7156
 	*/
7157
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7157
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7158 7158
 	{
7159
-		$filter_query = $this->getFilter($filters,true,true);
7160
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7161
-		$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 
7159
+		$filter_query = $this->getFilter($filters, true, true);
7160
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7161
+		$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 
7162 7162
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
7163 7163
                     GROUP BY spotter_output.departure_airport_icao
7164 7164
 					ORDER BY airport_departure_icao_count DESC";
@@ -7170,7 +7170,7 @@  discard block
 block discarded – undo
7170 7170
 		$airport_array = array();
7171 7171
 		$temp_array = array();
7172 7172
         
7173
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7173
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7174 7174
 		{
7175 7175
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7176 7176
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7191,11 +7191,11 @@  discard block
 block discarded – undo
7191 7191
 	* @return Array the airport list
7192 7192
 	*
7193 7193
 	*/
7194
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7194
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7195 7195
 	{
7196
-		$filter_query = $this->getFilter($filters,true,true);
7197
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7198
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7196
+		$filter_query = $this->getFilter($filters, true, true);
7197
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7198
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7199 7199
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7200 7200
                     GROUP BY spotter_output.departure_airport_country
7201 7201
 					ORDER BY airport_departure_country_count DESC";
@@ -7207,7 +7207,7 @@  discard block
 block discarded – undo
7207 7207
 		$airport_array = array();
7208 7208
 		$temp_array = array();
7209 7209
         
7210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7211 7211
 		{
7212 7212
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7213 7213
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7225,11 +7225,11 @@  discard block
 block discarded – undo
7225 7225
 	* @return Array the airport list
7226 7226
 	*
7227 7227
 	*/
7228
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7228
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7229 7229
 	{
7230 7230
 		global $globalTimezone, $globalDBdriver;
7231
-		$filter_query = $this->getFilter($filters,true,true);
7232
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7231
+		$filter_query = $this->getFilter($filters, true, true);
7232
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7233 7233
 		if ($globalTimezone != '') {
7234 7234
 			date_default_timezone_set($globalTimezone);
7235 7235
 			$datetime = new DateTime($date);
@@ -7237,12 +7237,12 @@  discard block
 block discarded – undo
7237 7237
 		} else $offset = '+00:00';
7238 7238
 
7239 7239
 		if ($globalDBdriver == 'mysql') {
7240
-			$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 
7240
+			$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 
7241 7241
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
7242 7242
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7243 7243
 					ORDER BY airport_departure_icao_count DESC";
7244 7244
 		} else {
7245
-			$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 
7245
+			$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 
7246 7246
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
7247 7247
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7248 7248
 					ORDER BY airport_departure_icao_count DESC";
@@ -7254,7 +7254,7 @@  discard block
 block discarded – undo
7254 7254
 		$airport_array = array();
7255 7255
 		$temp_array = array();
7256 7256
         
7257
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7257
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7258 7258
 		{
7259 7259
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7260 7260
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7275,11 +7275,11 @@  discard block
 block discarded – undo
7275 7275
 	* @return Array the airport list
7276 7276
 	*
7277 7277
 	*/
7278
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7278
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7279 7279
 	{
7280 7280
 		global $globalTimezone, $globalDBdriver;
7281
-		$filter_query = $this->getFilter($filters,true,true);
7282
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7281
+		$filter_query = $this->getFilter($filters, true, true);
7282
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7283 7283
 		if ($globalTimezone != '') {
7284 7284
 			date_default_timezone_set($globalTimezone);
7285 7285
 			$datetime = new DateTime($date);
@@ -7287,12 +7287,12 @@  discard block
 block discarded – undo
7287 7287
 		} else $offset = '+00:00';
7288 7288
 
7289 7289
 		if ($globalDBdriver == 'mysql') {
7290
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7290
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7291 7291
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7292 7292
 					GROUP BY spotter_output.departure_airport_country
7293 7293
 					ORDER BY airport_departure_country_count DESC";
7294 7294
 		} else {
7295
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7295
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7296 7296
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7297 7297
 					GROUP BY spotter_output.departure_airport_country
7298 7298
 					ORDER BY airport_departure_country_count DESC";
@@ -7304,7 +7304,7 @@  discard block
 block discarded – undo
7304 7304
 		$airport_array = array();
7305 7305
 		$temp_array = array();
7306 7306
         
7307
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7307
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7308 7308
 		{
7309 7309
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7310 7310
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7322,11 +7322,11 @@  discard block
 block discarded – undo
7322 7322
 	* @return Array the airport list
7323 7323
 	*
7324 7324
 	*/
7325
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7325
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7326 7326
 	{
7327
-		$filter_query = $this->getFilter($filters,true,true);
7328
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7329
-		$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 
7327
+		$filter_query = $this->getFilter($filters, true, true);
7328
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7329
+		$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 
7330 7330
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
7331 7331
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7332 7332
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7338,7 +7338,7 @@  discard block
 block discarded – undo
7338 7338
 		$airport_array = array();
7339 7339
 		$temp_array = array();
7340 7340
         
7341
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7341
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7342 7342
 		{
7343 7343
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7344 7344
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7358,11 +7358,11 @@  discard block
 block discarded – undo
7358 7358
 	* @return Array the airport list
7359 7359
 	*
7360 7360
 	*/
7361
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7361
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7362 7362
 	{
7363
-		$filter_query = $this->getFilter($filters,true,true);
7364
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7365
-		$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 
7363
+		$filter_query = $this->getFilter($filters, true, true);
7364
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7365
+		$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 
7366 7366
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7367 7367
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7368 7368
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7374,7 +7374,7 @@  discard block
 block discarded – undo
7374 7374
 		$airport_array = array();
7375 7375
 		$temp_array = array();
7376 7376
         
7377
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7377
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7378 7378
 		{
7379 7379
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7380 7380
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7394,11 +7394,11 @@  discard block
 block discarded – undo
7394 7394
 	* @return Array the airport list
7395 7395
 	*
7396 7396
 	*/
7397
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7397
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7398 7398
 	{
7399
-		$filter_query = $this->getFilter($filters,true,true);
7400
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7401
-		$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 
7399
+		$filter_query = $this->getFilter($filters, true, true);
7400
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7401
+		$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 
7402 7402
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7403 7403
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7404 7404
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7409,7 +7409,7 @@  discard block
 block discarded – undo
7409 7409
 		$airport_array = array();
7410 7410
 		$temp_array = array();
7411 7411
         
7412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7413 7413
 		{
7414 7414
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7415 7415
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7431,11 +7431,11 @@  discard block
 block discarded – undo
7431 7431
 	* @return Array the airport list
7432 7432
 	*
7433 7433
 	*/
7434
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7434
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7435 7435
 	{
7436
-		$filter_query = $this->getFilter($filters,true,true);
7437
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7438
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7436
+		$filter_query = $this->getFilter($filters, true, true);
7437
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7438
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7439 7439
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7440 7440
                     GROUP BY spotter_output.departure_airport_country
7441 7441
 					ORDER BY airport_departure_country_count DESC";
@@ -7447,7 +7447,7 @@  discard block
 block discarded – undo
7447 7447
 		$airport_array = array();
7448 7448
 		$temp_array = array();
7449 7449
         
7450
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7450
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7451 7451
 		{
7452 7452
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7453 7453
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7464,11 +7464,11 @@  discard block
 block discarded – undo
7464 7464
 	* @return Array the airport list
7465 7465
 	*
7466 7466
 	*/
7467
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7467
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7468 7468
 	{
7469
-		$filter_query = $this->getFilter($filters,true,true);
7470
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7471
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7469
+		$filter_query = $this->getFilter($filters, true, true);
7470
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7471
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7472 7472
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7473 7473
 			GROUP BY spotter_output.departure_airport_country
7474 7474
 			ORDER BY airport_departure_country_count DESC";
@@ -7484,11 +7484,11 @@  discard block
 block discarded – undo
7484 7484
 	* @return Array the airport list
7485 7485
 	*
7486 7486
 	*/
7487
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7487
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7488 7488
 	{
7489
-		$filter_query = $this->getFilter($filters,true,true);
7490
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7491
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7489
+		$filter_query = $this->getFilter($filters, true, true);
7490
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7491
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7492 7492
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7493 7493
 			GROUP BY spotter_output.departure_airport_country
7494 7494
 			ORDER BY airport_departure_country_count DESC";
@@ -7506,12 +7506,12 @@  discard block
 block discarded – undo
7506 7506
 	* @return Array the airport list
7507 7507
 	*
7508 7508
 	*/
7509
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7509
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7510 7510
 	{
7511
-		$filter_query = $this->getFilter($filters,true,true);
7512
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7511
+		$filter_query = $this->getFilter($filters, true, true);
7512
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7513 7513
 
7514
-		$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 
7514
+		$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 
7515 7515
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7516 7516
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7517 7517
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7523,7 +7523,7 @@  discard block
 block discarded – undo
7523 7523
 		$airport_array = array();
7524 7524
 		$temp_array = array();
7525 7525
         
7526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7527 7527
 		{
7528 7528
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7529 7529
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7544,11 +7544,11 @@  discard block
 block discarded – undo
7544 7544
 	* @return Array the airport list
7545 7545
 	*
7546 7546
 	*/
7547
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7547
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7548 7548
 	{
7549
-		$filter_query = $this->getFilter($filters,true,true);
7550
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7551
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7549
+		$filter_query = $this->getFilter($filters, true, true);
7550
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7551
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7552 7552
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7553 7553
                     GROUP BY spotter_output.departure_airport_country
7554 7554
 					ORDER BY airport_departure_country_count DESC";
@@ -7560,7 +7560,7 @@  discard block
 block discarded – undo
7560 7560
 		$airport_array = array();
7561 7561
 		$temp_array = array();
7562 7562
         
7563
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7563
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7564 7564
 		{
7565 7565
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7566 7566
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7583,11 +7583,11 @@  discard block
 block discarded – undo
7583 7583
 	* @return Array the airport list
7584 7584
 	*
7585 7585
 	*/
7586
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7586
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7587 7587
 	{
7588 7588
 		global $globalDBdriver;
7589
-		$filter_query = $this->getFilter($filters,true,true);
7590
-		$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 
7589
+		$filter_query = $this->getFilter($filters, true, true);
7590
+		$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 
7591 7591
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7592 7592
                 if ($olderthanmonths > 0) {
7593 7593
             		if ($globalDBdriver == 'mysql') {
@@ -7607,28 +7607,28 @@  discard block
 block discarded – undo
7607 7607
 		if ($year != '') {
7608 7608
 			if ($globalDBdriver == 'mysql') {
7609 7609
 				$query .= " AND YEAR(spotter_output.date) = :year";
7610
-				$query_values = array_merge($query_values,array(':year' => $year));
7610
+				$query_values = array_merge($query_values, array(':year' => $year));
7611 7611
 			} else {
7612 7612
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7613
-				$query_values = array_merge($query_values,array(':year' => $year));
7613
+				$query_values = array_merge($query_values, array(':year' => $year));
7614 7614
 			}
7615 7615
 		}
7616 7616
 		if ($month != '') {
7617 7617
 			if ($globalDBdriver == 'mysql') {
7618 7618
 				$query .= " AND MONTH(spotter_output.date) = :month";
7619
-				$query_values = array_merge($query_values,array(':month' => $month));
7619
+				$query_values = array_merge($query_values, array(':month' => $month));
7620 7620
 			} else {
7621 7621
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7622
-				$query_values = array_merge($query_values,array(':month' => $month));
7622
+				$query_values = array_merge($query_values, array(':month' => $month));
7623 7623
 			}
7624 7624
 		}
7625 7625
 		if ($day != '') {
7626 7626
 			if ($globalDBdriver == 'mysql') {
7627 7627
 				$query .= " AND DAY(spotter_output.date) = :day";
7628
-				$query_values = array_merge($query_values,array(':day' => $day));
7628
+				$query_values = array_merge($query_values, array(':day' => $day));
7629 7629
 			} else {
7630 7630
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7631
-				$query_values = array_merge($query_values,array(':day' => $day));
7631
+				$query_values = array_merge($query_values, array(':day' => $day));
7632 7632
 			}
7633 7633
 		}
7634 7634
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7642,7 +7642,7 @@  discard block
 block discarded – undo
7642 7642
 		$airport_array = array();
7643 7643
 		$temp_array = array();
7644 7644
         
7645
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7645
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7646 7646
 		{
7647 7647
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7648 7648
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7665,11 +7665,11 @@  discard block
 block discarded – undo
7665 7665
 	* @return Array the airport list
7666 7666
 	*
7667 7667
 	*/
7668
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7668
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7669 7669
 	{
7670 7670
 		global $globalDBdriver;
7671
-		$filter_query = $this->getFilter($filters,true,true);
7672
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, 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 
7671
+		$filter_query = $this->getFilter($filters, true, true);
7672
+		$query = "SELECT DISTINCT spotter_output.airline_icao, 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 
7673 7673
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7674 7674
                 if ($olderthanmonths > 0) {
7675 7675
             		if ($globalDBdriver == 'mysql') {
@@ -7699,7 +7699,7 @@  discard block
 block discarded – undo
7699 7699
 		$airport_array = array();
7700 7700
 		$temp_array = array();
7701 7701
         
7702
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7702
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7703 7703
 		{
7704 7704
 			$temp_array['airline_icao'] = $row['airline_icao'];
7705 7705
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7724,11 +7724,11 @@  discard block
 block discarded – undo
7724 7724
 	* @return Array the airport list
7725 7725
 	*
7726 7726
 	*/
7727
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7727
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7728 7728
 	{
7729 7729
 		global $globalDBdriver;
7730
-		$filter_query = $this->getFilter($filters,true,true);
7731
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7730
+		$filter_query = $this->getFilter($filters, true, true);
7731
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7732 7732
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7733 7733
                 if ($olderthanmonths > 0) {
7734 7734
             		if ($globalDBdriver == 'mysql') {
@@ -7748,28 +7748,28 @@  discard block
 block discarded – undo
7748 7748
 		if ($year != '') {
7749 7749
 			if ($globalDBdriver == 'mysql') {
7750 7750
 				$query .= " AND YEAR(spotter_output.date) = :year";
7751
-				$query_values = array_merge($query_values,array(':year' => $year));
7751
+				$query_values = array_merge($query_values, array(':year' => $year));
7752 7752
 			} else {
7753 7753
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7754
-				$query_values = array_merge($query_values,array(':year' => $year));
7754
+				$query_values = array_merge($query_values, array(':year' => $year));
7755 7755
 			}
7756 7756
 		}
7757 7757
 		if ($month != '') {
7758 7758
 			if ($globalDBdriver == 'mysql') {
7759 7759
 				$query .= " AND MONTH(spotter_output.date) = :month";
7760
-				$query_values = array_merge($query_values,array(':month' => $month));
7760
+				$query_values = array_merge($query_values, array(':month' => $month));
7761 7761
 			} else {
7762 7762
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7763
-				$query_values = array_merge($query_values,array(':month' => $month));
7763
+				$query_values = array_merge($query_values, array(':month' => $month));
7764 7764
 			}
7765 7765
 		}
7766 7766
 		if ($day != '') {
7767 7767
 			if ($globalDBdriver == 'mysql') {
7768 7768
 				$query .= " AND DAY(spotter_output.date) = :day";
7769
-				$query_values = array_merge($query_values,array(':day' => $day));
7769
+				$query_values = array_merge($query_values, array(':day' => $day));
7770 7770
 			} else {
7771 7771
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7772
-				$query_values = array_merge($query_values,array(':day' => $day));
7772
+				$query_values = array_merge($query_values, array(':day' => $day));
7773 7773
 			}
7774 7774
 		}
7775 7775
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7782,7 +7782,7 @@  discard block
 block discarded – undo
7782 7782
       
7783 7783
 		$airport_array = array();
7784 7784
 		$temp_array = array();
7785
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7785
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7786 7786
 		{
7787 7787
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7788 7788
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7805,11 +7805,11 @@  discard block
 block discarded – undo
7805 7805
 	* @return Array the airport list
7806 7806
 	*
7807 7807
 	*/
7808
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7808
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7809 7809
 	{
7810 7810
 		global $globalDBdriver;
7811
-		$filter_query = $this->getFilter($filters,true,true);
7812
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7811
+		$filter_query = $this->getFilter($filters, true, true);
7812
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7813 7813
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7814 7814
                 if ($olderthanmonths > 0) {
7815 7815
             		if ($globalDBdriver == 'mysql') {
@@ -7839,7 +7839,7 @@  discard block
 block discarded – undo
7839 7839
 		$airport_array = array();
7840 7840
 		$temp_array = array();
7841 7841
         
7842
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7842
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7843 7843
 		{
7844 7844
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7845 7845
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7865,9 +7865,9 @@  discard block
 block discarded – undo
7865 7865
 	*/
7866 7866
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7867 7867
 	{
7868
-		$filter_query = $this->getFilter($filters,true,true);
7869
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7870
-		$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 
7868
+		$filter_query = $this->getFilter($filters, true, true);
7869
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7870
+		$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 
7871 7871
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7872 7872
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7873 7873
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7878,7 +7878,7 @@  discard block
 block discarded – undo
7878 7878
 		$airport_array = array();
7879 7879
 		$temp_array = array();
7880 7880
         
7881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7882 7882
 		{
7883 7883
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7884 7884
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7899,12 +7899,12 @@  discard block
 block discarded – undo
7899 7899
 	* @return Array the airport list
7900 7900
 	*
7901 7901
 	*/
7902
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7902
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7903 7903
 	{
7904
-		$filter_query = $this->getFilter($filters,true,true);
7905
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7904
+		$filter_query = $this->getFilter($filters, true, true);
7905
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7906 7906
 					
7907
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7907
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7908 7908
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7909 7909
                     GROUP BY spotter_output.arrival_airport_country
7910 7910
 					ORDER BY airport_arrival_country_count DESC";
@@ -7916,7 +7916,7 @@  discard block
 block discarded – undo
7916 7916
 		$airport_array = array();
7917 7917
 		$temp_array = array();
7918 7918
         
7919
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7919
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7920 7920
 		{
7921 7921
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7922 7922
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7934,11 +7934,11 @@  discard block
 block discarded – undo
7934 7934
 	* @return Array the airport list
7935 7935
 	*
7936 7936
 	*/
7937
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7937
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7938 7938
 	{
7939
-		$filter_query = $this->getFilter($filters,true,true);
7940
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7941
-		$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 
7939
+		$filter_query = $this->getFilter($filters, true, true);
7940
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7941
+		$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 
7942 7942
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7943 7943
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7944 7944
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7950,7 +7950,7 @@  discard block
 block discarded – undo
7950 7950
 		$airport_array = array();
7951 7951
 		$temp_array = array();
7952 7952
         
7953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7954 7954
 		{
7955 7955
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7956 7956
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7972,11 +7972,11 @@  discard block
 block discarded – undo
7972 7972
 	* @return Array the airport list
7973 7973
 	*
7974 7974
 	*/
7975
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7975
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7976 7976
 	{
7977
-		$filter_query = $this->getFilter($filters,true,true);
7978
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7979
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7977
+		$filter_query = $this->getFilter($filters, true, true);
7978
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7979
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7980 7980
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7981 7981
                     GROUP BY spotter_output.arrival_airport_country
7982 7982
 					ORDER BY airport_arrival_country_count DESC";
@@ -7988,7 +7988,7 @@  discard block
 block discarded – undo
7988 7988
 		$airport_array = array();
7989 7989
 		$temp_array = array();
7990 7990
         
7991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7992 7992
 		{
7993 7993
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7994 7994
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8006,12 +8006,12 @@  discard block
 block discarded – undo
8006 8006
 	* @return Array the airport list
8007 8007
 	*
8008 8008
 	*/
8009
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8009
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8010 8010
 	{
8011
-		$filter_query = $this->getFilter($filters,true,true);
8012
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8011
+		$filter_query = $this->getFilter($filters, true, true);
8012
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8013 8013
 
8014
-		$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 
8014
+		$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 
8015 8015
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
8016 8016
                     GROUP BY spotter_output.arrival_airport_icao
8017 8017
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8023,7 +8023,7 @@  discard block
 block discarded – undo
8023 8023
 		$airport_array = array();
8024 8024
 		$temp_array = array();
8025 8025
         
8026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8027 8027
 		{
8028 8028
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8029 8029
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8044,11 +8044,11 @@  discard block
 block discarded – undo
8044 8044
 	* @return Array the airport list
8045 8045
 	*
8046 8046
 	*/
8047
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8047
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8048 8048
 	{
8049
-		$filter_query = $this->getFilter($filters,true,true);
8050
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8051
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8049
+		$filter_query = $this->getFilter($filters, true, true);
8050
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8051
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8052 8052
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8053 8053
                     GROUP BY spotter_output.arrival_airport_country
8054 8054
 					ORDER BY airport_arrival_country_count DESC";
@@ -8060,7 +8060,7 @@  discard block
 block discarded – undo
8060 8060
 		$airport_array = array();
8061 8061
 		$temp_array = array();
8062 8062
         
8063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8064 8064
 		{
8065 8065
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8066 8066
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8079,11 +8079,11 @@  discard block
 block discarded – undo
8079 8079
 	* @return Array the airport list
8080 8080
 	*
8081 8081
 	*/
8082
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8082
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8083 8083
 	{
8084
-		$filter_query = $this->getFilter($filters,true,true);
8085
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8086
-		$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 
8084
+		$filter_query = $this->getFilter($filters, true, true);
8085
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8086
+		$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 
8087 8087
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8088 8088
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8089 8089
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8095,7 +8095,7 @@  discard block
 block discarded – undo
8095 8095
 		$airport_array = array();
8096 8096
 		$temp_array = array();
8097 8097
         
8098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8099 8099
 		{
8100 8100
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8101 8101
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8116,11 +8116,11 @@  discard block
 block discarded – undo
8116 8116
 	* @return Array the airport list
8117 8117
 	*
8118 8118
 	*/
8119
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8119
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8120 8120
 	{
8121
-		$filter_query = $this->getFilter($filters,true,true);
8122
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8123
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8121
+		$filter_query = $this->getFilter($filters, true, true);
8122
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8123
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8124 8124
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8125 8125
                     GROUP BY spotter_output.arrival_airport_country
8126 8126
 					ORDER BY airport_arrival_country_count DESC";
@@ -8132,7 +8132,7 @@  discard block
 block discarded – undo
8132 8132
 		$airport_array = array();
8133 8133
 		$temp_array = array();
8134 8134
         
8135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8136 8136
 		{
8137 8137
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8138 8138
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8150,11 +8150,11 @@  discard block
 block discarded – undo
8150 8150
 	* @return Array the airport list
8151 8151
 	*
8152 8152
 	*/
8153
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8153
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8154 8154
 	{
8155
-		$filter_query = $this->getFilter($filters,true,true);
8156
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8157
-		$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 
8155
+		$filter_query = $this->getFilter($filters, true, true);
8156
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8157
+		$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 
8158 8158
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8159 8159
                     GROUP BY spotter_output.arrival_airport_icao
8160 8160
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8166,7 +8166,7 @@  discard block
 block discarded – undo
8166 8166
 		$airport_array = array();
8167 8167
 		$temp_array = array();
8168 8168
         
8169
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8169
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8170 8170
 		{
8171 8171
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8172 8172
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8188,11 +8188,11 @@  discard block
 block discarded – undo
8188 8188
 	* @return Array the airport list
8189 8189
 	*
8190 8190
 	*/
8191
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8191
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8192 8192
 	{
8193
-		$filter_query = $this->getFilter($filters,true,true);
8194
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8195
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8193
+		$filter_query = $this->getFilter($filters, true, true);
8194
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8195
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8196 8196
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8197 8197
                     GROUP BY spotter_output.arrival_airport_country
8198 8198
 					ORDER BY airport_arrival_country_count DESC";
@@ -8204,7 +8204,7 @@  discard block
 block discarded – undo
8204 8204
 		$airport_array = array();
8205 8205
 		$temp_array = array();
8206 8206
         
8207
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8207
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8208 8208
 		{
8209 8209
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8210 8210
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8223,11 +8223,11 @@  discard block
 block discarded – undo
8223 8223
 	* @return Array the airport list
8224 8224
 	*
8225 8225
 	*/
8226
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8226
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8227 8227
 	{
8228 8228
 		global $globalTimezone, $globalDBdriver;
8229
-		$filter_query = $this->getFilter($filters,true,true);
8230
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8229
+		$filter_query = $this->getFilter($filters, true, true);
8230
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8231 8231
 		if ($globalTimezone != '') {
8232 8232
 			date_default_timezone_set($globalTimezone);
8233 8233
 			$datetime = new DateTime($date);
@@ -8235,12 +8235,12 @@  discard block
 block discarded – undo
8235 8235
 		} else $offset = '+00:00';
8236 8236
 
8237 8237
 		if ($globalDBdriver == 'mysql') {
8238
-			$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 
8238
+			$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 
8239 8239
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8240 8240
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8241 8241
 					ORDER BY airport_arrival_icao_count DESC";
8242 8242
 		} else {
8243
-			$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 
8243
+			$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 
8244 8244
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8245 8245
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8246 8246
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8252,7 +8252,7 @@  discard block
 block discarded – undo
8252 8252
 		$airport_array = array();
8253 8253
 		$temp_array = array();
8254 8254
         
8255
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8255
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8256 8256
 		{
8257 8257
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8258 8258
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8276,8 +8276,8 @@  discard block
 block discarded – undo
8276 8276
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8277 8277
 	{
8278 8278
 		global $globalTimezone, $globalDBdriver;
8279
-		$filter_query = $this->getFilter($filters,true,true);
8280
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8279
+		$filter_query = $this->getFilter($filters, true, true);
8280
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8281 8281
 		if ($globalTimezone != '') {
8282 8282
 			date_default_timezone_set($globalTimezone);
8283 8283
 			$datetime = new DateTime($date);
@@ -8285,12 +8285,12 @@  discard block
 block discarded – undo
8285 8285
 		} else $offset = '+00:00';
8286 8286
 
8287 8287
 		if ($globalDBdriver == 'mysql') {
8288
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8288
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8289 8289
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8290 8290
 					GROUP BY spotter_output.arrival_airport_country
8291 8291
 					ORDER BY airport_arrival_country_count DESC";
8292 8292
 		} else {
8293
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8293
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8294 8294
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
8295 8295
 					GROUP BY spotter_output.arrival_airport_country
8296 8296
 					ORDER BY airport_arrival_country_count DESC";
@@ -8302,7 +8302,7 @@  discard block
 block discarded – undo
8302 8302
 		$airport_array = array();
8303 8303
 		$temp_array = array();
8304 8304
         
8305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8306 8306
 		{
8307 8307
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8308 8308
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8320,11 +8320,11 @@  discard block
 block discarded – undo
8320 8320
 	* @return Array the airport list
8321 8321
 	*
8322 8322
 	*/
8323
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8323
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8324 8324
 	{
8325
-		$filter_query = $this->getFilter($filters,true,true);
8326
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8327
-		$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 
8325
+		$filter_query = $this->getFilter($filters, true, true);
8326
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8327
+		$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 
8328 8328
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
8329 8329
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8330 8330
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8336,7 +8336,7 @@  discard block
 block discarded – undo
8336 8336
 		$airport_array = array();
8337 8337
 		$temp_array = array();
8338 8338
         
8339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8340 8340
 		{
8341 8341
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8342 8342
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8356,11 +8356,11 @@  discard block
 block discarded – undo
8356 8356
 	* @return Array the airport list
8357 8357
 	*
8358 8358
 	*/
8359
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8359
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8360 8360
 	{
8361
-		$filter_query = $this->getFilter($filters,true,true);
8362
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8363
-		$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 
8361
+		$filter_query = $this->getFilter($filters, true, true);
8362
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8363
+		$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 
8364 8364
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8365 8365
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8366 8366
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8371,7 +8371,7 @@  discard block
 block discarded – undo
8371 8371
 		$airport_array = array();
8372 8372
 		$temp_array = array();
8373 8373
         
8374
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8374
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8375 8375
 		{
8376 8376
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8377 8377
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8391,11 +8391,11 @@  discard block
 block discarded – undo
8391 8391
 	* @return Array the airport list
8392 8392
 	*
8393 8393
 	*/
8394
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8394
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8395 8395
 	{
8396
-		$filter_query = $this->getFilter($filters,true,true);
8397
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8398
-		$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 
8396
+		$filter_query = $this->getFilter($filters, true, true);
8397
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8398
+		$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 
8399 8399
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8400 8400
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8401 8401
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8406,7 +8406,7 @@  discard block
 block discarded – undo
8406 8406
 		$airport_array = array();
8407 8407
 		$temp_array = array();
8408 8408
         
8409
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8409
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8410 8410
 		{
8411 8411
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8412 8412
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8428,9 +8428,9 @@  discard block
 block discarded – undo
8428 8428
 	*/
8429 8429
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8430 8430
 	{
8431
-		$filter_query = $this->getFilter($filters,true,true);
8432
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8433
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8431
+		$filter_query = $this->getFilter($filters, true, true);
8432
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8433
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8434 8434
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8435 8435
                     GROUP BY spotter_output.arrival_airport_country
8436 8436
 					ORDER BY airport_arrival_country_count DESC";
@@ -8442,7 +8442,7 @@  discard block
 block discarded – undo
8442 8442
 		$airport_array = array();
8443 8443
 		$temp_array = array();
8444 8444
         
8445
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8445
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8446 8446
 		{
8447 8447
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8448 8448
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8461,9 +8461,9 @@  discard block
 block discarded – undo
8461 8461
 	*/
8462 8462
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8463 8463
 	{
8464
-		$filter_query = $this->getFilter($filters,true,true);
8465
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8466
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8464
+		$filter_query = $this->getFilter($filters, true, true);
8465
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8466
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8467 8467
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8468 8468
                     GROUP BY spotter_output.arrival_airport_country
8469 8469
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8481,9 +8481,9 @@  discard block
 block discarded – undo
8481 8481
 	*/
8482 8482
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8483 8483
 	{
8484
-		$filter_query = $this->getFilter($filters,true,true);
8485
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8486
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8484
+		$filter_query = $this->getFilter($filters, true, true);
8485
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8486
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8487 8487
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8488 8488
                     GROUP BY spotter_output.arrival_airport_country
8489 8489
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8501,11 +8501,11 @@  discard block
 block discarded – undo
8501 8501
 	* @return Array the airport list
8502 8502
 	*
8503 8503
 	*/
8504
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8504
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8505 8505
 	{
8506
-		$filter_query = $this->getFilter($filters,true,true);
8507
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8508
-		$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 
8506
+		$filter_query = $this->getFilter($filters, true, true);
8507
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8508
+		$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 
8509 8509
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8510 8510
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8511 8511
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8517,7 +8517,7 @@  discard block
 block discarded – undo
8517 8517
 		$airport_array = array();
8518 8518
 		$temp_array = array();
8519 8519
         
8520
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8520
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8521 8521
 		{
8522 8522
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8523 8523
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8538,12 +8538,12 @@  discard block
 block discarded – undo
8538 8538
 	* @return Array the airport list
8539 8539
 	*
8540 8540
 	*/
8541
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8541
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8542 8542
 	{
8543 8543
 		global $globalDBdriver;
8544
-		$filter_query = $this->getFilter($filters,true,true);
8545
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8546
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8544
+		$filter_query = $this->getFilter($filters, true, true);
8545
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8546
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8547 8547
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8548 8548
                     GROUP BY spotter_output.arrival_airport_country
8549 8549
 					ORDER BY airport_arrival_country_count DESC";
@@ -8555,7 +8555,7 @@  discard block
 block discarded – undo
8555 8555
 		$airport_array = array();
8556 8556
 		$temp_array = array();
8557 8557
         
8558
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8558
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8559 8559
 		{
8560 8560
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8561 8561
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8574,38 +8574,38 @@  discard block
 block discarded – undo
8574 8574
 	* @return Array the airport departure list
8575 8575
 	*
8576 8576
 	*/
8577
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8577
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8578 8578
 	{
8579 8579
 		global $globalDBdriver;
8580
-		$filter_query = $this->getFilter($filters,true,true);
8581
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8580
+		$filter_query = $this->getFilter($filters, true, true);
8581
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8582 8582
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8583 8583
 		$query_values = array();
8584 8584
 		if ($year != '') {
8585 8585
 			if ($globalDBdriver == 'mysql') {
8586 8586
 				$query .= " AND YEAR(spotter_output.date) = :year";
8587
-				$query_values = array_merge($query_values,array(':year' => $year));
8587
+				$query_values = array_merge($query_values, array(':year' => $year));
8588 8588
 			} else {
8589 8589
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8590
-				$query_values = array_merge($query_values,array(':year' => $year));
8590
+				$query_values = array_merge($query_values, array(':year' => $year));
8591 8591
 			}
8592 8592
 		}
8593 8593
 		if ($month != '') {
8594 8594
 			if ($globalDBdriver == 'mysql') {
8595 8595
 				$query .= " AND MONTH(spotter_output.date) = :month";
8596
-				$query_values = array_merge($query_values,array(':month' => $month));
8596
+				$query_values = array_merge($query_values, array(':month' => $month));
8597 8597
 			} else {
8598 8598
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8599
-				$query_values = array_merge($query_values,array(':month' => $month));
8599
+				$query_values = array_merge($query_values, array(':month' => $month));
8600 8600
 			}
8601 8601
 		}
8602 8602
 		if ($day != '') {
8603 8603
 			if ($globalDBdriver == 'mysql') {
8604 8604
 				$query .= " AND DAY(spotter_output.date) = :day";
8605
-				$query_values = array_merge($query_values,array(':day' => $day));
8605
+				$query_values = array_merge($query_values, array(':day' => $day));
8606 8606
 			} else {
8607 8607
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8608
-				$query_values = array_merge($query_values,array(':day' => $day));
8608
+				$query_values = array_merge($query_values, array(':day' => $day));
8609 8609
 			}
8610 8610
 		}
8611 8611
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8619,7 +8619,7 @@  discard block
 block discarded – undo
8619 8619
 		$airport_array = array();
8620 8620
 		$temp_array = array();
8621 8621
         
8622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8623 8623
 		{
8624 8624
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8625 8625
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8637,38 +8637,38 @@  discard block
 block discarded – undo
8637 8637
 	* @return Array the airport arrival list
8638 8638
 	*
8639 8639
 	*/
8640
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8640
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8641 8641
 	{
8642 8642
 		global $globalDBdriver;
8643
-		$filter_query = $this->getFilter($filters,true,true);
8644
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8643
+		$filter_query = $this->getFilter($filters, true, true);
8644
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8645 8645
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8646 8646
 		$query_values = array();
8647 8647
 		if ($year != '') {
8648 8648
 			if ($globalDBdriver == 'mysql') {
8649 8649
 				$query .= " AND YEAR(spotter_output.date) = :year";
8650
-				$query_values = array_merge($query_values,array(':year' => $year));
8650
+				$query_values = array_merge($query_values, array(':year' => $year));
8651 8651
 			} else {
8652 8652
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8653
-				$query_values = array_merge($query_values,array(':year' => $year));
8653
+				$query_values = array_merge($query_values, array(':year' => $year));
8654 8654
 			}
8655 8655
 		}
8656 8656
 		if ($month != '') {
8657 8657
 			if ($globalDBdriver == 'mysql') {
8658 8658
 				$query .= " AND MONTH(spotter_output.date) = :month";
8659
-				$query_values = array_merge($query_values,array(':month' => $month));
8659
+				$query_values = array_merge($query_values, array(':month' => $month));
8660 8660
 			} else {
8661 8661
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8662
-				$query_values = array_merge($query_values,array(':month' => $month));
8662
+				$query_values = array_merge($query_values, array(':month' => $month));
8663 8663
 			}
8664 8664
 		}
8665 8665
 		if ($day != '') {
8666 8666
 			if ($globalDBdriver == 'mysql') {
8667 8667
 				$query .= " AND DAY(spotter_output.date) = :day";
8668
-				$query_values = array_merge($query_values,array(':day' => $day));
8668
+				$query_values = array_merge($query_values, array(':day' => $day));
8669 8669
 			} else {
8670 8670
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8671
-				$query_values = array_merge($query_values,array(':day' => $day));
8671
+				$query_values = array_merge($query_values, array(':day' => $day));
8672 8672
 			}
8673 8673
 		}
8674 8674
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8682,7 +8682,7 @@  discard block
 block discarded – undo
8682 8682
 		$airport_array = array();
8683 8683
 		$temp_array = array();
8684 8684
         
8685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8686 8686
 		{
8687 8687
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8688 8688
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8705,8 +8705,8 @@  discard block
 block discarded – undo
8705 8705
 	*/
8706 8706
 	public function countAllRoutes($filters = array())
8707 8707
 	{
8708
-		$filter_query = $this->getFilter($filters,true,true);
8709
-		$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
8708
+		$filter_query = $this->getFilter($filters, true, true);
8709
+		$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
8710 8710
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
8711 8711
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
8712 8712
                     ORDER BY route_count DESC
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 		$routes_array = array();
8720 8720
 		$temp_array = array();
8721 8721
         
8722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8723 8723
 		{
8724 8724
 			$temp_array['route_count'] = $row['route_count'];
8725 8725
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8746,11 +8746,11 @@  discard block
 block discarded – undo
8746 8746
 	* @return Array the route list
8747 8747
 	*
8748 8748
 	*/
8749
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8749
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8750 8750
 	{
8751
-		$filter_query = $this->getFilter($filters,true,true);
8752
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8753
-		$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
8751
+		$filter_query = $this->getFilter($filters, true, true);
8752
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8753
+		$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
8754 8754
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8755 8755
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8756 8756
 			    ORDER BY route_count DESC";
@@ -8761,7 +8761,7 @@  discard block
 block discarded – undo
8761 8761
 		$routes_array = array();
8762 8762
 		$temp_array = array();
8763 8763
         
8764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8765 8765
 		{
8766 8766
 			$temp_array['route_count'] = $row['route_count'];
8767 8767
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8788,9 +8788,9 @@  discard block
 block discarded – undo
8788 8788
 	*/
8789 8789
 	public function countAllRoutesByRegistration($registration, $filters = array())
8790 8790
 	{
8791
-		$filter_query = $this->getFilter($filters,true,true);
8791
+		$filter_query = $this->getFilter($filters, true, true);
8792 8792
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8793
-		$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
8793
+		$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
8794 8794
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8795 8795
                     GROUP BY route
8796 8796
                     ORDER BY route_count DESC";
@@ -8802,7 +8802,7 @@  discard block
 block discarded – undo
8802 8802
 		$routes_array = array();
8803 8803
 		$temp_array = array();
8804 8804
         
8805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8806 8806
 		{
8807 8807
 			$temp_array['route_count'] = $row['route_count'];
8808 8808
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8830,9 +8830,9 @@  discard block
 block discarded – undo
8830 8830
 	*/
8831 8831
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8832 8832
 	{
8833
-		$filter_query = $this->getFilter($filters,true,true);
8834
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8835
-		$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
8833
+		$filter_query = $this->getFilter($filters, true, true);
8834
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8835
+		$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
8836 8836
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8837 8837
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8838 8838
 			    ORDER BY route_count DESC";
@@ -8844,7 +8844,7 @@  discard block
 block discarded – undo
8844 8844
 		$routes_array = array();
8845 8845
 		$temp_array = array();
8846 8846
         
8847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8848 8848
 		{
8849 8849
 			$temp_array['route_count'] = $row['route_count'];
8850 8850
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8872,9 +8872,9 @@  discard block
 block discarded – undo
8872 8872
 	*/
8873 8873
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8874 8874
 	{
8875
-		$filter_query = $this->getFilter($filters,true,true);
8876
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8877
-		$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
8875
+		$filter_query = $this->getFilter($filters, true, true);
8876
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8877
+		$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
8878 8878
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8879 8879
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8880 8880
 			    ORDER BY route_count DESC";
@@ -8885,7 +8885,7 @@  discard block
 block discarded – undo
8885 8885
 		$routes_array = array();
8886 8886
 		$temp_array = array();
8887 8887
         
8888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8889 8889
 		{
8890 8890
 			$temp_array['route_count'] = $row['route_count'];
8891 8891
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8913,9 +8913,9 @@  discard block
 block discarded – undo
8913 8913
 	*/
8914 8914
 	public function countAllRoutesByCountry($country, $filters = array())
8915 8915
 	{
8916
-		$filter_query = $this->getFilter($filters,true,true);
8917
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8918
-		$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
8916
+		$filter_query = $this->getFilter($filters, true, true);
8917
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8918
+		$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
8919 8919
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8920 8920
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8921 8921
 			    ORDER BY route_count DESC";
@@ -8926,7 +8926,7 @@  discard block
 block discarded – undo
8926 8926
 		$routes_array = array();
8927 8927
 		$temp_array = array();
8928 8928
         
8929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8930 8930
 		{
8931 8931
 			$temp_array['route_count'] = $row['route_count'];
8932 8932
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8954,8 +8954,8 @@  discard block
 block discarded – undo
8954 8954
 	public function countAllRoutesByDate($date, $filters = array())
8955 8955
 	{
8956 8956
 		global $globalTimezone, $globalDBdriver;
8957
-		$filter_query = $this->getFilter($filters,true,true);
8958
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8957
+		$filter_query = $this->getFilter($filters, true, true);
8958
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8959 8959
 		if ($globalTimezone != '') {
8960 8960
 			date_default_timezone_set($globalTimezone);
8961 8961
 			$datetime = new DateTime($date);
@@ -8963,12 +8963,12 @@  discard block
 block discarded – undo
8963 8963
 		} else $offset = '+00:00';
8964 8964
 		
8965 8965
 		if ($globalDBdriver == 'mysql') {
8966
-			$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
8966
+			$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
8967 8967
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8968 8968
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8969 8969
 				    ORDER BY route_count DESC";
8970 8970
 		} else {
8971
-			$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
8971
+			$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
8972 8972
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8973 8973
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8974 8974
 				    ORDER BY route_count DESC";
@@ -8980,7 +8980,7 @@  discard block
 block discarded – undo
8980 8980
 		$routes_array = array();
8981 8981
 		$temp_array = array();
8982 8982
         
8983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8984 8984
 		{
8985 8985
 			$temp_array['route_count'] = $row['route_count'];
8986 8986
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9007,9 +9007,9 @@  discard block
 block discarded – undo
9007 9007
 	*/
9008 9008
 	public function countAllRoutesByIdent($ident, $filters = array())
9009 9009
 	{
9010
-		$filter_query = $this->getFilter($filters,true,true);
9011
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9012
-		$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
9010
+		$filter_query = $this->getFilter($filters, true, true);
9011
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9012
+		$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
9013 9013
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9014 9014
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9015 9015
                     ORDER BY route_count DESC";
@@ -9021,7 +9021,7 @@  discard block
 block discarded – undo
9021 9021
 		$routes_array = array();
9022 9022
 		$temp_array = array();
9023 9023
         
9024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9025 9025
 		{
9026 9026
 			$temp_array['route_count'] = $row['route_count'];
9027 9027
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9045,11 +9045,11 @@  discard block
 block discarded – undo
9045 9045
 	* @return Array the route list
9046 9046
 	*
9047 9047
 	*/
9048
-	public function countAllRoutesByOwner($owner,$filters = array())
9048
+	public function countAllRoutesByOwner($owner, $filters = array())
9049 9049
 	{
9050
-		$filter_query = $this->getFilter($filters,true,true);
9051
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9052
-		$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
9050
+		$filter_query = $this->getFilter($filters, true, true);
9051
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9052
+		$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
9053 9053
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9054 9054
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9055 9055
                     ORDER BY route_count DESC";
@@ -9061,7 +9061,7 @@  discard block
 block discarded – undo
9061 9061
 		$routes_array = array();
9062 9062
 		$temp_array = array();
9063 9063
         
9064
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9064
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9065 9065
 		{
9066 9066
 			$temp_array['route_count'] = $row['route_count'];
9067 9067
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9085,11 +9085,11 @@  discard block
 block discarded – undo
9085 9085
 	* @return Array the route list
9086 9086
 	*
9087 9087
 	*/
9088
-	public function countAllRoutesByPilot($pilot,$filters = array())
9088
+	public function countAllRoutesByPilot($pilot, $filters = array())
9089 9089
 	{
9090
-		$filter_query = $this->getFilter($filters,true,true);
9091
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9092
-		$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
9090
+		$filter_query = $this->getFilter($filters, true, true);
9091
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9092
+		$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
9093 9093
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9094 9094
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9095 9095
                     ORDER BY route_count DESC";
@@ -9101,7 +9101,7 @@  discard block
 block discarded – undo
9101 9101
 		$routes_array = array();
9102 9102
 		$temp_array = array();
9103 9103
         
9104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9105 9105
 		{
9106 9106
 			$temp_array['route_count'] = $row['route_count'];
9107 9107
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9128,9 +9128,9 @@  discard block
 block discarded – undo
9128 9128
 	*/
9129 9129
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9130 9130
 	{
9131
-		$filter_query = $this->getFilter($filters,true,true);
9132
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9133
-		$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
9131
+		$filter_query = $this->getFilter($filters, true, true);
9132
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9133
+		$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
9134 9134
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9135 9135
                     GROUP BY route
9136 9136
                     ORDER BY route_count DESC";
@@ -9142,7 +9142,7 @@  discard block
 block discarded – undo
9142 9142
 		$routes_array = array();
9143 9143
 		$temp_array = array();
9144 9144
         
9145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9146 9146
 		{
9147 9147
 			$temp_array['route_count'] = $row['route_count'];
9148 9148
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9170,8 +9170,8 @@  discard block
 block discarded – undo
9170 9170
 	*/
9171 9171
 	public function countAllRoutesWithWaypoints($filters = array())
9172 9172
 	{
9173
-		$filter_query = $this->getFilter($filters,true,true);
9174
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, 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
9173
+		$filter_query = $this->getFilter($filters, true, true);
9174
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, 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
9175 9175
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9176 9176
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
9177 9177
                     ORDER BY route_count DESC
@@ -9184,7 +9184,7 @@  discard block
 block discarded – undo
9184 9184
 		$routes_array = array();
9185 9185
 		$temp_array = array();
9186 9186
         
9187
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9187
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9188 9188
 		{
9189 9189
 			$temp_array['spotter_id'] = $row['spotter_id'];
9190 9190
 			$temp_array['route_count'] = $row['route_count'];
@@ -9209,11 +9209,11 @@  discard block
 block discarded – undo
9209 9209
 	* @return Array the callsign list
9210 9210
 	*
9211 9211
 	*/
9212
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9212
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9213 9213
 	{
9214 9214
 		global $globalDBdriver;
9215
-		$filter_query = $this->getFilter($filters,true,true);
9216
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9215
+		$filter_query = $this->getFilter($filters, true, true);
9216
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9217 9217
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9218 9218
 		 if ($olderthanmonths > 0) {
9219 9219
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9227,28 +9227,28 @@  discard block
 block discarded – undo
9227 9227
 		if ($year != '') {
9228 9228
 			if ($globalDBdriver == 'mysql') {
9229 9229
 				$query .= " AND YEAR(spotter_output.date) = :year";
9230
-				$query_values = array_merge($query_values,array(':year' => $year));
9230
+				$query_values = array_merge($query_values, array(':year' => $year));
9231 9231
 			} else {
9232 9232
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9233
-				$query_values = array_merge($query_values,array(':year' => $year));
9233
+				$query_values = array_merge($query_values, array(':year' => $year));
9234 9234
 			}
9235 9235
 		}
9236 9236
 		if ($month != '') {
9237 9237
 			if ($globalDBdriver == 'mysql') {
9238 9238
 				$query .= " AND MONTH(spotter_output.date) = :month";
9239
-				$query_values = array_merge($query_values,array(':month' => $month));
9239
+				$query_values = array_merge($query_values, array(':month' => $month));
9240 9240
 			} else {
9241 9241
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9242
-				$query_values = array_merge($query_values,array(':month' => $month));
9242
+				$query_values = array_merge($query_values, array(':month' => $month));
9243 9243
 			}
9244 9244
 		}
9245 9245
 		if ($day != '') {
9246 9246
 			if ($globalDBdriver == 'mysql') {
9247 9247
 				$query .= " AND DAY(spotter_output.date) = :day";
9248
-				$query_values = array_merge($query_values,array(':day' => $day));
9248
+				$query_values = array_merge($query_values, array(':day' => $day));
9249 9249
 			} else {
9250 9250
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9251
-				$query_values = array_merge($query_values,array(':day' => $day));
9251
+				$query_values = array_merge($query_values, array(':day' => $day));
9252 9252
 			}
9253 9253
 		}
9254 9254
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9260,7 +9260,7 @@  discard block
 block discarded – undo
9260 9260
 		$callsign_array = array();
9261 9261
 		$temp_array = array();
9262 9262
         
9263
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9263
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9264 9264
 		{
9265 9265
 			$temp_array['callsign_icao'] = $row['ident'];
9266 9266
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9282,8 +9282,8 @@  discard block
 block discarded – undo
9282 9282
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9283 9283
 	{
9284 9284
 		global $globalDBdriver;
9285
-		$filter_query = $this->getFilter($filters,true,true);
9286
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9285
+		$filter_query = $this->getFilter($filters, true, true);
9286
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9287 9287
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9288 9288
 		 if ($olderthanmonths > 0) {
9289 9289
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9302,7 +9302,7 @@  discard block
 block discarded – undo
9302 9302
 		$callsign_array = array();
9303 9303
 		$temp_array = array();
9304 9304
         
9305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9306 9306
 		{
9307 9307
 			$temp_array['callsign_icao'] = $row['ident'];
9308 9308
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9356,7 +9356,7 @@  discard block
 block discarded – undo
9356 9356
 		$date_array = array();
9357 9357
 		$temp_array = array();
9358 9358
         
9359
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9359
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9360 9360
 		{
9361 9361
 			$temp_array['date_name'] = $row['date_name'];
9362 9362
 			$temp_array['date_count'] = $row['date_count'];
@@ -9381,15 +9381,15 @@  discard block
 block discarded – undo
9381 9381
 			$datetime = new DateTime();
9382 9382
 			$offset = $datetime->format('P');
9383 9383
 		} else $offset = '+00:00';
9384
-		$filter_query = $this->getFilter($filters,true,true);
9384
+		$filter_query = $this->getFilter($filters, true, true);
9385 9385
 		if ($globalDBdriver == 'mysql') {
9386
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9386
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9387 9387
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9388 9388
 								GROUP BY spotter_output.airline_icao, date_name 
9389 9389
 								ORDER BY date_count DESC
9390 9390
 								LIMIT 10 OFFSET 0";
9391 9391
 		} else {
9392
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9392
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9393 9393
 								FROM spotter_output 
9394 9394
 								WHERE spotter_output.airline_icao <> '' 
9395 9395
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9404,7 +9404,7 @@  discard block
 block discarded – undo
9404 9404
 		$date_array = array();
9405 9405
 		$temp_array = array();
9406 9406
         
9407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9408 9408
 		{
9409 9409
 			$temp_array['date_name'] = $row['date_name'];
9410 9410
 			$temp_array['date_count'] = $row['date_count'];
@@ -9430,7 +9430,7 @@  discard block
 block discarded – undo
9430 9430
 			$datetime = new DateTime();
9431 9431
 			$offset = $datetime->format('P');
9432 9432
 		} else $offset = '+00:00';
9433
-		$filter_query = $this->getFilter($filters,true,true);
9433
+		$filter_query = $this->getFilter($filters, true, true);
9434 9434
 		if ($globalDBdriver == 'mysql') {
9435 9435
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9436 9436
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9451,7 +9451,7 @@  discard block
 block discarded – undo
9451 9451
 		$date_array = array();
9452 9452
 		$temp_array = array();
9453 9453
         
9454
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9454
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9455 9455
 		{
9456 9456
 			$temp_array['date_name'] = $row['date_name'];
9457 9457
 			$temp_array['date_count'] = $row['date_count'];
@@ -9476,7 +9476,7 @@  discard block
 block discarded – undo
9476 9476
 			$datetime = new DateTime();
9477 9477
 			$offset = $datetime->format('P');
9478 9478
 		} else $offset = '+00:00';
9479
-		$filter_query = $this->getFilter($filters,true,true);
9479
+		$filter_query = $this->getFilter($filters, true, true);
9480 9480
 		if ($globalDBdriver == 'mysql') {
9481 9481
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9482 9482
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9497,7 +9497,7 @@  discard block
 block discarded – undo
9497 9497
 		$date_array = array();
9498 9498
 		$temp_array = array();
9499 9499
         
9500
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9500
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9501 9501
 		{
9502 9502
 			$temp_array['date_name'] = $row['date_name'];
9503 9503
 			$temp_array['date_count'] = $row['date_count'];
@@ -9518,7 +9518,7 @@  discard block
 block discarded – undo
9518 9518
 	public function countAllDatesLastMonthByAirlines($filters = array())
9519 9519
 	{
9520 9520
 		global $globalTimezone, $globalDBdriver;
9521
-		$filter_query = $this->getFilter($filters,true,true);
9521
+		$filter_query = $this->getFilter($filters, true, true);
9522 9522
 		if ($globalTimezone != '') {
9523 9523
 			date_default_timezone_set($globalTimezone);
9524 9524
 			$datetime = new DateTime();
@@ -9526,13 +9526,13 @@  discard block
 block discarded – undo
9526 9526
 		} else $offset = '+00:00';
9527 9527
 		
9528 9528
 		if ($globalDBdriver == 'mysql') {
9529
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9529
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9530 9530
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9531 9531
 								GROUP BY spotter_output.airline_icao, date_name 
9532 9532
 								ORDER BY spotter_output.date ASC";
9533 9533
 			$query_data = array(':offset' => $offset);
9534 9534
 		} else {
9535
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9535
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9536 9536
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9537 9537
 								GROUP BY spotter_output.airline_icao, date_name 
9538 9538
 								ORDER BY date_name ASC";
@@ -9545,7 +9545,7 @@  discard block
 block discarded – undo
9545 9545
 		$date_array = array();
9546 9546
 		$temp_array = array();
9547 9547
         
9548
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9548
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9549 9549
 		{
9550 9550
 			$temp_array['date_name'] = $row['date_name'];
9551 9551
 			$temp_array['date_count'] = $row['date_count'];
@@ -9592,7 +9592,7 @@  discard block
 block discarded – undo
9592 9592
 		$date_array = array();
9593 9593
 		$temp_array = array();
9594 9594
         
9595
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9595
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9596 9596
 		{
9597 9597
 			$temp_array['month_name'] = $row['month_name'];
9598 9598
 			$temp_array['year_name'] = $row['year_name'];
@@ -9613,7 +9613,7 @@  discard block
 block discarded – undo
9613 9613
 	public function countAllMonthsByAirlines($filters = array())
9614 9614
 	{
9615 9615
 		global $globalTimezone, $globalDBdriver;
9616
-		$filter_query = $this->getFilter($filters,true,true);
9616
+		$filter_query = $this->getFilter($filters, true, true);
9617 9617
 		if ($globalTimezone != '') {
9618 9618
 			date_default_timezone_set($globalTimezone);
9619 9619
 			$datetime = new DateTime();
@@ -9621,12 +9621,12 @@  discard block
 block discarded – undo
9621 9621
 		} else $offset = '+00:00';
9622 9622
 
9623 9623
 		if ($globalDBdriver == 'mysql') {
9624
-			$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
9624
+			$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
9625 9625
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9626 9626
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9627 9627
 								ORDER BY date_count DESC";
9628 9628
 		} else {
9629
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9629
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9630 9630
 								FROM spotter_output 
9631 9631
 								WHERE spotter_output.airline_icao <> '' 
9632 9632
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9640,7 +9640,7 @@  discard block
 block discarded – undo
9640 9640
 		$date_array = array();
9641 9641
 		$temp_array = array();
9642 9642
         
9643
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9643
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9644 9644
 		{
9645 9645
 			$temp_array['month_name'] = $row['month_name'];
9646 9646
 			$temp_array['year_name'] = $row['year_name'];
@@ -9667,14 +9667,14 @@  discard block
 block discarded – undo
9667 9667
 			$datetime = new DateTime();
9668 9668
 			$offset = $datetime->format('P');
9669 9669
 		} else $offset = '+00:00';
9670
-		$filter_query = $this->getFilter($filters,true,true);
9670
+		$filter_query = $this->getFilter($filters, true, true);
9671 9671
 		if ($globalDBdriver == 'mysql') {
9672
-			$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
9672
+			$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
9673 9673
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9674 9674
 								GROUP BY year_name, month_name 
9675 9675
 								ORDER BY date_count DESC";
9676 9676
 		} else {
9677
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9677
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9678 9678
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9679 9679
 								GROUP BY year_name, month_name 
9680 9680
 								ORDER BY date_count DESC";
@@ -9686,7 +9686,7 @@  discard block
 block discarded – undo
9686 9686
 		$date_array = array();
9687 9687
 		$temp_array = array();
9688 9688
         
9689
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9689
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9690 9690
 		{
9691 9691
 			$temp_array['month_name'] = $row['month_name'];
9692 9692
 			$temp_array['year_name'] = $row['year_name'];
@@ -9712,15 +9712,15 @@  discard block
 block discarded – undo
9712 9712
 			$datetime = new DateTime();
9713 9713
 			$offset = $datetime->format('P');
9714 9714
 		} else $offset = '+00:00';
9715
-		$filter_query = $this->getFilter($filters,true,true);
9715
+		$filter_query = $this->getFilter($filters, true, true);
9716 9716
 
9717 9717
 		if ($globalDBdriver == 'mysql') {
9718
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9718
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9719 9719
 								FROM spotter_output".$filter_query." owner_name <> ''
9720 9720
 								GROUP BY year_name, month_name
9721 9721
 								ORDER BY date_count DESC";
9722 9722
 		} else {
9723
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9723
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9724 9724
 								FROM spotter_output".$filter_query." owner_name <> ''
9725 9725
 								GROUP BY year_name, month_name
9726 9726
 								ORDER BY date_count DESC";
@@ -9732,7 +9732,7 @@  discard block
 block discarded – undo
9732 9732
 		$date_array = array();
9733 9733
 		$temp_array = array();
9734 9734
         
9735
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9735
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9736 9736
 		{
9737 9737
 			$temp_array['month_name'] = $row['month_name'];
9738 9738
 			$temp_array['year_name'] = $row['year_name'];
@@ -9753,7 +9753,7 @@  discard block
 block discarded – undo
9753 9753
 	public function countAllMonthsOwnersByAirlines($filters = array())
9754 9754
 	{
9755 9755
 		global $globalTimezone, $globalDBdriver;
9756
-		$filter_query = $this->getFilter($filters,true,true);
9756
+		$filter_query = $this->getFilter($filters, true, true);
9757 9757
 		if ($globalTimezone != '') {
9758 9758
 			date_default_timezone_set($globalTimezone);
9759 9759
 			$datetime = new DateTime();
@@ -9761,12 +9761,12 @@  discard block
 block discarded – undo
9761 9761
 		} else $offset = '+00:00';
9762 9762
 
9763 9763
 		if ($globalDBdriver == 'mysql') {
9764
-			$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
9764
+			$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
9765 9765
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9766 9766
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9767 9767
 								ORDER BY date_count DESC";
9768 9768
 		} else {
9769
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9769
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9770 9770
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9771 9771
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9772 9772
 								ORDER BY date_count DESC";
@@ -9778,7 +9778,7 @@  discard block
 block discarded – undo
9778 9778
 		$date_array = array();
9779 9779
 		$temp_array = array();
9780 9780
         
9781
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9781
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9782 9782
 		{
9783 9783
 			$temp_array['month_name'] = $row['month_name'];
9784 9784
 			$temp_array['year_name'] = $row['year_name'];
@@ -9805,15 +9805,15 @@  discard block
 block discarded – undo
9805 9805
 			$datetime = new DateTime();
9806 9806
 			$offset = $datetime->format('P');
9807 9807
 		} else $offset = '+00:00';
9808
-		$filter_query = $this->getFilter($filters,true,true);
9808
+		$filter_query = $this->getFilter($filters, true, true);
9809 9809
 
9810 9810
 		if ($globalDBdriver == 'mysql') {
9811
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9811
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9812 9812
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9813 9813
 								GROUP BY year_name, month_name
9814 9814
 								ORDER BY date_count DESC";
9815 9815
 		} else {
9816
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9816
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9817 9817
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9818 9818
 								GROUP BY year_name, month_name
9819 9819
 								ORDER BY date_count DESC";
@@ -9825,7 +9825,7 @@  discard block
 block discarded – undo
9825 9825
 		$date_array = array();
9826 9826
 		$temp_array = array();
9827 9827
         
9828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9829 9829
 		{
9830 9830
 			$temp_array['month_name'] = $row['month_name'];
9831 9831
 			$temp_array['year_name'] = $row['year_name'];
@@ -9846,7 +9846,7 @@  discard block
 block discarded – undo
9846 9846
 	public function countAllMonthsPilotsByAirlines($filters = array())
9847 9847
 	{
9848 9848
 		global $globalTimezone, $globalDBdriver;
9849
-		$filter_query = $this->getFilter($filters,true,true);
9849
+		$filter_query = $this->getFilter($filters, true, true);
9850 9850
 		if ($globalTimezone != '') {
9851 9851
 			date_default_timezone_set($globalTimezone);
9852 9852
 			$datetime = new DateTime();
@@ -9854,12 +9854,12 @@  discard block
 block discarded – undo
9854 9854
 		} else $offset = '+00:00';
9855 9855
 
9856 9856
 		if ($globalDBdriver == 'mysql') {
9857
-			$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
9857
+			$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
9858 9858
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9859 9859
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9860 9860
 								ORDER BY date_count DESC";
9861 9861
 		} else {
9862
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9862
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9863 9863
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9864 9864
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9865 9865
 								ORDER BY date_count DESC";
@@ -9871,7 +9871,7 @@  discard block
 block discarded – undo
9871 9871
 		$date_array = array();
9872 9872
 		$temp_array = array();
9873 9873
         
9874
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9874
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9875 9875
 		{
9876 9876
 			$temp_array['month_name'] = $row['month_name'];
9877 9877
 			$temp_array['year_name'] = $row['year_name'];
@@ -9893,7 +9893,7 @@  discard block
 block discarded – undo
9893 9893
 	public function countAllMonthsAirlines($filters = array())
9894 9894
 	{
9895 9895
 		global $globalTimezone, $globalDBdriver;
9896
-		$filter_query = $this->getFilter($filters,true,true);
9896
+		$filter_query = $this->getFilter($filters, true, true);
9897 9897
 		if ($globalTimezone != '') {
9898 9898
 			date_default_timezone_set($globalTimezone);
9899 9899
 			$datetime = new DateTime();
@@ -9901,12 +9901,12 @@  discard block
 block discarded – undo
9901 9901
 		} else $offset = '+00:00';
9902 9902
 
9903 9903
 		if ($globalDBdriver == 'mysql') {
9904
-			$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
9904
+			$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
9905 9905
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9906 9906
 								GROUP BY year_name, month_name
9907 9907
 								ORDER BY date_count DESC";
9908 9908
 		} else {
9909
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9909
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9910 9910
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9911 9911
 								GROUP BY year_name, month_name
9912 9912
 								ORDER BY date_count DESC";
@@ -9918,7 +9918,7 @@  discard block
 block discarded – undo
9918 9918
 		$date_array = array();
9919 9919
 		$temp_array = array();
9920 9920
         
9921
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9921
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9922 9922
 		{
9923 9923
 			$temp_array['month_name'] = $row['month_name'];
9924 9924
 			$temp_array['year_name'] = $row['year_name'];
@@ -9944,15 +9944,15 @@  discard block
 block discarded – undo
9944 9944
 			$datetime = new DateTime();
9945 9945
 			$offset = $datetime->format('P');
9946 9946
 		} else $offset = '+00:00';
9947
-		$filter_query = $this->getFilter($filters,true,true);
9947
+		$filter_query = $this->getFilter($filters, true, true);
9948 9948
 
9949 9949
 		if ($globalDBdriver == 'mysql') {
9950
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9950
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9951 9951
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9952 9952
 								GROUP BY year_name, month_name
9953 9953
 								ORDER BY date_count DESC";
9954 9954
 		} else {
9955
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9955
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9956 9956
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9957 9957
 								GROUP BY year_name, month_name
9958 9958
 								ORDER BY date_count DESC";
@@ -9964,7 +9964,7 @@  discard block
 block discarded – undo
9964 9964
 		$date_array = array();
9965 9965
 		$temp_array = array();
9966 9966
         
9967
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9967
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9968 9968
 		{
9969 9969
 			$temp_array['month_name'] = $row['month_name'];
9970 9970
 			$temp_array['year_name'] = $row['year_name'];
@@ -9986,7 +9986,7 @@  discard block
 block discarded – undo
9986 9986
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9987 9987
 	{
9988 9988
 		global $globalTimezone, $globalDBdriver;
9989
-		$filter_query = $this->getFilter($filters,true,true);
9989
+		$filter_query = $this->getFilter($filters, true, true);
9990 9990
 		if ($globalTimezone != '') {
9991 9991
 			date_default_timezone_set($globalTimezone);
9992 9992
 			$datetime = new DateTime();
@@ -9994,12 +9994,12 @@  discard block
 block discarded – undo
9994 9994
 		} else $offset = '+00:00';
9995 9995
 
9996 9996
 		if ($globalDBdriver == 'mysql') {
9997
-			$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
9997
+			$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
9998 9998
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9999 9999
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10000 10000
 								ORDER BY date_count DESC";
10001 10001
 		} else {
10002
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
10002
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
10003 10003
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10004 10004
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10005 10005
 								ORDER BY date_count DESC";
@@ -10011,7 +10011,7 @@  discard block
 block discarded – undo
10011 10011
 		$date_array = array();
10012 10012
 		$temp_array = array();
10013 10013
         
10014
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10014
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10015 10015
 		{
10016 10016
 			$temp_array['month_name'] = $row['month_name'];
10017 10017
 			$temp_array['year_name'] = $row['year_name'];
@@ -10038,15 +10038,15 @@  discard block
 block discarded – undo
10038 10038
 			$datetime = new DateTime();
10039 10039
 			$offset = $datetime->format('P');
10040 10040
 		} else $offset = '+00:00';
10041
-		$filter_query = $this->getFilter($filters,true,true);
10041
+		$filter_query = $this->getFilter($filters, true, true);
10042 10042
 
10043 10043
 		if ($globalDBdriver == 'mysql') {
10044
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10044
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
10045 10045
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10046 10046
 								GROUP BY year_name, month_name
10047 10047
 								ORDER BY date_count DESC";
10048 10048
 		} else {
10049
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10049
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10050 10050
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10051 10051
 								GROUP BY year_name, month_name
10052 10052
 								ORDER BY date_count DESC";
@@ -10058,7 +10058,7 @@  discard block
 block discarded – undo
10058 10058
 		$date_array = array();
10059 10059
 		$temp_array = array();
10060 10060
         
10061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10062 10062
 		{
10063 10063
 			$temp_array['month_name'] = $row['month_name'];
10064 10064
 			$temp_array['year_name'] = $row['year_name'];
@@ -10080,7 +10080,7 @@  discard block
 block discarded – undo
10080 10080
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10081 10081
 	{
10082 10082
 		global $globalTimezone, $globalDBdriver;
10083
-		$filter_query = $this->getFilter($filters,true,true);
10083
+		$filter_query = $this->getFilter($filters, true, true);
10084 10084
 		if ($globalTimezone != '') {
10085 10085
 			date_default_timezone_set($globalTimezone);
10086 10086
 			$datetime = new DateTime();
@@ -10088,12 +10088,12 @@  discard block
 block discarded – undo
10088 10088
 		} else $offset = '+00:00';
10089 10089
 
10090 10090
 		if ($globalDBdriver == 'mysql') {
10091
-			$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
10091
+			$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
10092 10092
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10093 10093
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10094 10094
 								ORDER BY date_count DESC";
10095 10095
 		} else {
10096
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10096
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
10097 10097
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10098 10098
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10099 10099
 								ORDER BY date_count DESC";
@@ -10105,7 +10105,7 @@  discard block
 block discarded – undo
10105 10105
 		$date_array = array();
10106 10106
 		$temp_array = array();
10107 10107
         
10108
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10108
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10109 10109
 		{
10110 10110
 			$temp_array['month_name'] = $row['month_name'];
10111 10111
 			$temp_array['year_name'] = $row['year_name'];
@@ -10133,7 +10133,7 @@  discard block
 block discarded – undo
10133 10133
 			$datetime = new DateTime();
10134 10134
 			$offset = $datetime->format('P');
10135 10135
 		} else $offset = '+00:00';
10136
-		$filter_query = $this->getFilter($filters,true,true);
10136
+		$filter_query = $this->getFilter($filters, true, true);
10137 10137
 		if ($globalDBdriver == 'mysql') {
10138 10138
 			$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
10139 10139
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10154,7 +10154,7 @@  discard block
 block discarded – undo
10154 10154
 		$date_array = array();
10155 10155
 		$temp_array = array();
10156 10156
         
10157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10158 10158
 		{
10159 10159
 			$temp_array['year_name'] = $row['year_name'];
10160 10160
 			$temp_array['month_name'] = $row['month_name'];
@@ -10174,7 +10174,7 @@  discard block
 block discarded – undo
10174 10174
 	* @return Array the hour list
10175 10175
 	*
10176 10176
 	*/
10177
-	public function countAllHours($orderby,$filters = array())
10177
+	public function countAllHours($orderby, $filters = array())
10178 10178
 	{
10179 10179
 		global $globalTimezone, $globalDBdriver;
10180 10180
 		if ($globalTimezone != '') {
@@ -10222,7 +10222,7 @@  discard block
 block discarded – undo
10222 10222
 		$hour_array = array();
10223 10223
 		$temp_array = array();
10224 10224
         
10225
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10225
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10226 10226
 		{
10227 10227
 			$temp_array['hour_name'] = $row['hour_name'];
10228 10228
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10242,7 +10242,7 @@  discard block
 block discarded – undo
10242 10242
 	public function countAllHoursByAirlines($orderby, $filters = array())
10243 10243
 	{
10244 10244
 		global $globalTimezone, $globalDBdriver;
10245
-		$filter_query = $this->getFilter($filters,true,true);
10245
+		$filter_query = $this->getFilter($filters, true, true);
10246 10246
 		if ($globalTimezone != '') {
10247 10247
 			date_default_timezone_set($globalTimezone);
10248 10248
 			$datetime = new DateTime();
@@ -10260,7 +10260,7 @@  discard block
 block discarded – undo
10260 10260
 		}
10261 10261
 		
10262 10262
 		if ($globalDBdriver == 'mysql') {
10263
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10263
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10264 10264
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10265 10265
 								GROUP BY spotter_output.airline_icao, hour_name 
10266 10266
 								".$orderby_sql;
@@ -10273,7 +10273,7 @@  discard block
 block discarded – undo
10273 10273
   */    
10274 10274
 		$query_data = array(':offset' => $offset);
10275 10275
 		} else {
10276
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10276
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10277 10277
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10278 10278
 								GROUP BY spotter_output.airline_icao, hour_name 
10279 10279
 								".$orderby_sql;
@@ -10286,7 +10286,7 @@  discard block
 block discarded – undo
10286 10286
 		$hour_array = array();
10287 10287
 		$temp_array = array();
10288 10288
         
10289
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10289
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10290 10290
 		{
10291 10291
 			$temp_array['hour_name'] = $row['hour_name'];
10292 10292
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10309,34 +10309,34 @@  discard block
 block discarded – undo
10309 10309
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10310 10310
 	{
10311 10311
 		global $globalTimezone, $globalDBdriver;
10312
-		$filter_query = $this->getFilter($filters,true,true);
10312
+		$filter_query = $this->getFilter($filters, true, true);
10313 10313
 		if ($globalTimezone != '') {
10314 10314
 			date_default_timezone_set($globalTimezone);
10315 10315
 			$datetime = new DateTime();
10316 10316
 			$offset = $datetime->format('P');
10317 10317
 		} else $offset = '+00:00';
10318 10318
 
10319
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10319
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10320 10320
 
10321 10321
 		if ($globalDBdriver == 'mysql') {
10322
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10322
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10323 10323
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10324 10324
 								GROUP BY hour_name 
10325 10325
 								ORDER BY hour_name ASC";
10326 10326
 		} else {
10327
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10327
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10328 10328
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10329 10329
 								GROUP BY hour_name 
10330 10330
 								ORDER BY hour_name ASC";
10331 10331
 		}
10332 10332
 		
10333 10333
 		$sth = $this->db->prepare($query);
10334
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10334
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10335 10335
       
10336 10336
 		$hour_array = array();
10337 10337
 		$temp_array = array();
10338 10338
         
10339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10340 10340
 		{
10341 10341
 			$temp_array['hour_name'] = $row['hour_name'];
10342 10342
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10359,8 +10359,8 @@  discard block
 block discarded – undo
10359 10359
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10360 10360
 	{
10361 10361
 		global $globalTimezone, $globalDBdriver;
10362
-		$filter_query = $this->getFilter($filters,true,true);
10363
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10362
+		$filter_query = $this->getFilter($filters, true, true);
10363
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10364 10364
 		if ($globalTimezone != '') {
10365 10365
 			date_default_timezone_set($globalTimezone);
10366 10366
 			$datetime = new DateTime();
@@ -10368,24 +10368,24 @@  discard block
 block discarded – undo
10368 10368
 		} else $offset = '+00:00';
10369 10369
 
10370 10370
 		if ($globalDBdriver == 'mysql') {
10371
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10371
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10372 10372
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10373 10373
 								GROUP BY hour_name 
10374 10374
 								ORDER BY hour_name ASC";
10375 10375
 		} else {
10376
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10376
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10377 10377
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10378 10378
 								GROUP BY hour_name 
10379 10379
 								ORDER BY hour_name ASC";
10380 10380
 		}
10381 10381
 		
10382 10382
 		$sth = $this->db->prepare($query);
10383
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10383
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10384 10384
       
10385 10385
 		$hour_array = array();
10386 10386
 		$temp_array = array();
10387 10387
         
10388
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10388
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10389 10389
 		{
10390 10390
 			$temp_array['hour_name'] = $row['hour_name'];
10391 10391
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10406,8 +10406,8 @@  discard block
 block discarded – undo
10406 10406
 	public function countAllHoursByRegistration($registration, $filters = array())
10407 10407
 	{
10408 10408
 		global $globalTimezone, $globalDBdriver;
10409
-		$filter_query = $this->getFilter($filters,true,true);
10410
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10409
+		$filter_query = $this->getFilter($filters, true, true);
10410
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10411 10411
 		if ($globalTimezone != '') {
10412 10412
 			date_default_timezone_set($globalTimezone);
10413 10413
 			$datetime = new DateTime();
@@ -10415,24 +10415,24 @@  discard block
 block discarded – undo
10415 10415
 		} else $offset = '+00:00';
10416 10416
 
10417 10417
 		if ($globalDBdriver == 'mysql') {
10418
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10418
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10419 10419
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10420 10420
 								GROUP BY hour_name 
10421 10421
 								ORDER BY hour_name ASC";
10422 10422
 		} else {
10423
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10423
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10424 10424
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10425 10425
 								GROUP BY hour_name 
10426 10426
 								ORDER BY hour_name ASC";
10427 10427
 		}
10428 10428
 		
10429 10429
 		$sth = $this->db->prepare($query);
10430
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10430
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10431 10431
       
10432 10432
 		$hour_array = array();
10433 10433
 		$temp_array = array();
10434 10434
         
10435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10436 10436
 		{
10437 10437
 			$temp_array['hour_name'] = $row['hour_name'];
10438 10438
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10453,8 +10453,8 @@  discard block
 block discarded – undo
10453 10453
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10454 10454
 	{
10455 10455
 		global $globalTimezone, $globalDBdriver;
10456
-		$filter_query = $this->getFilter($filters,true,true);
10457
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10456
+		$filter_query = $this->getFilter($filters, true, true);
10457
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10458 10458
 		if ($globalTimezone != '') {
10459 10459
 			date_default_timezone_set($globalTimezone);
10460 10460
 			$datetime = new DateTime();
@@ -10462,24 +10462,24 @@  discard block
 block discarded – undo
10462 10462
 		} else $offset = '+00:00';
10463 10463
 
10464 10464
 		if ($globalDBdriver == 'mysql') {
10465
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10465
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10466 10466
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10467 10467
 								GROUP BY hour_name 
10468 10468
 								ORDER BY hour_name ASC";
10469 10469
 		} else {
10470
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10470
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10471 10471
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10472 10472
 								GROUP BY hour_name 
10473 10473
 								ORDER BY hour_name ASC";
10474 10474
 		}
10475 10475
 		
10476 10476
 		$sth = $this->db->prepare($query);
10477
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10477
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10478 10478
       
10479 10479
 		$hour_array = array();
10480 10480
 		$temp_array = array();
10481 10481
         
10482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10483 10483
 		{
10484 10484
 			$temp_array['hour_name'] = $row['hour_name'];
10485 10485
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10498,11 +10498,11 @@  discard block
 block discarded – undo
10498 10498
 	* @return Array the hour list
10499 10499
 	*
10500 10500
 	*/
10501
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10501
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10502 10502
 	{
10503 10503
 		global $globalTimezone, $globalDBdriver;
10504
-		$filter_query = $this->getFilter($filters,true,true);
10505
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10504
+		$filter_query = $this->getFilter($filters, true, true);
10505
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10506 10506
 		if ($globalTimezone != '') {
10507 10507
 			date_default_timezone_set($globalTimezone);
10508 10508
 			$datetime = new DateTime();
@@ -10510,24 +10510,24 @@  discard block
 block discarded – undo
10510 10510
 		} else $offset = '+00:00';
10511 10511
 
10512 10512
 		if ($globalDBdriver == 'mysql') {
10513
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10513
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10514 10514
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10515 10515
 								GROUP BY hour_name 
10516 10516
 								ORDER BY hour_name ASC";
10517 10517
 		} else {
10518
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10518
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10519 10519
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10520 10520
 								GROUP BY hour_name 
10521 10521
 								ORDER BY hour_name ASC";
10522 10522
 		}
10523 10523
 		
10524 10524
 		$sth = $this->db->prepare($query);
10525
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10525
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10526 10526
       
10527 10527
 		$hour_array = array();
10528 10528
 		$temp_array = array();
10529 10529
         
10530
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10530
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10531 10531
 		{
10532 10532
 			$temp_array['hour_name'] = $row['hour_name'];
10533 10533
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10549,8 +10549,8 @@  discard block
 block discarded – undo
10549 10549
 	public function countAllHoursByDate($date, $filters = array())
10550 10550
 	{
10551 10551
 		global $globalTimezone, $globalDBdriver;
10552
-		$filter_query = $this->getFilter($filters,true,true);
10553
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10552
+		$filter_query = $this->getFilter($filters, true, true);
10553
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10554 10554
 		if ($globalTimezone != '') {
10555 10555
 			date_default_timezone_set($globalTimezone);
10556 10556
 			$datetime = new DateTime($date);
@@ -10558,12 +10558,12 @@  discard block
 block discarded – undo
10558 10558
 		} else $offset = '+00:00';
10559 10559
 
10560 10560
 		if ($globalDBdriver == 'mysql') {
10561
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10561
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10562 10562
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10563 10563
 								GROUP BY hour_name 
10564 10564
 								ORDER BY hour_name ASC";
10565 10565
 		} else {
10566
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10566
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10567 10567
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10568 10568
 								GROUP BY hour_name 
10569 10569
 								ORDER BY hour_name ASC";
@@ -10575,7 +10575,7 @@  discard block
 block discarded – undo
10575 10575
 		$hour_array = array();
10576 10576
 		$temp_array = array();
10577 10577
         
10578
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10578
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10579 10579
 		{
10580 10580
 			$temp_array['hour_name'] = $row['hour_name'];
10581 10581
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10597,8 +10597,8 @@  discard block
 block discarded – undo
10597 10597
 	public function countAllHoursByIdent($ident, $filters = array())
10598 10598
 	{
10599 10599
 		global $globalTimezone, $globalDBdriver;
10600
-		$filter_query = $this->getFilter($filters,true,true);
10601
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10600
+		$filter_query = $this->getFilter($filters, true, true);
10601
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10602 10602
 		if ($globalTimezone != '') {
10603 10603
 			date_default_timezone_set($globalTimezone);
10604 10604
 			$datetime = new DateTime();
@@ -10606,12 +10606,12 @@  discard block
 block discarded – undo
10606 10606
 		} else $offset = '+00:00';
10607 10607
 
10608 10608
 		if ($globalDBdriver == 'mysql') {
10609
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10609
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10610 10610
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10611 10611
 								GROUP BY hour_name 
10612 10612
 								ORDER BY hour_name ASC";
10613 10613
 		} else {
10614
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10614
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10615 10615
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10616 10616
 								GROUP BY hour_name 
10617 10617
 								ORDER BY hour_name ASC";
@@ -10619,12 +10619,12 @@  discard block
 block discarded – undo
10619 10619
       
10620 10620
 		
10621 10621
 		$sth = $this->db->prepare($query);
10622
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10622
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10623 10623
       
10624 10624
 		$hour_array = array();
10625 10625
 		$temp_array = array();
10626 10626
         
10627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10628 10628
 		{
10629 10629
 			$temp_array['hour_name'] = $row['hour_name'];
10630 10630
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10644,8 +10644,8 @@  discard block
 block discarded – undo
10644 10644
 	public function countAllHoursByOwner($owner, $filters = array())
10645 10645
 	{
10646 10646
 		global $globalTimezone, $globalDBdriver;
10647
-		$filter_query = $this->getFilter($filters,true,true);
10648
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10647
+		$filter_query = $this->getFilter($filters, true, true);
10648
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10649 10649
 		if ($globalTimezone != '') {
10650 10650
 			date_default_timezone_set($globalTimezone);
10651 10651
 			$datetime = new DateTime();
@@ -10653,12 +10653,12 @@  discard block
 block discarded – undo
10653 10653
 		} else $offset = '+00:00';
10654 10654
 
10655 10655
 		if ($globalDBdriver == 'mysql') {
10656
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10656
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10657 10657
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10658 10658
 								GROUP BY hour_name 
10659 10659
 								ORDER BY hour_name ASC";
10660 10660
 		} else {
10661
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10661
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10662 10662
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10663 10663
 								GROUP BY hour_name 
10664 10664
 								ORDER BY hour_name ASC";
@@ -10666,12 +10666,12 @@  discard block
 block discarded – undo
10666 10666
       
10667 10667
 		
10668 10668
 		$sth = $this->db->prepare($query);
10669
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10669
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10670 10670
       
10671 10671
 		$hour_array = array();
10672 10672
 		$temp_array = array();
10673 10673
         
10674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10675 10675
 		{
10676 10676
 			$temp_array['hour_name'] = $row['hour_name'];
10677 10677
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10691,8 +10691,8 @@  discard block
 block discarded – undo
10691 10691
 	public function countAllHoursByPilot($pilot, $filters = array())
10692 10692
 	{
10693 10693
 		global $globalTimezone, $globalDBdriver;
10694
-		$filter_query = $this->getFilter($filters,true,true);
10695
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10694
+		$filter_query = $this->getFilter($filters, true, true);
10695
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10696 10696
 		if ($globalTimezone != '') {
10697 10697
 			date_default_timezone_set($globalTimezone);
10698 10698
 			$datetime = new DateTime();
@@ -10700,12 +10700,12 @@  discard block
 block discarded – undo
10700 10700
 		} else $offset = '+00:00';
10701 10701
 
10702 10702
 		if ($globalDBdriver == 'mysql') {
10703
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10703
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10704 10704
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10705 10705
 								GROUP BY hour_name 
10706 10706
 								ORDER BY hour_name ASC";
10707 10707
 		} else {
10708
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10708
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10709 10709
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10710 10710
 								GROUP BY hour_name 
10711 10711
 								ORDER BY hour_name ASC";
@@ -10713,12 +10713,12 @@  discard block
 block discarded – undo
10713 10713
       
10714 10714
 		
10715 10715
 		$sth = $this->db->prepare($query);
10716
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10716
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10717 10717
       
10718 10718
 		$hour_array = array();
10719 10719
 		$temp_array = array();
10720 10720
         
10721
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10721
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10722 10722
 		{
10723 10723
 			$temp_array['hour_name'] = $row['hour_name'];
10724 10724
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10737,12 +10737,12 @@  discard block
 block discarded – undo
10737 10737
 	* @return Array the hour list
10738 10738
 	*
10739 10739
 	*/
10740
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10740
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10741 10741
 	{
10742 10742
 		global $globalTimezone, $globalDBdriver;
10743
-		$filter_query = $this->getFilter($filters,true,true);
10744
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10745
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10743
+		$filter_query = $this->getFilter($filters, true, true);
10744
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10745
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10746 10746
 		if ($globalTimezone != '') {
10747 10747
 			date_default_timezone_set($globalTimezone);
10748 10748
 			$datetime = new DateTime();
@@ -10750,24 +10750,24 @@  discard block
 block discarded – undo
10750 10750
 		} else $offset = '+00:00';
10751 10751
 
10752 10752
 		if ($globalDBdriver == 'mysql') {
10753
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10753
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10754 10754
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10755 10755
 								GROUP BY hour_name 
10756 10756
 								ORDER BY hour_name ASC";
10757 10757
 		} else {
10758
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10758
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10759 10759
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10760 10760
 								GROUP BY hour_name 
10761 10761
 								ORDER BY hour_name ASC";
10762 10762
 		}
10763 10763
 		
10764 10764
 		$sth = $this->db->prepare($query);
10765
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10765
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10766 10766
       
10767 10767
 		$hour_array = array();
10768 10768
 		$temp_array = array();
10769 10769
         
10770
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10770
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10771 10771
 		{
10772 10772
 			$temp_array['hour_name'] = $row['hour_name'];
10773 10773
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10788,8 +10788,8 @@  discard block
 block discarded – undo
10788 10788
 	public function countAllHoursByCountry($country, $filters = array())
10789 10789
 	{
10790 10790
 		global $globalTimezone, $globalDBdriver;
10791
-		$filter_query = $this->getFilter($filters,true,true);
10792
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10791
+		$filter_query = $this->getFilter($filters, true, true);
10792
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10793 10793
 		if ($globalTimezone != '') {
10794 10794
 			date_default_timezone_set($globalTimezone);
10795 10795
 			$datetime = new DateTime();
@@ -10797,24 +10797,24 @@  discard block
 block discarded – undo
10797 10797
 		} else $offset = '+00:00';
10798 10798
 
10799 10799
 		if ($globalDBdriver == 'mysql') {
10800
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10800
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10801 10801
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10802 10802
 								GROUP BY hour_name 
10803 10803
 								ORDER BY hour_name ASC";
10804 10804
 		} else {
10805
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10805
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10806 10806
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10807 10807
 								GROUP BY hour_name 
10808 10808
 								ORDER BY hour_name ASC";
10809 10809
 		}
10810 10810
 		
10811 10811
 		$sth = $this->db->prepare($query);
10812
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10812
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10813 10813
       
10814 10814
 		$hour_array = array();
10815 10815
 		$temp_array = array();
10816 10816
         
10817
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10817
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10818 10818
 		{
10819 10819
 			$temp_array['hour_name'] = $row['hour_name'];
10820 10820
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10834,29 +10834,29 @@  discard block
 block discarded – undo
10834 10834
 	* @return Integer the number of aircrafts
10835 10835
 	*
10836 10836
 	*/
10837
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10837
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10838 10838
 	{
10839 10839
 		global $globalDBdriver;
10840
-		$filter_query = $this->getFilter($filters,true,true);
10841
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10840
+		$filter_query = $this->getFilter($filters, true, true);
10841
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10842 10842
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10843 10843
 		$query_values = array();
10844 10844
 		if ($year != '') {
10845 10845
 			if ($globalDBdriver == 'mysql') {
10846 10846
 				$query .= " AND YEAR(spotter_output.date) = :year";
10847
-				$query_values = array_merge($query_values,array(':year' => $year));
10847
+				$query_values = array_merge($query_values, array(':year' => $year));
10848 10848
 			} else {
10849 10849
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10850
-				$query_values = array_merge($query_values,array(':year' => $year));
10850
+				$query_values = array_merge($query_values, array(':year' => $year));
10851 10851
 			}
10852 10852
 		}
10853 10853
 		if ($month != '') {
10854 10854
 			if ($globalDBdriver == 'mysql') {
10855 10855
 				$query .= " AND MONTH(spotter_output.date) = :month";
10856
-				$query_values = array_merge($query_values,array(':month' => $month));
10856
+				$query_values = array_merge($query_values, array(':month' => $month));
10857 10857
 			} else {
10858 10858
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10859
-				$query_values = array_merge($query_values,array(':month' => $month));
10859
+				$query_values = array_merge($query_values, array(':month' => $month));
10860 10860
 			}
10861 10861
 		}
10862 10862
 
@@ -10871,29 +10871,29 @@  discard block
 block discarded – undo
10871 10871
 	* @return Integer the number of aircrafts
10872 10872
 	*
10873 10873
 	*/
10874
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10874
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
10877
-		$filter_query = $this->getFilter($filters,true,true);
10878
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10877
+		$filter_query = $this->getFilter($filters, true, true);
10878
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10879 10879
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10880 10880
 		$query_values = array();
10881 10881
 		if ($year != '') {
10882 10882
 			if ($globalDBdriver == 'mysql') {
10883 10883
 				$query .= " AND YEAR(spotter_output.date) = :year";
10884
-				$query_values = array_merge($query_values,array(':year' => $year));
10884
+				$query_values = array_merge($query_values, array(':year' => $year));
10885 10885
 			} else {
10886 10886
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10887
-				$query_values = array_merge($query_values,array(':year' => $year));
10887
+				$query_values = array_merge($query_values, array(':year' => $year));
10888 10888
 			}
10889 10889
 		}
10890 10890
 		if ($month != '') {
10891 10891
 			if ($globalDBdriver == 'mysql') {
10892 10892
 				$query .= " AND MONTH(spotter_output.date) = :month";
10893
-				$query_values = array_merge($query_values,array(':month' => $month));
10893
+				$query_values = array_merge($query_values, array(':month' => $month));
10894 10894
 			} else {
10895 10895
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10896
-				$query_values = array_merge($query_values,array(':month' => $month));
10896
+				$query_values = array_merge($query_values, array(':month' => $month));
10897 10897
 			}
10898 10898
 		}
10899 10899
 		
@@ -10908,29 +10908,29 @@  discard block
 block discarded – undo
10908 10908
 	* @return Integer the number of pilots
10909 10909
 	*
10910 10910
 	*/
10911
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10911
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
10914
-		$filter_query = $this->getFilter($filters,true,true);
10915
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10914
+		$filter_query = $this->getFilter($filters, true, true);
10915
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10916 10916
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10917 10917
 		$query_values = array();
10918 10918
 		if ($year != '') {
10919 10919
 			if ($globalDBdriver == 'mysql') {
10920 10920
 				$query .= " AND YEAR(spotter_output.date) = :year";
10921
-				$query_values = array_merge($query_values,array(':year' => $year));
10921
+				$query_values = array_merge($query_values, array(':year' => $year));
10922 10922
 			} else {
10923 10923
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10924
-				$query_values = array_merge($query_values,array(':year' => $year));
10924
+				$query_values = array_merge($query_values, array(':year' => $year));
10925 10925
 			}
10926 10926
 		}
10927 10927
 		if ($month != '') {
10928 10928
 			if ($globalDBdriver == 'mysql') {
10929 10929
 				$query .= " AND MONTH(spotter_output.date) = :month";
10930
-				$query_values = array_merge($query_values,array(':month' => $month));
10930
+				$query_values = array_merge($query_values, array(':month' => $month));
10931 10931
 			} else {
10932 10932
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10933
-				$query_values = array_merge($query_values,array(':month' => $month));
10933
+				$query_values = array_merge($query_values, array(':month' => $month));
10934 10934
 			}
10935 10935
 		}
10936 10936
 		$sth = $this->db->prepare($query);
@@ -10944,29 +10944,29 @@  discard block
 block discarded – undo
10944 10944
 	* @return Integer the number of owners
10945 10945
 	*
10946 10946
 	*/
10947
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10947
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10948 10948
 	{
10949 10949
 		global $globalDBdriver;
10950
-		$filter_query = $this->getFilter($filters,true,true);
10951
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10950
+		$filter_query = $this->getFilter($filters, true, true);
10951
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10952 10952
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10953 10953
 		$query_values = array();
10954 10954
 		if ($year != '') {
10955 10955
 			if ($globalDBdriver == 'mysql') {
10956 10956
 				$query .= " AND YEAR(spotter_output.date) = :year";
10957
-				$query_values = array_merge($query_values,array(':year' => $year));
10957
+				$query_values = array_merge($query_values, array(':year' => $year));
10958 10958
 			} else {
10959 10959
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10960
-				$query_values = array_merge($query_values,array(':year' => $year));
10960
+				$query_values = array_merge($query_values, array(':year' => $year));
10961 10961
 			}
10962 10962
 		}
10963 10963
 		if ($month != '') {
10964 10964
 			if ($globalDBdriver == 'mysql') {
10965 10965
 				$query .= " AND MONTH(spotter_output.date) = :month";
10966
-				$query_values = array_merge($query_values,array(':month' => $month));
10966
+				$query_values = array_merge($query_values, array(':month' => $month));
10967 10967
 			} else {
10968 10968
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10969
-				$query_values = array_merge($query_values,array(':month' => $month));
10969
+				$query_values = array_merge($query_values, array(':month' => $month));
10970 10970
 			}
10971 10971
 		}
10972 10972
 		$sth = $this->db->prepare($query);
@@ -10981,32 +10981,32 @@  discard block
 block discarded – undo
10981 10981
 	* @return Integer the number of flights
10982 10982
 	*
10983 10983
 	*/
10984
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10984
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
10987
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10987
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10988 10988
 		$query_values = array();
10989 10989
 		$query = '';
10990 10990
 		if ($year != '') {
10991 10991
 			if ($globalDBdriver == 'mysql') {
10992 10992
 				$query .= " AND YEAR(spotter_output.date) = :year";
10993
-				$query_values = array_merge($query_values,array(':year' => $year));
10993
+				$query_values = array_merge($query_values, array(':year' => $year));
10994 10994
 			} else {
10995 10995
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10996
-				$query_values = array_merge($query_values,array(':year' => $year));
10996
+				$query_values = array_merge($query_values, array(':year' => $year));
10997 10997
 			}
10998 10998
 		}
10999 10999
 		if ($month != '') {
11000 11000
 			if ($globalDBdriver == 'mysql') {
11001 11001
 				$query .= " AND MONTH(spotter_output.date) = :month";
11002
-				$query_values = array_merge($query_values,array(':month' => $month));
11002
+				$query_values = array_merge($query_values, array(':month' => $month));
11003 11003
 			} else {
11004 11004
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11005
-				$query_values = array_merge($query_values,array(':month' => $month));
11005
+				$query_values = array_merge($query_values, array(':month' => $month));
11006 11006
 			}
11007 11007
 		}
11008 11008
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11009
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11009
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11010 11010
 		
11011 11011
 		$sth = $this->db->prepare($queryi);
11012 11012
 		$sth->execute($query_values);
@@ -11019,29 +11019,29 @@  discard block
 block discarded – undo
11019 11019
 	* @return Integer the number of flights
11020 11020
 	*
11021 11021
 	*/
11022
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11022
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11023 11023
 	{
11024 11024
 		global $globalDBdriver;
11025
-		$filter_query = $this->getFilter($filters,true,true);
11026
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11025
+		$filter_query = $this->getFilter($filters, true, true);
11026
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11027 11027
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11028 11028
 		$query_values = array();
11029 11029
 		if ($year != '') {
11030 11030
 			if ($globalDBdriver == 'mysql') {
11031 11031
 				$query .= " AND YEAR(spotter_output.date) = :year";
11032
-				$query_values = array_merge($query_values,array(':year' => $year));
11032
+				$query_values = array_merge($query_values, array(':year' => $year));
11033 11033
 			} else {
11034 11034
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11035
-				$query_values = array_merge($query_values,array(':year' => $year));
11035
+				$query_values = array_merge($query_values, array(':year' => $year));
11036 11036
 			}
11037 11037
 		}
11038 11038
 		if ($month != '') {
11039 11039
 			if ($globalDBdriver == 'mysql') {
11040 11040
 				$query .= " AND MONTH(spotter_output.date) = :month";
11041
-				$query_values = array_merge($query_values,array(':month' => $month));
11041
+				$query_values = array_merge($query_values, array(':month' => $month));
11042 11042
 			} else {
11043 11043
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11044
-				$query_values = array_merge($query_values,array(':month' => $month));
11044
+				$query_values = array_merge($query_values, array(':month' => $month));
11045 11045
 			}
11046 11046
 		}
11047 11047
       
@@ -11058,10 +11058,10 @@  discard block
 block discarded – undo
11058 11058
 	* @return Integer the number of airlines
11059 11059
 	*
11060 11060
 	*/
11061
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11061
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11062 11062
 	{
11063 11063
 		global $globalDBdriver;
11064
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11064
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11065 11065
 							FROM spotter_output";
11066 11066
       
11067 11067
 		$query_values = array();
@@ -11069,23 +11069,23 @@  discard block
 block discarded – undo
11069 11069
 		if ($year != '') {
11070 11070
 			if ($globalDBdriver == 'mysql') {
11071 11071
 				$query .= " AND YEAR(spotter_output.date) = :year";
11072
-				$query_values = array_merge($query_values,array(':year' => $year));
11072
+				$query_values = array_merge($query_values, array(':year' => $year));
11073 11073
 			} else {
11074 11074
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11075
-				$query_values = array_merge($query_values,array(':year' => $year));
11075
+				$query_values = array_merge($query_values, array(':year' => $year));
11076 11076
 			}
11077 11077
 		}
11078 11078
 		if ($month != '') {
11079 11079
 			if ($globalDBdriver == 'mysql') {
11080 11080
 				$query .= " AND MONTH(spotter_output.date) = :month";
11081
-				$query_values = array_merge($query_values,array(':month' => $month));
11081
+				$query_values = array_merge($query_values, array(':month' => $month));
11082 11082
 			} else {
11083 11083
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11084
-				$query_values = array_merge($query_values,array(':month' => $month));
11084
+				$query_values = array_merge($query_values, array(':month' => $month));
11085 11085
 			}
11086 11086
 		}
11087 11087
                 if ($query == '') $queryi .= $this->getFilter($filters);
11088
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11088
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11089 11089
 
11090 11090
 
11091 11091
 		$sth = $this->db->prepare($queryi);
@@ -11103,7 +11103,7 @@  discard block
 block discarded – undo
11103 11103
 	public function countAllHoursFromToday($filters = array())
11104 11104
 	{
11105 11105
 		global $globalTimezone, $globalDBdriver;
11106
-		$filter_query = $this->getFilter($filters,true,true);
11106
+		$filter_query = $this->getFilter($filters, true, true);
11107 11107
 		if ($globalTimezone != '') {
11108 11108
 			date_default_timezone_set($globalTimezone);
11109 11109
 			$datetime = new DateTime();
@@ -11111,12 +11111,12 @@  discard block
 block discarded – undo
11111 11111
 		} else $offset = '+00:00';
11112 11112
 
11113 11113
 		if ($globalDBdriver == 'mysql') {
11114
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11114
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11115 11115
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11116 11116
 								GROUP BY hour_name 
11117 11117
 								ORDER BY hour_name ASC";
11118 11118
 		} else {
11119
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11119
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11120 11120
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11121 11121
 								GROUP BY hour_name 
11122 11122
 								ORDER BY hour_name ASC";
@@ -11128,7 +11128,7 @@  discard block
 block discarded – undo
11128 11128
 		$hour_array = array();
11129 11129
 		$temp_array = array();
11130 11130
         
11131
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11131
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11132 11132
 		{
11133 11133
 			$temp_array['hour_name'] = $row['hour_name'];
11134 11134
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11147,14 +11147,14 @@  discard block
 block discarded – undo
11147 11147
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11148 11148
 	{
11149 11149
 		global $global_query, $globalDBdriver, $globalTimezone;
11150
-		$filter_query = $this->getFilter($filters,true,true);
11150
+		$filter_query = $this->getFilter($filters, true, true);
11151 11151
 		date_default_timezone_set('UTC');
11152 11152
 		$limit_query = '';
11153 11153
 		if ($limit != "")
11154 11154
 		{
11155 11155
 			$limit_array = explode(",", $limit);
11156
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11157
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11156
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11157
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11158 11158
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11159 11159
 			{
11160 11160
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11207,7 +11207,7 @@  discard block
 block discarded – undo
11207 11207
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
11208 11208
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11209 11209
 			//echo $query;
11210
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11210
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11211 11211
 			/*
11212 11212
 			$sth = $this->db->prepare($query);
11213 11213
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11226,9 +11226,9 @@  discard block
 block discarded – undo
11226 11226
 	*/
11227 11227
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11228 11228
 	{
11229
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11229
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11230 11230
 
11231
-		$query  = "SELECT spotter_output.spotter_id
11231
+		$query = "SELECT spotter_output.spotter_id
11232 11232
 								FROM spotter_output 
11233 11233
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11234 11234
         
@@ -11236,7 +11236,7 @@  discard block
 block discarded – undo
11236 11236
 		$sth = $this->db->prepare($query);
11237 11237
 		$sth->execute();
11238 11238
 
11239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11240 11240
 		{
11241 11241
 			return $row['spotter_id'];
11242 11242
 		}
@@ -11261,23 +11261,23 @@  discard block
 block discarded – undo
11261 11261
 		}
11262 11262
 		
11263 11263
 		$current_date = date("Y-m-d H:i:s");
11264
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11264
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11265 11265
 		
11266 11266
 		$diff = abs(strtotime($current_date) - strtotime($date));
11267 11267
 
11268
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11268
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11269 11269
 		$years = $time_array['years'];
11270 11270
 		
11271
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11271
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11272 11272
 		$months = $time_array['months'];
11273 11273
 		
11274
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11274
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11275 11275
 		$days = $time_array['days'];
11276
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11276
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11277 11277
 		$hours = $time_array['hours'];
11278
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11278
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11279 11279
 		$minutes = $time_array['minutes'];
11280
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11280
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11281 11281
 		
11282 11282
 		return $time_array;	
11283 11283
 	}	
@@ -11303,63 +11303,63 @@  discard block
 block discarded – undo
11303 11303
 			$temp_array['direction_degree'] = $direction;
11304 11304
 			$temp_array['direction_shortname'] = "N";
11305 11305
 			$temp_array['direction_fullname'] = "North";
11306
-		} elseif ($direction >= 22.5 && $direction < 45){
11306
+		} elseif ($direction >= 22.5 && $direction < 45) {
11307 11307
 			$temp_array['direction_degree'] = $direction;
11308 11308
 			$temp_array['direction_shortname'] = "NNE";
11309 11309
 			$temp_array['direction_fullname'] = "North-Northeast";
11310
-		} elseif ($direction >= 45 && $direction < 67.5){
11310
+		} elseif ($direction >= 45 && $direction < 67.5) {
11311 11311
 			$temp_array['direction_degree'] = $direction;
11312 11312
 			$temp_array['direction_shortname'] = "NE";
11313 11313
 			$temp_array['direction_fullname'] = "Northeast";
11314
-		} elseif ($direction >= 67.5 && $direction < 90){
11314
+		} elseif ($direction >= 67.5 && $direction < 90) {
11315 11315
 			$temp_array['direction_degree'] = $direction;
11316 11316
 			$temp_array['direction_shortname'] = "ENE";
11317 11317
 			$temp_array['direction_fullname'] = "East-Northeast";
11318
-		} elseif ($direction >= 90 && $direction < 112.5){
11318
+		} elseif ($direction >= 90 && $direction < 112.5) {
11319 11319
 			$temp_array['direction_degree'] = $direction;
11320 11320
 			$temp_array['direction_shortname'] = "E";
11321 11321
 			$temp_array['direction_fullname'] = "East";
11322
-		} elseif ($direction >= 112.5 && $direction < 135){
11322
+		} elseif ($direction >= 112.5 && $direction < 135) {
11323 11323
 			$temp_array['direction_degree'] = $direction;
11324 11324
 			$temp_array['direction_shortname'] = "ESE";
11325 11325
 			$temp_array['direction_fullname'] = "East-Southeast";
11326
-		} elseif ($direction >= 135 && $direction < 157.5){
11326
+		} elseif ($direction >= 135 && $direction < 157.5) {
11327 11327
 			$temp_array['direction_degree'] = $direction;
11328 11328
 			$temp_array['direction_shortname'] = "SE";
11329 11329
 			$temp_array['direction_fullname'] = "Southeast";
11330
-		} elseif ($direction >= 157.5 && $direction < 180){
11330
+		} elseif ($direction >= 157.5 && $direction < 180) {
11331 11331
 			$temp_array['direction_degree'] = $direction;
11332 11332
 			$temp_array['direction_shortname'] = "SSE";
11333 11333
 			$temp_array['direction_fullname'] = "South-Southeast";
11334
-		} elseif ($direction >= 180 && $direction < 202.5){
11334
+		} elseif ($direction >= 180 && $direction < 202.5) {
11335 11335
 			$temp_array['direction_degree'] = $direction;
11336 11336
 			$temp_array['direction_shortname'] = "S";
11337 11337
 			$temp_array['direction_fullname'] = "South";
11338
-		} elseif ($direction >= 202.5 && $direction < 225){
11338
+		} elseif ($direction >= 202.5 && $direction < 225) {
11339 11339
 			$temp_array['direction_degree'] = $direction;
11340 11340
 			$temp_array['direction_shortname'] = "SSW";
11341 11341
 			$temp_array['direction_fullname'] = "South-Southwest";
11342
-		} elseif ($direction >= 225 && $direction < 247.5){
11342
+		} elseif ($direction >= 225 && $direction < 247.5) {
11343 11343
 			$temp_array['direction_degree'] = $direction;
11344 11344
 			$temp_array['direction_shortname'] = "SW";
11345 11345
 			$temp_array['direction_fullname'] = "Southwest";
11346
-		} elseif ($direction >= 247.5 && $direction < 270){
11346
+		} elseif ($direction >= 247.5 && $direction < 270) {
11347 11347
 			$temp_array['direction_degree'] = $direction;
11348 11348
 			$temp_array['direction_shortname'] = "WSW";
11349 11349
 			$temp_array['direction_fullname'] = "West-Southwest";
11350
-		} elseif ($direction >= 270 && $direction < 292.5){
11350
+		} elseif ($direction >= 270 && $direction < 292.5) {
11351 11351
 			$temp_array['direction_degree'] = $direction;
11352 11352
 			$temp_array['direction_shortname'] = "W";
11353 11353
 			$temp_array['direction_fullname'] = "West";
11354
-		} elseif ($direction >= 292.5 && $direction < 315){
11354
+		} elseif ($direction >= 292.5 && $direction < 315) {
11355 11355
 			$temp_array['direction_degree'] = $direction;
11356 11356
 			$temp_array['direction_shortname'] = "WNW";
11357 11357
 			$temp_array['direction_fullname'] = "West-Northwest";
11358
-		} elseif ($direction >= 315 && $direction < 337.5){
11358
+		} elseif ($direction >= 315 && $direction < 337.5) {
11359 11359
 			$temp_array['direction_degree'] = $direction;
11360 11360
 			$temp_array['direction_shortname'] = "NW";
11361 11361
 			$temp_array['direction_fullname'] = "Northwest";
11362
-		} elseif ($direction >= 337.5 && $direction < 360){
11362
+		} elseif ($direction >= 337.5 && $direction < 360) {
11363 11363
 			$temp_array['direction_degree'] = $direction;
11364 11364
 			$temp_array['direction_shortname'] = "NNW";
11365 11365
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11412,9 +11412,9 @@  discard block
 block discarded – undo
11412 11412
 	*/
11413 11413
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11414 11414
 	{
11415
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11415
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11416 11416
 	
11417
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11417
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11418 11418
 		
11419 11419
 		$sth = $this->db->prepare($query);
11420 11420
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11437,9 +11437,9 @@  discard block
 block discarded – undo
11437 11437
 	*/
11438 11438
 	public function getAircraftTypeBymodeS($aircraft_modes)
11439 11439
 	{
11440
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11440
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11441 11441
 	
11442
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11442
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11443 11443
 		
11444 11444
 		$sth = $this->db->prepare($query);
11445 11445
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11460,11 +11460,11 @@  discard block
 block discarded – undo
11460 11460
 	* @param Float $longitude longitute of the flight
11461 11461
 	* @return String the countrie
11462 11462
 	*/
11463
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11463
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11464 11464
 	{
11465 11465
 		global $globalDBdriver, $globalDebug;
11466
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11467
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11466
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11467
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11468 11468
 	
11469 11469
 		$Connection = new Connection($this->db);
11470 11470
 		if (!$Connection->tableExists('countries')) return '';
@@ -11504,7 +11504,7 @@  discard block
 block discarded – undo
11504 11504
 	public function getCountryFromISO2($iso2)
11505 11505
 	{
11506 11506
 		global $globalDBdriver, $globalDebug;
11507
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11507
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11508 11508
 	
11509 11509
 		$Connection = new Connection($this->db);
11510 11510
 		if (!$Connection->tableExists('countries')) return '';
@@ -11536,19 +11536,19 @@  discard block
 block discarded – undo
11536 11536
 	*/
11537 11537
 	public function convertAircraftRegistration($registration)
11538 11538
 	{
11539
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11539
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11540 11540
 		$registration_prefix = '';
11541 11541
 		$registration_1 = substr($registration, 0, 1);
11542 11542
 		$registration_2 = substr($registration, 0, 2);
11543 11543
 
11544 11544
 		//first get the prefix based on two characters
11545
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11545
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11546 11546
       
11547 11547
 		
11548 11548
 		$sth = $this->db->prepare($query);
11549 11549
 		$sth->execute(array(':registration_2' => $registration_2));
11550 11550
         
11551
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11551
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11552 11552
 		{
11553 11553
 			$registration_prefix = $row['registration_prefix'];
11554 11554
 		}
@@ -11556,11 +11556,11 @@  discard block
 block discarded – undo
11556 11556
 		//if we didn't find a two chracter prefix lets just search the one with one character
11557 11557
 		if ($registration_prefix == '')
11558 11558
 		{
11559
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11559
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11560 11560
 			$sth = $this->db->prepare($query);
11561 11561
 			$sth->execute(array(':registration_1' => $registration_1));
11562 11562
 	        
11563
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11563
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11564 11564
 			{
11565 11565
 				$registration_prefix = $row['registration_prefix'];
11566 11566
 			}
@@ -11574,7 +11574,7 @@  discard block
 block discarded – undo
11574 11574
 			} else {
11575 11575
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11576 11576
 			}
11577
-		} else if(strlen($registration_prefix) == 2){
11577
+		} else if (strlen($registration_prefix) == 2) {
11578 11578
 			if (0 === strpos($registration, 'N')) {
11579 11579
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11580 11580
 			} else {
@@ -11593,17 +11593,17 @@  discard block
 block discarded – undo
11593 11593
 	*/
11594 11594
 	public function countryFromAircraftRegistration($registration)
11595 11595
 	{
11596
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11596
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11597 11597
 		
11598 11598
 		$registration_prefix = '';
11599
-		$registration_test = explode('-',$registration);
11599
+		$registration_test = explode('-', $registration);
11600 11600
 		$country = '';
11601 11601
 		if ($registration_test[0] != $registration) {
11602 11602
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11603 11603
 	      
11604 11604
 			$sth = $this->db->prepare($query);
11605 11605
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11606
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11606
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11607 11607
 			{
11608 11608
 				//$registration_prefix = $row['registration_prefix'];
11609 11609
 				$country = $row['country'];
@@ -11614,13 +11614,13 @@  discard block
 block discarded – undo
11614 11614
 
11615 11615
 			$country = '';
11616 11616
 			//first get the prefix based on two characters
11617
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11617
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11618 11618
       
11619 11619
 			
11620 11620
 			$sth = $this->db->prepare($query);
11621 11621
 			$sth->execute(array(':registration_2' => $registration_2));
11622 11622
         
11623
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11623
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11624 11624
 			{
11625 11625
 				$registration_prefix = $row['registration_prefix'];
11626 11626
 				$country = $row['country'];
@@ -11629,12 +11629,12 @@  discard block
 block discarded – undo
11629 11629
 			//if we didn't find a two chracter prefix lets just search the one with one character
11630 11630
 			if ($registration_prefix == "")
11631 11631
 			{
11632
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11632
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11633 11633
 	      
11634 11634
 				$sth = $this->db->prepare($query);
11635 11635
 				$sth->execute(array(':registration_1' => $registration_1));
11636 11636
 	        
11637
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11637
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11638 11638
 				{
11639 11639
 					//$registration_prefix = $row['registration_prefix'];
11640 11640
 					$country = $row['country'];
@@ -11654,17 +11654,17 @@  discard block
 block discarded – undo
11654 11654
 	*/
11655 11655
 	public function registrationPrefixFromAircraftRegistration($registration)
11656 11656
 	{
11657
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11657
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11658 11658
 		
11659 11659
 		$registration_prefix = '';
11660
-		$registration_test = explode('-',$registration);
11660
+		$registration_test = explode('-', $registration);
11661 11661
 		//$country = '';
11662 11662
 		if ($registration_test[0] != $registration) {
11663
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11663
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11664 11664
 	      
11665 11665
 			$sth = $this->db->prepare($query);
11666 11666
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11667
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11667
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11668 11668
 			{
11669 11669
 				$registration_prefix = $row['registration_prefix'];
11670 11670
 				//$country = $row['country'];
@@ -11674,13 +11674,13 @@  discard block
 block discarded – undo
11674 11674
 		        $registration_2 = substr($registration, 0, 2);
11675 11675
 
11676 11676
 			//first get the prefix based on two characters
11677
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11677
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11678 11678
       
11679 11679
 			
11680 11680
 			$sth = $this->db->prepare($query);
11681 11681
 			$sth->execute(array(':registration_2' => $registration_2));
11682 11682
         
11683
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11683
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11684 11684
 			{
11685 11685
 				$registration_prefix = $row['registration_prefix'];
11686 11686
 				//$country = $row['country'];
@@ -11689,12 +11689,12 @@  discard block
 block discarded – undo
11689 11689
 			//if we didn't find a two chracter prefix lets just search the one with one character
11690 11690
 			if ($registration_prefix == "")
11691 11691
 			{
11692
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11692
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11693 11693
 	      
11694 11694
 				$sth = $this->db->prepare($query);
11695 11695
 				$sth->execute(array(':registration_1' => $registration_1));
11696 11696
 	        
11697
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11697
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11698 11698
 				{
11699 11699
 					$registration_prefix = $row['registration_prefix'];
11700 11700
 					//$country = $row['country'];
@@ -11715,13 +11715,13 @@  discard block
 block discarded – undo
11715 11715
 	*/
11716 11716
 	public function countryFromAircraftRegistrationCode($registration)
11717 11717
 	{
11718
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11718
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11719 11719
 		
11720 11720
 		$country = '';
11721
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11721
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11722 11722
 		$sth = $this->db->prepare($query);
11723 11723
 		$sth->execute(array(':registration' => $registration));
11724
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11724
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11725 11725
 		{
11726 11726
 			$country = $row['country'];
11727 11727
 		}
@@ -11734,9 +11734,9 @@  discard block
 block discarded – undo
11734 11734
 	* @param String $flightaware_id flightaware_id from spotter_output table
11735 11735
 	* @param String $highlight New highlight value
11736 11736
 	*/
11737
-	public function setHighlightFlight($flightaware_id,$highlight) {
11737
+	public function setHighlightFlight($flightaware_id, $highlight) {
11738 11738
 		
11739
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11739
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11740 11740
 		$sth = $this->db->prepare($query);
11741 11741
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11742 11742
 	}
@@ -11748,13 +11748,13 @@  discard block
 block discarded – undo
11748 11748
 	* @param String $date Date of spotted aircraft
11749 11749
 	* @param String $highlight New highlight value
11750 11750
 	*/
11751
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11751
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11752 11752
 		if ($date == '') {
11753 11753
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11754 11754
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11755 11755
 		} else {
11756 11756
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11757
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11757
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11758 11758
 		}
11759 11759
 		$sth = $this->db->prepare($query);
11760 11760
 		$sth->execute($query_values);
@@ -11784,7 +11784,7 @@  discard block
 block discarded – undo
11784 11784
 		
11785 11785
 		$bitly_data = json_decode($bitly_data);
11786 11786
 		$bitly_url = '';
11787
-		if ($bitly_data->status_txt = "OK"){
11787
+		if ($bitly_data->status_txt = "OK") {
11788 11788
 			$bitly_url = $bitly_data->data->url;
11789 11789
 		}
11790 11790
 
@@ -11794,7 +11794,7 @@  discard block
 block discarded – undo
11794 11794
 
11795 11795
 	public function getOrderBy()
11796 11796
 	{
11797
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
11797
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
11798 11798
 		
11799 11799
 		return $orderby;
11800 11800
 		
@@ -11928,14 +11928,14 @@  discard block
 block discarded – undo
11928 11928
 		}
11929 11929
 		$sth = $this->db->prepare($query);
11930 11930
 		$sth->execute();
11931
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11931
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11932 11932
 		{
11933 11933
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11934 11934
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11935 11935
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11936
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11936
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11937 11937
 				$sthu = $this->db->prepare($update_query);
11938
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
11938
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
11939 11939
 			}
11940 11940
 		}
11941 11941
 		
@@ -11948,7 +11948,7 @@  discard block
 block discarded – undo
11948 11948
 		}
11949 11949
 		$sth = $this->db->prepare($query);
11950 11950
 		$sth->execute();
11951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11952 11952
 		{
11953 11953
 			if (is_numeric(substr($row['ident'], -1, 1)))
11954 11954
 			{
@@ -11957,11 +11957,11 @@  discard block
 block discarded – undo
11957 11957
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11958 11958
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11959 11959
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11960
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11960
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11961 11961
 				if (isset($airline_array[0]['name'])) {
11962
-					$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";
11962
+					$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";
11963 11963
 					$sthu = $this->db->prepare($update_query);
11964
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
11964
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
11965 11965
 				}
11966 11966
 			}
11967 11967
 		}
@@ -11981,18 +11981,18 @@  discard block
 block discarded – undo
11981 11981
 		}
11982 11982
 		$sth = $this->db->prepare($query);
11983 11983
 		$sth->execute();
11984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11985 11985
 		{
11986 11986
 			if ($row['aircraft_icao'] != '') {
11987 11987
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11988
-				if ($row['registration'] != ""){
11988
+				if ($row['registration'] != "") {
11989 11989
 					$image_array = $Image->getSpotterImage($row['registration']);
11990 11990
 					if (!isset($image_array[0]['registration'])) {
11991 11991
 						$Image->addSpotterImage($row['registration']);
11992 11992
 					}
11993 11993
 				}
11994 11994
 				if (count($aircraft_name) > 0) {
11995
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11995
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11996 11996
 					$sthu = $this->db->prepare($update_query);
11997 11997
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11998 11998
 				}
@@ -12007,10 +12007,10 @@  discard block
 block discarded – undo
12007 12007
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
12008 12008
 		$sth = $this->db->prepare($query);
12009 12009
 		$sth->execute();
12010
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12010
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12011 12011
 		{
12012 12012
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12013
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12013
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12014 12014
 				$airport_icao = '';
12015 12015
 				 if (isset($closestAirports[0])) {
12016 12016
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12024,7 +12024,7 @@  discard block
 block discarded – undo
12024 12024
 								break;
12025 12025
 							}
12026 12026
 						}
12027
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12027
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12028 12028
 						$airport_icao = $closestAirports[0]['icao'];
12029 12029
 						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";
12030 12030
 					} else {
@@ -12035,28 +12035,28 @@  discard block
 block discarded – undo
12035 12035
 				}
12036 12036
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12037 12037
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12038
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12038
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12039 12039
 					$sthu = $this->db->prepare($update_query);
12040
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12040
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12041 12041
 				}
12042 12042
 			}
12043 12043
 		}
12044 12044
 	}
12045 12045
 	
12046
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12046
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12047 12047
 		global $globalDBdriver;
12048
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12048
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12049 12049
 /*
12050 12050
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12051 12051
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12052 12052
                       having distance < $dist ORDER BY distance limit 100;";
12053 12053
 */
12054 12054
 		if ($globalDBdriver == 'mysql') {
12055
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12055
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
12056 12056
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12057 12057
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12058 12058
                 } else {
12059
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12059
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
12060 12060
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
12061 12061
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
12062 12062
     		}
Please login to merge, or discard this patch.
Braces   +733 added lines, -256 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -139,8 +141,11 @@  discard block
 block discarded – undo
139 141
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
140 142
 			}
141 143
 		}
142
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
143
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
144
+		if ($filter_query_where == '' && $where) {
145
+			$filter_query_where = ' WHERE';
146
+		} elseif ($filter_query_where != '' && $and) {
147
+			$filter_query_where .= ' AND';
148
+		}
144 149
 		if ($filter_query_where != '') {
145 150
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
146 151
 		}
@@ -163,10 +168,18 @@  discard block
 block discarded – undo
163 168
 		$Image = new Image($this->db);
164 169
 		$Schedule = new Schedule($this->db);
165 170
 		$ACARS = new ACARS($this->db);
166
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
167
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
168
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
169
-		if (!isset($globalVAM)) $globalVAM = FALSE;
171
+		if (!isset($globalIVAO)) {
172
+			$globalIVAO = FALSE;
173
+		}
174
+		if (!isset($globalVATSIM)) {
175
+			$globalVATSIM = FALSE;
176
+		}
177
+		if (!isset($globalphpVMS)) {
178
+			$globalphpVMS = FALSE;
179
+		}
180
+		if (!isset($globalVAM)) {
181
+			$globalVAM = FALSE;
182
+		}
170 183
 		date_default_timezone_set('UTC');
171 184
 		
172 185
 		if (!is_string($query))
@@ -213,21 +226,35 @@  discard block
 block discarded – undo
213 226
 			} else {
214 227
 				$temp_array['spotter_id'] = '';
215 228
 			}
216
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
217
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
229
+			if (isset($row['flightaware_id'])) {
230
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
231
+			}
232
+			if (isset($row['modes'])) {
233
+				$temp_array['modes'] = $row['modes'];
234
+			}
218 235
 			$temp_array['ident'] = $row['ident'];
219 236
 			if (isset($row['registration']) && $row['registration'] != '') {
220 237
 				$temp_array['registration'] = $row['registration'];
221 238
 			} elseif (isset($temp_array['modes'])) {
222 239
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
223
-			} else $temp_array['registration'] = '';
224
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
240
+			} else {
241
+				$temp_array['registration'] = '';
242
+			}
243
+			if (isset($row['aircraft_icao'])) {
244
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
245
+			}
225 246
 			
226 247
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
227 248
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
228
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
229
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
230
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
249
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
250
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
251
+			}
252
+			if (isset($row['latitude'])) {
253
+				$temp_array['latitude'] = $row['latitude'];
254
+			}
255
+			if (isset($row['longitude'])) {
256
+				$temp_array['longitude'] = $row['longitude'];
257
+			}
231 258
 			/*
232 259
 			if (Connection->tableExists('countries')) {
233 260
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -237,8 +264,12 @@  discard block
 block discarded – undo
237 264
 				}
238 265
 			}
239 266
 			*/
240
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
241
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
267
+			if (isset($row['waypoints'])) {
268
+				$temp_array['waypoints'] = $row['waypoints'];
269
+			}
270
+			if (isset($row['format_source'])) {
271
+				$temp_array['format_source'] = $row['format_source'];
272
+			}
242 273
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
243 274
 				$temp_array['route_stop'] = $row['route_stop'];
244 275
 				$allroute = explode(' ',$row['route_stop']);
@@ -254,13 +285,19 @@  discard block
 block discarded – undo
254 285
 					}
255 286
 				}
256 287
 			}
257
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
288
+			if (isset($row['altitude'])) {
289
+				$temp_array['altitude'] = $row['altitude'];
290
+			}
258 291
 			if (isset($row['heading'])) {
259 292
 				$temp_array['heading'] = $row['heading'];
260 293
 				$heading_direction = $this->parseDirection($row['heading']);
261
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
294
+				if (isset($heading_direction[0]['direction_fullname'])) {
295
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
296
+				}
297
+			}
298
+			if (isset($row['ground_speed'])) {
299
+				$temp_array['ground_speed'] = $row['ground_speed'];
262 300
 			}
263
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
264 301
 			$temp_array['image'] = "";
265 302
 			$temp_array['image_thumbnail'] = "";
266 303
 			$temp_array['image_source'] = "";
@@ -268,7 +305,9 @@  discard block
 block discarded – undo
268 305
  
269 306
 			if (isset($row['highlight'])) {
270 307
 				$temp_array['highlight'] = $row['highlight'];
271
-			} else $temp_array['highlight'] = '';
308
+			} else {
309
+				$temp_array['highlight'] = '';
310
+			}
272 311
 			
273 312
 			if (isset($row['date'])) {
274 313
 				$dateArray = $this->parseDateString($row['date']);
@@ -322,7 +361,9 @@  discard block
 block discarded – undo
322 361
 				
323 362
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
324 363
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
325
-					} else $temp_array['aircraft_shadow'] = 'default.png';
364
+					} else {
365
+						$temp_array['aircraft_shadow'] = 'default.png';
366
+					}
326 367
                                 } else {
327 368
                             		$temp_array['aircraft_shadow'] = 'default.png';
328 369
 					$temp_array['aircraft_name'] = 'N/A';
@@ -330,11 +371,17 @@  discard block
 block discarded – undo
330 371
                             	}
331 372
 			}
332 373
 			$fromsource = NULL;
333
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
334
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
335
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
336
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
337
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
374
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
375
+				$fromsource = $globalAirlinesSource;
376
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
377
+				$fromsource = 'vatsim';
378
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
379
+				$fromsource = 'ivao';
380
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
381
+				$fromsource = 'vatsim';
382
+			} elseif (isset($globalIVAO) && $globalIVAO) {
383
+				$fromsource = 'ivao';
384
+			}
338 385
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
339 386
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
340 387
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -357,12 +404,18 @@  discard block
 block discarded – undo
357 404
 				}
358 405
 			} else {
359 406
 				$temp_array['airline_icao'] = $row['airline_icao'];
360
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
361
-				else $temp_array['airline_iata'] = 'N/A';
407
+				if (isset($row['airline_iata'])) {
408
+					$temp_array['airline_iata'] = $row['airline_iata'];
409
+				} else {
410
+					$temp_array['airline_iata'] = 'N/A';
411
+				}
362 412
 				$temp_array['airline_name'] = $row['airline_name'];
363 413
 				$temp_array['airline_country'] = $row['airline_country'];
364
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
365
-				else $temp_array['airline_callsign'] = 'N/A';
414
+				if (isset($row['airline_callsign'])) {
415
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
416
+				} else {
417
+					$temp_array['airline_callsign'] = 'N/A';
418
+				}
366 419
 				$temp_array['airline_type'] = $row['airline_type'];
367 420
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
368 421
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -389,7 +442,9 @@  discard block
 block discarded – undo
389 442
 			}
390 443
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
391 444
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
392
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
445
+				if ($owner_info['owner'] != '') {
446
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
447
+				}
393 448
 				$temp_array['aircraft_base'] = $owner_info['base'];
394 449
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
395 450
 			}
@@ -397,9 +452,14 @@  discard block
 block discarded – undo
397 452
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
398 453
 			{
399 454
 				if ($globalIVAO) {
400
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
401
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
402
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
455
+					if (isset($temp_array['airline_icao'])) {
456
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
457
+					} else {
458
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
459
+					}
460
+				} else {
461
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
462
+				}
403 463
 				if (count($image_array) > 0) {
404 464
 					$temp_array['image'] = $image_array[0]['image'];
405 465
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -451,7 +511,9 @@  discard block
 block discarded – undo
451 511
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
452 512
 			if ($row['departure_airport_icao'] != '') {
453 513
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
454
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
514
+				if (!isset($departure_airport_array[0]['name'])) {
515
+					$departure_airport_array = $this->getAllAirportInfo('NA');
516
+				}
455 517
 			/*
456 518
 			} elseif ($row['departure_airport_name'] != '') {
457 519
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -459,7 +521,9 @@  discard block
 block discarded – undo
459 521
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
460 522
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
461 523
 			*/
462
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
524
+			} else {
525
+				$departure_airport_array = $this->getAllAirportInfo('NA');
526
+			}
463 527
 			if (isset($departure_airport_array[0]['name'])) {
464 528
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
465 529
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -479,8 +543,12 @@  discard block
 block discarded – undo
479 543
 			
480 544
 			if ($row['arrival_airport_icao'] != '') {
481 545
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
482
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
483
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
546
+				if (count($arrival_airport_array) == 0) {
547
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
548
+				}
549
+			} else {
550
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
551
+			}
484 552
 			if (isset($arrival_airport_array[0]['name'])) {
485 553
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
486 554
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -496,27 +564,45 @@  discard block
 block discarded – undo
496 564
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
497 565
 			}
498 566
 			*/
499
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
500
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
501
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
502
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
503
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
567
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
568
+				$temp_array['pilot_id'] = $row['pilot_id'];
569
+			}
570
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
571
+				$temp_array['pilot_name'] = $row['pilot_name'];
572
+			}
573
+			if (isset($row['source_name']) && $row['source_name'] != '') {
574
+				$temp_array['source_name'] = $row['source_name'];
575
+			}
576
+			if (isset($row['over_country']) && $row['over_country'] != '') {
577
+				$temp_array['over_country'] = $row['over_country'];
578
+			}
579
+			if (isset($row['distance']) && $row['distance'] != '') {
580
+				$temp_array['distance'] = $row['distance'];
581
+			}
504 582
 			if (isset($row['squawk'])) {
505 583
 				$temp_array['squawk'] = $row['squawk'];
506 584
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
507 585
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
508
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
586
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
587
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
588
+					}
509 589
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
510 590
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
511
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
591
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
592
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
593
+					}
594
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
595
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
596
+				}
513 597
 			}
514 598
     			
515 599
 			$temp_array['query_number_rows'] = $num_rows;
516 600
 			
517 601
 			$spotter_array[] = $temp_array;
518 602
 		}
519
-		if ($num_rows == 0) return array();
603
+		if ($num_rows == 0) {
604
+			return array();
605
+		}
520 606
 		$spotter_array[0]['query_number_rows'] = $num_rows;
521 607
 		return $spotter_array;
522 608
 	}	
@@ -549,7 +635,9 @@  discard block
 block discarded – undo
549 635
 				foreach ($q_array as $q_item){
550 636
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
551 637
 					$additional_query .= " AND (";
552
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
638
+					if (is_int($q_item)) {
639
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
640
+					}
553 641
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
554 642
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
555 643
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -570,7 +658,9 @@  discard block
 block discarded – undo
570 658
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
571 659
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
572 660
 					$translate = $Translation->ident2icao($q_item);
573
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
661
+					if ($translate != $q_item) {
662
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
663
+					}
574 664
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
575 665
 					$additional_query .= ")";
576 666
 				}
@@ -797,7 +887,9 @@  discard block
 block discarded – undo
797 887
 				date_default_timezone_set($globalTimezone);
798 888
 				$datetime = new DateTime();
799 889
 				$offset = $datetime->format('P');
800
-			} else $offset = '+00:00';
890
+			} else {
891
+				$offset = '+00:00';
892
+			}
801 893
 
802 894
 			if ($date_array[1] != "")
803 895
 			{
@@ -829,8 +921,12 @@  discard block
 block discarded – undo
829 921
 			{
830 922
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
831 923
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
832
-			} else $limit_query = "";
833
-		} else $limit_query = "";
924
+			} else {
925
+				$limit_query = "";
926
+			}
927
+		} else {
928
+			$limit_query = "";
929
+		}
834 930
 
835 931
 
836 932
 		if ($sort != "")
@@ -898,8 +994,12 @@  discard block
 block discarded – undo
898 994
 			{
899 995
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
900 996
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
901
-			} else $limit_query = "";
902
-		} else $limit_query = "";
997
+			} else {
998
+				$limit_query = "";
999
+			}
1000
+		} else {
1001
+			$limit_query = "";
1002
+		}
903 1003
 		
904 1004
 		if ($sort != "")
905 1005
 		{
@@ -1223,7 +1323,9 @@  discard block
 block discarded – undo
1223 1323
 		global $global_query;
1224 1324
 		
1225 1325
 		date_default_timezone_set('UTC');
1226
-		if ($id == '') return array();
1326
+		if ($id == '') {
1327
+			return array();
1328
+		}
1227 1329
 		$additional_query = "spotter_output.spotter_id = :id";
1228 1330
 		$query_values = array(':id' => $id);
1229 1331
 
@@ -1338,8 +1440,11 @@  discard block
 block discarded – undo
1338 1440
 		if ($sort != "")
1339 1441
 		{
1340 1442
 			$search_orderby_array = $this->getOrderBy();
1341
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1342
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1443
+			if (isset($search_orderby_array[$sort]['sql'])) {
1444
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1445
+			} else {
1446
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1447
+			}
1343 1448
 		} else {
1344 1449
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1345 1450
 		}
@@ -1964,7 +2069,9 @@  discard block
 block discarded – undo
1964 2069
 		{
1965 2070
 			$highlight = $row['highlight'];
1966 2071
 		}
1967
-		if (isset($highlight)) return $highlight;
2072
+		if (isset($highlight)) {
2073
+			return $highlight;
2074
+		}
1968 2075
 	}
1969 2076
 
1970 2077
 	
@@ -1992,7 +2099,9 @@  discard block
 block discarded – undo
1992 2099
 		$sth->closeCursor();
1993 2100
 		if (count($row) > 0) {
1994 2101
 			return $row['usage'];
1995
-		} else return '';
2102
+		} else {
2103
+			return '';
2104
+		}
1996 2105
 	}
1997 2106
 
1998 2107
 	/**
@@ -2017,7 +2126,9 @@  discard block
 block discarded – undo
2017 2126
 		$sth->closeCursor();
2018 2127
 		if (count($row) > 0) {
2019 2128
 			return $row['icao'];
2020
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2021 2132
 	}
2022 2133
 
2023 2134
 	/**
@@ -2045,7 +2156,9 @@  discard block
 block discarded – undo
2045 2156
 			$airport_longitude = $row['longitude'];
2046 2157
 			$Common = new Common();
2047 2158
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2048
-		} else return '';
2159
+		} else {
2160
+			return '';
2161
+		}
2049 2162
 	}
2050 2163
 	
2051 2164
 	/**
@@ -2157,7 +2270,9 @@  discard block
 block discarded – undo
2157 2270
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2158 2271
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2159 2272
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2160
-		} else return array();
2273
+		} else {
2274
+			return array();
2275
+		}
2161 2276
 		if ($globalDBdriver == 'mysql') {
2162 2277
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2163 2278
 		} else {
@@ -2192,7 +2307,9 @@  discard block
 block discarded – undo
2192 2307
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2193 2308
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2194 2309
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2195
-		} else return array();
2310
+		} else {
2311
+			return array();
2312
+		}
2196 2313
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2197 2314
 		$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.")";
2198 2315
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2227,7 +2344,9 @@  discard block
 block discarded – undo
2227 2344
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2228 2345
 	{
2229 2346
 		global $globalUseRealAirlines;
2230
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2347
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2348
+			$fromsource = NULL;
2349
+		}
2231 2350
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2232 2351
 		if ($airline_icao == 'NA') {
2233 2352
 			$airline_array = array();
@@ -2296,7 +2415,9 @@  discard block
 block discarded – undo
2296 2415
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2297 2416
 	{
2298 2417
 		global $globalUseRealAirlines;
2299
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2418
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2419
+			$fromsource = NULL;
2420
+		}
2300 2421
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2301 2422
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2302 2423
 		$sth = $this->db->prepare($query);
@@ -2312,7 +2433,9 @@  discard block
 block discarded – undo
2312 2433
 			$sth->execute(array(':fromsource' => $fromsource));
2313 2434
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2314 2435
 			$sth->closeCursor();
2315
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2436
+			if ($row['nb'] == 0) {
2437
+				$result = $this->getAllAirlineInfoByName($airline_name);
2438
+			}
2316 2439
 		}
2317 2440
 		return $result;
2318 2441
 	}
@@ -2375,15 +2498,20 @@  discard block
 block discarded – undo
2375 2498
 				'A320-211' => 'A320',
2376 2499
 				'747-8i' => 'B748',
2377 2500
 				'A380' => 'A388');
2378
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2501
+		if (isset($all_aircraft[$aircraft_type])) {
2502
+			return $all_aircraft[$aircraft_type];
2503
+		}
2379 2504
 
2380 2505
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2381 2506
 		$aircraft_type = strtoupper($aircraft_type);
2382 2507
 		$sth = $this->db->prepare($query);
2383 2508
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2384 2509
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2385
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2386
-		else return '';
2510
+		if (isset($result[0]['icao'])) {
2511
+			return $result[0]['icao'];
2512
+		} else {
2513
+			return '';
2514
+		}
2387 2515
 	}
2388 2516
 	
2389 2517
 	/**
@@ -2406,9 +2534,13 @@  discard block
 block discarded – undo
2406 2534
 		$sth->closeCursor();
2407 2535
 		if (isset($row['icaotypecode'])) {
2408 2536
 			$icao = $row['icaotypecode'];
2409
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2537
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2538
+				$icao = $this->aircraft_correct_icaotype[$icao];
2539
+			}
2410 2540
 			return $icao;
2411
-		} else return '';
2541
+		} else {
2542
+			return '';
2543
+		}
2412 2544
 	}
2413 2545
 
2414 2546
 	/**
@@ -2431,7 +2563,9 @@  discard block
 block discarded – undo
2431 2563
 		$sth->closeCursor();
2432 2564
 		if (isset($row['icaotypecode'])) {
2433 2565
 			return $row['icaotypecode'];
2434
-		} else return '';
2566
+		} else {
2567
+			return '';
2568
+		}
2435 2569
 	}
2436 2570
 
2437 2571
 	/**
@@ -2477,7 +2611,9 @@  discard block
 block discarded – undo
2477 2611
 		$sth->closeCursor();
2478 2612
 		if (isset($row['operator_correct'])) {
2479 2613
 			return $row['operator_correct'];
2480
-		} else return $operator;
2614
+		} else {
2615
+			return $operator;
2616
+		}
2481 2617
 	}
2482 2618
 
2483 2619
 	/**
@@ -2490,7 +2626,9 @@  discard block
 block discarded – undo
2490 2626
 	public function getRouteInfo($callsign)
2491 2627
 	{
2492 2628
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2493
-                if ($callsign == '') return array();
2629
+                if ($callsign == '') {
2630
+                	return array();
2631
+                }
2494 2632
 		$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";
2495 2633
 		
2496 2634
 		$sth = $this->db->prepare($query);
@@ -2500,7 +2638,9 @@  discard block
 block discarded – undo
2500 2638
 		$sth->closeCursor();
2501 2639
 		if (count($row) > 0) {
2502 2640
 			return $row;
2503
-		} else return array();
2641
+		} else {
2642
+			return array();
2643
+		}
2504 2644
 	}
2505 2645
 	
2506 2646
 	/**
@@ -2553,7 +2693,9 @@  discard block
 block discarded – undo
2553 2693
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2554 2694
 			$sth->closeCursor();
2555 2695
 			return $result;
2556
-		} else return array();
2696
+		} else {
2697
+			return array();
2698
+		}
2557 2699
 	}
2558 2700
 	
2559 2701
   
@@ -2712,8 +2854,11 @@  discard block
 block discarded – undo
2712 2854
 		$query .= " ORDER BY spotter_output.source_name ASC";
2713 2855
 
2714 2856
 		$sth = $this->db->prepare($query);
2715
-		if (!empty($query_values)) $sth->execute($query_values);
2716
-		else $sth->execute();
2857
+		if (!empty($query_values)) {
2858
+			$sth->execute($query_values);
2859
+		} else {
2860
+			$sth->execute();
2861
+		}
2717 2862
 
2718 2863
 		$source_array = array();
2719 2864
 		$temp_array = array();
@@ -2746,9 +2891,13 @@  discard block
 block discarded – undo
2746 2891
 								WHERE spotter_output.airline_icao <> '' 
2747 2892
 								ORDER BY spotter_output.airline_name ASC";
2748 2893
 			*/
2749
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2750
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2751
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2894
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2895
+				$forsource = $globalAirlinesSource;
2896
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2897
+				$forsource = 'vatsim';
2898
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2899
+				$forsource = 'ivao';
2900
+			}
2752 2901
 			if ($forsource === NULL) {
2753 2902
 				$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";
2754 2903
 				$query_data = array();
@@ -2791,9 +2940,13 @@  discard block
 block discarded – undo
2791 2940
 	{
2792 2941
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2793 2942
 		$filter_query = $this->getFilter($filters,true,true);
2794
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2795
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2796
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2943
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2944
+			$forsource = $globalAirlinesSource;
2945
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2946
+			$forsource = 'vatsim';
2947
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2948
+			$forsource = 'ivao';
2949
+		}
2797 2950
 		if ($forsource === NULL) {
2798 2951
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2799 2952
 			$query_data = array();
@@ -3104,7 +3257,9 @@  discard block
 block discarded – undo
3104 3257
 			date_default_timezone_set($globalTimezone);
3105 3258
 			$datetime = new DateTime();
3106 3259
 			$offset = $datetime->format('P');
3107
-		} else $offset = '+00:00';
3260
+		} else {
3261
+			$offset = '+00:00';
3262
+		}
3108 3263
 		if ($airport_icao == '') {
3109 3264
 			if ($globalDBdriver == 'mysql') {
3110 3265
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3136,7 +3291,9 @@  discard block
 block discarded – undo
3136 3291
 			date_default_timezone_set($globalTimezone);
3137 3292
 			$datetime = new DateTime();
3138 3293
 			$offset = $datetime->format('P');
3139
-		} else $offset = '+00:00';
3294
+		} else {
3295
+			$offset = '+00:00';
3296
+		}
3140 3297
 		if ($airport_icao == '') {
3141 3298
 			if ($globalDBdriver == 'mysql') {
3142 3299
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3169,7 +3326,9 @@  discard block
 block discarded – undo
3169 3326
 			date_default_timezone_set($globalTimezone);
3170 3327
 			$datetime = new DateTime();
3171 3328
 			$offset = $datetime->format('P');
3172
-		} else $offset = '+00:00';
3329
+		} else {
3330
+			$offset = '+00:00';
3331
+		}
3173 3332
 		if ($airport_icao == '') {
3174 3333
 			if ($globalDBdriver == 'mysql') {
3175 3334
 				$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 
@@ -3208,7 +3367,9 @@  discard block
 block discarded – undo
3208 3367
 			date_default_timezone_set($globalTimezone);
3209 3368
 			$datetime = new DateTime();
3210 3369
 			$offset = $datetime->format('P');
3211
-		} else $offset = '+00:00';
3370
+		} else {
3371
+			$offset = '+00:00';
3372
+		}
3212 3373
 		if ($airport_icao == '') {
3213 3374
 			if ($globalDBdriver == 'mysql') {
3214 3375
 				$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 
@@ -3253,7 +3414,9 @@  discard block
 block discarded – undo
3253 3414
 			date_default_timezone_set($globalTimezone);
3254 3415
 			$datetime = new DateTime();
3255 3416
 			$offset = $datetime->format('P');
3256
-		} else $offset = '+00:00';
3417
+		} else {
3418
+			$offset = '+00:00';
3419
+		}
3257 3420
 		if ($airport_icao == '') {
3258 3421
 			if ($globalDBdriver == 'mysql') {
3259 3422
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3288,7 +3451,9 @@  discard block
 block discarded – undo
3288 3451
 			date_default_timezone_set($globalTimezone);
3289 3452
 			$datetime = new DateTime();
3290 3453
 			$offset = $datetime->format('P');
3291
-		} else $offset = '+00:00';
3454
+		} else {
3455
+			$offset = '+00:00';
3456
+		}
3292 3457
 		if ($airport_icao == '') {
3293 3458
 			if ($globalDBdriver == 'mysql') {
3294 3459
 				$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 
@@ -3330,7 +3495,9 @@  discard block
 block discarded – undo
3330 3495
 			date_default_timezone_set($globalTimezone);
3331 3496
 			$datetime = new DateTime();
3332 3497
 			$offset = $datetime->format('P');
3333
-		} else $offset = '+00:00';
3498
+		} else {
3499
+			$offset = '+00:00';
3500
+		}
3334 3501
 		if ($airport_icao == '') {
3335 3502
 			if ($globalDBdriver == 'mysql') {
3336 3503
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3364,7 +3531,9 @@  discard block
 block discarded – undo
3364 3531
 			date_default_timezone_set($globalTimezone);
3365 3532
 			$datetime = new DateTime();
3366 3533
 			$offset = $datetime->format('P');
3367
-		} else $offset = '+00:00';
3534
+		} else {
3535
+			$offset = '+00:00';
3536
+		}
3368 3537
 		if ($airport_icao == '') {
3369 3538
 			if ($globalDBdriver == 'mysql') {
3370 3539
 				$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 
@@ -3412,7 +3581,9 @@  discard block
 block discarded – undo
3412 3581
 			date_default_timezone_set($globalTimezone);
3413 3582
 			$datetime = new DateTime();
3414 3583
 			$offset = $datetime->format('P');
3415
-		} else $offset = '+00:00';
3584
+		} else {
3585
+			$offset = '+00:00';
3586
+		}
3416 3587
 
3417 3588
 		if ($globalDBdriver == 'mysql') {
3418 3589
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3532,7 +3703,9 @@  discard block
 block discarded – undo
3532 3703
 	*/	
3533 3704
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3534 3705
 	{
3535
-		if ($groundspeed == '') $groundspeed = NULL;
3706
+		if ($groundspeed == '') {
3707
+			$groundspeed = NULL;
3708
+		}
3536 3709
 		$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';
3537 3710
                 $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);
3538 3711
 
@@ -3582,10 +3755,18 @@  discard block
 block discarded – undo
3582 3755
 		$Image = new Image($this->db);
3583 3756
 		$Common = new Common();
3584 3757
 		
3585
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3586
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3587
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3588
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3758
+		if (!isset($globalIVAO)) {
3759
+			$globalIVAO = FALSE;
3760
+		}
3761
+		if (!isset($globalVATSIM)) {
3762
+			$globalVATSIM = FALSE;
3763
+		}
3764
+		if (!isset($globalphpVMS)) {
3765
+			$globalphpVMS = FALSE;
3766
+		}
3767
+		if (!isset($globalVAM)) {
3768
+			$globalVAM = FALSE;
3769
+		}
3589 3770
 		date_default_timezone_set('UTC');
3590 3771
 		
3591 3772
 		//getting the registration
@@ -3598,23 +3779,33 @@  discard block
 block discarded – undo
3598 3779
 				if ($ModeS != '') {
3599 3780
 					$timeelapsed = microtime(true);
3600 3781
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3601
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3782
+					if ($globalDebugTimeElapsed) {
3783
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3784
+					}
3602 3785
 				} else {
3603 3786
 					$myhex = explode('-',$flightaware_id);
3604 3787
 					if (count($myhex) > 0) {
3605 3788
 						$timeelapsed = microtime(true);
3606 3789
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3607
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3790
+						if ($globalDebugTimeElapsed) {
3791
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3792
+						}
3608 3793
 					}
3609 3794
 				}
3610 3795
 			}
3611 3796
 		}
3612 3797
 		$fromsource = NULL;
3613
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3614
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3615
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3616
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3617
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3798
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3799
+			$fromsource = $globalAirlinesSource;
3800
+		} elseif ($format_source == 'vatsimtxt') {
3801
+			$fromsource = 'vatsim';
3802
+		} elseif ($format_source == 'whazzup') {
3803
+			$fromsource = 'ivao';
3804
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3805
+			$fromsource = 'vatsim';
3806
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3807
+			$fromsource = 'ivao';
3808
+		}
3618 3809
 		//getting the airline information
3619 3810
 		if ($ident != "")
3620 3811
 		{
@@ -3638,15 +3829,21 @@  discard block
 block discarded – undo
3638 3829
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3639 3830
 						$airline_array = $this->getAllAirlineInfo("NA");
3640 3831
 					}
3641
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3832
+					if ($globalDebugTimeElapsed) {
3833
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3834
+					}
3642 3835
 
3643 3836
 				} else {
3644 3837
 					$timeelapsed = microtime(true);
3645 3838
 					$airline_array = $this->getAllAirlineInfo("NA");
3646
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3839
+					if ($globalDebugTimeElapsed) {
3840
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3841
+					}
3647 3842
 				}
3648 3843
 			}
3649
-		} else $airline_array = array();
3844
+		} else {
3845
+			$airline_array = array();
3846
+		}
3650 3847
 		
3651 3848
 		//getting the aircraft information
3652 3849
 		$aircraft_array = array();
@@ -3660,27 +3857,37 @@  discard block
 block discarded – undo
3660 3857
 				{
3661 3858
 					$timeelapsed = microtime(true);
3662 3859
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3663
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					if ($globalDebugTimeElapsed) {
3861
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3862
+					}
3664 3863
 				} else {
3665 3864
 					$timeelapsed = microtime(true);
3666 3865
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3866
+					if ($globalDebugTimeElapsed) {
3867
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3868
+					}
3668 3869
 				}
3669 3870
 			}
3670 3871
 		} else {
3671 3872
 			if ($ModeS != '') {
3672 3873
 				$timeelapsed = microtime(true);
3673 3874
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3674
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3875
+				if ($globalDebugTimeElapsed) {
3876
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3877
+				}
3675 3878
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3676 3879
 				{
3677 3880
 					$timeelapsed = microtime(true);
3678 3881
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3882
+					if ($globalDebugTimeElapsed) {
3883
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884
+					}
3680 3885
 				} else {
3681 3886
 					$timeelapsed = microtime(true);
3682 3887
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3683
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3888
+					if ($globalDebugTimeElapsed) {
3889
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3890
+					}
3684 3891
 				}
3685 3892
 			}
3686 3893
 		}
@@ -3696,7 +3903,9 @@  discard block
 block discarded – undo
3696 3903
 			} else {
3697 3904
 				$timeelapsed = microtime(true);
3698 3905
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3699
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3906
+				if ($globalDebugTimeElapsed) {
3907
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3908
+				}
3700 3909
 			}
3701 3910
 		}
3702 3911
 		
@@ -3711,7 +3920,9 @@  discard block
 block discarded – undo
3711 3920
 			} else {
3712 3921
 				$timeelapsed = microtime(true);
3713 3922
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3714
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3923
+				if ($globalDebugTimeElapsed) {
3924
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3925
+				}
3715 3926
 			}
3716 3927
 		}
3717 3928
 
@@ -3745,7 +3956,9 @@  discard block
 block discarded – undo
3745 3956
 			{
3746 3957
 				return false;
3747 3958
 			}
3748
-		} else $altitude = 0;
3959
+		} else {
3960
+			$altitude = 0;
3961
+		}
3749 3962
 		
3750 3963
 		if ($heading != "")
3751 3964
 		{
@@ -3774,7 +3987,9 @@  discard block
 block discarded – undo
3774 3987
 		{
3775 3988
 			$timeelapsed = microtime(true);
3776 3989
 			$image_array = $Image->getSpotterImage($registration);
3777
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3990
+			if ($globalDebugTimeElapsed) {
3991
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3992
+			}
3778 3993
 			if (!isset($image_array[0]['registration']))
3779 3994
 			{
3780 3995
 				//echo "Add image !!!! \n";
@@ -3782,14 +3997,21 @@  discard block
 block discarded – undo
3782 3997
 			}
3783 3998
 			$timeelapsed = microtime(true);
3784 3999
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3785
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3786
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4000
+			if ($globalDebugTimeElapsed) {
4001
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4002
+			}
4003
+			if ($owner_info['owner'] != '') {
4004
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4005
+			}
3787 4006
 		}
3788 4007
     
3789 4008
 		if ($globalIVAO && $aircraft_icao != '')
3790 4009
 		{
3791
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
-            		else $airline_icao = '';
4010
+            		if (isset($airline_array[0]['icao'])) {
4011
+            			$airline_icao = $airline_array[0]['icao'];
4012
+            		} else {
4013
+            			$airline_icao = '';
4014
+            		}
3793 4015
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3794 4016
 			if (!isset($image_array[0]['registration']))
3795 4017
 			{
@@ -3834,16 +4056,28 @@  discard block
 block discarded – undo
3834 4056
                 {
3835 4057
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3836 4058
                 }
3837
-                if ($registration == '') $registration = 'NA';
4059
+                if ($registration == '') {
4060
+                	$registration = 'NA';
4061
+                }
3838 4062
                 if ($latitude == '' && $longitude == '') {
3839 4063
             		$latitude = 0;
3840 4064
             		$longitude = 0;
3841 4065
             	}
3842
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4066
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4067
+                	$squawk = NULL;
4068
+                }
4069
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4070
+                	$verticalrate = NULL;
4071
+                }
4072
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4073
+                	$heading = 0;
4074
+                }
4075
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4076
+                	$groundspeed = 0;
4077
+                }
4078
+                if (!isset($aircraft_owner)) {
4079
+                	$aircraft_owner = NULL;
4080
+                }
3847 4081
                 $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) 
3848 4082
                 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)";
3849 4083
 
@@ -3854,9 +4088,13 @@  discard block
 block discarded – undo
3854 4088
 		if ($airline_type == '') {
3855 4089
 			$timeelapsed = microtime(true);
3856 4090
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4091
+			if ($globalDebugTimeElapsed) {
4092
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4093
+			}
4094
+		}
4095
+		if ($airline_type == null) {
4096
+			$airline_type = '';
3858 4097
 		}
3859
-		if ($airline_type == null) $airline_type = '';
3860 4098
                 $aircraft_type = $aircraft_array[0]['type'];
3861 4099
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862 4100
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4020,7 +4258,9 @@  discard block
 block discarded – undo
4020 4258
 			}
4021 4259
 		}
4022 4260
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4023
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4261
+		if ($limit) {
4262
+			$query .= " LIMIT 10 OFFSET 0";
4263
+		}
4024 4264
 
4025 4265
 		$sth = $this->db->prepare($query);
4026 4266
 		$sth->execute($query_values);
@@ -4093,7 +4333,9 @@  discard block
 block discarded – undo
4093 4333
 		}
4094 4334
 		
4095 4335
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4096
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4336
+		if ($limit) {
4337
+			$query .= " LIMIT 10 OFFSET 0";
4338
+		}
4097 4339
       
4098 4340
 		
4099 4341
 		$sth = $this->db->prepare($query);
@@ -4137,7 +4379,9 @@  discard block
 block discarded – undo
4137 4379
 			}
4138 4380
 		}
4139 4381
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4140
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4382
+		if ($limit) {
4383
+			$query .= " LIMIT 10 OFFSET 0";
4384
+		}
4141 4385
       
4142 4386
 		
4143 4387
 		$sth = $this->db->prepare($query);
@@ -4213,7 +4457,9 @@  discard block
 block discarded – undo
4213 4457
 			}
4214 4458
 		}
4215 4459
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4216
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4460
+		if ($limit) {
4461
+			$query .= " LIMIT 10 OFFSET 0";
4462
+		}
4217 4463
 		
4218 4464
 		$sth = $this->db->prepare($query);
4219 4465
 		$sth->execute($query_values);
@@ -4255,7 +4501,9 @@  discard block
 block discarded – undo
4255 4501
 			}
4256 4502
 		}
4257 4503
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4258
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4504
+		if ($limit) {
4505
+			$query .= " LIMIT 10 OFFSET 0";
4506
+		}
4259 4507
       
4260 4508
 		
4261 4509
 		$sth = $this->db->prepare($query);
@@ -4498,7 +4746,9 @@  discard block
 block discarded – undo
4498 4746
 			date_default_timezone_set($globalTimezone);
4499 4747
 			$datetime = new DateTime($date);
4500 4748
 			$offset = $datetime->format('P');
4501
-		} else $offset = '+00:00';
4749
+		} else {
4750
+			$offset = '+00:00';
4751
+		}
4502 4752
 
4503 4753
 		if ($globalDBdriver == 'mysql') {
4504 4754
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4546,7 +4796,9 @@  discard block
 block discarded – undo
4546 4796
 			date_default_timezone_set($globalTimezone);
4547 4797
 			$datetime = new DateTime($date);
4548 4798
 			$offset = $datetime->format('P');
4549
-		} else $offset = '+00:00';
4799
+		} else {
4800
+			$offset = '+00:00';
4801
+		}
4550 4802
 		
4551 4803
 		if ($globalDBdriver == 'mysql') {
4552 4804
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4664,8 +4916,11 @@  discard block
 block discarded – undo
4664 4916
 		$sth = $this->db->prepare($query);
4665 4917
 		$sth->execute($query_values);
4666 4918
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4667
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4668
-		else return $result[0]['duration'];
4919
+		if (is_numeric($result[0]['duration'])) {
4920
+			return gmdate('H:i:s',$result[0]['duration']);
4921
+		} else {
4922
+			return $result[0]['duration'];
4923
+		}
4669 4924
 	}
4670 4925
 
4671 4926
 	/**
@@ -4752,8 +5007,11 @@  discard block
 block discarded – undo
4752 5007
 		$sth = $this->db->prepare($query);
4753 5008
 		$sth->execute($query_values);
4754 5009
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4755
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4756
-		else return $result[0]['duration'];
5010
+		if (is_int($result[0]['duration'])) {
5011
+			return gmdate('H:i:s',$result[0]['duration']);
5012
+		} else {
5013
+			return $result[0]['duration'];
5014
+		}
4757 5015
 	}
4758 5016
 
4759 5017
 	/**
@@ -4958,7 +5216,9 @@  discard block
 block discarded – undo
4958 5216
 		}
4959 5217
 		$query .= " GROUP BY spotter_output.airline_country
4960 5218
 					ORDER BY airline_country_count DESC";
4961
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5219
+		if ($limit) {
5220
+			$query .= " LIMIT 10 OFFSET 0";
5221
+		}
4962 5222
       
4963 5223
 		$sth = $this->db->prepare($query);
4964 5224
 		$sth->execute($query_values);
@@ -4986,7 +5246,9 @@  discard block
 block discarded – undo
4986 5246
 		global $globalDBdriver;
4987 5247
 		//$filter_query = $this->getFilter($filters,true,true);
4988 5248
 		$Connection= new Connection($this->db);
4989
-		if (!$Connection->tableExists('countries')) return array();
5249
+		if (!$Connection->tableExists('countries')) {
5250
+			return array();
5251
+		}
4990 5252
 		/*
4991 5253
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4992 5254
 					FROM countries c, spotter_output s
@@ -5018,7 +5280,9 @@  discard block
 block discarded – undo
5018 5280
 		}
5019 5281
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
5020 5282
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5021
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5283
+		if ($limit) {
5284
+			$query .= " LIMIT 10 OFFSET 0";
5285
+		}
5022 5286
       
5023 5287
 		
5024 5288
 		$sth = $this->db->prepare($query);
@@ -5095,7 +5359,9 @@  discard block
 block discarded – undo
5095 5359
 		}
5096 5360
 
5097 5361
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5098
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5362
+		if ($limit) {
5363
+			$query .= " LIMIT 10 OFFSET 0";
5364
+		}
5099 5365
  
5100 5366
 		$sth = $this->db->prepare($query);
5101 5367
 		$sth->execute($query_values);
@@ -5169,7 +5435,9 @@  discard block
 block discarded – undo
5169 5435
 		}
5170 5436
 
5171 5437
 		$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";
5172
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5438
+		if ($limit) {
5439
+			$query .= " LIMIT 10 OFFSET 0";
5440
+		}
5173 5441
  
5174 5442
 		$sth = $this->db->prepare($query);
5175 5443
 		$sth->execute($query_values);
@@ -5216,7 +5484,9 @@  discard block
 block discarded – undo
5216 5484
 		}
5217 5485
 
5218 5486
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5219
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5487
+		if ($limit) {
5488
+			$query .= " LIMIT 10 OFFSET 0";
5489
+		}
5220 5490
  
5221 5491
 		$sth = $this->db->prepare($query);
5222 5492
 		$sth->execute();
@@ -5269,7 +5539,9 @@  discard block
 block discarded – undo
5269 5539
 			if($row['registration'] != "")
5270 5540
 			{
5271 5541
 				$image_array = $Image->getSpotterImage($row['registration']);
5272
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5542
+				if (isset($image_array[0]['image_thumbnail'])) {
5543
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5544
+				}
5273 5545
 			}
5274 5546
 			$temp_array['registration_count'] = $row['registration_count'];
5275 5547
 
@@ -5344,7 +5616,9 @@  discard block
 block discarded – undo
5344 5616
 			if($row['registration'] != "")
5345 5617
 			{
5346 5618
 				$image_array = $Image->getSpotterImage($row['registration']);
5347
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5619
+				if (isset($image_array[0]['image_thumbnail'])) {
5620
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5621
+				}
5348 5622
 			}
5349 5623
 			$temp_array['registration_count'] = $row['registration_count'];
5350 5624
 
@@ -5451,7 +5725,9 @@  discard block
 block discarded – undo
5451 5725
 			if($row['registration'] != "")
5452 5726
 			{
5453 5727
 				$image_array = $Image->getSpotterImage($row['registration']);
5454
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5728
+				if (isset($image_array[0]['image_thumbnail'])) {
5729
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5730
+				}
5455 5731
 			}
5456 5732
 			$temp_array['registration_count'] = $row['registration_count'];
5457 5733
 			$aircraft_array[] = $temp_array;
@@ -5576,7 +5852,9 @@  discard block
 block discarded – undo
5576 5852
 			date_default_timezone_set($globalTimezone);
5577 5853
 			$datetime = new DateTime($date);
5578 5854
 			$offset = $datetime->format('P');
5579
-		} else $offset = '+00:00';
5855
+		} else {
5856
+			$offset = '+00:00';
5857
+		}
5580 5858
 
5581 5859
 		if ($globalDBdriver == 'mysql') {
5582 5860
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5623,7 +5901,9 @@  discard block
 block discarded – undo
5623 5901
 			date_default_timezone_set($globalTimezone);
5624 5902
 			$datetime = new DateTime($date);
5625 5903
 			$offset = $datetime->format('P');
5626
-		} else $offset = '+00:00';
5904
+		} else {
5905
+			$offset = '+00:00';
5906
+		}
5627 5907
 
5628 5908
 		if ($globalDBdriver == 'mysql') {
5629 5909
 			$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 
@@ -5652,7 +5932,9 @@  discard block
 block discarded – undo
5652 5932
 			if($row['registration'] != "")
5653 5933
 			{
5654 5934
 				$image_array = $Image->getSpotterImage($row['registration']);
5655
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5935
+				if (isset($image_array[0]['image_thumbnail'])) {
5936
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5937
+				}
5656 5938
 			}
5657 5939
 			$temp_array['registration_count'] = $row['registration_count'];
5658 5940
  
@@ -5677,7 +5959,9 @@  discard block
 block discarded – undo
5677 5959
 			date_default_timezone_set($globalTimezone);
5678 5960
 			$datetime = new DateTime($date);
5679 5961
 			$offset = $datetime->format('P');
5680
-		} else $offset = '+00:00';
5962
+		} else {
5963
+			$offset = '+00:00';
5964
+		}
5681 5965
 
5682 5966
 		if ($globalDBdriver == 'mysql') {
5683 5967
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5871,8 +6155,11 @@  discard block
 block discarded – undo
5871 6155
 			if($row['registration'] != "")
5872 6156
 			{
5873 6157
 				$image_array = $Image->getSpotterImage($row['registration']);
5874
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5875
-				else $temp_array['image_thumbnail'] = '';
6158
+				if (isset($image_array[0]['image_thumbnail'])) {
6159
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6160
+				} else {
6161
+					$temp_array['image_thumbnail'] = '';
6162
+				}
5876 6163
 			}
5877 6164
 			$temp_array['registration_count'] = $row['registration_count'];
5878 6165
 			$aircraft_array[] = $temp_array;
@@ -5945,8 +6232,11 @@  discard block
 block discarded – undo
5945 6232
 			if($row['registration'] != "")
5946 6233
 			{
5947 6234
 				$image_array = $Image->getSpotterImage($row['registration']);
5948
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5949
-				else $temp_array['image_thumbnail'] = '';
6235
+				if (isset($image_array[0]['image_thumbnail'])) {
6236
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6237
+				} else {
6238
+					$temp_array['image_thumbnail'] = '';
6239
+				}
5950 6240
 			}
5951 6241
 			$temp_array['registration_count'] = $row['registration_count'];
5952 6242
 			$aircraft_array[] = $temp_array;
@@ -6019,8 +6309,11 @@  discard block
 block discarded – undo
6019 6309
 			if($row['registration'] != "")
6020 6310
 			{
6021 6311
 				$image_array = $Image->getSpotterImage($row['registration']);
6022
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6023
-				else $temp_array['image_thumbnail'] = '';
6312
+				if (isset($image_array[0]['image_thumbnail'])) {
6313
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6314
+				} else {
6315
+					$temp_array['image_thumbnail'] = '';
6316
+				}
6024 6317
 			}
6025 6318
 			$temp_array['registration_count'] = $row['registration_count'];
6026 6319
 			$aircraft_array[] = $temp_array;
@@ -6229,7 +6522,9 @@  discard block
 block discarded – undo
6229 6522
 			if($row['registration'] != "")
6230 6523
 			{
6231 6524
 				$image_array = $Image->getSpotterImage($row['registration']);
6232
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6525
+				if (isset($image_array[0]['image_thumbnail'])) {
6526
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6527
+				}
6233 6528
 			}
6234 6529
 			$temp_array['registration_count'] = $row['registration_count'];
6235 6530
           
@@ -6346,7 +6641,9 @@  discard block
 block discarded – undo
6346 6641
 			if($row['registration'] != "")
6347 6642
 			{
6348 6643
 				$image_array = $Image->getSpotterImage($row['registration']);
6349
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6644
+				if (isset($image_array[0]['image_thumbnail'])) {
6645
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6646
+				}
6350 6647
 			}
6351 6648
 			$temp_array['registration_count'] = $row['registration_count'];
6352 6649
           
@@ -6512,7 +6809,9 @@  discard block
 block discarded – undo
6512 6809
 			}
6513 6810
 		}
6514 6811
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6515
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6812
+		if ($limit) {
6813
+			$query .= " LIMIT 10 OFFSET 0";
6814
+		}
6516 6815
 		
6517 6816
 		$sth = $this->db->prepare($query);
6518 6817
 		$sth->execute($query_values);
@@ -6531,7 +6830,9 @@  discard block
 block discarded – undo
6531 6830
 			if($row['registration'] != "")
6532 6831
 			{
6533 6832
 				$image_array = $Image->getSpotterImage($row['registration']);
6534
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6833
+				if (isset($image_array[0]['image_thumbnail'])) {
6834
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6835
+				}
6535 6836
 			}
6536 6837
           
6537 6838
 			$aircraft_array[] = $temp_array;
@@ -6572,7 +6873,9 @@  discard block
 block discarded – undo
6572 6873
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6573 6874
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6574 6875
                 $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";
6575
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6876
+		if ($limit) {
6877
+			$query .= " LIMIT 10 OFFSET 0";
6878
+		}
6576 6879
 		
6577 6880
 		$sth = $this->db->prepare($query);
6578 6881
 		$sth->execute();
@@ -6592,7 +6895,9 @@  discard block
 block discarded – undo
6592 6895
 			if($row['registration'] != "")
6593 6896
 			{
6594 6897
 				$image_array = $Image->getSpotterImage($row['registration']);
6595
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6898
+				if (isset($image_array[0]['image_thumbnail'])) {
6899
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6900
+				}
6596 6901
 			}
6597 6902
           
6598 6903
 			$aircraft_array[] = $temp_array;
@@ -6658,7 +6963,9 @@  discard block
 block discarded – undo
6658 6963
 		}
6659 6964
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6660 6965
 				ORDER BY airport_departure_icao_count DESC";
6661
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6966
+		if ($limit) {
6967
+			$query .= " LIMIT 10 OFFSET 0";
6968
+		}
6662 6969
 
6663 6970
 		$sth = $this->db->prepare($query);
6664 6971
 		$sth->execute($query_values);
@@ -6709,7 +7016,9 @@  discard block
 block discarded – undo
6709 7016
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6710 7017
                 $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
6711 7018
 				ORDER BY airport_departure_icao_count DESC";
6712
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7019
+		if ($limit) {
7020
+			$query .= " LIMIT 10 OFFSET 0";
7021
+		}
6713 7022
       
6714 7023
 		$sth = $this->db->prepare($query);
6715 7024
 		$sth->execute();
@@ -6787,7 +7096,9 @@  discard block
 block discarded – undo
6787 7096
 		}
6788 7097
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6789 7098
 				ORDER BY airport_departure_icao_count DESC";
6790
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7099
+		if ($limit) {
7100
+			$query .= " LIMIT 10 OFFSET 0";
7101
+		}
6791 7102
     		//echo $query;
6792 7103
 		$sth = $this->db->prepare($query);
6793 7104
 		$sth->execute($query_values);
@@ -6839,7 +7150,9 @@  discard block
 block discarded – undo
6839 7150
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6840 7151
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6841 7152
 				ORDER BY airport_departure_icao_count DESC";
6842
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7153
+		if ($limit) {
7154
+			$query .= " LIMIT 10 OFFSET 0";
7155
+		}
6843 7156
       
6844 7157
 		$sth = $this->db->prepare($query);
6845 7158
 		$sth->execute();
@@ -7234,7 +7547,9 @@  discard block
 block discarded – undo
7234 7547
 			date_default_timezone_set($globalTimezone);
7235 7548
 			$datetime = new DateTime($date);
7236 7549
 			$offset = $datetime->format('P');
7237
-		} else $offset = '+00:00';
7550
+		} else {
7551
+			$offset = '+00:00';
7552
+		}
7238 7553
 
7239 7554
 		if ($globalDBdriver == 'mysql') {
7240 7555
 			$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 
@@ -7284,7 +7599,9 @@  discard block
 block discarded – undo
7284 7599
 			date_default_timezone_set($globalTimezone);
7285 7600
 			$datetime = new DateTime($date);
7286 7601
 			$offset = $datetime->format('P');
7287
-		} else $offset = '+00:00';
7602
+		} else {
7603
+			$offset = '+00:00';
7604
+		}
7288 7605
 
7289 7606
 		if ($globalDBdriver == 'mysql') {
7290 7607
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7633,7 +7950,9 @@  discard block
 block discarded – undo
7633 7950
 		}
7634 7951
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7635 7952
 					ORDER BY airport_arrival_icao_count DESC";
7636
-		if ($limit) $query .= " LIMIT 10";
7953
+		if ($limit) {
7954
+			$query .= " LIMIT 10";
7955
+		}
7637 7956
       
7638 7957
 		
7639 7958
 		$sth = $this->db->prepare($query);
@@ -7653,7 +7972,9 @@  discard block
 block discarded – undo
7653 7972
 			if ($icaoaskey) {
7654 7973
 				$icao = $row['arrival_airport_icao'];
7655 7974
 				$airport_array[$icao] = $temp_array;
7656
-			} else $airport_array[] = $temp_array;
7975
+			} else {
7976
+				$airport_array[] = $temp_array;
7977
+			}
7657 7978
 		}
7658 7979
 
7659 7980
 		return $airport_array;
@@ -7690,7 +8011,9 @@  discard block
 block discarded – undo
7690 8011
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7691 8012
                 $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
7692 8013
 					ORDER BY airport_arrival_icao_count DESC";
7693
-		if ($limit) $query .= " LIMIT 10";
8014
+		if ($limit) {
8015
+			$query .= " LIMIT 10";
8016
+		}
7694 8017
       
7695 8018
 		
7696 8019
 		$sth = $this->db->prepare($query);
@@ -7711,7 +8034,9 @@  discard block
 block discarded – undo
7711 8034
 			if ($icaoaskey) {
7712 8035
 				$icao = $row['arrival_airport_icao'];
7713 8036
 				$airport_array[$icao] = $temp_array;
7714
-			} else $airport_array[] = $temp_array;
8037
+			} else {
8038
+				$airport_array[] = $temp_array;
8039
+			}
7715 8040
 		}
7716 8041
 
7717 8042
 		return $airport_array;
@@ -7774,7 +8099,9 @@  discard block
 block discarded – undo
7774 8099
 		}
7775 8100
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7776 8101
 					ORDER BY airport_arrival_icao_count DESC";
7777
-		if ($limit) $query .= " LIMIT 10";
8102
+		if ($limit) {
8103
+			$query .= " LIMIT 10";
8104
+		}
7778 8105
       
7779 8106
 		
7780 8107
 		$sth = $this->db->prepare($query);
@@ -7793,7 +8120,9 @@  discard block
 block discarded – undo
7793 8120
 			if ($icaoaskey) {
7794 8121
 				$icao = $row['arrival_airport_icao'];
7795 8122
 				$airport_array[$icao] = $temp_array;
7796
-			} else $airport_array[] = $temp_array;
8123
+			} else {
8124
+				$airport_array[] = $temp_array;
8125
+			}
7797 8126
 		}
7798 8127
 
7799 8128
 		return $airport_array;
@@ -7830,7 +8159,9 @@  discard block
 block discarded – undo
7830 8159
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7831 8160
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7832 8161
 					ORDER BY airport_arrival_icao_count DESC";
7833
-		if ($limit) $query .= " LIMIT 10";
8162
+		if ($limit) {
8163
+			$query .= " LIMIT 10";
8164
+		}
7834 8165
       
7835 8166
 		
7836 8167
 		$sth = $this->db->prepare($query);
@@ -7851,7 +8182,9 @@  discard block
 block discarded – undo
7851 8182
 			if ($icaoaskey) {
7852 8183
 				$icao = $row['arrival_airport_icao'];
7853 8184
 				$airport_array[$icao] = $temp_array;
7854
-			} else $airport_array[] = $temp_array;
8185
+			} else {
8186
+				$airport_array[] = $temp_array;
8187
+			}
7855 8188
 		}
7856 8189
 
7857 8190
 		return $airport_array;
@@ -8232,7 +8565,9 @@  discard block
 block discarded – undo
8232 8565
 			date_default_timezone_set($globalTimezone);
8233 8566
 			$datetime = new DateTime($date);
8234 8567
 			$offset = $datetime->format('P');
8235
-		} else $offset = '+00:00';
8568
+		} else {
8569
+			$offset = '+00:00';
8570
+		}
8236 8571
 
8237 8572
 		if ($globalDBdriver == 'mysql') {
8238 8573
 			$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 
@@ -8282,7 +8617,9 @@  discard block
 block discarded – undo
8282 8617
 			date_default_timezone_set($globalTimezone);
8283 8618
 			$datetime = new DateTime($date);
8284 8619
 			$offset = $datetime->format('P');
8285
-		} else $offset = '+00:00';
8620
+		} else {
8621
+			$offset = '+00:00';
8622
+		}
8286 8623
 
8287 8624
 		if ($globalDBdriver == 'mysql') {
8288 8625
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8673,7 +9010,9 @@  discard block
 block discarded – undo
8673 9010
 		}
8674 9011
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8675 9012
 					ORDER BY airport_arrival_country_count DESC";
8676
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9013
+		if ($limit) {
9014
+			$query .= " LIMIT 10 OFFSET 0";
9015
+		}
8677 9016
       
8678 9017
 		
8679 9018
 		$sth = $this->db->prepare($query);
@@ -8960,7 +9299,9 @@  discard block
 block discarded – undo
8960 9299
 			date_default_timezone_set($globalTimezone);
8961 9300
 			$datetime = new DateTime($date);
8962 9301
 			$offset = $datetime->format('P');
8963
-		} else $offset = '+00:00';
9302
+		} else {
9303
+			$offset = '+00:00';
9304
+		}
8964 9305
 		
8965 9306
 		if ($globalDBdriver == 'mysql') {
8966 9307
 			$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
@@ -9216,12 +9557,18 @@  discard block
 block discarded – undo
9216 9557
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9217 9558
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9218 9559
 		 if ($olderthanmonths > 0) {
9219
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9220
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9560
+			if ($globalDBdriver == 'mysql') {
9561
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9562
+			} else {
9563
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9564
+			}
9221 9565
 		}
9222 9566
 		if ($sincedate != '') {
9223
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9224
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9567
+			if ($globalDBdriver == 'mysql') {
9568
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9569
+			} else {
9570
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9571
+			}
9225 9572
 		}
9226 9573
 		$query_values = array();
9227 9574
 		if ($year != '') {
@@ -9252,7 +9599,9 @@  discard block
 block discarded – undo
9252 9599
 			}
9253 9600
 		}
9254 9601
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9255
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9602
+		if ($limit) {
9603
+			$query .= " LIMIT 10 OFFSET 0";
9604
+		}
9256 9605
       		
9257 9606
 		$sth = $this->db->prepare($query);
9258 9607
 		$sth->execute($query_values);
@@ -9286,15 +9635,23 @@  discard block
 block discarded – undo
9286 9635
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9287 9636
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9288 9637
 		 if ($olderthanmonths > 0) {
9289
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9290
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9638
+			if ($globalDBdriver == 'mysql') {
9639
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9640
+			} else {
9641
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9642
+			}
9291 9643
 		}
9292 9644
 		if ($sincedate != '') {
9293
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9294
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9645
+			if ($globalDBdriver == 'mysql') {
9646
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9647
+			} else {
9648
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9649
+			}
9295 9650
 		}
9296 9651
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9297
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9652
+		if ($limit) {
9653
+			$query .= " LIMIT 10 OFFSET 0";
9654
+		}
9298 9655
       		
9299 9656
 		$sth = $this->db->prepare($query);
9300 9657
 		$sth->execute();
@@ -9331,7 +9688,9 @@  discard block
 block discarded – undo
9331 9688
 			date_default_timezone_set($globalTimezone);
9332 9689
 			$datetime = new DateTime();
9333 9690
 			$offset = $datetime->format('P');
9334
-		} else $offset = '+00:00';
9691
+		} else {
9692
+			$offset = '+00:00';
9693
+		}
9335 9694
 
9336 9695
 		if ($globalDBdriver == 'mysql') {
9337 9696
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9380,7 +9739,9 @@  discard block
 block discarded – undo
9380 9739
 			date_default_timezone_set($globalTimezone);
9381 9740
 			$datetime = new DateTime();
9382 9741
 			$offset = $datetime->format('P');
9383
-		} else $offset = '+00:00';
9742
+		} else {
9743
+			$offset = '+00:00';
9744
+		}
9384 9745
 		$filter_query = $this->getFilter($filters,true,true);
9385 9746
 		if ($globalDBdriver == 'mysql') {
9386 9747
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9429,7 +9790,9 @@  discard block
 block discarded – undo
9429 9790
 			date_default_timezone_set($globalTimezone);
9430 9791
 			$datetime = new DateTime();
9431 9792
 			$offset = $datetime->format('P');
9432
-		} else $offset = '+00:00';
9793
+		} else {
9794
+			$offset = '+00:00';
9795
+		}
9433 9796
 		$filter_query = $this->getFilter($filters,true,true);
9434 9797
 		if ($globalDBdriver == 'mysql') {
9435 9798
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9475,7 +9838,9 @@  discard block
 block discarded – undo
9475 9838
 			date_default_timezone_set($globalTimezone);
9476 9839
 			$datetime = new DateTime();
9477 9840
 			$offset = $datetime->format('P');
9478
-		} else $offset = '+00:00';
9841
+		} else {
9842
+			$offset = '+00:00';
9843
+		}
9479 9844
 		$filter_query = $this->getFilter($filters,true,true);
9480 9845
 		if ($globalDBdriver == 'mysql') {
9481 9846
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9523,7 +9888,9 @@  discard block
 block discarded – undo
9523 9888
 			date_default_timezone_set($globalTimezone);
9524 9889
 			$datetime = new DateTime();
9525 9890
 			$offset = $datetime->format('P');
9526
-		} else $offset = '+00:00';
9891
+		} else {
9892
+			$offset = '+00:00';
9893
+		}
9527 9894
 		
9528 9895
 		if ($globalDBdriver == 'mysql') {
9529 9896
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9571,7 +9938,9 @@  discard block
 block discarded – undo
9571 9938
 			date_default_timezone_set($globalTimezone);
9572 9939
 			$datetime = new DateTime();
9573 9940
 			$offset = $datetime->format('P');
9574
-		} else $offset = '+00:00';
9941
+		} else {
9942
+			$offset = '+00:00';
9943
+		}
9575 9944
 
9576 9945
 		if ($globalDBdriver == 'mysql') {
9577 9946
 			$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
@@ -9618,7 +9987,9 @@  discard block
 block discarded – undo
9618 9987
 			date_default_timezone_set($globalTimezone);
9619 9988
 			$datetime = new DateTime();
9620 9989
 			$offset = $datetime->format('P');
9621
-		} else $offset = '+00:00';
9990
+		} else {
9991
+			$offset = '+00:00';
9992
+		}
9622 9993
 
9623 9994
 		if ($globalDBdriver == 'mysql') {
9624 9995
 			$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
@@ -9666,7 +10037,9 @@  discard block
 block discarded – undo
9666 10037
 			date_default_timezone_set($globalTimezone);
9667 10038
 			$datetime = new DateTime();
9668 10039
 			$offset = $datetime->format('P');
9669
-		} else $offset = '+00:00';
10040
+		} else {
10041
+			$offset = '+00:00';
10042
+		}
9670 10043
 		$filter_query = $this->getFilter($filters,true,true);
9671 10044
 		if ($globalDBdriver == 'mysql') {
9672 10045
 			$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
@@ -9711,7 +10084,9 @@  discard block
 block discarded – undo
9711 10084
 			date_default_timezone_set($globalTimezone);
9712 10085
 			$datetime = new DateTime();
9713 10086
 			$offset = $datetime->format('P');
9714
-		} else $offset = '+00:00';
10087
+		} else {
10088
+			$offset = '+00:00';
10089
+		}
9715 10090
 		$filter_query = $this->getFilter($filters,true,true);
9716 10091
 
9717 10092
 		if ($globalDBdriver == 'mysql') {
@@ -9758,7 +10133,9 @@  discard block
 block discarded – undo
9758 10133
 			date_default_timezone_set($globalTimezone);
9759 10134
 			$datetime = new DateTime();
9760 10135
 			$offset = $datetime->format('P');
9761
-		} else $offset = '+00:00';
10136
+		} else {
10137
+			$offset = '+00:00';
10138
+		}
9762 10139
 
9763 10140
 		if ($globalDBdriver == 'mysql') {
9764 10141
 			$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
@@ -9804,7 +10181,9 @@  discard block
 block discarded – undo
9804 10181
 			date_default_timezone_set($globalTimezone);
9805 10182
 			$datetime = new DateTime();
9806 10183
 			$offset = $datetime->format('P');
9807
-		} else $offset = '+00:00';
10184
+		} else {
10185
+			$offset = '+00:00';
10186
+		}
9808 10187
 		$filter_query = $this->getFilter($filters,true,true);
9809 10188
 
9810 10189
 		if ($globalDBdriver == 'mysql') {
@@ -9851,7 +10230,9 @@  discard block
 block discarded – undo
9851 10230
 			date_default_timezone_set($globalTimezone);
9852 10231
 			$datetime = new DateTime();
9853 10232
 			$offset = $datetime->format('P');
9854
-		} else $offset = '+00:00';
10233
+		} else {
10234
+			$offset = '+00:00';
10235
+		}
9855 10236
 
9856 10237
 		if ($globalDBdriver == 'mysql') {
9857 10238
 			$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
@@ -9898,7 +10279,9 @@  discard block
 block discarded – undo
9898 10279
 			date_default_timezone_set($globalTimezone);
9899 10280
 			$datetime = new DateTime();
9900 10281
 			$offset = $datetime->format('P');
9901
-		} else $offset = '+00:00';
10282
+		} else {
10283
+			$offset = '+00:00';
10284
+		}
9902 10285
 
9903 10286
 		if ($globalDBdriver == 'mysql') {
9904 10287
 			$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
@@ -9943,7 +10326,9 @@  discard block
 block discarded – undo
9943 10326
 			date_default_timezone_set($globalTimezone);
9944 10327
 			$datetime = new DateTime();
9945 10328
 			$offset = $datetime->format('P');
9946
-		} else $offset = '+00:00';
10329
+		} else {
10330
+			$offset = '+00:00';
10331
+		}
9947 10332
 		$filter_query = $this->getFilter($filters,true,true);
9948 10333
 
9949 10334
 		if ($globalDBdriver == 'mysql') {
@@ -9991,7 +10376,9 @@  discard block
 block discarded – undo
9991 10376
 			date_default_timezone_set($globalTimezone);
9992 10377
 			$datetime = new DateTime();
9993 10378
 			$offset = $datetime->format('P');
9994
-		} else $offset = '+00:00';
10379
+		} else {
10380
+			$offset = '+00:00';
10381
+		}
9995 10382
 
9996 10383
 		if ($globalDBdriver == 'mysql') {
9997 10384
 			$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
@@ -10037,7 +10424,9 @@  discard block
 block discarded – undo
10037 10424
 			date_default_timezone_set($globalTimezone);
10038 10425
 			$datetime = new DateTime();
10039 10426
 			$offset = $datetime->format('P');
10040
-		} else $offset = '+00:00';
10427
+		} else {
10428
+			$offset = '+00:00';
10429
+		}
10041 10430
 		$filter_query = $this->getFilter($filters,true,true);
10042 10431
 
10043 10432
 		if ($globalDBdriver == 'mysql') {
@@ -10085,7 +10474,9 @@  discard block
 block discarded – undo
10085 10474
 			date_default_timezone_set($globalTimezone);
10086 10475
 			$datetime = new DateTime();
10087 10476
 			$offset = $datetime->format('P');
10088
-		} else $offset = '+00:00';
10477
+		} else {
10478
+			$offset = '+00:00';
10479
+		}
10089 10480
 
10090 10481
 		if ($globalDBdriver == 'mysql') {
10091 10482
 			$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
@@ -10132,7 +10523,9 @@  discard block
 block discarded – undo
10132 10523
 			date_default_timezone_set($globalTimezone);
10133 10524
 			$datetime = new DateTime();
10134 10525
 			$offset = $datetime->format('P');
10135
-		} else $offset = '+00:00';
10526
+		} else {
10527
+			$offset = '+00:00';
10528
+		}
10136 10529
 		$filter_query = $this->getFilter($filters,true,true);
10137 10530
 		if ($globalDBdriver == 'mysql') {
10138 10531
 			$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
@@ -10181,7 +10574,9 @@  discard block
 block discarded – undo
10181 10574
 			date_default_timezone_set($globalTimezone);
10182 10575
 			$datetime = new DateTime();
10183 10576
 			$offset = $datetime->format('P');
10184
-		} else $offset = '+00:00';
10577
+		} else {
10578
+			$offset = '+00:00';
10579
+		}
10185 10580
 
10186 10581
 		$orderby_sql = '';
10187 10582
 		if ($orderby == "hour")
@@ -10247,7 +10642,9 @@  discard block
 block discarded – undo
10247 10642
 			date_default_timezone_set($globalTimezone);
10248 10643
 			$datetime = new DateTime();
10249 10644
 			$offset = $datetime->format('P');
10250
-		} else $offset = '+00:00';
10645
+		} else {
10646
+			$offset = '+00:00';
10647
+		}
10251 10648
 
10252 10649
 		$orderby_sql = '';
10253 10650
 		if ($orderby == "hour")
@@ -10314,7 +10711,9 @@  discard block
 block discarded – undo
10314 10711
 			date_default_timezone_set($globalTimezone);
10315 10712
 			$datetime = new DateTime();
10316 10713
 			$offset = $datetime->format('P');
10317
-		} else $offset = '+00:00';
10714
+		} else {
10715
+			$offset = '+00:00';
10716
+		}
10318 10717
 
10319 10718
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10320 10719
 
@@ -10365,7 +10764,9 @@  discard block
 block discarded – undo
10365 10764
 			date_default_timezone_set($globalTimezone);
10366 10765
 			$datetime = new DateTime();
10367 10766
 			$offset = $datetime->format('P');
10368
-		} else $offset = '+00:00';
10767
+		} else {
10768
+			$offset = '+00:00';
10769
+		}
10369 10770
 
10370 10771
 		if ($globalDBdriver == 'mysql') {
10371 10772
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10412,7 +10813,9 @@  discard block
 block discarded – undo
10412 10813
 			date_default_timezone_set($globalTimezone);
10413 10814
 			$datetime = new DateTime();
10414 10815
 			$offset = $datetime->format('P');
10415
-		} else $offset = '+00:00';
10816
+		} else {
10817
+			$offset = '+00:00';
10818
+		}
10416 10819
 
10417 10820
 		if ($globalDBdriver == 'mysql') {
10418 10821
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10459,7 +10862,9 @@  discard block
 block discarded – undo
10459 10862
 			date_default_timezone_set($globalTimezone);
10460 10863
 			$datetime = new DateTime();
10461 10864
 			$offset = $datetime->format('P');
10462
-		} else $offset = '+00:00';
10865
+		} else {
10866
+			$offset = '+00:00';
10867
+		}
10463 10868
 
10464 10869
 		if ($globalDBdriver == 'mysql') {
10465 10870
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10507,7 +10912,9 @@  discard block
 block discarded – undo
10507 10912
 			date_default_timezone_set($globalTimezone);
10508 10913
 			$datetime = new DateTime();
10509 10914
 			$offset = $datetime->format('P');
10510
-		} else $offset = '+00:00';
10915
+		} else {
10916
+			$offset = '+00:00';
10917
+		}
10511 10918
 
10512 10919
 		if ($globalDBdriver == 'mysql') {
10513 10920
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10555,7 +10962,9 @@  discard block
 block discarded – undo
10555 10962
 			date_default_timezone_set($globalTimezone);
10556 10963
 			$datetime = new DateTime($date);
10557 10964
 			$offset = $datetime->format('P');
10558
-		} else $offset = '+00:00';
10965
+		} else {
10966
+			$offset = '+00:00';
10967
+		}
10559 10968
 
10560 10969
 		if ($globalDBdriver == 'mysql') {
10561 10970
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10603,7 +11012,9 @@  discard block
 block discarded – undo
10603 11012
 			date_default_timezone_set($globalTimezone);
10604 11013
 			$datetime = new DateTime();
10605 11014
 			$offset = $datetime->format('P');
10606
-		} else $offset = '+00:00';
11015
+		} else {
11016
+			$offset = '+00:00';
11017
+		}
10607 11018
 
10608 11019
 		if ($globalDBdriver == 'mysql') {
10609 11020
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10650,7 +11061,9 @@  discard block
 block discarded – undo
10650 11061
 			date_default_timezone_set($globalTimezone);
10651 11062
 			$datetime = new DateTime();
10652 11063
 			$offset = $datetime->format('P');
10653
-		} else $offset = '+00:00';
11064
+		} else {
11065
+			$offset = '+00:00';
11066
+		}
10654 11067
 
10655 11068
 		if ($globalDBdriver == 'mysql') {
10656 11069
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10697,7 +11110,9 @@  discard block
 block discarded – undo
10697 11110
 			date_default_timezone_set($globalTimezone);
10698 11111
 			$datetime = new DateTime();
10699 11112
 			$offset = $datetime->format('P');
10700
-		} else $offset = '+00:00';
11113
+		} else {
11114
+			$offset = '+00:00';
11115
+		}
10701 11116
 
10702 11117
 		if ($globalDBdriver == 'mysql') {
10703 11118
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10747,7 +11162,9 @@  discard block
 block discarded – undo
10747 11162
 			date_default_timezone_set($globalTimezone);
10748 11163
 			$datetime = new DateTime();
10749 11164
 			$offset = $datetime->format('P');
10750
-		} else $offset = '+00:00';
11165
+		} else {
11166
+			$offset = '+00:00';
11167
+		}
10751 11168
 
10752 11169
 		if ($globalDBdriver == 'mysql') {
10753 11170
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10794,7 +11211,9 @@  discard block
 block discarded – undo
10794 11211
 			date_default_timezone_set($globalTimezone);
10795 11212
 			$datetime = new DateTime();
10796 11213
 			$offset = $datetime->format('P');
10797
-		} else $offset = '+00:00';
11214
+		} else {
11215
+			$offset = '+00:00';
11216
+		}
10798 11217
 
10799 11218
 		if ($globalDBdriver == 'mysql') {
10800 11219
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11005,8 +11424,11 @@  discard block
 block discarded – undo
11005 11424
 				$query_values = array_merge($query_values,array(':month' => $month));
11006 11425
 			}
11007 11426
 		}
11008
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11009
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11427
+		if (empty($query_values)) {
11428
+			$queryi .= $this->getFilter($filters);
11429
+		} else {
11430
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11431
+		}
11010 11432
 		
11011 11433
 		$sth = $this->db->prepare($queryi);
11012 11434
 		$sth->execute($query_values);
@@ -11084,8 +11506,11 @@  discard block
 block discarded – undo
11084 11506
 				$query_values = array_merge($query_values,array(':month' => $month));
11085 11507
 			}
11086 11508
 		}
11087
-                if ($query == '') $queryi .= $this->getFilter($filters);
11088
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11509
+                if ($query == '') {
11510
+                	$queryi .= $this->getFilter($filters);
11511
+                } else {
11512
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11513
+                }
11089 11514
 
11090 11515
 
11091 11516
 		$sth = $this->db->prepare($queryi);
@@ -11108,7 +11533,9 @@  discard block
 block discarded – undo
11108 11533
 			date_default_timezone_set($globalTimezone);
11109 11534
 			$datetime = new DateTime();
11110 11535
 			$offset = $datetime->format('P');
11111
-		} else $offset = '+00:00';
11536
+		} else {
11537
+			$offset = '+00:00';
11538
+		}
11112 11539
 
11113 11540
 		if ($globalDBdriver == 'mysql') {
11114 11541
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11294,7 +11721,9 @@  discard block
 block discarded – undo
11294 11721
 	*/
11295 11722
 	public function parseDirection($direction = 0)
11296 11723
 	{
11297
-		if ($direction == '') $direction = 0;
11724
+		if ($direction == '') {
11725
+			$direction = 0;
11726
+		}
11298 11727
 		$direction_array = array();
11299 11728
 		$temp_array = array();
11300 11729
 
@@ -11395,7 +11824,9 @@  discard block
 block discarded – undo
11395 11824
 		if (isset($result->AirlineFlightInfoResult))
11396 11825
 		{
11397 11826
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11398
-		} else return '';
11827
+		} else {
11828
+			return '';
11829
+		}
11399 11830
 		
11400 11831
 		$registration = $this->convertAircraftRegistration($registration);
11401 11832
 		
@@ -11424,7 +11855,9 @@  discard block
 block discarded – undo
11424 11855
 		if (count($row) > 0) {
11425 11856
 		    //return $row['Registration'];
11426 11857
 		    return $row['registration'];
11427
-		} else return '';
11858
+		} else {
11859
+			return '';
11860
+		}
11428 11861
 	
11429 11862
 	}
11430 11863
 
@@ -11447,9 +11880,14 @@  discard block
 block discarded – undo
11447 11880
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11448 11881
 		$sth->closeCursor();
11449 11882
 		if (count($row) > 0) {
11450
-		    if ($row['type_flight'] == null) return '';
11451
-		    else return $row['type_flight'];
11452
-		} else return '';
11883
+		    if ($row['type_flight'] == null) {
11884
+		    	return '';
11885
+		    } else {
11886
+		    	return $row['type_flight'];
11887
+		    }
11888
+		} else {
11889
+			return '';
11890
+		}
11453 11891
 	
11454 11892
 	}
11455 11893
 
@@ -11467,7 +11905,9 @@  discard block
 block discarded – undo
11467 11905
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11468 11906
 	
11469 11907
 		$Connection = new Connection($this->db);
11470
-		if (!$Connection->tableExists('countries')) return '';
11908
+		if (!$Connection->tableExists('countries')) {
11909
+			return '';
11910
+		}
11471 11911
 	
11472 11912
 		try {
11473 11913
 			/*
@@ -11487,9 +11927,13 @@  discard block
 block discarded – undo
11487 11927
 			$sth->closeCursor();
11488 11928
 			if (count($row) > 0) {
11489 11929
 				return $row;
11490
-			} else return '';
11930
+			} else {
11931
+				return '';
11932
+			}
11491 11933
 		} catch (PDOException $e) {
11492
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11934
+			if (isset($globalDebug) && $globalDebug) {
11935
+				echo 'Error : '.$e->getMessage()."\n";
11936
+			}
11493 11937
 			return '';
11494 11938
 		}
11495 11939
 	
@@ -11507,7 +11951,9 @@  discard block
 block discarded – undo
11507 11951
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11508 11952
 	
11509 11953
 		$Connection = new Connection($this->db);
11510
-		if (!$Connection->tableExists('countries')) return '';
11954
+		if (!$Connection->tableExists('countries')) {
11955
+			return '';
11956
+		}
11511 11957
 	
11512 11958
 		try {
11513 11959
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11519,9 +11965,13 @@  discard block
 block discarded – undo
11519 11965
 			$sth->closeCursor();
11520 11966
 			if (count($row) > 0) {
11521 11967
 				return $row;
11522
-			} else return '';
11968
+			} else {
11969
+				return '';
11970
+			}
11523 11971
 		} catch (PDOException $e) {
11524
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11972
+			if (isset($globalDebug) && $globalDebug) {
11973
+				echo 'Error : '.$e->getMessage()."\n";
11974
+			}
11525 11975
 			return '';
11526 11976
 		}
11527 11977
 	
@@ -11771,7 +12221,9 @@  discard block
 block discarded – undo
11771 12221
 	{
11772 12222
 		global $globalBitlyAccessToken;
11773 12223
 		
11774
-		if ($globalBitlyAccessToken == '') return $url;
12224
+		if ($globalBitlyAccessToken == '') {
12225
+			return $url;
12226
+		}
11775 12227
         
11776 12228
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11777 12229
 		
@@ -11920,7 +12372,9 @@  discard block
 block discarded – undo
11920 12372
 		
11921 12373
 
11922 12374
 		// routes
11923
-		if ($globalDebug) print "Routes...\n";
12375
+		if ($globalDebug) {
12376
+			print "Routes...\n";
12377
+		}
11924 12378
 		if ($globalDBdriver == 'mysql') {
11925 12379
 			$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)";
11926 12380
 		} else {
@@ -11939,7 +12393,9 @@  discard block
 block discarded – undo
11939 12393
 			}
11940 12394
 		}
11941 12395
 		
11942
-		if ($globalDebug) print "Airlines...\n";
12396
+		if ($globalDebug) {
12397
+			print "Airlines...\n";
12398
+		}
11943 12399
 		//airlines
11944 12400
 		if ($globalDBdriver == 'mysql') {
11945 12401
 			$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)";
@@ -11953,10 +12409,15 @@  discard block
 block discarded – undo
11953 12409
 			if (is_numeric(substr($row['ident'], -1, 1)))
11954 12410
 			{
11955 12411
 				$fromsource = NULL;
11956
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11957
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11958
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11959
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12412
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12413
+					$fromsource = 'vatsim';
12414
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12415
+					$fromsource = 'ivao';
12416
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12417
+					$fromsource = 'vatsim';
12418
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12419
+					$fromsource = 'ivao';
12420
+				}
11960 12421
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11961 12422
 				if (isset($airline_array[0]['name'])) {
11962 12423
 					$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";
@@ -11966,13 +12427,17 @@  discard block
 block discarded – undo
11966 12427
 			}
11967 12428
 		}
11968 12429
 
11969
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12430
+		if ($globalDebug) {
12431
+			print "Remove Duplicate in aircraft_modes...\n";
12432
+		}
11970 12433
 		//duplicate modes
11971 12434
 		$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";
11972 12435
 		$sth = $this->db->prepare($query);
11973 12436
 		$sth->execute();
11974 12437
 		
11975
-		if ($globalDebug) print "Aircraft...\n";
12438
+		if ($globalDebug) {
12439
+			print "Aircraft...\n";
12440
+		}
11976 12441
 		//aircraft
11977 12442
 		if ($globalDBdriver == 'mysql') {
11978 12443
 			$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)";
@@ -12015,26 +12480,38 @@  discard block
 block discarded – undo
12015 12480
 				 if (isset($closestAirports[0])) {
12016 12481
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12017 12482
 						$airport_icao = $closestAirports[0]['icao'];
12018
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12483
+						if ($globalDebug) {
12484
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12485
+						}
12019 12486
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12020 12487
 						foreach ($closestAirports as $airport) {
12021 12488
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12022 12489
 								$airport_icao = $airport['icao'];
12023
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12490
+								if ($globalDebug) {
12491
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12492
+								}
12024 12493
 								break;
12025 12494
 							}
12026 12495
 						}
12027 12496
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12028 12497
 						$airport_icao = $closestAirports[0]['icao'];
12029
-						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";
12498
+						if ($globalDebug) {
12499
+							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";
12500
+						}
12030 12501
 					} else {
12031
-						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";
12502
+						if ($globalDebug) {
12503
+							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";
12504
+						}
12032 12505
 					}
12033 12506
 				} else {
12034
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12507
+					if ($globalDebug) {
12508
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12509
+					}
12035 12510
 				}
12036 12511
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12037
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12512
+					if ($globalDebug) {
12513
+						echo "Updating airport to ".$airport_icao."...\n";
12514
+					}
12038 12515
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12039 12516
 					$sthu = $this->db->prepare($update_query);
12040 12517
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
owner-statistics-aircraft.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17 17
 if ($sort != '') {
18
-	$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18
+	$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
19 19
 } else {
20
-	$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", '',$filter);
20
+	$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", '', $filter);
21 21
 }
22 22
 
23 23
 if (!empty($spotter_array))
24 24
 {
25
-	$title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']);
25
+	$title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']);
26 26
 	require_once('header.php');
27 27
 	print '<div class="info column">';
28 28
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	include('owner-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Aircraft").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
37 37
 
38
-	$aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner,$filter);
38
+	$aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner, $filter);
39 39
 	if (!empty($aircraft_array))
40 40
 	{
41 41
 		print '<div class="table-responsive">';
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		print '</thead>';
48 48
 		print '<tbody>';
49 49
 		$i = 1;
50
-		foreach($aircraft_array as $aircraft_item)
50
+		foreach ($aircraft_array as $aircraft_item)
51 51
 		{
52 52
 			print '<tr>';
53 53
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 if ($sort != '') {
18 22
 	$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
19 23
 } else {
Please login to merge, or discard this patch.
owner-statistics-time.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Time of Day").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33 33
 
34
-	$hour_array = $Spotter->countAllHoursByOwner($owner,$filter);
34
+	$hour_array = $Spotter->countAllHoursByOwner($owner, $filter);
35 35
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
36 36
 	print '<div id="chartHour" class="chart" width="100%"></div>
37 37
       	<script> 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             var data = google.visualization.arrayToDataTable([
42 42
             	["'._("Hour").'", "'._("# of Flights").'"], ';
43 43
 	$hour_data = '';
44
-	foreach($hour_array as $hour_item)
44
+	foreach ($hour_array as $hour_item)
45 45
 	{
46 46
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
47 47
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-time.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['pilot_name']);
21
+	$title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['pilot_name']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Time of Day").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
33 33
 
34
-	$hour_array = $Spotter->countAllHoursByPilot($pilot,$filter);
34
+	$hour_array = $Spotter->countAllHoursByPilot($pilot, $filter);
35 35
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
36 36
 	print '<div id="chartHour" class="chart" width="100%"></div>
37 37
       	<script> 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             var data = google.visualization.arrayToDataTable([
42 42
             	["'._("Hour").'", "'._("# of Flights").'"], ';
43 43
 	$hour_data = '';
44
-	foreach($hour_array as $hour_item)
44
+	foreach ($hour_array as $hour_item)
45 45
 	{
46 46
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
47 47
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-airline.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['pilot_name']);
21
+	$title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['pilot_name']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('pilot-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Airlines").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
33 33
 
34
-	$airline_array = $Spotter->countAllAirlinesByPilot($pilot,$filter);
34
+	$airline_array = $Spotter->countAllAirlinesByPilot($pilot, $filter);
35 35
 	if (!empty($airline_array))
36 36
 	{
37 37
 		print '<div class="table-responsive">';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		print '</thead>';
47 47
 		print '<tbody>';
48 48
 		$i = 1;
49
-		foreach($airline_array as $airline_item)
49
+		foreach ($airline_array as $airline_item)
50 50
 		{
51 51
 			print '<tr>';
52 52
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-sub-menu.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 		<li class="dropdown">
8
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
8
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
9 9
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 10
 		    </a>
11 11
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 26
 		    </ul>
27 27
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
28
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30 30
 	</ul>
31 31
 </div>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +70 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,15 +3,39 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
7
+	echo '/'.$year;
8
+}
9
+?><?php if (isset($month) && $month != '') {
10
+	echo '/'.$month;
11
+}
12
+?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 13
 		<li class="dropdown">
8 14
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9 15
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 16
 		    </a>
11 17
 		    <ul class="dropdown-menu" role="menu">
12
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li>
13
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li>
14
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li>
18
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
19
+	echo '/'.$year;
20
+}
21
+?><?php if (isset($month) && $month != '') {
22
+	echo '/'.$month;
23
+}
24
+?>"><?php echo _("Aircraft Type"); ?></a></li>
25
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
26
+	echo '/'.$year;
27
+}
28
+?><?php if (isset($month) && $month != '') {
29
+	echo '/'.$month;
30
+}
31
+?>"><?php echo _("Registration"); ?></a></li>
32
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
33
+	echo '/'.$year;
34
+}
35
+?><?php if (isset($month) && $month != '') {
36
+	echo '/'.$month;
37
+}
38
+?>"><?php echo _("Manufacturer"); ?></a></li>
15 39
 		    </ul>
16 40
 		</li>
17 41
 		<li class="dropdown">
@@ -19,13 +43,49 @@  discard block
 block discarded – undo
19 43
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 44
 		    </a>
21 45
 		    <ul class="dropdown-menu" role="menu">
22
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li>
23
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
24
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li>
25
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
46
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
47
+	echo '/'.$year;
48
+}
49
+?><?php if (isset($month) && $month != '') {
50
+	echo '/'.$month;
51
+}
52
+?>"><?php echo _("Departure Airport"); ?></a></li>
53
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
54
+	echo '/'.$year;
55
+}
56
+?><?php if (isset($month) && $month != '') {
57
+	echo '/'.$month;
58
+}
59
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
60
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
61
+	echo '/'.$year;
62
+}
63
+?><?php if (isset($month) && $month != '') {
64
+	echo '/'.$month;
65
+}
66
+?>"><?php echo _("Arrival Airport"); ?></a></li>
67
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
68
+	echo '/'.$year;
69
+}
70
+?><?php if (isset($month) && $month != '') {
71
+	echo '/'.$month;
72
+}
73
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 74
 		    </ul>
27 75
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
76
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
77
+	echo '/'.$year;
78
+}
79
+?><?php if (isset($month) && $month != '') {
80
+	echo '/'.$month;
81
+}
82
+?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
83
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
84
+	echo '/'.$year;
85
+}
86
+?><?php if (isset($month) && $month != '') {
87
+	echo '/'.$month;
88
+}
89
+?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30 90
 	</ul>
31 91
 </div>
32 92
\ No newline at end of file
Please login to merge, or discard this patch.
owner-statistics-manufacturer.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33 33
 
34
-	$manufacturers_array = $Spotter->countAllAircraftManufacturerByOwner($owner,$filter);
34
+	$manufacturers_array = $Spotter->countAllAircraftManufacturerByOwner($owner, $filter);
35 35
 	if (!empty($manufacturers_array))
36 36
 	{
37 37
 		print '<div class="table-responsive">';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		print '</thead>';
45 45
 		print '<tbody>';
46 46
 		$i = 1;
47
-		foreach($manufacturers_array as $manufacturer_item)
47
+		foreach ($manufacturers_array as $manufacturer_item)
48 48
 		{
49 49
 			print '<tr>';
50 50
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-departure-airport-country.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Departure Airports by Owner of %s"),$spotter_array[0]['pilot_name']);
21
+	$title = sprintf(_("Most Common Departure Airports by Owner of %s"), $spotter_array[0]['pilot_name']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	include('owner-sub-menu.php');
29 29
 	print '<div class="column">';
30 30
 	print '<h2>'._("Most Common Departure Airports by Country").'</h2>';
31
-	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
31
+	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
32 32
 
33
-	$airport_country_array = $Spotter->countAllDepartureAirportCountriesByPilot($pilot,$filter);
33
+	$airport_country_array = $Spotter->countAllDepartureAirportCountriesByPilot($pilot, $filter);
34 34
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
35 35
 	print '<div id="chartCountry" class="chart" width="100%"></div>
36 36
       	<script> 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             var data = google.visualization.arrayToDataTable([
41 41
             	["'._("Country").'", "'._("# of times").'"], ';
42 42
 	$country_data = '';
43
-	foreach($airport_country_array as $airport_item)
43
+	foreach ($airport_country_array as $airport_item)
44 44
 	{
45 45
 		$country_data .= '[ "'.$airport_item['departure_airport_country'].'",'.$airport_item['airport_departure_country_count'].'],';
46 46
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		print '</thead>';
75 75
 		print '<tbody>';
76 76
 		$i = 1;
77
-		foreach($airport_country_array as $airport_item)
77
+		foreach ($airport_country_array as $airport_item)
78 78
 		{
79 79
 			print '<tr>';
80 80
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
owner-statistics-route.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Routes of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Routes").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33 33
 
34
-	$route_array = $Spotter->countAllRoutesByOwner($owner,$filter);
34
+	$route_array = $Spotter->countAllRoutesByOwner($owner, $filter);
35 35
 	if (!empty($route_array))
36 36
 	{
37 37
 		print '<div class="table-responsive">';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		print '</thead>';
47 47
 		print '<tbody>';
48 48
 		$i = 1;
49
-		foreach($route_array as $route_item)
49
+		foreach ($route_array as $route_item)
50 50
 		{
51 51
 			print '<tr>';
52 52
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.