Completed
Push — master ( 30fb54...74105a )
by Yannick
06:10
created
statistics-airport-departure.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1327 added lines, -1327 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;
64 64
 		$filters = array();
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Executes the SQL statements to get the spotter information
133
-	*
134
-	* @param String $query the SQL query
135
-	* @param Array $params parameter of the query
136
-	* @param String $limitQuery the limit query
137
-	* @return Array the spotter information
138
-	*
139
-	*/
132
+	 * Executes the SQL statements to get the spotter information
133
+	 *
134
+	 * @param String $query the SQL query
135
+	 * @param Array $params parameter of the query
136
+	 * @param String $limitQuery the limit query
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 301
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302 302
 					} else $temp_array['aircraft_shadow'] = 'default.png';
303
-                                } else {
304
-                            		$temp_array['aircraft_shadow'] = 'default.png';
303
+								} else {
304
+									$temp_array['aircraft_shadow'] = 'default.png';
305 305
 					$temp_array['aircraft_name'] = 'N/A';
306 306
 					$temp_array['aircraft_manufacturer'] = 'N/A';
307
-                            	}
307
+								}
308 308
 			}
309 309
 			$fromsource = NULL;
310 310
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Gets all the spotter information
504
-	*
505
-	* @return Array the spotter information
506
-	*
507
-	*/
503
+	 * Gets all the spotter information
504
+	 *
505
+	 * @return Array the spotter information
506
+	 *
507
+	 */
508 508
 	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())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 	
852 852
 	
853 853
 	/**
854
-	* Gets all the spotter information based on the latest data entry
855
-	*
856
-	* @return Array the spotter information
857
-	*
858
-	*/
854
+	 * Gets all the spotter information based on the latest data entry
855
+	 *
856
+	 * @return Array the spotter information
857
+	 *
858
+	 */
859 859
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
860 860
 	{
861 861
 		global $global_query;
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 	}
895 895
     
896 896
     
897
-    /**
898
-	* Gets all the spotter information based on a user's latitude and longitude
899
-	*
900
-	* @return Array the spotter information
901
-	*
902
-	*/
897
+	/**
898
+	 * Gets all the spotter information based on a user's latitude and longitude
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903 903
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
904 904
 	{
905 905
 		date_default_timezone_set('UTC');
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 				return false;
928 928
 			}
929 929
 		}
930
-    		$additional_query = '';
930
+			$additional_query = '';
931 931
 		if ($interval != "")
932 932
 		{
933 933
 			if (!is_string($interval))
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
 	}
968 968
     
969 969
     
970
-    /**
971
-	* Gets all the spotter information sorted by the newest aircraft type
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
970
+	/**
971
+	 * Gets all the spotter information sorted by the newest aircraft type
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
     
1014 1014
     
1015 1015
 	/**
1016
-	* Gets all the spotter information sorted by the newest aircraft registration
1017
-	*
1018
-	* @return Array the spotter information
1019
-	*
1020
-	*/
1016
+	 * Gets all the spotter information sorted by the newest aircraft registration
1017
+	 *
1018
+	 * @return Array the spotter information
1019
+	 *
1020
+	 */
1021 1021
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1022 1022
 	{
1023 1023
 		global $global_query;
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 	/**
1060
-	* Gets all the spotter information sorted by the newest airline
1061
-	*
1062
-	* @return Array the spotter information
1063
-	*
1064
-	*/
1060
+	 * Gets all the spotter information sorted by the newest airline
1061
+	 *
1062
+	 * @return Array the spotter information
1063
+	 *
1064
+	 */
1065 1065
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	}
1101 1101
     
1102 1102
     
1103
-    /**
1104
-	* Gets all the spotter information sorted by the newest departure airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1103
+	/**
1104
+	 * Gets all the spotter information sorted by the newest departure airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 
1149 1149
 	/**
1150
-	* Gets all the spotter information sorted by the newest arrival airport
1151
-	*
1152
-	* @return Array the spotter information
1153
-	*
1154
-	*/
1150
+	 * Gets all the spotter information sorted by the newest arrival airport
1151
+	 *
1152
+	 * @return Array the spotter information
1153
+	 *
1154
+	 */
1155 1155
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1156 1156
 	{
1157 1157
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information based on the spotter id
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information based on the spotter id
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getSpotterDataByID($id = '')
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1216,11 +1216,11 @@  discard block
 block discarded – undo
1216 1216
 	
1217 1217
 	
1218 1218
 	/**
1219
-	* Gets all the spotter information based on the callsign
1220
-	*
1221
-	* @return Array the spotter information
1222
-	*
1223
-	*/
1219
+	 * Gets all the spotter information based on the callsign
1220
+	 *
1221
+	 * @return Array the spotter information
1222
+	 *
1223
+	 */
1224 1224
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1225 1225
 	{
1226 1226
 		global $global_query;
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 	}
1272 1272
 	
1273 1273
 	/**
1274
-	* Gets all the spotter information based on the owner
1275
-	*
1276
-	* @return Array the spotter information
1277
-	*
1278
-	*/
1274
+	 * Gets all the spotter information based on the owner
1275
+	 *
1276
+	 * @return Array the spotter information
1277
+	 *
1278
+	 */
1279 1279
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
1280 1280
 	{
1281 1281
 		global $global_query;
@@ -1326,11 +1326,11 @@  discard block
 block discarded – undo
1326 1326
 	}
1327 1327
 	
1328 1328
 	/**
1329
-	* Gets all the spotter information based on the pilot
1330
-	*
1331
-	* @return Array the spotter information
1332
-	*
1333
-	*/
1329
+	 * Gets all the spotter information based on the pilot
1330
+	 *
1331
+	 * @return Array the spotter information
1332
+	 *
1333
+	 */
1334 1334
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1335 1335
 	{
1336 1336
 		global $global_query;
@@ -1383,11 +1383,11 @@  discard block
 block discarded – undo
1383 1383
 	
1384 1384
 	
1385 1385
 	/**
1386
-	* Gets all the spotter information based on the aircraft type
1387
-	*
1388
-	* @return Array the spotter information
1389
-	*
1390
-	*/
1386
+	 * Gets all the spotter information based on the aircraft type
1387
+	 *
1388
+	 * @return Array the spotter information
1389
+	 *
1390
+	 */
1391 1391
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1392 1392
 	{
1393 1393
 		global $global_query;
@@ -1441,11 +1441,11 @@  discard block
 block discarded – undo
1441 1441
 	
1442 1442
 	
1443 1443
 	/**
1444
-	* Gets all the spotter information based on the aircraft registration
1445
-	*
1446
-	* @return Array the spotter information
1447
-	*
1448
-	*/
1444
+	 * Gets all the spotter information based on the aircraft registration
1445
+	 *
1446
+	 * @return Array the spotter information
1447
+	 *
1448
+	 */
1449 1449
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1450 1450
 	{
1451 1451
 		global $global_query;
@@ -1502,11 +1502,11 @@  discard block
 block discarded – undo
1502 1502
 	
1503 1503
 	
1504 1504
 	/**
1505
-	* Gets all the spotter information based on the airline
1506
-	*
1507
-	* @return Array the spotter information
1508
-	*
1509
-	*/
1505
+	 * Gets all the spotter information based on the airline
1506
+	 *
1507
+	 * @return Array the spotter information
1508
+	 *
1509
+	 */
1510 1510
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1511 1511
 	{
1512 1512
 		global $global_query;
@@ -1559,11 +1559,11 @@  discard block
 block discarded – undo
1559 1559
 	
1560 1560
 	
1561 1561
 	/**
1562
-	* Gets all the spotter information based on the airport
1563
-	*
1564
-	* @return Array the spotter information
1565
-	*
1566
-	*/
1562
+	 * Gets all the spotter information based on the airport
1563
+	 *
1564
+	 * @return Array the spotter information
1565
+	 *
1566
+	 */
1567 1567
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1568 1568
 	{
1569 1569
 		global $global_query;
@@ -1617,11 +1617,11 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 
1619 1619
 	/**
1620
-	* Gets all the spotter information based on the date
1621
-	*
1622
-	* @return Array the spotter information
1623
-	*
1624
-	*/
1620
+	 * Gets all the spotter information based on the date
1621
+	 *
1622
+	 * @return Array the spotter information
1623
+	 *
1624
+	 */
1625 1625
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1626 1626
 	{
1627 1627
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1685,11 +1685,11 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
 
1687 1687
 	/**
1688
-	* Gets all the spotter information based on the country name
1689
-	*
1690
-	* @return Array the spotter information
1691
-	*
1692
-	*/
1688
+	 * Gets all the spotter information based on the country name
1689
+	 *
1690
+	 * @return Array the spotter information
1691
+	 *
1692
+	 */
1693 1693
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1694 1694
 	{
1695 1695
 		global $global_query;
@@ -1743,11 +1743,11 @@  discard block
 block discarded – undo
1743 1743
 	
1744 1744
 	
1745 1745
 	/**
1746
-	* Gets all the spotter information based on the manufacturer name
1747
-	*
1748
-	* @return Array the spotter information
1749
-	*
1750
-	*/
1746
+	 * Gets all the spotter information based on the manufacturer name
1747
+	 *
1748
+	 * @return Array the spotter information
1749
+	 *
1750
+	 */
1751 1751
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1752 1752
 	{
1753 1753
 		global $global_query;
@@ -1803,13 +1803,13 @@  discard block
 block discarded – undo
1803 1803
   
1804 1804
   
1805 1805
 	/**
1806
-	* Gets a list of all aircraft that take a route
1807
-	*
1808
-	* @param String $departure_airport_icao ICAO code of departure airport
1809
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1810
-	* @return Array the spotter information
1811
-	*
1812
-	*/
1806
+	 * Gets a list of all aircraft that take a route
1807
+	 *
1808
+	 * @param String $departure_airport_icao ICAO code of departure airport
1809
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1810
+	 * @return Array the spotter information
1811
+	 *
1812
+	 */
1813 1813
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1814 1814
 	{
1815 1815
 		global $global_query;
@@ -1878,11 +1878,11 @@  discard block
 block discarded – undo
1878 1878
 	
1879 1879
 	
1880 1880
 	/**
1881
-	* Gets all the spotter information based on the special column in the table
1882
-	*
1883
-	* @return Array the spotter information
1884
-	*
1885
-	*/
1881
+	 * Gets all the spotter information based on the special column in the table
1882
+	 *
1883
+	 * @return Array the spotter information
1884
+	 *
1885
+	 */
1886 1886
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1887 1887
 	{
1888 1888
 		global $global_query;
@@ -1921,11 +1921,11 @@  discard block
 block discarded – undo
1921 1921
 	}
1922 1922
 
1923 1923
 	/**
1924
-	* Gets all the highlight based on a aircraft registration
1925
-	*
1926
-	* @return String the highlight text
1927
-	*
1928
-	*/
1924
+	 * Gets all the highlight based on a aircraft registration
1925
+	 *
1926
+	 * @return String the highlight text
1927
+	 *
1928
+	 */
1929 1929
 	public function getHighlightByRegistration($registration,$filter = array())
1930 1930
 	{
1931 1931
 		global $global_query;
@@ -1947,13 +1947,13 @@  discard block
 block discarded – undo
1947 1947
 
1948 1948
 	
1949 1949
 	/**
1950
-	* Gets the squawk usage from squawk code
1951
-	*
1952
-	* @param String $squawk squawk code
1953
-	* @param String $country country
1954
-	* @return String usage
1955
-	*
1956
-	*/
1950
+	 * Gets the squawk usage from squawk code
1951
+	 *
1952
+	 * @param String $squawk squawk code
1953
+	 * @param String $country country
1954
+	 * @return String usage
1955
+	 *
1956
+	 */
1957 1957
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1958 1958
 	{
1959 1959
 		
@@ -1974,12 +1974,12 @@  discard block
 block discarded – undo
1974 1974
 	}
1975 1975
 
1976 1976
 	/**
1977
-	* Gets the airport icao from the iata
1978
-	*
1979
-	* @param String $airport_iata the iata code of the airport
1980
-	* @return String airport iata
1981
-	*
1982
-	*/
1977
+	 * Gets the airport icao from the iata
1978
+	 *
1979
+	 * @param String $airport_iata the iata code of the airport
1980
+	 * @return String airport iata
1981
+	 *
1982
+	 */
1983 1983
 	public function getAirportIcao($airport_iata = '')
1984 1984
 	{
1985 1985
 		
@@ -1999,14 +1999,14 @@  discard block
 block discarded – undo
1999 1999
 	}
2000 2000
 
2001 2001
 	/**
2002
-	* Gets the airport distance
2003
-	*
2004
-	* @param String $airport_icao the icao code of the airport
2005
-	* @param Float $latitude the latitude
2006
-	* @param Float $longitude the longitude
2007
-	* @return Float distance to the airport
2008
-	*
2009
-	*/
2002
+	 * Gets the airport distance
2003
+	 *
2004
+	 * @param String $airport_icao the icao code of the airport
2005
+	 * @param Float $latitude the latitude
2006
+	 * @param Float $longitude the longitude
2007
+	 * @return Float distance to the airport
2008
+	 *
2009
+	 */
2010 2010
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2011 2011
 	{
2012 2012
 		
@@ -2027,12 +2027,12 @@  discard block
 block discarded – undo
2027 2027
 	}
2028 2028
 	
2029 2029
 	/**
2030
-	* Gets the airport info based on the icao
2031
-	*
2032
-	* @param String $airport the icao code of the airport
2033
-	* @return Array airport information
2034
-	*
2035
-	*/
2030
+	 * Gets the airport info based on the icao
2031
+	 *
2032
+	 * @param String $airport the icao code of the airport
2033
+	 * @return Array airport information
2034
+	 *
2035
+	 */
2036 2036
 	public function getAllAirportInfo($airport = '')
2037 2037
 	{
2038 2038
 		
@@ -2078,12 +2078,12 @@  discard block
 block discarded – undo
2078 2078
 	}
2079 2079
 	
2080 2080
 	/**
2081
-	* Gets the airport info based on the country
2082
-	*
2083
-	* @param Array $countries Airports countries
2084
-	* @return Array airport information
2085
-	*
2086
-	*/
2081
+	 * Gets the airport info based on the country
2082
+	 *
2083
+	 * @param Array $countries Airports countries
2084
+	 * @return Array airport information
2085
+	 *
2086
+	 */
2087 2087
 	public function getAllAirportInfobyCountry($countries)
2088 2088
 	{
2089 2089
 		$lst_countries = '';
@@ -2121,12 +2121,12 @@  discard block
 block discarded – undo
2121 2121
 	}
2122 2122
 	
2123 2123
 	/**
2124
-	* Gets airports info based on the coord
2125
-	*
2126
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2127
-	* @return Array airport information
2128
-	*
2129
-	*/
2124
+	 * Gets airports info based on the coord
2125
+	 *
2126
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2127
+	 * @return Array airport information
2128
+	 *
2129
+	 */
2130 2130
 	public function getAllAirportInfobyCoord($coord)
2131 2131
 	{
2132 2132
 		global $globalDBdriver;
@@ -2157,12 +2157,12 @@  discard block
 block discarded – undo
2157 2157
 	}
2158 2158
 
2159 2159
 	/**
2160
-	* Gets waypoints info based on the coord
2161
-	*
2162
-	* @param Array $coord waypoints coord
2163
-	* @return Array airport information
2164
-	*
2165
-	*/
2160
+	 * Gets waypoints info based on the coord
2161
+	 *
2162
+	 * @param Array $coord waypoints coord
2163
+	 * @return Array airport information
2164
+	 *
2165
+	 */
2166 2166
 	public function getAllWaypointsInfobyCoord($coord)
2167 2167
 	{
2168 2168
 		if (is_array($coord)) {
@@ -2196,12 +2196,12 @@  discard block
 block discarded – undo
2196 2196
 	
2197 2197
 	
2198 2198
 	/**
2199
-	* Gets the airline info based on the icao code or iata code
2200
-	*
2201
-	* @param String $airline_icao the iata code of the airport
2202
-	* @return Array airport information
2203
-	*
2204
-	*/
2199
+	 * Gets the airline info based on the icao code or iata code
2200
+	 *
2201
+	 * @param String $airline_icao the iata code of the airport
2202
+	 * @return Array airport information
2203
+	 *
2204
+	 */
2205 2205
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2206 2206
 	{
2207 2207
 		global $globalUseRealAirlines;
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 			} else {
2233 2233
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2234 2234
 			}
2235
-                        /*
2235
+						/*
2236 2236
 			$airline_array = array();
2237 2237
 			$temp_array = array();
2238 2238
 		
@@ -2262,12 +2262,12 @@  discard block
 block discarded – undo
2262 2262
 	}
2263 2263
 	
2264 2264
 	/**
2265
-	* Gets the airline info based on the airline name
2266
-	*
2267
-	* @param String $airline_name the name of the airline
2268
-	* @return Array airline information
2269
-	*
2270
-	*/
2265
+	 * Gets the airline info based on the airline name
2266
+	 *
2267
+	 * @param String $airline_name the name of the airline
2268
+	 * @return Array airline information
2269
+	 *
2270
+	 */
2271 2271
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2272 2272
 	{
2273 2273
 		global $globalUseRealAirlines;
@@ -2295,12 +2295,12 @@  discard block
 block discarded – undo
2295 2295
 	
2296 2296
 	
2297 2297
 	/**
2298
-	* Gets the aircraft info based on the aircraft type
2299
-	*
2300
-	* @param String $aircraft_type the aircraft type
2301
-	* @return Array aircraft information
2302
-	*
2303
-	*/
2298
+	 * Gets the aircraft info based on the aircraft type
2299
+	 *
2300
+	 * @param String $aircraft_type the aircraft type
2301
+	 * @return Array aircraft information
2302
+	 *
2303
+	 */
2304 2304
 	public function getAllAircraftInfo($aircraft_type)
2305 2305
 	{
2306 2306
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2332,12 +2332,12 @@  discard block
 block discarded – undo
2332 2332
 	}
2333 2333
 
2334 2334
 	/**
2335
-	* Gets the aircraft icao based on the aircraft name/type
2336
-	*
2337
-	* @param String $aircraft_type the aircraft type
2338
-	* @return String aircraft information
2339
-	*
2340
-	*/
2335
+	 * Gets the aircraft icao based on the aircraft name/type
2336
+	 *
2337
+	 * @param String $aircraft_type the aircraft type
2338
+	 * @return String aircraft information
2339
+	 *
2340
+	 */
2341 2341
 	public function getAircraftIcao($aircraft_type)
2342 2342
 	{
2343 2343
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2362,12 +2362,12 @@  discard block
 block discarded – undo
2362 2362
 	}
2363 2363
 	
2364 2364
 	/**
2365
-	* Gets the aircraft info based on the aircraft modes
2366
-	*
2367
-	* @param String $aircraft_modes the aircraft ident (hex)
2368
-	* @return String aircraft type
2369
-	*
2370
-	*/
2365
+	 * Gets the aircraft info based on the aircraft modes
2366
+	 *
2367
+	 * @param String $aircraft_modes the aircraft ident (hex)
2368
+	 * @return String aircraft type
2369
+	 *
2370
+	 */
2371 2371
 	public function getAllAircraftType($aircraft_modes)
2372 2372
 	{
2373 2373
 		$aircraft_modes = filter_var($aircraft_modes,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 registration
2391
-	*
2392
-	* @param String $registration the aircraft registration
2393
-	* @return String aircraft type
2394
-	*
2395
-	*/
2390
+	 * Gets the aircraft info based on the aircraft registration
2391
+	 *
2392
+	 * @param String $registration the aircraft registration
2393
+	 * @return String aircraft type
2394
+	 *
2395
+	 */
2396 2396
 	public function getAllAircraftTypeByRegistration($registration)
2397 2397
 	{
2398 2398
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2410,12 +2410,12 @@  discard block
 block discarded – undo
2410 2410
 	}
2411 2411
 
2412 2412
 	/**
2413
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2414
-	*
2415
-	* @param String $registration the aircraft registration
2416
-	* @return Array spotter_id and flightaware_id
2417
-	*
2418
-	*/
2413
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2414
+	 *
2415
+	 * @param String $registration the aircraft registration
2416
+	 * @return Array spotter_id and flightaware_id
2417
+	 *
2418
+	 */
2419 2419
 	public function getAllIDByRegistration($registration)
2420 2420
 	{
2421 2421
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2434,12 +2434,12 @@  discard block
 block discarded – undo
2434 2434
 	}
2435 2435
 
2436 2436
 	/**
2437
-	* Gets correct aircraft operator code
2438
-	*
2439
-	* @param String $operator the aircraft operator code (callsign)
2440
-	* @return String aircraft operator code
2441
-	*
2442
-	*/
2437
+	 * Gets correct aircraft operator code
2438
+	 *
2439
+	 * @param String $operator the aircraft operator code (callsign)
2440
+	 * @return String aircraft operator code
2441
+	 *
2442
+	 */
2443 2443
 	public function getOperator($operator)
2444 2444
 	{
2445 2445
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2456,16 +2456,16 @@  discard block
 block discarded – undo
2456 2456
 	}
2457 2457
 
2458 2458
 	/**
2459
-	* Gets the aircraft route based on the aircraft callsign
2460
-	*
2461
-	* @param String $callsign the aircraft callsign
2462
-	* @return Array aircraft type
2463
-	*
2464
-	*/
2459
+	 * Gets the aircraft route based on the aircraft callsign
2460
+	 *
2461
+	 * @param String $callsign the aircraft callsign
2462
+	 * @return Array aircraft type
2463
+	 *
2464
+	 */
2465 2465
 	public function getRouteInfo($callsign)
2466 2466
 	{
2467 2467
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2468
-                if ($callsign == '') return array();
2468
+				if ($callsign == '') return array();
2469 2469
 		$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";
2470 2470
 		
2471 2471
 		$sth = $this->db->prepare($query);
@@ -2479,12 +2479,12 @@  discard block
 block discarded – undo
2479 2479
 	}
2480 2480
 	
2481 2481
 	/**
2482
-	* Gets the aircraft info based on the aircraft registration
2483
-	*
2484
-	* @param String $registration the aircraft registration
2485
-	* @return Array aircraft information
2486
-	*
2487
-	*/
2482
+	 * Gets the aircraft info based on the aircraft registration
2483
+	 *
2484
+	 * @param String $registration the aircraft registration
2485
+	 * @return Array aircraft information
2486
+	 *
2487
+	 */
2488 2488
 	public function getAircraftInfoByRegistration($registration)
2489 2489
 	{
2490 2490
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2511,12 +2511,12 @@  discard block
 block discarded – undo
2511 2511
 	}
2512 2512
 	
2513 2513
 	/**
2514
-	* Gets the aircraft owner & base based on the aircraft registration
2515
-	*
2516
-	* @param String $registration the aircraft registration
2517
-	* @return Array aircraft information
2518
-	*
2519
-	*/
2514
+	 * Gets the aircraft owner & base based on the aircraft registration
2515
+	 *
2516
+	 * @param String $registration the aircraft registration
2517
+	 * @return Array aircraft information
2518
+	 *
2519
+	 */
2520 2520
 	public function getAircraftOwnerByRegistration($registration)
2521 2521
 	{
2522 2522
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2533,11 +2533,11 @@  discard block
 block discarded – undo
2533 2533
 	
2534 2534
   
2535 2535
   /**
2536
-	* Gets all flights (but with only little info)
2537
-	*
2538
-	* @return Array basic flight information
2539
-	*
2540
-	*/
2536
+   * Gets all flights (but with only little info)
2537
+   *
2538
+   * @return Array basic flight information
2539
+   *
2540
+   */
2541 2541
 	public function getAllFlightsforSitemap()
2542 2542
 	{
2543 2543
 		//$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 ";
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
 		
2546 2546
 		$sth = $this->db->prepare($query);
2547 2547
 		$sth->execute();
2548
-                  /*
2548
+				  /*
2549 2549
 		$flight_array = array();
2550 2550
 		$temp_array = array();
2551 2551
 		
@@ -2567,11 +2567,11 @@  discard block
 block discarded – undo
2567 2567
 	}
2568 2568
   
2569 2569
 	/**
2570
-	* Gets a list of all aircraft manufacturers
2571
-	*
2572
-	* @return Array list of aircraft types
2573
-	*
2574
-	*/
2570
+	 * Gets a list of all aircraft manufacturers
2571
+	 *
2572
+	 * @return Array list of aircraft types
2573
+	 *
2574
+	 */
2575 2575
 	public function getAllManufacturers()
2576 2576
 	{
2577 2577
 		/*
@@ -2600,11 +2600,11 @@  discard block
 block discarded – undo
2600 2600
   
2601 2601
   
2602 2602
   /**
2603
-	* Gets a list of all aircraft types
2604
-	*
2605
-	* @return Array list of aircraft types
2606
-	*
2607
-	*/
2603
+   * Gets a list of all aircraft types
2604
+   *
2605
+   * @return Array list of aircraft types
2606
+   *
2607
+   */
2608 2608
 	public function getAllAircraftTypes($filters = array())
2609 2609
 	{
2610 2610
 		/*
@@ -2639,11 +2639,11 @@  discard block
 block discarded – undo
2639 2639
 	
2640 2640
 	
2641 2641
 	/**
2642
-	* Gets a list of all aircraft registrations
2643
-	*
2644
-	* @return Array list of aircraft registrations
2645
-	*
2646
-	*/
2642
+	 * Gets a list of all aircraft registrations
2643
+	 *
2644
+	 * @return Array list of aircraft registrations
2645
+	 *
2646
+	 */
2647 2647
 	public function getAllAircraftRegistrations($filters = array())
2648 2648
 	{
2649 2649
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2668,12 +2668,12 @@  discard block
 block discarded – undo
2668 2668
 	}
2669 2669
 
2670 2670
 	/**
2671
-	* Gets all source name
2672
-	*
2673
-	* @param String type format of source
2674
-	* @return Array list of source name
2675
-	*
2676
-	*/
2671
+	 * Gets all source name
2672
+	 *
2673
+	 * @param String type format of source
2674
+	 * @return Array list of source name
2675
+	 *
2676
+	 */
2677 2677
 	public function getAllSourceName($type = '',$filters = array())
2678 2678
 	{
2679 2679
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2704,11 +2704,11 @@  discard block
 block discarded – undo
2704 2704
 
2705 2705
 
2706 2706
 	/**
2707
-	* Gets a list of all airline names
2708
-	*
2709
-	* @return Array list of airline names
2710
-	*
2711
-	*/
2707
+	 * Gets a list of all airline names
2708
+	 *
2709
+	 * @return Array list of airline names
2710
+	 *
2711
+	 */
2712 2712
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2713 2713
 	{
2714 2714
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2757,11 +2757,11 @@  discard block
 block discarded – undo
2757 2757
 	}
2758 2758
 	
2759 2759
 	/**
2760
-	* Gets a list of all alliance names
2761
-	*
2762
-	* @return Array list of alliance names
2763
-	*
2764
-	*/
2760
+	 * Gets a list of all alliance names
2761
+	 *
2762
+	 * @return Array list of alliance names
2763
+	 *
2764
+	 */
2765 2765
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2766 2766
 	{
2767 2767
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2786,11 +2786,11 @@  discard block
 block discarded – undo
2786 2786
 	}
2787 2787
 	
2788 2788
 	/**
2789
-	* Gets a list of all airline countries
2790
-	*
2791
-	* @return Array list of airline countries
2792
-	*
2793
-	*/
2789
+	 * Gets a list of all airline countries
2790
+	 *
2791
+	 * @return Array list of airline countries
2792
+	 *
2793
+	 */
2794 2794
 	public function getAllAirlineCountries($filters = array())
2795 2795
 	{
2796 2796
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2818,11 +2818,11 @@  discard block
 block discarded – undo
2818 2818
 	
2819 2819
 	
2820 2820
 	/**
2821
-	* Gets a list of all departure & arrival names
2822
-	*
2823
-	* @return Array list of airport names
2824
-	*
2825
-	*/
2821
+	 * Gets a list of all departure & arrival names
2822
+	 *
2823
+	 * @return Array list of airport names
2824
+	 *
2825
+	 */
2826 2826
 	public function getAllAirportNames($filters = array())
2827 2827
 	{
2828 2828
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2871,11 +2871,11 @@  discard block
 block discarded – undo
2871 2871
 	
2872 2872
 	
2873 2873
 	/**
2874
-	* Gets a list of all departure & arrival airport countries
2875
-	*
2876
-	* @return Array list of airport countries
2877
-	*
2878
-	*/
2874
+	 * Gets a list of all departure & arrival airport countries
2875
+	 *
2876
+	 * @return Array list of airport countries
2877
+	 *
2878
+	 */
2879 2879
 	public function getAllAirportCountries($filters = array())
2880 2880
 	{
2881 2881
 		$airport_array = array();
@@ -2923,11 +2923,11 @@  discard block
 block discarded – undo
2923 2923
 	
2924 2924
 	
2925 2925
 	/**
2926
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2927
-	*
2928
-	* @return Array list of countries
2929
-	*
2930
-	*/
2926
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2927
+	 *
2928
+	 * @return Array list of countries
2929
+	 *
2930
+	 */
2931 2931
 	public function getAllCountries($filters = array())
2932 2932
 	{
2933 2933
 		$Connection= new Connection($this->db);
@@ -3004,11 +3004,11 @@  discard block
 block discarded – undo
3004 3004
 	
3005 3005
 	
3006 3006
 	/**
3007
-	* Gets a list of all idents/callsigns
3008
-	*
3009
-	* @return Array list of ident/callsign names
3010
-	*
3011
-	*/
3007
+	 * Gets a list of all idents/callsigns
3008
+	 *
3009
+	 * @return Array list of ident/callsign names
3010
+	 *
3011
+	 */
3012 3012
 	public function getAllIdents($filters = array())
3013 3013
 	{
3014 3014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3032,9 +3032,9 @@  discard block
 block discarded – undo
3032 3032
 	}
3033 3033
 
3034 3034
 	/**
3035
-	* Get a list of flights from airport since 7 days
3036
-	* @return Array number, icao, name and city of airports
3037
-	*/
3035
+	 * Get a list of flights from airport since 7 days
3036
+	 * @return Array number, icao, name and city of airports
3037
+	 */
3038 3038
 
3039 3039
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3040 3040
 		global $globalTimezone, $globalDBdriver;
@@ -3065,9 +3065,9 @@  discard block
 block discarded – undo
3065 3065
 	}
3066 3066
 
3067 3067
 	/**
3068
-	* Get a list of flights from airport since 7 days
3069
-	* @return Array number, icao, name and city of airports
3070
-	*/
3068
+	 * Get a list of flights from airport since 7 days
3069
+	 * @return Array number, icao, name and city of airports
3070
+	 */
3071 3071
 
3072 3072
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3073 3073
 		global $globalTimezone, $globalDBdriver;
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
 	}
3098 3098
 
3099 3099
 	/**
3100
-	* Get a list of flights from detected airport since 7 days
3101
-	* @return Array number, icao, name and city of airports
3102
-	*/
3100
+	 * Get a list of flights from detected airport since 7 days
3101
+	 * @return Array number, icao, name and city of airports
3102
+	 */
3103 3103
 
3104 3104
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3105 3105
 		global $globalTimezone, $globalDBdriver;
@@ -3137,9 +3137,9 @@  discard block
 block discarded – undo
3137 3137
 	}
3138 3138
 
3139 3139
 	/**
3140
-	* Get a list of flights from detected airport since 7 days
3141
-	* @return Array number, icao, name and city of airports
3142
-	*/
3140
+	 * Get a list of flights from detected airport since 7 days
3141
+	 * @return Array number, icao, name and city of airports
3142
+	 */
3143 3143
 
3144 3144
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3145 3145
 		global $globalTimezone, $globalDBdriver;
@@ -3181,9 +3181,9 @@  discard block
 block discarded – undo
3181 3181
 
3182 3182
 
3183 3183
 	/**
3184
-	* Get a list of flights to airport since 7 days
3185
-	* @return Array number, icao, name and city of airports
3186
-	*/
3184
+	 * Get a list of flights to airport since 7 days
3185
+	 * @return Array number, icao, name and city of airports
3186
+	 */
3187 3187
 
3188 3188
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3189 3189
 		global $globalTimezone, $globalDBdriver;
@@ -3216,9 +3216,9 @@  discard block
 block discarded – undo
3216 3216
 
3217 3217
 
3218 3218
 	/**
3219
-	* Get a list of flights detected to airport since 7 days
3220
-	* @return Array number, icao, name and city of airports
3221
-	*/
3219
+	 * Get a list of flights detected to airport since 7 days
3220
+	 * @return Array number, icao, name and city of airports
3221
+	 */
3222 3222
 
3223 3223
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3224 3224
 		global $globalTimezone, $globalDBdriver;
@@ -3259,9 +3259,9 @@  discard block
 block discarded – undo
3259 3259
 
3260 3260
 
3261 3261
 	/**
3262
-	* Get a list of flights to airport since 7 days
3263
-	* @return Array number, icao, name and city of airports
3264
-	*/
3262
+	 * Get a list of flights to airport since 7 days
3263
+	 * @return Array number, icao, name and city of airports
3264
+	 */
3265 3265
 
3266 3266
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3267 3267
 		global $globalTimezone, $globalDBdriver;
@@ -3293,9 +3293,9 @@  discard block
 block discarded – undo
3293 3293
 
3294 3294
 
3295 3295
 	/**
3296
-	* Get a list of flights detected to airport since 7 days
3297
-	* @return Array number, icao, name and city of airports
3298
-	*/
3296
+	 * Get a list of flights detected to airport since 7 days
3297
+	 * @return Array number, icao, name and city of airports
3298
+	 */
3299 3299
 
3300 3300
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3301 3301
 		global $globalTimezone, $globalDBdriver;
@@ -3339,11 +3339,11 @@  discard block
 block discarded – undo
3339 3339
 
3340 3340
 
3341 3341
 	/**
3342
-	* Gets a list of all dates
3343
-	*
3344
-	* @return Array list of date names
3345
-	*
3346
-	*/
3342
+	 * Gets a list of all dates
3343
+	 *
3344
+	 * @return Array list of date names
3345
+	 *
3346
+	 */
3347 3347
 	public function getAllDates()
3348 3348
 	{
3349 3349
 		global $globalTimezone, $globalDBdriver;
@@ -3384,11 +3384,11 @@  discard block
 block discarded – undo
3384 3384
 	
3385 3385
 	
3386 3386
 	/**
3387
-	* Gets all route combinations
3388
-	*
3389
-	* @return Array the route list
3390
-	*
3391
-	*/
3387
+	 * Gets all route combinations
3388
+	 *
3389
+	 * @return Array the route list
3390
+	 *
3391
+	 */
3392 3392
 	public function getAllRoutes()
3393 3393
 	{
3394 3394
 		$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 
@@ -3414,13 +3414,13 @@  discard block
 block discarded – undo
3414 3414
 	}
3415 3415
 
3416 3416
 	/**
3417
-	* Update ident spotter data
3418
-	*
3419
-	* @param String $flightaware_id the ID from flightaware
3420
-	* @param String $ident the flight ident
3421
-	* @return String success or false
3422
-	*
3423
-	*/	
3417
+	 * Update ident spotter data
3418
+	 *
3419
+	 * @param String $flightaware_id the ID from flightaware
3420
+	 * @param String $ident the flight ident
3421
+	 * @return String success or false
3422
+	 *
3423
+	 */	
3424 3424
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3425 3425
 	{
3426 3426
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3441,14 +3441,14 @@  discard block
 block discarded – undo
3441 3441
 		} else {
3442 3442
 			$airline_array = $this->getAllAirlineInfo("NA");
3443 3443
 		}
3444
-                $airline_name = $airline_array[0]['name'];
3445
-                $airline_icao = $airline_array[0]['icao'];
3446
-                $airline_country = $airline_array[0]['country'];
3447
-                $airline_type = $airline_array[0]['type'];
3444
+				$airline_name = $airline_array[0]['name'];
3445
+				$airline_icao = $airline_array[0]['icao'];
3446
+				$airline_country = $airline_array[0]['country'];
3447
+				$airline_type = $airline_array[0]['type'];
3448 3448
 
3449 3449
 
3450 3450
 		$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';
3451
-                $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);
3451
+				$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);
3452 3452
 
3453 3453
 		try {
3454 3454
 			$sth = $this->db->prepare($query);
@@ -3461,19 +3461,19 @@  discard block
 block discarded – undo
3461 3461
 
3462 3462
 	}
3463 3463
 	/**
3464
-	* Update latest spotter data
3465
-	*
3466
-	* @param String $flightaware_id the ID from flightaware
3467
-	* @param String $ident the flight ident
3468
-	* @param String $arrival_airport_icao the arrival airport
3469
-	* @return String success or false
3470
-	*
3471
-	*/	
3464
+	 * Update latest spotter data
3465
+	 *
3466
+	 * @param String $flightaware_id the ID from flightaware
3467
+	 * @param String $ident the flight ident
3468
+	 * @param String $arrival_airport_icao the arrival airport
3469
+	 * @return String success or false
3470
+	 *
3471
+	 */	
3472 3472
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3473 3473
 	{
3474 3474
 		if ($groundspeed == '') $groundspeed = NULL;
3475 3475
 		$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';
3476
-                $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);
3476
+				$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);
3477 3477
 
3478 3478
 		try {
3479 3479
 			$sth = $this->db->prepare($query);
@@ -3487,32 +3487,32 @@  discard block
 block discarded – undo
3487 3487
 	}
3488 3488
 
3489 3489
 	/**
3490
-	* Adds a new spotter data
3491
-	*
3492
-	* @param String $flightaware_id the ID from flightaware
3493
-	* @param String $ident the flight ident
3494
-	* @param String $aircraft_icao the aircraft type
3495
-	* @param String $departure_airport_icao the departure airport
3496
-	* @param String $arrival_airport_icao the arrival airport
3497
-	* @param String $latitude latitude of flight
3498
-	* @param String $longitude latitude of flight
3499
-	* @param String $waypoints waypoints of flight
3500
-	* @param String $altitude altitude of flight
3501
-	* @param String $heading heading of flight
3502
-	* @param String $groundspeed speed of flight
3503
-	* @param String $date date of flight
3504
-	* @param String $departure_airport_time departure time of flight
3505
-	* @param String $arrival_airport_time arrival time of flight
3506
-	* @param String $squawk squawk code of flight
3507
-	* @param String $route_stop route stop of flight
3508
-	* @param String $highlight highlight or not
3509
-	* @param String $ModeS ModesS code of flight
3510
-	* @param String $registration registration code of flight
3511
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3512
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3513
-	* @param String $verticalrate vertival rate of flight
3514
-	* @return String success or false
3515
-	*/
3490
+	 * Adds a new spotter data
3491
+	 *
3492
+	 * @param String $flightaware_id the ID from flightaware
3493
+	 * @param String $ident the flight ident
3494
+	 * @param String $aircraft_icao the aircraft type
3495
+	 * @param String $departure_airport_icao the departure airport
3496
+	 * @param String $arrival_airport_icao the arrival airport
3497
+	 * @param String $latitude latitude of flight
3498
+	 * @param String $longitude latitude of flight
3499
+	 * @param String $waypoints waypoints of flight
3500
+	 * @param String $altitude altitude of flight
3501
+	 * @param String $heading heading of flight
3502
+	 * @param String $groundspeed speed of flight
3503
+	 * @param String $date date of flight
3504
+	 * @param String $departure_airport_time departure time of flight
3505
+	 * @param String $arrival_airport_time arrival time of flight
3506
+	 * @param String $squawk squawk code of flight
3507
+	 * @param String $route_stop route stop of flight
3508
+	 * @param String $highlight highlight or not
3509
+	 * @param String $ModeS ModesS code of flight
3510
+	 * @param String $registration registration code of flight
3511
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3512
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3513
+	 * @param String $verticalrate vertival rate of flight
3514
+	 * @return String success or false
3515
+	 */
3516 3516
 	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 = '')
3517 3517
 	{
3518 3518
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3727,8 +3727,8 @@  discard block
 block discarded – undo
3727 3727
     
3728 3728
 		if ($globalIVAO && $aircraft_icao != '')
3729 3729
 		{
3730
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3731
-            		else $airline_icao = '';
3730
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3731
+					else $airline_icao = '';
3732 3732
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3733 3733
 			if (!isset($image_array[0]['registration']))
3734 3734
 			{
@@ -3759,53 +3759,53 @@  discard block
 block discarded – undo
3759 3759
 	
3760 3760
 		if (count($airline_array) == 0) 
3761 3761
 		{
3762
-                        $airline_array = $this->getAllAirlineInfo('NA');
3763
-                }
3764
-                if (count($aircraft_array) == 0) 
3765
-                {
3766
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3767
-                }
3768
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3769
-                {
3770
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3771
-                }
3772
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3773
-                {
3774
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3775
-                }
3776
-                if ($registration == '') $registration = 'NA';
3777
-                if ($latitude == '' && $longitude == '') {
3778
-            		$latitude = 0;
3779
-            		$longitude = 0;
3780
-            	}
3781
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3782
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3783
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3784
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3785
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3786
-                $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) 
3762
+						$airline_array = $this->getAllAirlineInfo('NA');
3763
+				}
3764
+				if (count($aircraft_array) == 0) 
3765
+				{
3766
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3767
+				}
3768
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3769
+				{
3770
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3771
+				}
3772
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3773
+				{
3774
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3775
+				}
3776
+				if ($registration == '') $registration = 'NA';
3777
+				if ($latitude == '' && $longitude == '') {
3778
+					$latitude = 0;
3779
+					$longitude = 0;
3780
+				}
3781
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3782
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3783
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3784
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3785
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3786
+				$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) 
3787 3787
                 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)";
3788 3788
 
3789
-                $airline_name = $airline_array[0]['name'];
3790
-                $airline_icao = $airline_array[0]['icao'];
3791
-                $airline_country = $airline_array[0]['country'];
3792
-                $airline_type = $airline_array[0]['type'];
3789
+				$airline_name = $airline_array[0]['name'];
3790
+				$airline_icao = $airline_array[0]['icao'];
3791
+				$airline_country = $airline_array[0]['country'];
3792
+				$airline_type = $airline_array[0]['type'];
3793 3793
 		if ($airline_type == '') {
3794 3794
 			$timeelapsed = microtime(true);
3795 3795
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3796 3796
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3797 3797
 		}
3798 3798
 		if ($airline_type == null) $airline_type = '';
3799
-                $aircraft_type = $aircraft_array[0]['type'];
3800
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3801
-                $departure_airport_name = $departure_airport_array[0]['name'];
3802
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3803
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3799
+				$aircraft_type = $aircraft_array[0]['type'];
3800
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3801
+				$departure_airport_name = $departure_airport_array[0]['name'];
3802
+			$departure_airport_city = $departure_airport_array[0]['city'];
3803
+				$departure_airport_country = $departure_airport_array[0]['country'];
3804 3804
                 
3805
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3806
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3807
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3808
-                $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);
3805
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3806
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3807
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3808
+				$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);
3809 3809
 
3810 3810
 		try {
3811 3811
 		        
@@ -3813,7 +3813,7 @@  discard block
 block discarded – undo
3813 3813
 			$sth->execute($query_values);
3814 3814
 			$this->db = null;
3815 3815
 		} catch (PDOException $e) {
3816
-		    return "error : ".$e->getMessage();
3816
+			return "error : ".$e->getMessage();
3817 3817
 		}
3818 3818
 		
3819 3819
 		return "success";
@@ -3822,11 +3822,11 @@  discard block
 block discarded – undo
3822 3822
 	
3823 3823
   
3824 3824
 	/**
3825
-	* Gets the aircraft ident within the last hour
3826
-	*
3827
-	* @return String the ident
3828
-	*
3829
-	*/
3825
+	 * Gets the aircraft ident within the last hour
3826
+	 *
3827
+	 * @return String the ident
3828
+	 *
3829
+	 */
3830 3830
 	public function getIdentFromLastHour($ident)
3831 3831
 	{
3832 3832
 		global $globalDBdriver, $globalTimezone;
@@ -3842,11 +3842,11 @@  discard block
 block discarded – undo
3842 3842
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3843 3843
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3844 3844
 			$query_data = array(':ident' => $ident);
3845
-    		}
3845
+			}
3846 3846
 		
3847 3847
 		$sth = $this->db->prepare($query);
3848 3848
 		$sth->execute($query_data);
3849
-    		$ident_result='';
3849
+			$ident_result='';
3850 3850
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3851 3851
 		{
3852 3852
 			$ident_result = $row['ident'];
@@ -3857,11 +3857,11 @@  discard block
 block discarded – undo
3857 3857
 	
3858 3858
 	
3859 3859
 	/**
3860
-	* Gets the aircraft data from the last 20 seconds
3861
-	*
3862
-	* @return Array the spotter data
3863
-	*
3864
-	*/
3860
+	 * Gets the aircraft data from the last 20 seconds
3861
+	 *
3862
+	 * @return Array the spotter data
3863
+	 *
3864
+	 */
3865 3865
 	public function getRealTimeData($q = '')
3866 3866
 	{
3867 3867
 		global $globalDBdriver;
@@ -3905,11 +3905,11 @@  discard block
 block discarded – undo
3905 3905
 	
3906 3906
 	
3907 3907
 	 /**
3908
-	* Gets all airlines that have flown over
3909
-	*
3910
-	* @return Array the airline list
3911
-	*
3912
-	*/
3908
+	  * Gets all airlines that have flown over
3909
+	  *
3910
+	  * @return Array the airline list
3911
+	  *
3912
+	  */
3913 3913
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3914 3914
 	{
3915 3915
 		global $globalDBdriver;
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3924 3924
 			}
3925 3925
 		}
3926
-                if ($sincedate != '') {
3926
+				if ($sincedate != '') {
3927 3927
 			if ($globalDBdriver == 'mysql') {
3928 3928
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3929 3929
 			} else {
@@ -3977,26 +3977,26 @@  discard block
 block discarded – undo
3977 3977
 	}
3978 3978
 
3979 3979
 	 /**
3980
-	* Gets all pilots that have flown over
3981
-	*
3982
-	* @return Array the pilots list
3983
-	*
3984
-	*/
3980
+	  * Gets all pilots that have flown over
3981
+	  *
3982
+	  * @return Array the pilots list
3983
+	  *
3984
+	  */
3985 3985
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
3986 3986
 	{
3987 3987
 		global $globalDBdriver;
3988 3988
 		$filter_query = $this->getFilter($filters,true,true);
3989 3989
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3990 3990
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3991
-                if ($olderthanmonths > 0) {
3992
-            		if ($globalDBdriver == 'mysql') {
3991
+				if ($olderthanmonths > 0) {
3992
+					if ($globalDBdriver == 'mysql') {
3993 3993
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3994 3994
 			} else {
3995 3995
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3996 3996
 			}
3997 3997
 		}
3998
-                if ($sincedate != '') {
3999
-            		if ($globalDBdriver == 'mysql') {
3998
+				if ($sincedate != '') {
3999
+					if ($globalDBdriver == 'mysql') {
4000 4000
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4001 4001
 			} else {
4002 4002
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4051,25 +4051,25 @@  discard block
 block discarded – undo
4051 4051
 	}
4052 4052
 	
4053 4053
 	/**
4054
-	* Gets all pilots that have flown over
4055
-	*
4056
-	* @return Array the pilots list
4057
-	*
4058
-	*/
4054
+	 * Gets all pilots that have flown over
4055
+	 *
4056
+	 * @return Array the pilots list
4057
+	 *
4058
+	 */
4059 4059
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4060 4060
 	{
4061 4061
 		global $globalDBdriver;
4062 4062
 		$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
4063 4063
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4064
-                if ($olderthanmonths > 0) {
4065
-            		if ($globalDBdriver == 'mysql') {
4064
+				if ($olderthanmonths > 0) {
4065
+					if ($globalDBdriver == 'mysql') {
4066 4066
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4067 4067
 			} else {
4068 4068
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4069 4069
 			}
4070 4070
 		}
4071
-                if ($sincedate != '') {
4072
-            		if ($globalDBdriver == 'mysql') {
4071
+				if ($sincedate != '') {
4072
+					if ($globalDBdriver == 'mysql') {
4073 4073
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4074 4074
 			} else {
4075 4075
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4098,26 +4098,26 @@  discard block
 block discarded – undo
4098 4098
 	}
4099 4099
 	
4100 4100
 	 /**
4101
-	* Gets all owner that have flown over
4102
-	*
4103
-	* @return Array the pilots list
4104
-	*
4105
-	*/
4101
+	  * Gets all owner that have flown over
4102
+	  *
4103
+	  * @return Array the pilots list
4104
+	  *
4105
+	  */
4106 4106
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4107 4107
 	{
4108 4108
 		global $globalDBdriver;
4109 4109
 		$filter_query = $this->getFilter($filters,true,true);
4110 4110
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4111 4111
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4112
-                if ($olderthanmonths > 0) {
4113
-            		if ($globalDBdriver == 'mysql') {
4112
+				if ($olderthanmonths > 0) {
4113
+					if ($globalDBdriver == 'mysql') {
4114 4114
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4115 4115
 			} else {
4116 4116
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4117 4117
 			}
4118 4118
 		}
4119
-                if ($sincedate != '') {
4120
-            		if ($globalDBdriver == 'mysql') {
4119
+				if ($sincedate != '') {
4120
+					if ($globalDBdriver == 'mysql') {
4121 4121
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4122 4122
 			} else {
4123 4123
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4168,26 +4168,26 @@  discard block
 block discarded – undo
4168 4168
 	}
4169 4169
 	
4170 4170
 	 /**
4171
-	* Gets all owner that have flown over
4172
-	*
4173
-	* @return Array the pilots list
4174
-	*
4175
-	*/
4171
+	  * Gets all owner that have flown over
4172
+	  *
4173
+	  * @return Array the pilots list
4174
+	  *
4175
+	  */
4176 4176
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4177 4177
 	{
4178 4178
 		global $globalDBdriver;
4179 4179
 		$filter_query = $this->getFilter($filters,true,true);
4180 4180
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4181 4181
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4182
-                if ($olderthanmonths > 0) {
4183
-            		if ($globalDBdriver == 'mysql') {
4182
+				if ($olderthanmonths > 0) {
4183
+					if ($globalDBdriver == 'mysql') {
4184 4184
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4185 4185
 			} else {
4186 4186
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4187 4187
 			}
4188 4188
 		}
4189
-                if ($sincedate != '') {
4190
-            		if ($globalDBdriver == 'mysql') {
4189
+				if ($sincedate != '') {
4190
+					if ($globalDBdriver == 'mysql') {
4191 4191
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4192 4192
 			} else {
4193 4193
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4214,11 +4214,11 @@  discard block
 block discarded – undo
4214 4214
 	}
4215 4215
 
4216 4216
 	/**
4217
-	* Gets all airlines that have flown over by aircraft
4218
-	*
4219
-	* @return Array the airline list
4220
-	*
4221
-	*/
4217
+	 * Gets all airlines that have flown over by aircraft
4218
+	 *
4219
+	 * @return Array the airline list
4220
+	 *
4221
+	 */
4222 4222
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4223 4223
 	{
4224 4224
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4250,11 +4250,11 @@  discard block
 block discarded – undo
4250 4250
 
4251 4251
 
4252 4252
 	/**
4253
-	* Gets all airline countries that have flown over by aircraft
4254
-	*
4255
-	* @return Array the airline country list
4256
-	*
4257
-	*/
4253
+	 * Gets all airline countries that have flown over by aircraft
4254
+	 *
4255
+	 * @return Array the airline country list
4256
+	 *
4257
+	 */
4258 4258
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4259 4259
 	{
4260 4260
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4286,11 +4286,11 @@  discard block
 block discarded – undo
4286 4286
 	
4287 4287
 	
4288 4288
 	/**
4289
-	* Gets all airlines that have flown over by airport
4290
-	*
4291
-	* @return Array the airline list
4292
-	*
4293
-	*/
4289
+	 * Gets all airlines that have flown over by airport
4290
+	 *
4291
+	 * @return Array the airline list
4292
+	 *
4293
+	 */
4294 4294
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4295 4295
 	{
4296 4296
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4321,11 +4321,11 @@  discard block
 block discarded – undo
4321 4321
 
4322 4322
 
4323 4323
 	/**
4324
-	* Gets all airline countries that have flown over by airport icao
4325
-	*
4326
-	* @return Array the airline country list
4327
-	*
4328
-	*/
4324
+	 * Gets all airline countries that have flown over by airport icao
4325
+	 *
4326
+	 * @return Array the airline country list
4327
+	 *
4328
+	 */
4329 4329
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4330 4330
 	{
4331 4331
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4355,11 +4355,11 @@  discard block
 block discarded – undo
4355 4355
 
4356 4356
 
4357 4357
 	/**
4358
-	* Gets all airlines that have flown over by aircraft manufacturer
4359
-	*
4360
-	* @return Array the airline list
4361
-	*
4362
-	*/
4358
+	 * Gets all airlines that have flown over by aircraft manufacturer
4359
+	 *
4360
+	 * @return Array the airline list
4361
+	 *
4362
+	 */
4363 4363
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4364 4364
 	{
4365 4365
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4390,11 +4390,11 @@  discard block
 block discarded – undo
4390 4390
 
4391 4391
 
4392 4392
 	/**
4393
-	* Gets all airline countries that have flown over by aircraft manufacturer
4394
-	*
4395
-	* @return Array the airline country list
4396
-	*
4397
-	*/
4393
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4394
+	 *
4395
+	 * @return Array the airline country list
4396
+	 *
4397
+	 */
4398 4398
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4399 4399
 	{
4400 4400
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4423,11 +4423,11 @@  discard block
 block discarded – undo
4423 4423
 
4424 4424
 
4425 4425
 	/**
4426
-	* Gets all airlines that have flown over by date
4427
-	*
4428
-	* @return Array the airline list
4429
-	*
4430
-	*/
4426
+	 * Gets all airlines that have flown over by date
4427
+	 *
4428
+	 * @return Array the airline list
4429
+	 *
4430
+	 */
4431 4431
 	public function countAllAirlinesByDate($date,$filters = array())
4432 4432
 	{
4433 4433
 		global $globalTimezone, $globalDBdriver;
@@ -4471,11 +4471,11 @@  discard block
 block discarded – undo
4471 4471
 	
4472 4472
 	
4473 4473
 	/**
4474
-	* Gets all airline countries that have flown over by date
4475
-	*
4476
-	* @return Array the airline country list
4477
-	*
4478
-	*/
4474
+	 * Gets all airline countries that have flown over by date
4475
+	 *
4476
+	 * @return Array the airline country list
4477
+	 *
4478
+	 */
4479 4479
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4480 4480
 	{
4481 4481
 		global $globalTimezone, $globalDBdriver;
@@ -4518,11 +4518,11 @@  discard block
 block discarded – undo
4518 4518
 
4519 4519
 
4520 4520
 	/**
4521
-	* Gets all airlines that have flown over by ident/callsign
4522
-	*
4523
-	* @return Array the airline list
4524
-	*
4525
-	*/
4521
+	 * Gets all airlines that have flown over by ident/callsign
4522
+	 *
4523
+	 * @return Array the airline list
4524
+	 *
4525
+	 */
4526 4526
 	public function countAllAirlinesByIdent($ident,$filters = array())
4527 4527
 	{
4528 4528
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4552,11 +4552,11 @@  discard block
 block discarded – undo
4552 4552
 	}
4553 4553
 
4554 4554
 	/**
4555
-	* Gets all airlines that have flown over by route
4556
-	*
4557
-	* @return Array the airline list
4558
-	*
4559
-	*/
4555
+	 * Gets all airlines that have flown over by route
4556
+	 *
4557
+	 * @return Array the airline list
4558
+	 *
4559
+	 */
4560 4560
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4561 4561
 	{
4562 4562
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4588,11 +4588,11 @@  discard block
 block discarded – undo
4588 4588
 	}
4589 4589
 
4590 4590
 	/**
4591
-	* Gets all airline countries that have flown over by route
4592
-	*
4593
-	* @return Array the airline country list
4594
-	*
4595
-	*/
4591
+	 * Gets all airline countries that have flown over by route
4592
+	 *
4593
+	 * @return Array the airline country list
4594
+	 *
4595
+	 */
4596 4596
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4597 4597
 	{
4598 4598
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4624,11 +4624,11 @@  discard block
 block discarded – undo
4624 4624
 
4625 4625
 
4626 4626
 	/**
4627
-	* Gets all airlines that have flown over by country
4628
-	*
4629
-	* @return Array the airline list
4630
-	*
4631
-	*/
4627
+	 * Gets all airlines that have flown over by country
4628
+	 *
4629
+	 * @return Array the airline list
4630
+	 *
4631
+	 */
4632 4632
 	public function countAllAirlinesByCountry($country,$filters = array())
4633 4633
 	{
4634 4634
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4658,11 +4658,11 @@  discard block
 block discarded – undo
4658 4658
 
4659 4659
 
4660 4660
 	/**
4661
-	* Gets all airline countries that have flown over by country
4662
-	*
4663
-	* @return Array the airline country list
4664
-	*
4665
-	*/
4661
+	 * Gets all airline countries that have flown over by country
4662
+	 *
4663
+	 * @return Array the airline country list
4664
+	 *
4665
+	 */
4666 4666
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4667 4667
 	{
4668 4668
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4691,11 +4691,11 @@  discard block
 block discarded – undo
4691 4691
 
4692 4692
 
4693 4693
 	/**
4694
-	* Gets all airlines countries
4695
-	*
4696
-	* @return Array the airline country list
4697
-	*
4698
-	*/
4694
+	 * Gets all airlines countries
4695
+	 *
4696
+	 * @return Array the airline country list
4697
+	 *
4698
+	 */
4699 4699
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4700 4700
 	{
4701 4701
 		global $globalDBdriver;
@@ -4750,11 +4750,11 @@  discard block
 block discarded – undo
4750 4750
 	}
4751 4751
 
4752 4752
 	/**
4753
-	* Gets all number of flight over countries
4754
-	*
4755
-	* @return Array the airline country list
4756
-	*
4757
-	*/
4753
+	 * Gets all number of flight over countries
4754
+	 *
4755
+	 * @return Array the airline country list
4756
+	 *
4757
+	 */
4758 4758
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4759 4759
 	{
4760 4760
 		global $globalDBdriver;
@@ -4776,15 +4776,15 @@  discard block
 block discarded – undo
4776 4776
 		$SpotterLive = new SpotterLive();
4777 4777
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4778 4778
 		$filter_query .= ' over_country IS NOT NULL';
4779
-                if ($olderthanmonths > 0) {
4779
+				if ($olderthanmonths > 0) {
4780 4780
 			if ($globalDBdriver == 'mysql') {
4781 4781
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4782 4782
 			} else {
4783 4783
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4784 4784
 			}
4785 4785
 		}
4786
-                if ($sincedate != '') {
4787
-            		if ($globalDBdriver == 'mysql') {
4786
+				if ($sincedate != '') {
4787
+					if ($globalDBdriver == 'mysql') {
4788 4788
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4789 4789
 			} else {
4790 4790
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4814,11 +4814,11 @@  discard block
 block discarded – undo
4814 4814
 	
4815 4815
 	
4816 4816
 	/**
4817
-	* Gets all aircraft types that have flown over
4818
-	*
4819
-	* @return Array the aircraft list
4820
-	*
4821
-	*/
4817
+	 * Gets all aircraft types that have flown over
4818
+	 *
4819
+	 * @return Array the aircraft list
4820
+	 *
4821
+	 */
4822 4822
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4823 4823
 	{
4824 4824
 		global $globalDBdriver;
@@ -4888,11 +4888,11 @@  discard block
 block discarded – undo
4888 4888
 	}
4889 4889
 
4890 4890
 	/**
4891
-	* Gets all aircraft types that have flown over by airline
4892
-	*
4893
-	* @return Array the aircraft list
4894
-	*
4895
-	*/
4891
+	 * Gets all aircraft types that have flown over by airline
4892
+	 *
4893
+	 * @return Array the aircraft list
4894
+	 *
4895
+	 */
4896 4896
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4897 4897
 	{
4898 4898
 		global $globalDBdriver;
@@ -4963,11 +4963,11 @@  discard block
 block discarded – undo
4963 4963
 	}
4964 4964
 
4965 4965
 	/**
4966
-	* Gets all aircraft types that have flown over by months
4967
-	*
4968
-	* @return Array the aircraft list
4969
-	*
4970
-	*/
4966
+	 * Gets all aircraft types that have flown over by months
4967
+	 *
4968
+	 * @return Array the aircraft list
4969
+	 *
4970
+	 */
4971 4971
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4972 4972
 	{
4973 4973
 		global $globalDBdriver;
@@ -5011,11 +5011,11 @@  discard block
 block discarded – undo
5011 5011
 
5012 5012
 
5013 5013
 	/**
5014
-	* Gets all aircraft registration that have flown over by aircaft icao
5015
-	*
5016
-	* @return Array the aircraft list
5017
-	*
5018
-	*/
5014
+	 * Gets all aircraft registration that have flown over by aircaft icao
5015
+	 *
5016
+	 * @return Array the aircraft list
5017
+	 *
5018
+	 */
5019 5019
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5020 5020
 	{
5021 5021
 		$Image = new Image($this->db);
@@ -5054,11 +5054,11 @@  discard block
 block discarded – undo
5054 5054
 
5055 5055
 
5056 5056
 	/**
5057
-	* Gets all aircraft types that have flown over by airline icao
5058
-	*
5059
-	* @return Array the aircraft list
5060
-	*
5061
-	*/
5057
+	 * Gets all aircraft types that have flown over by airline icao
5058
+	 *
5059
+	 * @return Array the aircraft list
5060
+	 *
5061
+	 */
5062 5062
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5063 5063
 	{
5064 5064
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5087,11 +5087,11 @@  discard block
 block discarded – undo
5087 5087
 
5088 5088
 
5089 5089
 	/**
5090
-	* Gets all aircraft registration that have flown over by airline icao
5091
-	*
5092
-	* @return Array the aircraft list
5093
-	*
5094
-	*/
5090
+	 * Gets all aircraft registration that have flown over by airline icao
5091
+	 *
5092
+	 * @return Array the aircraft list
5093
+	 *
5094
+	 */
5095 5095
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5096 5096
 	{
5097 5097
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5129,11 +5129,11 @@  discard block
 block discarded – undo
5129 5129
 
5130 5130
 
5131 5131
 	/**
5132
-	* Gets all aircraft manufacturer that have flown over by airline icao
5133
-	*
5134
-	* @return Array the aircraft list
5135
-	*
5136
-	*/
5132
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5133
+	 *
5134
+	 * @return Array the aircraft list
5135
+	 *
5136
+	 */
5137 5137
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5138 5138
 	{
5139 5139
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5161,11 +5161,11 @@  discard block
 block discarded – undo
5161 5161
 
5162 5162
 
5163 5163
 	/**
5164
-	* Gets all aircraft types that have flown over by airline icao
5165
-	*
5166
-	* @return Array the aircraft list
5167
-	*
5168
-	*/
5164
+	 * Gets all aircraft types that have flown over by airline icao
5165
+	 *
5166
+	 * @return Array the aircraft list
5167
+	 *
5168
+	 */
5169 5169
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5170 5170
 	{
5171 5171
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5194,11 +5194,11 @@  discard block
 block discarded – undo
5194 5194
 
5195 5195
 
5196 5196
 	/**
5197
-	* Gets all aircraft registration that have flown over by airport icao
5198
-	*
5199
-	* @return Array the aircraft list
5200
-	*
5201
-	*/
5197
+	 * Gets all aircraft registration that have flown over by airport icao
5198
+	 *
5199
+	 * @return Array the aircraft list
5200
+	 *
5201
+	 */
5202 5202
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5203 5203
 	{
5204 5204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5235,11 +5235,11 @@  discard block
 block discarded – undo
5235 5235
 	
5236 5236
 	
5237 5237
 	/**
5238
-	* Gets all aircraft manufacturer that have flown over by airport icao
5239
-	*
5240
-	* @return Array the aircraft list
5241
-	*
5242
-	*/
5238
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5239
+	 *
5240
+	 * @return Array the aircraft list
5241
+	 *
5242
+	 */
5243 5243
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5244 5244
 	{
5245 5245
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5265,11 +5265,11 @@  discard block
 block discarded – undo
5265 5265
 	}
5266 5266
 
5267 5267
 	/**
5268
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5269
-	*
5270
-	* @return Array the aircraft list
5271
-	*
5272
-	*/
5268
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5269
+	 *
5270
+	 * @return Array the aircraft list
5271
+	 *
5272
+	 */
5273 5273
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5274 5274
 	{
5275 5275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5296,11 +5296,11 @@  discard block
 block discarded – undo
5296 5296
 
5297 5297
 
5298 5298
 	/**
5299
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5300
-	*
5301
-	* @return Array the aircraft list
5302
-	*
5303
-	*/
5299
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5300
+	 *
5301
+	 * @return Array the aircraft list
5302
+	 *
5303
+	 */
5304 5304
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5305 5305
 	{
5306 5306
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5336,11 +5336,11 @@  discard block
 block discarded – undo
5336 5336
 	}
5337 5337
 
5338 5338
 	/**
5339
-	* Gets all aircraft types that have flown over by date
5340
-	*
5341
-	* @return Array the aircraft list
5342
-	*
5343
-	*/
5339
+	 * Gets all aircraft types that have flown over by date
5340
+	 *
5341
+	 * @return Array the aircraft list
5342
+	 *
5343
+	 */
5344 5344
 	public function countAllAircraftTypesByDate($date,$filters = array())
5345 5345
 	{
5346 5346
 		global $globalTimezone, $globalDBdriver;
@@ -5382,11 +5382,11 @@  discard block
 block discarded – undo
5382 5382
 
5383 5383
 
5384 5384
 	/**
5385
-	* Gets all aircraft registration that have flown over by date
5386
-	*
5387
-	* @return Array the aircraft list
5388
-	*
5389
-	*/
5385
+	 * Gets all aircraft registration that have flown over by date
5386
+	 *
5387
+	 * @return Array the aircraft list
5388
+	 *
5389
+	 */
5390 5390
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5391 5391
 	{
5392 5392
 		global $globalTimezone, $globalDBdriver;
@@ -5437,11 +5437,11 @@  discard block
 block discarded – undo
5437 5437
 
5438 5438
 
5439 5439
 	/**
5440
-	* Gets all aircraft manufacturer that have flown over by date
5441
-	*
5442
-	* @return Array the aircraft manufacturer list
5443
-	*
5444
-	*/
5440
+	 * Gets all aircraft manufacturer that have flown over by date
5441
+	 *
5442
+	 * @return Array the aircraft manufacturer list
5443
+	 *
5444
+	 */
5445 5445
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5446 5446
 	{
5447 5447
 		global $globalTimezone, $globalDBdriver;
@@ -5483,11 +5483,11 @@  discard block
 block discarded – undo
5483 5483
 
5484 5484
 
5485 5485
 	/**
5486
-	* Gets all aircraft types that have flown over by ident/callsign
5487
-	*
5488
-	* @return Array the aircraft list
5489
-	*
5490
-	*/
5486
+	 * Gets all aircraft types that have flown over by ident/callsign
5487
+	 *
5488
+	 * @return Array the aircraft list
5489
+	 *
5490
+	 */
5491 5491
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5492 5492
 	{
5493 5493
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5516,11 +5516,11 @@  discard block
 block discarded – undo
5516 5516
 
5517 5517
 
5518 5518
 	/**
5519
-	* Gets all aircraft registration that have flown over by ident/callsign
5520
-	*
5521
-	* @return Array the aircraft list
5522
-	*
5523
-	*/
5519
+	 * Gets all aircraft registration that have flown over by ident/callsign
5520
+	 *
5521
+	 * @return Array the aircraft list
5522
+	 *
5523
+	 */
5524 5524
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5525 5525
 	{
5526 5526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5560,11 +5560,11 @@  discard block
 block discarded – undo
5560 5560
 
5561 5561
 
5562 5562
 	/**
5563
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5564
-	*
5565
-	* @return Array the aircraft manufacturer list
5566
-	*
5567
-	*/
5563
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5564
+	 *
5565
+	 * @return Array the aircraft manufacturer list
5566
+	 *
5567
+	 */
5568 5568
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5569 5569
 	{
5570 5570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5590,11 +5590,11 @@  discard block
 block discarded – undo
5590 5590
 
5591 5591
 
5592 5592
 	/**
5593
-	* Gets all aircraft types that have flown over by route
5594
-	*
5595
-	* @return Array the aircraft list
5596
-	*
5597
-	*/
5593
+	 * Gets all aircraft types that have flown over by route
5594
+	 *
5595
+	 * @return Array the aircraft list
5596
+	 *
5597
+	 */
5598 5598
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5599 5599
 	{
5600 5600
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5623,11 +5623,11 @@  discard block
 block discarded – undo
5623 5623
 	}
5624 5624
 
5625 5625
 	/**
5626
-	* Gets all aircraft registration that have flown over by route
5627
-	*
5628
-	* @return Array the aircraft list
5629
-	*
5630
-	*/
5626
+	 * Gets all aircraft registration that have flown over by route
5627
+	 *
5628
+	 * @return Array the aircraft list
5629
+	 *
5630
+	 */
5631 5631
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5632 5632
 	{
5633 5633
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5669,11 +5669,11 @@  discard block
 block discarded – undo
5669 5669
 	
5670 5670
 	
5671 5671
 	/**
5672
-	* Gets all aircraft manufacturer that have flown over by route
5673
-	*
5674
-	* @return Array the aircraft manufacturer list
5675
-	*
5676
-	*/
5672
+	 * Gets all aircraft manufacturer that have flown over by route
5673
+	 *
5674
+	 * @return Array the aircraft manufacturer list
5675
+	 *
5676
+	 */
5677 5677
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5678 5678
 	{
5679 5679
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5707,11 +5707,11 @@  discard block
 block discarded – undo
5707 5707
 	
5708 5708
 	
5709 5709
 	/**
5710
-	* Gets all aircraft types that have flown over by country
5711
-	*
5712
-	* @return Array the aircraft list
5713
-	*
5714
-	*/
5710
+	 * Gets all aircraft types that have flown over by country
5711
+	 *
5712
+	 * @return Array the aircraft list
5713
+	 *
5714
+	 */
5715 5715
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5716 5716
 	{
5717 5717
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5742,11 +5742,11 @@  discard block
 block discarded – undo
5742 5742
 
5743 5743
 
5744 5744
 	/**
5745
-	* Gets all aircraft registration that have flown over by country
5746
-	*
5747
-	* @return Array the aircraft list
5748
-	*
5749
-	*/
5745
+	 * Gets all aircraft registration that have flown over by country
5746
+	 *
5747
+	 * @return Array the aircraft list
5748
+	 *
5749
+	 */
5750 5750
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5751 5751
 	{
5752 5752
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5786,11 +5786,11 @@  discard block
 block discarded – undo
5786 5786
 	
5787 5787
 	
5788 5788
 	/**
5789
-	* Gets all aircraft manufacturer that have flown over by country
5790
-	*
5791
-	* @return Array the aircraft manufacturer list
5792
-	*
5793
-	*/
5789
+	 * Gets all aircraft manufacturer that have flown over by country
5790
+	 *
5791
+	 * @return Array the aircraft manufacturer list
5792
+	 *
5793
+	 */
5794 5794
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5795 5795
 	{
5796 5796
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5821,18 +5821,18 @@  discard block
 block discarded – undo
5821 5821
 	
5822 5822
 	
5823 5823
 	/**
5824
-	* Gets all aircraft manufacturers that have flown over
5825
-	*
5826
-	* @return Array the aircraft list
5827
-	*
5828
-	*/
5824
+	 * Gets all aircraft manufacturers that have flown over
5825
+	 *
5826
+	 * @return Array the aircraft list
5827
+	 *
5828
+	 */
5829 5829
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
5830 5830
 	{
5831 5831
 		global $globalDBdriver;
5832 5832
 		$filter_query = $this->getFilter($filters,true,true);
5833 5833
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5834 5834
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5835
-                $query_values = array();
5835
+				$query_values = array();
5836 5836
 		if ($year != '') {
5837 5837
 			if ($globalDBdriver == 'mysql') {
5838 5838
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -5885,11 +5885,11 @@  discard block
 block discarded – undo
5885 5885
 	
5886 5886
 	
5887 5887
 	/**
5888
-	* Gets all aircraft registrations that have flown over
5889
-	*
5890
-	* @return Array the aircraft list
5891
-	*
5892
-	*/
5888
+	 * Gets all aircraft registrations that have flown over
5889
+	 *
5890
+	 * @return Array the aircraft list
5891
+	 *
5892
+	 */
5893 5893
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
5894 5894
 	{
5895 5895
 		global $globalDBdriver;
@@ -5897,15 +5897,15 @@  discard block
 block discarded – undo
5897 5897
 		$filter_query = $this->getFilter($filters,true,true);
5898 5898
 		$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    
5899 5899
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5900
-                if ($olderthanmonths > 0) {
5901
-            		if ($globalDBdriver == 'mysql') {
5900
+				if ($olderthanmonths > 0) {
5901
+					if ($globalDBdriver == 'mysql') {
5902 5902
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5903 5903
 			} else {
5904 5904
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5905 5905
 			}
5906 5906
 		}
5907
-                if ($sincedate != '') {
5908
-            		if ($globalDBdriver == 'mysql') {
5907
+				if ($sincedate != '') {
5908
+					if ($globalDBdriver == 'mysql') {
5909 5909
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5910 5910
 			} else {
5911 5911
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5970,11 +5970,11 @@  discard block
 block discarded – undo
5970 5970
 
5971 5971
 
5972 5972
 	/**
5973
-	* Gets all aircraft registrations that have flown over
5974
-	*
5975
-	* @return Array the aircraft list
5976
-	*
5977
-	*/
5973
+	 * Gets all aircraft registrations that have flown over
5974
+	 *
5975
+	 * @return Array the aircraft list
5976
+	 *
5977
+	 */
5978 5978
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5979 5979
 	{
5980 5980
 		global $globalDBdriver;
@@ -5982,15 +5982,15 @@  discard block
 block discarded – undo
5982 5982
 		$Image = new Image($this->db);
5983 5983
 		$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    
5984 5984
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5985
-                if ($olderthanmonths > 0) {
5986
-            		if ($globalDBdriver == 'mysql') {
5985
+				if ($olderthanmonths > 0) {
5986
+					if ($globalDBdriver == 'mysql') {
5987 5987
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5988 5988
 			} else {
5989 5989
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5990 5990
 			}
5991 5991
 		}
5992
-                if ($sincedate != '') {
5993
-            		if ($globalDBdriver == 'mysql') {
5992
+				if ($sincedate != '') {
5993
+					if ($globalDBdriver == 'mysql') {
5994 5994
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5995 5995
 			} else {
5996 5996
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5999,7 +5999,7 @@  discard block
 block discarded – undo
5999 5999
 
6000 6000
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6001 6001
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6002
-                $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";
6002
+				$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";
6003 6003
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6004 6004
 		
6005 6005
 		$sth = $this->db->prepare($query);
@@ -6031,26 +6031,26 @@  discard block
 block discarded – undo
6031 6031
 	
6032 6032
 	
6033 6033
 	/**
6034
-	* Gets all departure airports of the airplanes that have flown over
6035
-	*
6036
-	* @return Array the airport list
6037
-	*
6038
-	*/
6034
+	 * Gets all departure airports of the airplanes that have flown over
6035
+	 *
6036
+	 * @return Array the airport list
6037
+	 *
6038
+	 */
6039 6039
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6040 6040
 	{
6041 6041
 		global $globalDBdriver;
6042 6042
 		$filter_query = $this->getFilter($filters,true,true);
6043 6043
 		$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 
6044 6044
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6045
-                if ($olderthanmonths > 0) {
6046
-            		if ($globalDBdriver == 'mysql') {
6045
+				if ($olderthanmonths > 0) {
6046
+					if ($globalDBdriver == 'mysql') {
6047 6047
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6048 6048
 			} else {
6049 6049
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6050 6050
 			}
6051
-                }
6052
-                if ($sincedate != '') {
6053
-            		if ($globalDBdriver == 'mysql') {
6051
+				}
6052
+				if ($sincedate != '') {
6053
+					if ($globalDBdriver == 'mysql') {
6054 6054
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6055 6055
 			} else {
6056 6056
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
 				$query_values = array_merge($query_values,array(':day' => $day));
6085 6085
 			}
6086 6086
 		}
6087
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6087
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6088 6088
 				ORDER BY airport_departure_icao_count DESC";
6089 6089
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6090 6090
 
@@ -6107,35 +6107,35 @@  discard block
 block discarded – undo
6107 6107
 	}
6108 6108
 
6109 6109
 	/**
6110
-	* Gets all departure airports of the airplanes that have flown over
6111
-	*
6112
-	* @return Array the airport list
6113
-	*
6114
-	*/
6110
+	 * Gets all departure airports of the airplanes that have flown over
6111
+	 *
6112
+	 * @return Array the airport list
6113
+	 *
6114
+	 */
6115 6115
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6116 6116
 	{
6117 6117
 		global $globalDBdriver;
6118 6118
 		$filter_query = $this->getFilter($filters,true,true);
6119 6119
 		$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 
6120 6120
 			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 <> '' ";
6121
-                if ($olderthanmonths > 0) {
6122
-            		if ($globalDBdriver == 'mysql') {
6121
+				if ($olderthanmonths > 0) {
6122
+					if ($globalDBdriver == 'mysql') {
6123 6123
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6124 6124
 			} else {
6125 6125
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6126 6126
 			}
6127
-                }
6128
-                if ($sincedate != '') {
6129
-            		if ($globalDBdriver == 'mysql') {
6127
+				}
6128
+				if ($sincedate != '') {
6129
+					if ($globalDBdriver == 'mysql') {
6130 6130
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6131 6131
 			} else {
6132 6132
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6133 6133
 			}
6134 6134
 		}
6135 6135
 
6136
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6137
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6138
-                $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
6136
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6137
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6138
+				$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
6139 6139
 				ORDER BY airport_departure_icao_count DESC";
6140 6140
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6141 6141
       
@@ -6160,26 +6160,26 @@  discard block
 block discarded – undo
6160 6160
 	}
6161 6161
 
6162 6162
 	/**
6163
-	* Gets all detected departure airports of the airplanes that have flown over
6164
-	*
6165
-	* @return Array the airport list
6166
-	*
6167
-	*/
6163
+	 * Gets all detected departure airports of the airplanes that have flown over
6164
+	 *
6165
+	 * @return Array the airport list
6166
+	 *
6167
+	 */
6168 6168
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6169 6169
 	{
6170 6170
 		global $globalDBdriver;
6171 6171
 		$filter_query = $this->getFilter($filters,true,true);
6172 6172
 		$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
6173 6173
 				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";
6174
-                if ($olderthanmonths > 0) {
6175
-            		if ($globalDBdriver == 'mysql') {
6174
+				if ($olderthanmonths > 0) {
6175
+					if ($globalDBdriver == 'mysql') {
6176 6176
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6177 6177
 			} else {
6178 6178
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6179 6179
 			}
6180
-                }
6181
-                if ($sincedate != '') {
6182
-            		if ($globalDBdriver == 'mysql') {
6180
+				}
6181
+				if ($sincedate != '') {
6182
+					if ($globalDBdriver == 'mysql') {
6183 6183
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6184 6184
 			} else {
6185 6185
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6213,10 +6213,10 @@  discard block
 block discarded – undo
6213 6213
 				$query_values = array_merge($query_values,array(':day' => $day));
6214 6214
 			}
6215 6215
 		}
6216
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6216
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6217 6217
 				ORDER BY airport_departure_icao_count DESC";
6218 6218
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6219
-    		//echo $query;
6219
+			//echo $query;
6220 6220
 		$sth = $this->db->prepare($query);
6221 6221
 		$sth->execute($query_values);
6222 6222
       
@@ -6237,35 +6237,35 @@  discard block
 block discarded – undo
6237 6237
 	}
6238 6238
 	
6239 6239
 	/**
6240
-	* Gets all detected departure airports of the airplanes that have flown over
6241
-	*
6242
-	* @return Array the airport list
6243
-	*
6244
-	*/
6240
+	 * Gets all detected departure airports of the airplanes that have flown over
6241
+	 *
6242
+	 * @return Array the airport list
6243
+	 *
6244
+	 */
6245 6245
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6246 6246
 	{
6247 6247
 		global $globalDBdriver;
6248 6248
 		$filter_query = $this->getFilter($filters,true,true);
6249 6249
 		$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
6250 6250
 				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 ";
6251
-                if ($olderthanmonths > 0) {
6252
-            		if ($globalDBdriver == 'mysql') {
6251
+				if ($olderthanmonths > 0) {
6252
+					if ($globalDBdriver == 'mysql') {
6253 6253
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6254 6254
 			} else {
6255 6255
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6256 6256
 			}
6257
-                }
6258
-                if ($sincedate != '') {
6259
-            		if ($globalDBdriver == 'mysql') {
6257
+				}
6258
+				if ($sincedate != '') {
6259
+					if ($globalDBdriver == 'mysql') {
6260 6260
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6261 6261
 			} else {
6262 6262
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6263 6263
 			}
6264 6264
 		}
6265 6265
 
6266
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6267
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6268
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6266
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6267
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6268
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6269 6269
 				ORDER BY airport_departure_icao_count DESC";
6270 6270
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6271 6271
       
@@ -6290,11 +6290,11 @@  discard block
 block discarded – undo
6290 6290
 	}	
6291 6291
 	
6292 6292
 	/**
6293
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6294
-	*
6295
-	* @return Array the airport list
6296
-	*
6297
-	*/
6293
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6294
+	 *
6295
+	 * @return Array the airport list
6296
+	 *
6297
+	 */
6298 6298
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6299 6299
 	{
6300 6300
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6328,11 +6328,11 @@  discard block
 block discarded – undo
6328 6328
 	
6329 6329
 	
6330 6330
 	/**
6331
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6332
-	*
6333
-	* @return Array the airport list
6334
-	*
6335
-	*/
6331
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6332
+	 *
6333
+	 * @return Array the airport list
6334
+	 *
6335
+	 */
6336 6336
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6337 6337
 	{
6338 6338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6363,11 +6363,11 @@  discard block
 block discarded – undo
6363 6363
 	
6364 6364
 	
6365 6365
 	/**
6366
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6367
-	*
6368
-	* @return Array the airport list
6369
-	*
6370
-	*/
6366
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6367
+	 *
6368
+	 * @return Array the airport list
6369
+	 *
6370
+	 */
6371 6371
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6372 6372
 	{
6373 6373
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6400,11 +6400,11 @@  discard block
 block discarded – undo
6400 6400
 	
6401 6401
 	
6402 6402
 	/**
6403
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6404
-	*
6405
-	* @return Array the airport list
6406
-	*
6407
-	*/
6403
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6404
+	 *
6405
+	 * @return Array the airport list
6406
+	 *
6407
+	 */
6408 6408
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6409 6409
 	{
6410 6410
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6434,11 +6434,11 @@  discard block
 block discarded – undo
6434 6434
 	
6435 6435
 	
6436 6436
 	/**
6437
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6438
-	*
6439
-	* @return Array the airport list
6440
-	*
6441
-	*/
6437
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6438
+	 *
6439
+	 * @return Array the airport list
6440
+	 *
6441
+	 */
6442 6442
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6443 6443
 	{
6444 6444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6471,11 +6471,11 @@  discard block
 block discarded – undo
6471 6471
 	
6472 6472
 	
6473 6473
 	/**
6474
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6475
-	*
6476
-	* @return Array the airport list
6477
-	*
6478
-	*/
6474
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6475
+	 *
6476
+	 * @return Array the airport list
6477
+	 *
6478
+	 */
6479 6479
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6480 6480
 	{
6481 6481
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6505,11 +6505,11 @@  discard block
 block discarded – undo
6505 6505
 	
6506 6506
 	
6507 6507
 	/**
6508
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6509
-	*
6510
-	* @return Array the airport list
6511
-	*
6512
-	*/
6508
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6509
+	 *
6510
+	 * @return Array the airport list
6511
+	 *
6512
+	 */
6513 6513
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6514 6514
 	{
6515 6515
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6542,11 +6542,11 @@  discard block
 block discarded – undo
6542 6542
 	
6543 6543
 	
6544 6544
 	/**
6545
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6546
-	*
6547
-	* @return Array the airport list
6548
-	*
6549
-	*/
6545
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6546
+	 *
6547
+	 * @return Array the airport list
6548
+	 *
6549
+	 */
6550 6550
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6551 6551
 	{
6552 6552
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6577,11 +6577,11 @@  discard block
 block discarded – undo
6577 6577
 	
6578 6578
 	
6579 6579
 	/**
6580
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6581
-	*
6582
-	* @return Array the airport list
6583
-	*
6584
-	*/
6580
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6581
+	 *
6582
+	 * @return Array the airport list
6583
+	 *
6584
+	 */
6585 6585
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6586 6586
 	{
6587 6587
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6614,11 +6614,11 @@  discard block
 block discarded – undo
6614 6614
 	
6615 6615
 	
6616 6616
 	/**
6617
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6618
-	*
6619
-	* @return Array the airport list
6620
-	*
6621
-	*/
6617
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6618
+	 *
6619
+	 * @return Array the airport list
6620
+	 *
6621
+	 */
6622 6622
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6623 6623
 	{
6624 6624
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6648,11 +6648,11 @@  discard block
 block discarded – undo
6648 6648
 	
6649 6649
 	
6650 6650
 	/**
6651
-	* Gets all departure airports of the airplanes that have flown over based on a date
6652
-	*
6653
-	* @return Array the airport list
6654
-	*
6655
-	*/
6651
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6652
+	 *
6653
+	 * @return Array the airport list
6654
+	 *
6655
+	 */
6656 6656
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6657 6657
 	{
6658 6658
 		global $globalTimezone, $globalDBdriver;
@@ -6698,11 +6698,11 @@  discard block
 block discarded – undo
6698 6698
 	
6699 6699
 	
6700 6700
 	/**
6701
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6702
-	*
6703
-	* @return Array the airport list
6704
-	*
6705
-	*/
6701
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6702
+	 *
6703
+	 * @return Array the airport list
6704
+	 *
6705
+	 */
6706 6706
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6707 6707
 	{
6708 6708
 		global $globalTimezone, $globalDBdriver;
@@ -6745,11 +6745,11 @@  discard block
 block discarded – undo
6745 6745
 	
6746 6746
 	
6747 6747
 	/**
6748
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6749
-	*
6750
-	* @return Array the airport list
6751
-	*
6752
-	*/
6748
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6749
+	 *
6750
+	 * @return Array the airport list
6751
+	 *
6752
+	 */
6753 6753
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6754 6754
 	{
6755 6755
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6783,11 +6783,11 @@  discard block
 block discarded – undo
6783 6783
 	
6784 6784
 	
6785 6785
 	/**
6786
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6787
-	*
6788
-	* @return Array the airport list
6789
-	*
6790
-	*/
6786
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6787
+	 *
6788
+	 * @return Array the airport list
6789
+	 *
6790
+	 */
6791 6791
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6792 6792
 	{
6793 6793
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6818,11 +6818,11 @@  discard block
 block discarded – undo
6818 6818
 	
6819 6819
 	
6820 6820
 	/**
6821
-	* Gets all departure airports of the airplanes that have flown over based on a country
6822
-	*
6823
-	* @return Array the airport list
6824
-	*
6825
-	*/
6821
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6822
+	 *
6823
+	 * @return Array the airport list
6824
+	 *
6825
+	 */
6826 6826
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6827 6827
 	{
6828 6828
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6856,11 +6856,11 @@  discard block
 block discarded – undo
6856 6856
 
6857 6857
 
6858 6858
 	/**
6859
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6860
-	*
6861
-	* @return Array the airport list
6862
-	*
6863
-	*/
6859
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6860
+	 *
6861
+	 * @return Array the airport list
6862
+	 *
6863
+	 */
6864 6864
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6865 6865
 	{
6866 6866
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6890,31 +6890,31 @@  discard block
 block discarded – undo
6890 6890
 	
6891 6891
 
6892 6892
 	/**
6893
-	* Gets all arrival airports of the airplanes that have flown over
6894
-	*
6895
-	* @param Boolean $limit Limit result to 10 or not
6896
-	* @param Integer $olderthanmonths Only show result older than x months
6897
-	* @param String $sincedate Only show result since x date
6898
-	* @param Boolean $icaoaskey Show result by ICAO
6899
-	* @param Array $filters Filter used here
6900
-	* @return Array the airport list
6901
-	*
6902
-	*/
6893
+	 * Gets all arrival airports of the airplanes that have flown over
6894
+	 *
6895
+	 * @param Boolean $limit Limit result to 10 or not
6896
+	 * @param Integer $olderthanmonths Only show result older than x months
6897
+	 * @param String $sincedate Only show result since x date
6898
+	 * @param Boolean $icaoaskey Show result by ICAO
6899
+	 * @param Array $filters Filter used here
6900
+	 * @return Array the airport list
6901
+	 *
6902
+	 */
6903 6903
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
6904 6904
 	{
6905 6905
 		global $globalDBdriver;
6906 6906
 		$filter_query = $this->getFilter($filters,true,true);
6907 6907
 		$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 
6908 6908
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6909
-                if ($olderthanmonths > 0) {
6910
-            		if ($globalDBdriver == 'mysql') {
6909
+				if ($olderthanmonths > 0) {
6910
+					if ($globalDBdriver == 'mysql') {
6911 6911
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6912 6912
 			} else {
6913 6913
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6914 6914
 			}
6915 6915
 		}
6916
-                if ($sincedate != '') {
6917
-            		if ($globalDBdriver == 'mysql') {
6916
+				if ($sincedate != '') {
6917
+					if ($globalDBdriver == 'mysql') {
6918 6918
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6919 6919
 			} else {
6920 6920
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6948,7 +6948,7 @@  discard block
 block discarded – undo
6948 6948
 				$query_values = array_merge($query_values,array(':day' => $day));
6949 6949
 			}
6950 6950
 		}
6951
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6951
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6952 6952
 					ORDER BY airport_arrival_icao_count DESC";
6953 6953
 		if ($limit) $query .= " LIMIT 10";
6954 6954
       
@@ -6977,35 +6977,35 @@  discard block
 block discarded – undo
6977 6977
 	}
6978 6978
 
6979 6979
 	/**
6980
-	* Gets all arrival airports of the airplanes that have flown over
6981
-	*
6982
-	* @return Array the airport list
6983
-	*
6984
-	*/
6980
+	 * Gets all arrival airports of the airplanes that have flown over
6981
+	 *
6982
+	 * @return Array the airport list
6983
+	 *
6984
+	 */
6985 6985
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6986 6986
 	{
6987 6987
 		global $globalDBdriver;
6988 6988
 		$filter_query = $this->getFilter($filters,true,true);
6989 6989
 		$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 
6990 6990
 			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 <> '' ";
6991
-                if ($olderthanmonths > 0) {
6992
-            		if ($globalDBdriver == 'mysql') {
6991
+				if ($olderthanmonths > 0) {
6992
+					if ($globalDBdriver == 'mysql') {
6993 6993
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6994 6994
 			} else {
6995 6995
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6996 6996
 			}
6997 6997
 		}
6998
-                if ($sincedate != '') {
6999
-            		if ($globalDBdriver == 'mysql') {
6998
+				if ($sincedate != '') {
6999
+					if ($globalDBdriver == 'mysql') {
7000 7000
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7001 7001
 			} else {
7002 7002
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7003 7003
 			}
7004 7004
 		}
7005 7005
 
7006
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7007
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7008
-                $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
7006
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7007
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7008
+				$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
7009 7009
 					ORDER BY airport_arrival_icao_count DESC";
7010 7010
 		if ($limit) $query .= " LIMIT 10";
7011 7011
       
@@ -7036,26 +7036,26 @@  discard block
 block discarded – undo
7036 7036
 
7037 7037
 
7038 7038
 	/**
7039
-	* Gets all detected arrival airports of the airplanes that have flown over
7040
-	*
7041
-	* @return Array the airport list
7042
-	*
7043
-	*/
7039
+	 * Gets all detected arrival airports of the airplanes that have flown over
7040
+	 *
7041
+	 * @return Array the airport list
7042
+	 *
7043
+	 */
7044 7044
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7045 7045
 	{
7046 7046
 		global $globalDBdriver;
7047 7047
 		$filter_query = $this->getFilter($filters,true,true);
7048 7048
 		$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 
7049 7049
 			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";
7050
-                if ($olderthanmonths > 0) {
7051
-            		if ($globalDBdriver == 'mysql') {
7050
+				if ($olderthanmonths > 0) {
7051
+					if ($globalDBdriver == 'mysql') {
7052 7052
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7053 7053
 			} else {
7054 7054
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7055 7055
 			}
7056 7056
 		}
7057
-                if ($sincedate != '') {
7058
-            		if ($globalDBdriver == 'mysql') {
7057
+				if ($sincedate != '') {
7058
+					if ($globalDBdriver == 'mysql') {
7059 7059
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7060 7060
 			} else {
7061 7061
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7089,7 +7089,7 @@  discard block
 block discarded – undo
7089 7089
 				$query_values = array_merge($query_values,array(':day' => $day));
7090 7090
 			}
7091 7091
 		}
7092
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7092
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7093 7093
 					ORDER BY airport_arrival_icao_count DESC";
7094 7094
 		if ($limit) $query .= " LIMIT 10";
7095 7095
       
@@ -7117,35 +7117,35 @@  discard block
 block discarded – undo
7117 7117
 	}
7118 7118
 	
7119 7119
 	/**
7120
-	* Gets all detected arrival airports of the airplanes that have flown over
7121
-	*
7122
-	* @return Array the airport list
7123
-	*
7124
-	*/
7120
+	 * Gets all detected arrival airports of the airplanes that have flown over
7121
+	 *
7122
+	 * @return Array the airport list
7123
+	 *
7124
+	 */
7125 7125
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7126 7126
 	{
7127 7127
 		global $globalDBdriver;
7128 7128
 		$filter_query = $this->getFilter($filters,true,true);
7129 7129
 		$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 
7130 7130
 			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 ";
7131
-                if ($olderthanmonths > 0) {
7132
-            		if ($globalDBdriver == 'mysql') {
7131
+				if ($olderthanmonths > 0) {
7132
+					if ($globalDBdriver == 'mysql') {
7133 7133
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7134 7134
 			} else {
7135 7135
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7136 7136
 			}
7137 7137
 		}
7138
-                if ($sincedate != '') {
7139
-            		if ($globalDBdriver == 'mysql') {
7138
+				if ($sincedate != '') {
7139
+					if ($globalDBdriver == 'mysql') {
7140 7140
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7141 7141
 			} else {
7142 7142
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7143 7143
 			}
7144 7144
 		}
7145 7145
 
7146
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7147
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7148
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7146
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7147
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7148
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7149 7149
 					ORDER BY airport_arrival_icao_count DESC";
7150 7150
 		if ($limit) $query .= " LIMIT 10";
7151 7151
       
@@ -7175,11 +7175,11 @@  discard block
 block discarded – undo
7175 7175
 	}	
7176 7176
 	
7177 7177
 	/**
7178
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7179
-	*
7180
-	* @return Array the airport list
7181
-	*
7182
-	*/
7178
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7179
+	 *
7180
+	 * @return Array the airport list
7181
+	 *
7182
+	 */
7183 7183
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7184 7184
 	{
7185 7185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7211,11 +7211,11 @@  discard block
 block discarded – undo
7211 7211
 	
7212 7212
 	
7213 7213
 	/**
7214
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7215
-	*
7216
-	* @return Array the airport list
7217
-	*
7218
-	*/
7214
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7215
+	 *
7216
+	 * @return Array the airport list
7217
+	 *
7218
+	 */
7219 7219
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7220 7220
 	{
7221 7221
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7246,11 +7246,11 @@  discard block
 block discarded – undo
7246 7246
 	
7247 7247
 	
7248 7248
 	/**
7249
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7250
-	*
7251
-	* @return Array the airport list
7252
-	*
7253
-	*/
7249
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7250
+	 *
7251
+	 * @return Array the airport list
7252
+	 *
7253
+	 */
7254 7254
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7255 7255
 	{
7256 7256
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7284,11 +7284,11 @@  discard block
 block discarded – undo
7284 7284
 	
7285 7285
 	
7286 7286
 	/**
7287
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7288
-	*
7289
-	* @return Array the airport list
7290
-	*
7291
-	*/
7287
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7288
+	 *
7289
+	 * @return Array the airport list
7290
+	 *
7291
+	 */
7292 7292
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7293 7293
 	{
7294 7294
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7318,11 +7318,11 @@  discard block
 block discarded – undo
7318 7318
 	
7319 7319
 	
7320 7320
 	/**
7321
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7322
-	*
7323
-	* @return Array the airport list
7324
-	*
7325
-	*/
7321
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7322
+	 *
7323
+	 * @return Array the airport list
7324
+	 *
7325
+	 */
7326 7326
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7327 7327
 	{
7328 7328
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7356,11 +7356,11 @@  discard block
 block discarded – undo
7356 7356
 	
7357 7357
 	
7358 7358
 	/**
7359
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7360
-	*
7361
-	* @return Array the airport list
7362
-	*
7363
-	*/
7359
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7360
+	 *
7361
+	 * @return Array the airport list
7362
+	 *
7363
+	 */
7364 7364
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7365 7365
 	{
7366 7366
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7391,11 +7391,11 @@  discard block
 block discarded – undo
7391 7391
 	
7392 7392
 	
7393 7393
 	/**
7394
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
7395
-	*
7396
-	* @return Array the airport list
7397
-	*
7398
-	*/
7394
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
7395
+	 *
7396
+	 * @return Array the airport list
7397
+	 *
7398
+	 */
7399 7399
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7400 7400
 	{
7401 7401
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7428,11 +7428,11 @@  discard block
 block discarded – undo
7428 7428
 	
7429 7429
 	
7430 7430
 	/**
7431
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7432
-	*
7433
-	* @return Array the airport list
7434
-	*
7435
-	*/
7431
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7432
+	 *
7433
+	 * @return Array the airport list
7434
+	 *
7435
+	 */
7436 7436
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7437 7437
 	{
7438 7438
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7462,11 +7462,11 @@  discard block
 block discarded – undo
7462 7462
 	
7463 7463
 	
7464 7464
 	/**
7465
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7466
-	*
7467
-	* @return Array the airport list
7468
-	*
7469
-	*/
7465
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7466
+	 *
7467
+	 * @return Array the airport list
7468
+	 *
7469
+	 */
7470 7470
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7471 7471
 	{
7472 7472
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7500,11 +7500,11 @@  discard block
 block discarded – undo
7500 7500
 	
7501 7501
 	
7502 7502
 	/**
7503
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7504
-	*
7505
-	* @return Array the airport list
7506
-	*
7507
-	*/
7503
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7504
+	 *
7505
+	 * @return Array the airport list
7506
+	 *
7507
+	 */
7508 7508
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7509 7509
 	{
7510 7510
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7535,11 +7535,11 @@  discard block
 block discarded – undo
7535 7535
 	
7536 7536
 	
7537 7537
 	/**
7538
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7539
-	*
7540
-	* @return Array the airport list
7541
-	*
7542
-	*/
7538
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7539
+	 *
7540
+	 * @return Array the airport list
7541
+	 *
7542
+	 */
7543 7543
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7544 7544
 	{
7545 7545
 		global $globalTimezone, $globalDBdriver;
@@ -7585,11 +7585,11 @@  discard block
 block discarded – undo
7585 7585
 	
7586 7586
 	
7587 7587
 	/**
7588
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7589
-	*
7590
-	* @return Array the airport list
7591
-	*
7592
-	*/
7588
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7589
+	 *
7590
+	 * @return Array the airport list
7591
+	 *
7592
+	 */
7593 7593
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7594 7594
 	{
7595 7595
 		global $globalTimezone, $globalDBdriver;
@@ -7632,11 +7632,11 @@  discard block
 block discarded – undo
7632 7632
 	
7633 7633
 	
7634 7634
 	/**
7635
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7636
-	*
7637
-	* @return Array the airport list
7638
-	*
7639
-	*/
7635
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7636
+	 *
7637
+	 * @return Array the airport list
7638
+	 *
7639
+	 */
7640 7640
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7641 7641
 	{
7642 7642
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7669,11 +7669,11 @@  discard block
 block discarded – undo
7669 7669
 	
7670 7670
 	
7671 7671
 	/**
7672
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7673
-	*
7674
-	* @return Array the airport list
7675
-	*
7676
-	*/
7672
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7673
+	 *
7674
+	 * @return Array the airport list
7675
+	 *
7676
+	 */
7677 7677
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7678 7678
 	{
7679 7679
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7704,11 +7704,11 @@  discard block
 block discarded – undo
7704 7704
 	
7705 7705
 	
7706 7706
 	/**
7707
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7708
-	*
7709
-	* @return Array the airport list
7710
-	*
7711
-	*/
7707
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7708
+	 *
7709
+	 * @return Array the airport list
7710
+	 *
7711
+	 */
7712 7712
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7713 7713
 	{
7714 7714
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7741,11 +7741,11 @@  discard block
 block discarded – undo
7741 7741
 	
7742 7742
 	
7743 7743
 	/**
7744
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7745
-	*
7746
-	* @return Array the airport list
7747
-	*
7748
-	*/
7744
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7745
+	 *
7746
+	 * @return Array the airport list
7747
+	 *
7748
+	 */
7749 7749
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7750 7750
 	{
7751 7751
 		global $globalDBdriver;
@@ -7777,11 +7777,11 @@  discard block
 block discarded – undo
7777 7777
 
7778 7778
 
7779 7779
 	/**
7780
-	* Counts all airport departure countries
7781
-	*
7782
-	* @return Array the airport departure list
7783
-	*
7784
-	*/
7780
+	 * Counts all airport departure countries
7781
+	 *
7782
+	 * @return Array the airport departure list
7783
+	 *
7784
+	 */
7785 7785
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
7786 7786
 	{
7787 7787
 		global $globalDBdriver;
@@ -7840,11 +7840,11 @@  discard block
 block discarded – undo
7840 7840
 	
7841 7841
 	
7842 7842
 	/**
7843
-	* Counts all airport arrival countries
7844
-	*
7845
-	* @return Array the airport arrival list
7846
-	*
7847
-	*/
7843
+	 * Counts all airport arrival countries
7844
+	 *
7845
+	 * @return Array the airport arrival list
7846
+	 *
7847
+	 */
7848 7848
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
7849 7849
 	{
7850 7850
 		global $globalDBdriver;
@@ -7906,11 +7906,11 @@  discard block
 block discarded – undo
7906 7906
 
7907 7907
 
7908 7908
 	/**
7909
-	* Gets all route combinations
7910
-	*
7911
-	* @return Array the route list
7912
-	*
7913
-	*/
7909
+	 * Gets all route combinations
7910
+	 *
7911
+	 * @return Array the route list
7912
+	 *
7913
+	 */
7914 7914
 	public function countAllRoutes($filters = array())
7915 7915
 	{
7916 7916
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7949,11 +7949,11 @@  discard block
 block discarded – undo
7949 7949
 	
7950 7950
 	
7951 7951
 	/**
7952
-	* Gets all route combinations based on an aircraft
7953
-	*
7954
-	* @return Array the route list
7955
-	*
7956
-	*/
7952
+	 * Gets all route combinations based on an aircraft
7953
+	 *
7954
+	 * @return Array the route list
7955
+	 *
7956
+	 */
7957 7957
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7958 7958
 	{
7959 7959
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7989,11 +7989,11 @@  discard block
 block discarded – undo
7989 7989
 	
7990 7990
 	
7991 7991
 	/**
7992
-	* Gets all route combinations based on an aircraft registration
7993
-	*
7994
-	* @return Array the route list
7995
-	*
7996
-	*/
7992
+	 * Gets all route combinations based on an aircraft registration
7993
+	 *
7994
+	 * @return Array the route list
7995
+	 *
7996
+	 */
7997 7997
 	public function countAllRoutesByRegistration($registration, $filters = array())
7998 7998
 	{
7999 7999
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8031,11 +8031,11 @@  discard block
 block discarded – undo
8031 8031
 	
8032 8032
 	
8033 8033
 	/**
8034
-	* Gets all route combinations based on an airline
8035
-	*
8036
-	* @return Array the route list
8037
-	*
8038
-	*/
8034
+	 * Gets all route combinations based on an airline
8035
+	 *
8036
+	 * @return Array the route list
8037
+	 *
8038
+	 */
8039 8039
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8040 8040
 	{
8041 8041
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8073,11 +8073,11 @@  discard block
 block discarded – undo
8073 8073
 	
8074 8074
 	
8075 8075
 	/**
8076
-	* Gets all route combinations based on an airport
8077
-	*
8078
-	* @return Array the route list
8079
-	*
8080
-	*/
8076
+	 * Gets all route combinations based on an airport
8077
+	 *
8078
+	 * @return Array the route list
8079
+	 *
8080
+	 */
8081 8081
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8082 8082
 	{
8083 8083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8114,11 +8114,11 @@  discard block
 block discarded – undo
8114 8114
 	
8115 8115
 	
8116 8116
 	/**
8117
-	* Gets all route combinations based on an country
8118
-	*
8119
-	* @return Array the route list
8120
-	*
8121
-	*/
8117
+	 * Gets all route combinations based on an country
8118
+	 *
8119
+	 * @return Array the route list
8120
+	 *
8121
+	 */
8122 8122
 	public function countAllRoutesByCountry($country, $filters = array())
8123 8123
 	{
8124 8124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8154,11 +8154,11 @@  discard block
 block discarded – undo
8154 8154
 
8155 8155
 
8156 8156
 	/**
8157
-	* Gets all route combinations based on an date
8158
-	*
8159
-	* @return Array the route list
8160
-	*
8161
-	*/
8157
+	 * Gets all route combinations based on an date
8158
+	 *
8159
+	 * @return Array the route list
8160
+	 *
8161
+	 */
8162 8162
 	public function countAllRoutesByDate($date, $filters = array())
8163 8163
 	{
8164 8164
 		global $globalTimezone, $globalDBdriver;
@@ -8208,11 +8208,11 @@  discard block
 block discarded – undo
8208 8208
 	
8209 8209
 	
8210 8210
 	/**
8211
-	* Gets all route combinations based on an ident/callsign
8212
-	*
8213
-	* @return Array the route list
8214
-	*
8215
-	*/
8211
+	 * Gets all route combinations based on an ident/callsign
8212
+	 *
8213
+	 * @return Array the route list
8214
+	 *
8215
+	 */
8216 8216
 	public function countAllRoutesByIdent($ident, $filters = array())
8217 8217
 	{
8218 8218
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8249,11 +8249,11 @@  discard block
 block discarded – undo
8249 8249
 	
8250 8250
 	
8251 8251
 	/**
8252
-	* Gets all route combinations based on an manufacturer
8253
-	*
8254
-	* @return Array the route list
8255
-	*
8256
-	*/
8252
+	 * Gets all route combinations based on an manufacturer
8253
+	 *
8254
+	 * @return Array the route list
8255
+	 *
8256
+	 */
8257 8257
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8258 8258
 	{
8259 8259
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8291,11 +8291,11 @@  discard block
 block discarded – undo
8291 8291
 	
8292 8292
 	
8293 8293
 	/**
8294
-	* Gets all route combinations with waypoints
8295
-	*
8296
-	* @return Array the route list
8297
-	*
8298
-	*/
8294
+	 * Gets all route combinations with waypoints
8295
+	 *
8296
+	 * @return Array the route list
8297
+	 *
8298
+	 */
8299 8299
 	public function countAllRoutesWithWaypoints($filters = array())
8300 8300
 	{
8301 8301
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8332,11 +8332,11 @@  discard block
 block discarded – undo
8332 8332
 	}
8333 8333
 	
8334 8334
 	/**
8335
-	* Gets all callsigns that have flown over
8336
-	*
8337
-	* @return Array the callsign list
8338
-	*
8339
-	*/
8335
+	 * Gets all callsigns that have flown over
8336
+	 *
8337
+	 * @return Array the callsign list
8338
+	 *
8339
+	 */
8340 8340
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8341 8341
 	{
8342 8342
 		global $globalDBdriver;
@@ -8402,11 +8402,11 @@  discard block
 block discarded – undo
8402 8402
 	}
8403 8403
 
8404 8404
 	/**
8405
-	* Gets all callsigns that have flown over
8406
-	*
8407
-	* @return Array the callsign list
8408
-	*
8409
-	*/
8405
+	 * Gets all callsigns that have flown over
8406
+	 *
8407
+	 * @return Array the callsign list
8408
+	 *
8409
+	 */
8410 8410
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8411 8411
 	{
8412 8412
 		global $globalDBdriver;
@@ -8447,11 +8447,11 @@  discard block
 block discarded – undo
8447 8447
 
8448 8448
 
8449 8449
 	/**
8450
-	* Counts all dates
8451
-	*
8452
-	* @return Array the date list
8453
-	*
8454
-	*/
8450
+	 * Counts all dates
8451
+	 *
8452
+	 * @return Array the date list
8453
+	 *
8454
+	 */
8455 8455
 	public function countAllDates($filters = array())
8456 8456
 	{
8457 8457
 		global $globalTimezone, $globalDBdriver;
@@ -8496,11 +8496,11 @@  discard block
 block discarded – undo
8496 8496
 	}
8497 8497
 	
8498 8498
 	/**
8499
-	* Counts all dates
8500
-	*
8501
-	* @return Array the date list
8502
-	*
8503
-	*/
8499
+	 * Counts all dates
8500
+	 *
8501
+	 * @return Array the date list
8502
+	 *
8503
+	 */
8504 8504
 	public function countAllDatesByAirlines($filters = array())
8505 8505
 	{
8506 8506
 		global $globalTimezone, $globalDBdriver;
@@ -8545,11 +8545,11 @@  discard block
 block discarded – undo
8545 8545
 	}	
8546 8546
 	
8547 8547
 	/**
8548
-	* Counts all dates during the last 7 days
8549
-	*
8550
-	* @return Array the date list
8551
-	*
8552
-	*/
8548
+	 * Counts all dates during the last 7 days
8549
+	 *
8550
+	 * @return Array the date list
8551
+	 *
8552
+	 */
8553 8553
 	public function countAllDatesLast7Days($filters = array())
8554 8554
 	{
8555 8555
 		global $globalTimezone, $globalDBdriver;
@@ -8571,7 +8571,7 @@  discard block
 block discarded – undo
8571 8571
 			$query .= " GROUP BY date_name 
8572 8572
 								ORDER BY date_name ASC";
8573 8573
 			$query_data = array(':offset' => $offset);
8574
-    		}
8574
+			}
8575 8575
 		
8576 8576
 		$sth = $this->db->prepare($query);
8577 8577
 		$sth->execute($query_data);
@@ -8591,11 +8591,11 @@  discard block
 block discarded – undo
8591 8591
 	}
8592 8592
 
8593 8593
 	/**
8594
-	* Counts all dates during the last month
8595
-	*
8596
-	* @return Array the date list
8597
-	*
8598
-	*/
8594
+	 * Counts all dates during the last month
8595
+	 *
8596
+	 * @return Array the date list
8597
+	 *
8598
+	 */
8599 8599
 	public function countAllDatesLastMonth($filters = array())
8600 8600
 	{
8601 8601
 		global $globalTimezone, $globalDBdriver;
@@ -8617,7 +8617,7 @@  discard block
 block discarded – undo
8617 8617
 			$query .= " GROUP BY date_name 
8618 8618
 								ORDER BY date_name ASC";
8619 8619
 			$query_data = array(':offset' => $offset);
8620
-    		}
8620
+			}
8621 8621
 		
8622 8622
 		$sth = $this->db->prepare($query);
8623 8623
 		$sth->execute($query_data);
@@ -8638,11 +8638,11 @@  discard block
 block discarded – undo
8638 8638
 
8639 8639
 
8640 8640
 	/**
8641
-	* Counts all dates during the last month
8642
-	*
8643
-	* @return Array the date list
8644
-	*
8645
-	*/
8641
+	 * Counts all dates during the last month
8642
+	 *
8643
+	 * @return Array the date list
8644
+	 *
8645
+	 */
8646 8646
 	public function countAllDatesLastMonthByAirlines($filters = array())
8647 8647
 	{
8648 8648
 		global $globalTimezone, $globalDBdriver;
@@ -8665,7 +8665,7 @@  discard block
 block discarded – undo
8665 8665
 								GROUP BY spotter_output.airline_icao, date_name 
8666 8666
 								ORDER BY date_name ASC";
8667 8667
 			$query_data = array(':offset' => $offset);
8668
-    		}
8668
+			}
8669 8669
 		
8670 8670
 		$sth = $this->db->prepare($query);
8671 8671
 		$sth->execute($query_data);
@@ -8687,11 +8687,11 @@  discard block
 block discarded – undo
8687 8687
 	
8688 8688
 
8689 8689
 	/**
8690
-	* Counts all month
8691
-	*
8692
-	* @return Array the month list
8693
-	*
8694
-	*/
8690
+	 * Counts all month
8691
+	 *
8692
+	 * @return Array the month list
8693
+	 *
8694
+	 */
8695 8695
 	public function countAllMonths($filters = array())
8696 8696
 	{
8697 8697
 		global $globalTimezone, $globalDBdriver;
@@ -8733,11 +8733,11 @@  discard block
 block discarded – undo
8733 8733
 	}
8734 8734
 
8735 8735
 	/**
8736
-	* Counts all month
8737
-	*
8738
-	* @return Array the month list
8739
-	*
8740
-	*/
8736
+	 * Counts all month
8737
+	 *
8738
+	 * @return Array the month list
8739
+	 *
8740
+	 */
8741 8741
 	public function countAllMonthsByAirlines($filters = array())
8742 8742
 	{
8743 8743
 		global $globalTimezone, $globalDBdriver;
@@ -8782,11 +8782,11 @@  discard block
 block discarded – undo
8782 8782
 	}
8783 8783
 
8784 8784
 	/**
8785
-	* Counts all military month
8786
-	*
8787
-	* @return Array the month list
8788
-	*
8789
-	*/
8785
+	 * Counts all military month
8786
+	 *
8787
+	 * @return Array the month list
8788
+	 *
8789
+	 */
8790 8790
 	public function countAllMilitaryMonths($filters = array())
8791 8791
 	{
8792 8792
 		global $globalTimezone, $globalDBdriver;
@@ -8827,11 +8827,11 @@  discard block
 block discarded – undo
8827 8827
 	}
8828 8828
 	
8829 8829
 	/**
8830
-	* Counts all month owners
8831
-	*
8832
-	* @return Array the month list
8833
-	*
8834
-	*/
8830
+	 * Counts all month owners
8831
+	 *
8832
+	 * @return Array the month list
8833
+	 *
8834
+	 */
8835 8835
 	public function countAllMonthsOwners($filters = array())
8836 8836
 	{
8837 8837
 		global $globalTimezone, $globalDBdriver;
@@ -8873,11 +8873,11 @@  discard block
 block discarded – undo
8873 8873
 	}
8874 8874
 	
8875 8875
 	/**
8876
-	* Counts all month owners
8877
-	*
8878
-	* @return Array the month list
8879
-	*
8880
-	*/
8876
+	 * Counts all month owners
8877
+	 *
8878
+	 * @return Array the month list
8879
+	 *
8880
+	 */
8881 8881
 	public function countAllMonthsOwnersByAirlines($filters = array())
8882 8882
 	{
8883 8883
 		global $globalTimezone, $globalDBdriver;
@@ -8920,11 +8920,11 @@  discard block
 block discarded – undo
8920 8920
 	}
8921 8921
 
8922 8922
 	/**
8923
-	* Counts all month pilot
8924
-	*
8925
-	* @return Array the month list
8926
-	*
8927
-	*/
8923
+	 * Counts all month pilot
8924
+	 *
8925
+	 * @return Array the month list
8926
+	 *
8927
+	 */
8928 8928
 	public function countAllMonthsPilots($filters = array())
8929 8929
 	{
8930 8930
 		global $globalTimezone, $globalDBdriver;
@@ -8966,11 +8966,11 @@  discard block
 block discarded – undo
8966 8966
 	}
8967 8967
 	
8968 8968
 	/**
8969
-	* Counts all month pilot
8970
-	*
8971
-	* @return Array the month list
8972
-	*
8973
-	*/
8969
+	 * Counts all month pilot
8970
+	 *
8971
+	 * @return Array the month list
8972
+	 *
8973
+	 */
8974 8974
 	public function countAllMonthsPilotsByAirlines($filters = array())
8975 8975
 	{
8976 8976
 		global $globalTimezone, $globalDBdriver;
@@ -9013,11 +9013,11 @@  discard block
 block discarded – undo
9013 9013
 	}
9014 9014
 
9015 9015
 	/**
9016
-	* Counts all month airline
9017
-	*
9018
-	* @return Array the month list
9019
-	*
9020
-	*/
9016
+	 * Counts all month airline
9017
+	 *
9018
+	 * @return Array the month list
9019
+	 *
9020
+	 */
9021 9021
 	public function countAllMonthsAirlines($filters = array())
9022 9022
 	{
9023 9023
 		global $globalTimezone, $globalDBdriver;
@@ -9059,11 +9059,11 @@  discard block
 block discarded – undo
9059 9059
 	}
9060 9060
 	
9061 9061
 	/**
9062
-	* Counts all month aircraft
9063
-	*
9064
-	* @return Array the month list
9065
-	*
9066
-	*/
9062
+	 * Counts all month aircraft
9063
+	 *
9064
+	 * @return Array the month list
9065
+	 *
9066
+	 */
9067 9067
 	public function countAllMonthsAircrafts($filters = array())
9068 9068
 	{
9069 9069
 		global $globalTimezone, $globalDBdriver;
@@ -9106,11 +9106,11 @@  discard block
 block discarded – undo
9106 9106
 	
9107 9107
 
9108 9108
 	/**
9109
-	* Counts all month aircraft
9110
-	*
9111
-	* @return Array the month list
9112
-	*
9113
-	*/
9109
+	 * Counts all month aircraft
9110
+	 *
9111
+	 * @return Array the month list
9112
+	 *
9113
+	 */
9114 9114
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9115 9115
 	{
9116 9116
 		global $globalTimezone, $globalDBdriver;
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	}
9154 9154
 
9155 9155
 	/**
9156
-	* Counts all month real arrival
9157
-	*
9158
-	* @return Array the month list
9159
-	*
9160
-	*/
9156
+	 * Counts all month real arrival
9157
+	 *
9158
+	 * @return Array the month list
9159
+	 *
9160
+	 */
9161 9161
 	public function countAllMonthsRealArrivals($filters = array())
9162 9162
 	{
9163 9163
 		global $globalTimezone, $globalDBdriver;
@@ -9200,11 +9200,11 @@  discard block
 block discarded – undo
9200 9200
 	
9201 9201
 
9202 9202
 	/**
9203
-	* Counts all month real arrival
9204
-	*
9205
-	* @return Array the month list
9206
-	*
9207
-	*/
9203
+	 * Counts all month real arrival
9204
+	 *
9205
+	 * @return Array the month list
9206
+	 *
9207
+	 */
9208 9208
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9209 9209
 	{
9210 9210
 		global $globalTimezone, $globalDBdriver;
@@ -9248,11 +9248,11 @@  discard block
 block discarded – undo
9248 9248
 	
9249 9249
 
9250 9250
 	/**
9251
-	* Counts all dates during the last year
9252
-	*
9253
-	* @return Array the date list
9254
-	*
9255
-	*/
9251
+	 * Counts all dates during the last year
9252
+	 *
9253
+	 * @return Array the date list
9254
+	 *
9255
+	 */
9256 9256
 	public function countAllMonthsLastYear($filters)
9257 9257
 	{
9258 9258
 		global $globalTimezone, $globalDBdriver;
@@ -9274,7 +9274,7 @@  discard block
 block discarded – undo
9274 9274
 			$query .= " GROUP BY year_name, month_name
9275 9275
 								ORDER BY year_name, month_name ASC";
9276 9276
 			$query_data = array(':offset' => $offset);
9277
-    		}
9277
+			}
9278 9278
 		
9279 9279
 		$sth = $this->db->prepare($query);
9280 9280
 		$sth->execute($query_data);
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 	
9298 9298
 	
9299 9299
 	/**
9300
-	* Counts all hours
9301
-	*
9302
-	* @return Array the hour list
9303
-	*
9304
-	*/
9300
+	 * Counts all hours
9301
+	 *
9302
+	 * @return Array the hour list
9303
+	 *
9304
+	 */
9305 9305
 	public function countAllHours($orderby,$filters = array())
9306 9306
 	{
9307 9307
 		global $globalTimezone, $globalDBdriver;
@@ -9362,11 +9362,11 @@  discard block
 block discarded – undo
9362 9362
 	}
9363 9363
 	
9364 9364
 	/**
9365
-	* Counts all hours
9366
-	*
9367
-	* @return Array the hour list
9368
-	*
9369
-	*/
9365
+	 * Counts all hours
9366
+	 *
9367
+	 * @return Array the hour list
9368
+	 *
9369
+	 */
9370 9370
 	public function countAllHoursByAirlines($orderby, $filters = array())
9371 9371
 	{
9372 9372
 		global $globalTimezone, $globalDBdriver;
@@ -9429,11 +9429,11 @@  discard block
 block discarded – undo
9429 9429
 
9430 9430
 
9431 9431
 	/**
9432
-	* Counts all hours by airline
9433
-	*
9434
-	* @return Array the hour list
9435
-	*
9436
-	*/
9432
+	 * Counts all hours by airline
9433
+	 *
9434
+	 * @return Array the hour list
9435
+	 *
9436
+	 */
9437 9437
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9438 9438
 	{
9439 9439
 		global $globalTimezone, $globalDBdriver;
@@ -9479,11 +9479,11 @@  discard block
 block discarded – undo
9479 9479
 	
9480 9480
 	
9481 9481
 	/**
9482
-	* Counts all hours by aircraft
9483
-	*
9484
-	* @return Array the hour list
9485
-	*
9486
-	*/
9482
+	 * Counts all hours by aircraft
9483
+	 *
9484
+	 * @return Array the hour list
9485
+	 *
9486
+	 */
9487 9487
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
9488 9488
 	{
9489 9489
 		global $globalTimezone, $globalDBdriver;
@@ -9526,11 +9526,11 @@  discard block
 block discarded – undo
9526 9526
 	
9527 9527
 	
9528 9528
 	/**
9529
-	* Counts all hours by aircraft registration
9530
-	*
9531
-	* @return Array the hour list
9532
-	*
9533
-	*/
9529
+	 * Counts all hours by aircraft registration
9530
+	 *
9531
+	 * @return Array the hour list
9532
+	 *
9533
+	 */
9534 9534
 	public function countAllHoursByRegistration($registration, $filters = array())
9535 9535
 	{
9536 9536
 		global $globalTimezone, $globalDBdriver;
@@ -9573,11 +9573,11 @@  discard block
 block discarded – undo
9573 9573
 	
9574 9574
 	
9575 9575
 	/**
9576
-	* Counts all hours by airport
9577
-	*
9578
-	* @return Array the hour list
9579
-	*
9580
-	*/
9576
+	 * Counts all hours by airport
9577
+	 *
9578
+	 * @return Array the hour list
9579
+	 *
9580
+	 */
9581 9581
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9582 9582
 	{
9583 9583
 		global $globalTimezone, $globalDBdriver;
@@ -9621,11 +9621,11 @@  discard block
 block discarded – undo
9621 9621
 	
9622 9622
 	
9623 9623
 	/**
9624
-	* Counts all hours by manufacturer
9625
-	*
9626
-	* @return Array the hour list
9627
-	*
9628
-	*/
9624
+	 * Counts all hours by manufacturer
9625
+	 *
9626
+	 * @return Array the hour list
9627
+	 *
9628
+	 */
9629 9629
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9630 9630
 	{
9631 9631
 		global $globalTimezone, $globalDBdriver;
@@ -9669,11 +9669,11 @@  discard block
 block discarded – undo
9669 9669
 	
9670 9670
 	
9671 9671
 	/**
9672
-	* Counts all hours by date
9673
-	*
9674
-	* @return Array the hour list
9675
-	*
9676
-	*/
9672
+	 * Counts all hours by date
9673
+	 *
9674
+	 * @return Array the hour list
9675
+	 *
9676
+	 */
9677 9677
 	public function countAllHoursByDate($date, $filters = array())
9678 9678
 	{
9679 9679
 		global $globalTimezone, $globalDBdriver;
@@ -9717,11 +9717,11 @@  discard block
 block discarded – undo
9717 9717
 	
9718 9718
 	
9719 9719
 	/**
9720
-	* Counts all hours by a ident/callsign
9721
-	*
9722
-	* @return Array the hour list
9723
-	*
9724
-	*/
9720
+	 * Counts all hours by a ident/callsign
9721
+	 *
9722
+	 * @return Array the hour list
9723
+	 *
9724
+	 */
9725 9725
 	public function countAllHoursByIdent($ident, $filters = array())
9726 9726
 	{
9727 9727
 		global $globalTimezone, $globalDBdriver;
@@ -9766,11 +9766,11 @@  discard block
 block discarded – undo
9766 9766
 	
9767 9767
 	
9768 9768
 	/**
9769
-	* Counts all hours by route
9770
-	*
9771
-	* @return Array the hour list
9772
-	*
9773
-	*/
9769
+	 * Counts all hours by route
9770
+	 *
9771
+	 * @return Array the hour list
9772
+	 *
9773
+	 */
9774 9774
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9775 9775
 	{
9776 9776
 		global $globalTimezone, $globalDBdriver;
@@ -9814,11 +9814,11 @@  discard block
 block discarded – undo
9814 9814
 	
9815 9815
 	
9816 9816
 	/**
9817
-	* Counts all hours by country
9818
-	*
9819
-	* @return Array the hour list
9820
-	*
9821
-	*/
9817
+	 * Counts all hours by country
9818
+	 *
9819
+	 * @return Array the hour list
9820
+	 *
9821
+	 */
9822 9822
 	public function countAllHoursByCountry($country, $filters = array())
9823 9823
 	{
9824 9824
 		global $globalTimezone, $globalDBdriver;
@@ -9863,11 +9863,11 @@  discard block
 block discarded – undo
9863 9863
 
9864 9864
 
9865 9865
 	/**
9866
-	* Counts all aircraft that have flown over
9867
-	*
9868
-	* @return Integer the number of aircrafts
9869
-	*
9870
-	*/
9866
+	 * Counts all aircraft that have flown over
9867
+	 *
9868
+	 * @return Integer the number of aircrafts
9869
+	 *
9870
+	 */
9871 9871
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
9872 9872
 	{
9873 9873
 		global $globalDBdriver;
@@ -9900,11 +9900,11 @@  discard block
 block discarded – undo
9900 9900
 	}
9901 9901
 
9902 9902
 	/**
9903
-	* Counts all flight that really arrival
9904
-	*
9905
-	* @return Integer the number of aircrafts
9906
-	*
9907
-	*/
9903
+	 * Counts all flight that really arrival
9904
+	 *
9905
+	 * @return Integer the number of aircrafts
9906
+	 *
9907
+	 */
9908 9908
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
9909 9909
 	{
9910 9910
 		global $globalDBdriver;
@@ -9937,11 +9937,11 @@  discard block
 block discarded – undo
9937 9937
 	}
9938 9938
 
9939 9939
 	/**
9940
-	* Counts all pilots that have flown over
9941
-	*
9942
-	* @return Integer the number of pilots
9943
-	*
9944
-	*/
9940
+	 * Counts all pilots that have flown over
9941
+	 *
9942
+	 * @return Integer the number of pilots
9943
+	 *
9944
+	 */
9945 9945
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
9946 9946
 	{
9947 9947
 		global $globalDBdriver;
@@ -9973,11 +9973,11 @@  discard block
 block discarded – undo
9973 9973
 	}
9974 9974
 
9975 9975
 	/**
9976
-	* Counts all owners that have flown over
9977
-	*
9978
-	* @return Integer the number of owners
9979
-	*
9980
-	*/
9976
+	 * Counts all owners that have flown over
9977
+	 *
9978
+	 * @return Integer the number of owners
9979
+	 *
9980
+	 */
9981 9981
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
9982 9982
 	{
9983 9983
 		global $globalDBdriver;
@@ -10010,11 +10010,11 @@  discard block
 block discarded – undo
10010 10010
 	
10011 10011
 	
10012 10012
 	/**
10013
-	* Counts all flights that have flown over
10014
-	*
10015
-	* @return Integer the number of flights
10016
-	*
10017
-	*/
10013
+	 * Counts all flights that have flown over
10014
+	 *
10015
+	 * @return Integer the number of flights
10016
+	 *
10017
+	 */
10018 10018
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10019 10019
 	{
10020 10020
 		global $globalDBdriver;
@@ -10049,11 +10049,11 @@  discard block
 block discarded – undo
10049 10049
 	}
10050 10050
 	
10051 10051
 	/**
10052
-	* Counts all military flights that have flown over
10053
-	*
10054
-	* @return Integer the number of flights
10055
-	*
10056
-	*/
10052
+	 * Counts all military flights that have flown over
10053
+	 *
10054
+	 * @return Integer the number of flights
10055
+	 *
10056
+	 */
10057 10057
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10058 10058
 	{
10059 10059
 		global $globalDBdriver;
@@ -10088,11 +10088,11 @@  discard block
 block discarded – undo
10088 10088
 	
10089 10089
 	
10090 10090
 	/**
10091
-	* Counts all airlines that have flown over
10092
-	*
10093
-	* @return Integer the number of airlines
10094
-	*
10095
-	*/
10091
+	 * Counts all airlines that have flown over
10092
+	 *
10093
+	 * @return Integer the number of airlines
10094
+	 *
10095
+	 */
10096 10096
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10097 10097
 	{
10098 10098
 		global $globalDBdriver;
@@ -10119,8 +10119,8 @@  discard block
 block discarded – undo
10119 10119
 				$query_values = array_merge($query_values,array(':month' => $month));
10120 10120
 			}
10121 10121
 		}
10122
-                if ($query == '') $queryi .= $this->getFilter($filters);
10123
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10122
+				if ($query == '') $queryi .= $this->getFilter($filters);
10123
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10124 10124
 
10125 10125
 
10126 10126
 		$sth = $this->db->prepare($queryi);
@@ -10130,11 +10130,11 @@  discard block
 block discarded – undo
10130 10130
 
10131 10131
   
10132 10132
 	/**
10133
-	* Counts all hours of today
10134
-	*
10135
-	* @return Array the hour list
10136
-	*
10137
-	*/
10133
+	 * Counts all hours of today
10134
+	 *
10135
+	 * @return Array the hour list
10136
+	 *
10137
+	 */
10138 10138
 	public function countAllHoursFromToday($filters = array())
10139 10139
 	{
10140 10140
 		global $globalTimezone, $globalDBdriver;
@@ -10174,11 +10174,11 @@  discard block
 block discarded – undo
10174 10174
 	}
10175 10175
     
10176 10176
 	/**
10177
-	* Gets all the spotter information based on calculated upcoming flights
10178
-	*
10179
-	* @return Array the spotter information
10180
-	*
10181
-	*/
10177
+	 * Gets all the spotter information based on calculated upcoming flights
10178
+	 *
10179
+	 * @return Array the spotter information
10180
+	 *
10181
+	 */
10182 10182
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10183 10183
 	{
10184 10184
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -10253,12 +10253,12 @@  discard block
 block discarded – undo
10253 10253
 	}
10254 10254
     
10255 10255
     
10256
-     /**
10257
-	* Gets the Barrie Spotter ID based on the FlightAware ID
10258
-	*
10259
-	* @return Integer the Barrie Spotter ID
10256
+	 /**
10257
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
10258
+	  *
10259
+	  * @return Integer the Barrie Spotter ID
10260 10260
 q	*
10261
-	*/
10261
+	  */
10262 10262
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10263 10263
 	{
10264 10264
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -10279,13 +10279,13 @@  discard block
 block discarded – undo
10279 10279
   
10280 10280
  
10281 10281
 	/**
10282
-	* Parses a date string
10283
-	*
10284
-	* @param String $dateString the date string
10285
-	* @param String $timezone the timezone of a user
10286
-	* @return Array the time information
10287
-	*
10288
-	*/
10282
+	 * Parses a date string
10283
+	 *
10284
+	 * @param String $dateString the date string
10285
+	 * @param String $timezone the timezone of a user
10286
+	 * @return Array the time information
10287
+	 *
10288
+	 */
10289 10289
 	public function parseDateString($dateString, $timezone = '')
10290 10290
 	{
10291 10291
 		$time_array = array();
@@ -10321,12 +10321,12 @@  discard block
 block discarded – undo
10321 10321
 	
10322 10322
 	
10323 10323
 	/**
10324
-	* Parses the direction degrees to working
10325
-	*
10326
-	* @param Float $direction the direction in degrees
10327
-	* @return Array the direction information
10328
-	*
10329
-	*/
10324
+	 * Parses the direction degrees to working
10325
+	 *
10326
+	 * @param Float $direction the direction in degrees
10327
+	 * @return Array the direction information
10328
+	 *
10329
+	 */
10330 10330
 	public function parseDirection($direction = 0)
10331 10331
 	{
10332 10332
 		if ($direction == '') $direction = 0;
@@ -10405,12 +10405,12 @@  discard block
 block discarded – undo
10405 10405
 	
10406 10406
 	
10407 10407
 	/**
10408
-	* Gets the aircraft registration
10409
-	*
10410
-	* @param String $flightaware_id the flight aware id
10411
-	* @return String the aircraft registration
10412
-	*
10413
-	*/
10408
+	 * Gets the aircraft registration
10409
+	 *
10410
+	 * @param String $flightaware_id the flight aware id
10411
+	 * @return String the aircraft registration
10412
+	 *
10413
+	 */
10414 10414
 	
10415 10415
 	public function getAircraftRegistration($flightaware_id)
10416 10416
 	{
@@ -10439,12 +10439,12 @@  discard block
 block discarded – undo
10439 10439
 
10440 10440
 
10441 10441
 	/**
10442
-	* Gets the aircraft registration from ModeS
10443
-	*
10444
-	* @param String $aircraft_modes the flight ModeS in hex
10445
-	* @return String the aircraft registration
10446
-	*
10447
-	*/
10442
+	 * Gets the aircraft registration from ModeS
10443
+	 *
10444
+	 * @param String $aircraft_modes the flight ModeS in hex
10445
+	 * @return String the aircraft registration
10446
+	 *
10447
+	 */
10448 10448
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
10449 10449
 	{
10450 10450
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -10457,19 +10457,19 @@  discard block
 block discarded – undo
10457 10457
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
10458 10458
 		$sth->closeCursor();
10459 10459
 		if (count($row) > 0) {
10460
-		    //return $row['Registration'];
10461
-		    return $row['registration'];
10460
+			//return $row['Registration'];
10461
+			return $row['registration'];
10462 10462
 		} else return '';
10463 10463
 	
10464 10464
 	}
10465 10465
 
10466 10466
 	/**
10467
-	* Gets the aircraft type from ModeS
10468
-	*
10469
-	* @param String $aircraft_modes the flight ModeS in hex
10470
-	* @return String the aircraft type
10471
-	*
10472
-	*/
10467
+	 * Gets the aircraft type from ModeS
10468
+	 *
10469
+	 * @param String $aircraft_modes the flight ModeS in hex
10470
+	 * @return String the aircraft type
10471
+	 *
10472
+	 */
10473 10473
 	public function getAircraftTypeBymodeS($aircraft_modes)
10474 10474
 	{
10475 10475
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -10482,19 +10482,19 @@  discard block
 block discarded – undo
10482 10482
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
10483 10483
 		$sth->closeCursor();
10484 10484
 		if (count($row) > 0) {
10485
-		    if ($row['type_flight'] == null) return '';
10486
-		    else return $row['type_flight'];
10485
+			if ($row['type_flight'] == null) return '';
10486
+			else return $row['type_flight'];
10487 10487
 		} else return '';
10488 10488
 	
10489 10489
 	}
10490 10490
 
10491 10491
 	/**
10492
-	* Gets Country from latitude/longitude
10493
-	*
10494
-	* @param Float $latitude latitute of the flight
10495
-	* @param Float $longitude longitute of the flight
10496
-	* @return String the countrie
10497
-	*/
10492
+	 * Gets Country from latitude/longitude
10493
+	 *
10494
+	 * @param Float $latitude latitute of the flight
10495
+	 * @param Float $longitude longitute of the flight
10496
+	 * @return String the countrie
10497
+	 */
10498 10498
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
10499 10499
 	{
10500 10500
 		global $globalDBdriver, $globalDebug;
@@ -10531,11 +10531,11 @@  discard block
 block discarded – undo
10531 10531
 	}
10532 10532
 
10533 10533
 	/**
10534
-	* Gets Country from iso2
10535
-	*
10536
-	* @param String $iso2 ISO2 country code
10537
-	* @return String the countrie
10538
-	*/
10534
+	 * Gets Country from iso2
10535
+	 *
10536
+	 * @param String $iso2 ISO2 country code
10537
+	 * @return String the countrie
10538
+	 */
10539 10539
 	public function getCountryFromISO2($iso2)
10540 10540
 	{
10541 10541
 		global $globalDBdriver, $globalDebug;
@@ -10563,12 +10563,12 @@  discard block
 block discarded – undo
10563 10563
 	}
10564 10564
 
10565 10565
 	/**
10566
-	* converts the registration code using the country prefix
10567
-	*
10568
-	* @param String $registration the aircraft registration
10569
-	* @return String the aircraft registration
10570
-	*
10571
-	*/
10566
+	 * converts the registration code using the country prefix
10567
+	 *
10568
+	 * @param String $registration the aircraft registration
10569
+	 * @return String the aircraft registration
10570
+	 *
10571
+	 */
10572 10572
 	public function convertAircraftRegistration($registration)
10573 10573
 	{
10574 10574
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10620,12 +10620,12 @@  discard block
 block discarded – undo
10620 10620
 	}
10621 10621
 
10622 10622
 	/**
10623
-	* Country from the registration code
10624
-	*
10625
-	* @param String $registration the aircraft registration
10626
-	* @return String the country
10627
-	*
10628
-	*/
10623
+	 * Country from the registration code
10624
+	 *
10625
+	 * @param String $registration the aircraft registration
10626
+	 * @return String the country
10627
+	 *
10628
+	 */
10629 10629
 	public function countryFromAircraftRegistration($registration)
10630 10630
 	{
10631 10631
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10644,8 +10644,8 @@  discard block
 block discarded – undo
10644 10644
 				$country = $row['country'];
10645 10645
 			}
10646 10646
 		} else {
10647
-    			$registration_1 = substr($registration, 0, 1);
10648
-		        $registration_2 = substr($registration, 0, 2);
10647
+				$registration_1 = substr($registration, 0, 1);
10648
+				$registration_2 = substr($registration, 0, 2);
10649 10649
 
10650 10650
 			$country = '';
10651 10651
 			//first get the prefix based on two characters
@@ -10681,12 +10681,12 @@  discard block
 block discarded – undo
10681 10681
 	}
10682 10682
 
10683 10683
 	/**
10684
-	* Registration prefix from the registration code
10685
-	*
10686
-	* @param String $registration the aircraft registration
10687
-	* @return String the registration prefix
10688
-	*
10689
-	*/
10684
+	 * Registration prefix from the registration code
10685
+	 *
10686
+	 * @param String $registration the aircraft registration
10687
+	 * @return String the registration prefix
10688
+	 *
10689
+	 */
10690 10690
 	public function registrationPrefixFromAircraftRegistration($registration)
10691 10691
 	{
10692 10692
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10705,8 +10705,8 @@  discard block
 block discarded – undo
10705 10705
 				//$country = $row['country'];
10706 10706
 			}
10707 10707
 		} else {
10708
-    			$registration_1 = substr($registration, 0, 1);
10709
-		        $registration_2 = substr($registration, 0, 2);
10708
+				$registration_1 = substr($registration, 0, 1);
10709
+				$registration_2 = substr($registration, 0, 2);
10710 10710
 
10711 10711
 			//first get the prefix based on two characters
10712 10712
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -10742,12 +10742,12 @@  discard block
 block discarded – undo
10742 10742
 
10743 10743
 
10744 10744
 	/**
10745
-	* Country from the registration code
10746
-	*
10747
-	* @param String $registration the aircraft registration
10748
-	* @return String the country
10749
-	*
10750
-	*/
10745
+	 * Country from the registration code
10746
+	 *
10747
+	 * @param String $registration the aircraft registration
10748
+	 * @return String the country
10749
+	 *
10750
+	 */
10751 10751
 	public function countryFromAircraftRegistrationCode($registration)
10752 10752
 	{
10753 10753
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10764,11 +10764,11 @@  discard block
 block discarded – undo
10764 10764
 	}
10765 10765
 	
10766 10766
 	/**
10767
-	* Set a new highlight value for a flight
10768
-	*
10769
-	* @param String $flightaware_id flightaware_id from spotter_output table
10770
-	* @param String $highlight New highlight value
10771
-	*/
10767
+	 * Set a new highlight value for a flight
10768
+	 *
10769
+	 * @param String $flightaware_id flightaware_id from spotter_output table
10770
+	 * @param String $highlight New highlight value
10771
+	 */
10772 10772
 	public function setHighlightFlight($flightaware_id,$highlight) {
10773 10773
 		
10774 10774
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -10777,12 +10777,12 @@  discard block
 block discarded – undo
10777 10777
 	}
10778 10778
 
10779 10779
 	/**
10780
-	* Set a new highlight value for a flight by Registration
10781
-	*
10782
-	* @param String $registration Registration of the aircraft
10783
-	* @param String $date Date of spotted aircraft
10784
-	* @param String $highlight New highlight value
10785
-	*/
10780
+	 * Set a new highlight value for a flight by Registration
10781
+	 *
10782
+	 * @param String $registration Registration of the aircraft
10783
+	 * @param String $date Date of spotted aircraft
10784
+	 * @param String $highlight New highlight value
10785
+	 */
10786 10786
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
10787 10787
 		if ($date == '') {
10788 10788
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -10796,12 +10796,12 @@  discard block
 block discarded – undo
10796 10796
 	}
10797 10797
 	
10798 10798
 	/**
10799
-	* Gets the short url from bit.ly
10800
-	*
10801
-	* @param String $url the full url
10802
-	* @return String the bit.ly url
10803
-	*
10804
-	*/
10799
+	 * Gets the short url from bit.ly
10800
+	 *
10801
+	 * @param String $url the full url
10802
+	 * @return String the bit.ly url
10803
+	 *
10804
+	 */
10805 10805
 	public function getBitlyURL($url)
10806 10806
 	{
10807 10807
 		global $globalBitlyAccessToken;
@@ -11090,11 +11090,11 @@  discard block
 block discarded – undo
11090 11090
 			$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 
11091 11091
 	                      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)) 
11092 11092
 	                      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;";
11093
-                } else {
11093
+				} else {
11094 11094
 			$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 
11095 11095
 	                      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)) 
11096 11096
 	                      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;";
11097
-    		}
11097
+			}
11098 11098
 		$sth = $this->db->prepare($query);
11099 11099
 		$sth->execute();
11100 11100
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Indentation   +614 added lines, -614 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 		$this->db = $Connection->db;
9 9
 	}
10 10
 
11
-    /**
12
-    * Get SQL query part for filter used
13
-    * @param Array $filter the filter
14
-    * @return Array the SQL part
15
-    */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
11
+	/**
12
+	 * Get SQL query part for filter used
13
+	 * @param Array $filter the filter
14
+	 * @return Array the SQL part
15
+	 */
16
+	public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18 18
 	$filters = array();
19 19
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
@@ -27,58 +27,58 @@  discard block
 block discarded – undo
27 27
 	$filter_query_join = '';
28 28
 	$filter_query_where = '';
29 29
 	foreach($filters as $flt) {
30
-	    if (isset($flt['airlines']) && !empty($flt['airlines'])) {
30
+		if (isset($flt['airlines']) && !empty($flt['airlines'])) {
31 31
 		if ($flt['airlines'][0] != '') {
32
-		    if (isset($flt['source'])) {
32
+			if (isset($flt['source'])) {
33 33
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
34
-		    } else {
34
+			} else {
35 35
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
36
-		    }
36
+			}
37
+		}
37 38
 		}
38
-	    }
39
-	    if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
39
+		if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
40 40
 		if (isset($flt['source'])) {
41
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
41
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
42 42
 		} else {
43
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
43
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
44 44
 		}
45
-	    }
46
-	    if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
45
+		}
46
+		if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
47 47
 		if (isset($flt['source'])) {
48
-		    $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_archive_output.flightaware_id";
48
+			$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_archive_output.flightaware_id";
49
+		}
49 50
 		}
50
-	    }
51 51
 	}
52 52
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
53
-	    if ($filter['airlines'][0] != '') {
53
+		if ($filter['airlines'][0] != '') {
54 54
 		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
55
-	    }
55
+		}
56 56
 	}
57 57
 	
58 58
 	if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
59
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
59
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
60 60
 	}
61 61
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
62
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
62
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
63 63
 	}
64 64
 	if (isset($filter['source']) && !empty($filter['source'])) {
65
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
65
+		$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
66 66
 	}
67 67
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
68
-	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
68
+		$filter_query_where = " WHERE ident = '".$filter['ident']."'";
69 69
 	}
70 70
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
71
-	    if ($filter_query_where == '') {
71
+		if ($filter_query_where == '') {
72 72
 		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
73
-	    } else {
73
+		} else {
74 74
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75
-	    }
75
+		}
76 76
 	}
77 77
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
78 78
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
79 79
 	$filter_query = $filter_query_join.$filter_query_where;
80 80
 	return $filter_query;
81
-    }
81
+	}
82 82
 
83 83
 	// Spotter_archive
84 84
 	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
@@ -109,44 +109,44 @@  discard block
 block discarded – undo
109 109
 	}
110 110
 
111 111
 
112
-        /**
113
-        * Gets all the spotter information based on a particular callsign
114
-        *
115
-        * @return Array the spotter information
116
-        *
117
-        */
118
-        public function getLastArchiveSpotterDataByIdent($ident)
119
-        {
112
+		/**
113
+		 * Gets all the spotter information based on a particular callsign
114
+		 *
115
+		 * @return Array the spotter information
116
+		 *
117
+		 */
118
+		public function getLastArchiveSpotterDataByIdent($ident)
119
+		{
120 120
 		$Spotter = new Spotter($this->db);
121
-                date_default_timezone_set('UTC');
121
+				date_default_timezone_set('UTC');
122 122
 
123
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
124
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
125
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
123
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
124
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
125
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
126 126
 
127
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
127
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
128 128
 
129
-                return $spotter_array;
130
-        }
129
+				return $spotter_array;
130
+		}
131 131
 
132 132
 
133
-        /**
134
-        * Gets last the spotter information based on a particular id
135
-        *
136
-        * @return Array the spotter information
137
-        *
138
-        */
139
-        public function getLastArchiveSpotterDataById($id)
140
-        {
141
-    		$Spotter = new Spotter($this->db);
142
-                date_default_timezone_set('UTC');
143
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
144
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
145
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
146
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
133
+		/**
134
+		 * Gets last the spotter information based on a particular id
135
+		 *
136
+		 * @return Array the spotter information
137
+		 *
138
+		 */
139
+		public function getLastArchiveSpotterDataById($id)
140
+		{
141
+			$Spotter = new Spotter($this->db);
142
+				date_default_timezone_set('UTC');
143
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
144
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
145
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
146
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
147 147
 
148 148
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
149
-                  /*
149
+				  /*
150 150
                 try {
151 151
                         $Connection = new Connection();
152 152
                         $sth = Connection->$db->prepare($query);
@@ -156,232 +156,232 @@  discard block
 block discarded – undo
156 156
                 }
157 157
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
158 158
                 */
159
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
160
-
161
-                return $spotter_array;
162
-        }
163
-
164
-        /**
165
-        * Gets all the spotter information based on a particular id
166
-        *
167
-        * @return Array the spotter information
168
-        *
169
-        */
170
-        public function getAllArchiveSpotterDataById($id)
171
-        {
172
-                date_default_timezone_set('UTC');
173
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
174
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
159
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
160
+
161
+				return $spotter_array;
162
+		}
163
+
164
+		/**
165
+		 * Gets all the spotter information based on a particular id
166
+		 *
167
+		 * @return Array the spotter information
168
+		 *
169
+		 */
170
+		public function getAllArchiveSpotterDataById($id)
171
+		{
172
+				date_default_timezone_set('UTC');
173
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
174
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
175 175
 
176 176
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
177 177
 
178
-                try {
179
-                        $sth = $this->db->prepare($query);
180
-                        $sth->execute(array(':id' => $id));
181
-                } catch(PDOException $e) {
182
-                        echo $e->getMessage();
183
-                        die;
184
-                }
185
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
186
-
187
-                return $spotter_array;
188
-        }
189
-
190
-        /**
191
-        * Gets coordinate & time spotter information based on a particular id
192
-        *
193
-        * @return Array the spotter information
194
-        *
195
-        */
196
-        public function getCoordArchiveSpotterDataById($id)
197
-        {
198
-                date_default_timezone_set('UTC');
199
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
200
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
178
+				try {
179
+						$sth = $this->db->prepare($query);
180
+						$sth->execute(array(':id' => $id));
181
+				} catch(PDOException $e) {
182
+						echo $e->getMessage();
183
+						die;
184
+				}
185
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
186
+
187
+				return $spotter_array;
188
+		}
189
+
190
+		/**
191
+		 * Gets coordinate & time spotter information based on a particular id
192
+		 *
193
+		 * @return Array the spotter information
194
+		 *
195
+		 */
196
+		public function getCoordArchiveSpotterDataById($id)
197
+		{
198
+				date_default_timezone_set('UTC');
199
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
200
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
201 201
 
202 202
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
203 203
 
204
-                try {
205
-                        $sth = $this->db->prepare($query);
206
-                        $sth->execute(array(':id' => $id));
207
-                } catch(PDOException $e) {
208
-                        echo $e->getMessage();
209
-                        die;
210
-                }
211
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
204
+				try {
205
+						$sth = $this->db->prepare($query);
206
+						$sth->execute(array(':id' => $id));
207
+				} catch(PDOException $e) {
208
+						echo $e->getMessage();
209
+						die;
210
+				}
211
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
212 212
 
213
-                return $spotter_array;
214
-        }
213
+				return $spotter_array;
214
+		}
215 215
 
216 216
 
217
-        /**
218
-        * Gets altitude information based on a particular callsign
219
-        *
220
-        * @return Array the spotter information
221
-        *
222
-        */
223
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
224
-        {
217
+		/**
218
+		 * Gets altitude information based on a particular callsign
219
+		 *
220
+		 * @return Array the spotter information
221
+		 *
222
+		 */
223
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
224
+		{
225 225
 
226
-                date_default_timezone_set('UTC');
226
+				date_default_timezone_set('UTC');
227 227
 
228
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
229
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
228
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
229
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
230 230
 
231
-                try {
232
-                        $sth = $this->db->prepare($query);
233
-                        $sth->execute(array(':ident' => $ident));
234
-                } catch(PDOException $e) {
235
-                        echo $e->getMessage();
236
-                        die;
237
-                }
238
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
231
+				try {
232
+						$sth = $this->db->prepare($query);
233
+						$sth->execute(array(':ident' => $ident));
234
+				} catch(PDOException $e) {
235
+						echo $e->getMessage();
236
+						die;
237
+				}
238
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
239 239
 
240
-                return $spotter_array;
241
-        }
240
+				return $spotter_array;
241
+		}
242 242
 
243
-        /**
244
-        * Gets altitude information based on a particular id
245
-        *
246
-        * @return Array the spotter information
247
-        *
248
-        */
249
-        public function getAltitudeArchiveSpotterDataById($id)
250
-        {
243
+		/**
244
+		 * Gets altitude information based on a particular id
245
+		 *
246
+		 * @return Array the spotter information
247
+		 *
248
+		 */
249
+		public function getAltitudeArchiveSpotterDataById($id)
250
+		{
251 251
 
252
-                date_default_timezone_set('UTC');
252
+				date_default_timezone_set('UTC');
253 253
 
254
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
255
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
254
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
255
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
256 256
 
257
-                try {
258
-                        $sth = $this->db->prepare($query);
259
-                        $sth->execute(array(':id' => $id));
260
-                } catch(PDOException $e) {
261
-                        echo $e->getMessage();
262
-                        die;
263
-                }
264
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
257
+				try {
258
+						$sth = $this->db->prepare($query);
259
+						$sth->execute(array(':id' => $id));
260
+				} catch(PDOException $e) {
261
+						echo $e->getMessage();
262
+						die;
263
+				}
264
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
265 265
 
266
-                return $spotter_array;
267
-        }
266
+				return $spotter_array;
267
+		}
268 268
 
269
-        /**
270
-        * Gets altitude & speed information based on a particular id
271
-        *
272
-        * @return Array the spotter information
273
-        *
274
-        */
275
-        public function getAltitudeSpeedArchiveSpotterDataById($id)
276
-        {
269
+		/**
270
+		 * Gets altitude & speed information based on a particular id
271
+		 *
272
+		 * @return Array the spotter information
273
+		 *
274
+		 */
275
+		public function getAltitudeSpeedArchiveSpotterDataById($id)
276
+		{
277 277
 
278
-                date_default_timezone_set('UTC');
278
+				date_default_timezone_set('UTC');
279 279
 
280
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
281
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
280
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
281
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
282 282
 
283
-                try {
284
-                        $sth = $this->db->prepare($query);
285
-                        $sth->execute(array(':id' => $id));
286
-                } catch(PDOException $e) {
287
-                        echo $e->getMessage();
288
-                        die;
289
-                }
290
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
283
+				try {
284
+						$sth = $this->db->prepare($query);
285
+						$sth->execute(array(':id' => $id));
286
+				} catch(PDOException $e) {
287
+						echo $e->getMessage();
288
+						die;
289
+				}
290
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
291 291
 
292
-                return $spotter_array;
293
-        }
292
+				return $spotter_array;
293
+		}
294 294
 
295 295
 
296
-        /**
297
-        * Gets altitude information based on a particular callsign
298
-        *
299
-        * @return Array the spotter information
300
-        *
301
-        */
302
-        public function getLastAltitudeArchiveSpotterDataByIdent($ident)
303
-        {
296
+		/**
297
+		 * Gets altitude information based on a particular callsign
298
+		 *
299
+		 * @return Array the spotter information
300
+		 *
301
+		 */
302
+		public function getLastAltitudeArchiveSpotterDataByIdent($ident)
303
+		{
304 304
 
305
-                date_default_timezone_set('UTC');
305
+				date_default_timezone_set('UTC');
306 306
 
307
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
308
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
307
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
308
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
309 309
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
310 310
 
311
-                try {
312
-                        $sth = $this->db->prepare($query);
313
-                        $sth->execute(array(':ident' => $ident));
314
-                } catch(PDOException $e) {
315
-                        echo $e->getMessage();
316
-                        die;
317
-                }
318
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
311
+				try {
312
+						$sth = $this->db->prepare($query);
313
+						$sth->execute(array(':ident' => $ident));
314
+				} catch(PDOException $e) {
315
+						echo $e->getMessage();
316
+						die;
317
+				}
318
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
319 319
 
320
-                return $spotter_array;
321
-        }
320
+				return $spotter_array;
321
+		}
322 322
 
323 323
 
324 324
 
325
-       /**
326
-        * Gets all the archive spotter information
327
-        *
328
-        * @return Array the spotter information
329
-        *
330
-        */
331
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
332
-        {
333
-    		$Spotter = new Spotter($this->db);
334
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
335
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
325
+	   /**
326
+	    * Gets all the archive spotter information
327
+	    *
328
+	    * @return Array the spotter information
329
+	    *
330
+	    */
331
+		public function getSpotterArchiveData($ident,$flightaware_id,$date)
332
+		{
333
+			$Spotter = new Spotter($this->db);
334
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
335
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
336 336
 
337
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
337
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
338 338
 
339
-                return $spotter_array;
340
-        }
339
+				return $spotter_array;
340
+		}
341 341
         
342
-        public function deleteSpotterArchiveTrackData()
343
-        {
342
+		public function deleteSpotterArchiveTrackData()
343
+		{
344 344
 		global $globalArchiveKeepTrackMonths;
345
-                date_default_timezone_set('UTC');
345
+				date_default_timezone_set('UTC');
346 346
 		$query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
347
-                try {
348
-                        $sth = $this->db->prepare($query);
349
-                        $sth->execute();
350
-                } catch(PDOException $e) {
351
-                        echo $e->getMessage();
352
-                        die;
353
-                }
347
+				try {
348
+						$sth = $this->db->prepare($query);
349
+						$sth->execute();
350
+				} catch(PDOException $e) {
351
+						echo $e->getMessage();
352
+						die;
353
+				}
354 354
 	}
355 355
 
356 356
 	/**
357
-        * Gets Minimal Live Spotter data
358
-        *
359
-        * @return Array the spotter information
360
-        *
361
-        */
362
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
363
-        {
364
-                global $globalDBdriver, $globalLiveInterval;
365
-                date_default_timezone_set('UTC');
366
-
367
-                $filter_query = '';
368
-                if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
370
-                }
371
-                // Use spotter_output also ?
372
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
374
-                }
375
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
377
-                }
378
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
380
-                }
381
-
382
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
383
-                if ($globalDBdriver == 'mysql') {
384
-                        /*
357
+	 * Gets Minimal Live Spotter data
358
+	 *
359
+	 * @return Array the spotter information
360
+	 *
361
+	 */
362
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
363
+		{
364
+				global $globalDBdriver, $globalLiveInterval;
365
+				date_default_timezone_set('UTC');
366
+
367
+				$filter_query = '';
368
+				if (isset($filter['source']) && !empty($filter['source'])) {
369
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
370
+				}
371
+				// Use spotter_output also ?
372
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
374
+				}
375
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
377
+				}
378
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
380
+				}
381
+
382
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
383
+				if ($globalDBdriver == 'mysql') {
384
+						/*
385 385
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
386 386
                     		    FROM spotter_archive 
387 387
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -400,56 +400,56 @@  discard block
 block discarded – undo
400 400
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
401 401
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
402 402
                         	    '.$filter_query.' ORDER BY flightaware_id';
403
-                } else {
404
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
405
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
403
+				} else {
404
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
405
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
406 406
                         	    FROM spotter_archive 
407 407
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
408 408
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
409 409
                         	    '.$filter_query.' ORDER BY flightaware_id';
410
-                }
411
-                //echo $query;
412
-                try {
413
-                        $sth = $this->db->prepare($query);
414
-                        $sth->execute();
415
-                } catch(PDOException $e) {
416
-                        echo $e->getMessage();
417
-                        die;
418
-                }
419
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
420
-
421
-                return $spotter_array;
422
-        }
410
+				}
411
+				//echo $query;
412
+				try {
413
+						$sth = $this->db->prepare($query);
414
+						$sth->execute();
415
+				} catch(PDOException $e) {
416
+						echo $e->getMessage();
417
+						die;
418
+				}
419
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
420
+
421
+				return $spotter_array;
422
+		}
423 423
 
424 424
 	/**
425
-        * Gets Minimal Live Spotter data
426
-        *
427
-        * @return Array the spotter information
428
-        *
429
-        */
430
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
431
-        {
432
-                global $globalDBdriver, $globalLiveInterval;
433
-                date_default_timezone_set('UTC');
434
-
435
-                $filter_query = '';
436
-                if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
438
-                }
439
-                // Should use spotter_output also ?
440
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
442
-                }
443
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
445
-                }
446
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
448
-                }
449
-
450
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
451
-                if ($globalDBdriver == 'mysql') {
452
-                        /*
425
+	 * Gets Minimal Live Spotter data
426
+	 *
427
+	 * @return Array the spotter information
428
+	 *
429
+	 */
430
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
431
+		{
432
+				global $globalDBdriver, $globalLiveInterval;
433
+				date_default_timezone_set('UTC');
434
+
435
+				$filter_query = '';
436
+				if (isset($filter['source']) && !empty($filter['source'])) {
437
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
438
+				}
439
+				// Should use spotter_output also ?
440
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
442
+				}
443
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
445
+				}
446
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
448
+				}
449
+
450
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
451
+				if ($globalDBdriver == 'mysql') {
452
+						/*
453 453
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
454 454
                     		    FROM spotter_archive 
455 455
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -460,95 +460,95 @@  discard block
 block discarded – undo
460 460
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
461 461
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
462 462
 
463
-                } else {
464
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
465
-                       /*
463
+				} else {
464
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
465
+					   /*
466 466
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
467 467
                         	    FROM spotter_archive_output 
468 468
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
469 469
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
470 470
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
471 471
                         */
472
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
472
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
473 473
                         	    FROM spotter_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
476 476
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
477 477
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
478 478
                         	    
479
-                }
480
-                //echo $query;
481
-                try {
482
-                        $sth = $this->db->prepare($query);
483
-                        $sth->execute();
484
-                } catch(PDOException $e) {
485
-                        echo $e->getMessage();
486
-                        die;
487
-                }
488
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
489
-
490
-                return $spotter_array;
491
-        }
479
+				}
480
+				//echo $query;
481
+				try {
482
+						$sth = $this->db->prepare($query);
483
+						$sth->execute();
484
+				} catch(PDOException $e) {
485
+						echo $e->getMessage();
486
+						die;
487
+				}
488
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
489
+
490
+				return $spotter_array;
491
+		}
492 492
 
493 493
 	 /**
494
-        * Gets count Live Spotter data
495
-        *
496
-        * @return Array the spotter information
497
-        *
498
-        */
499
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
500
-        {
501
-                global $globalDBdriver, $globalLiveInterval;
502
-                date_default_timezone_set('UTC');
503
-
504
-                $filter_query = '';
505
-                if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
507
-                }
508
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
510
-                }
511
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
513
-                }
514
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
516
-                }
517
-
518
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
519
-                if ($globalDBdriver == 'mysql') {
494
+	  * Gets count Live Spotter data
495
+	  *
496
+	  * @return Array the spotter information
497
+	  *
498
+	  */
499
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
500
+		{
501
+				global $globalDBdriver, $globalLiveInterval;
502
+				date_default_timezone_set('UTC');
503
+
504
+				$filter_query = '';
505
+				if (isset($filter['source']) && !empty($filter['source'])) {
506
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
507
+				}
508
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
510
+				}
511
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
513
+				}
514
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
516
+				}
517
+
518
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
519
+				if ($globalDBdriver == 'mysql') {
520 520
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
521 521
 			FROM spotter_archive l 
522 522
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
523
-                } else {
523
+				} else {
524 524
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
525
-                }
526
-                //echo $query;
527
-                try {
528
-                        $sth = $this->db->prepare($query);
529
-                        $sth->execute();
530
-                } catch(PDOException $e) {
531
-                        echo $e->getMessage();
532
-                        die;
533
-                }
525
+				}
526
+				//echo $query;
527
+				try {
528
+						$sth = $this->db->prepare($query);
529
+						$sth->execute();
530
+				} catch(PDOException $e) {
531
+						echo $e->getMessage();
532
+						die;
533
+				}
534 534
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
535 535
 		$sth->closeCursor();
536
-                return $result['nb'];
536
+				return $result['nb'];
537 537
 
538
-        }
538
+		}
539 539
 
540 540
 
541 541
 
542 542
 	// Spotter_Archive_output
543 543
 	
544
-    /**
545
-    * Gets all the spotter information
546
-    *
547
-    * @return Array the spotter information
548
-    *
549
-    */
550
-    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())
551
-    {
544
+	/**
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550
+	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())
551
+	{
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
554 554
 	$Translation = new Translation();
@@ -562,159 +562,159 @@  discard block
 block discarded – undo
562 562
 	$filter_query = $this->getFilter($filters);
563 563
 	if ($q != "")
564 564
 	{
565
-	    if (!is_string($q))
566
-	    {
565
+		if (!is_string($q))
566
+		{
567 567
 		return false;
568
-	    } else {
568
+		} else {
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572 572
 		foreach ($q_array as $q_item){
573
-		    $additional_query .= " AND (";
574
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
575
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
591
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
592
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
593
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
594
-		    $translate = $Translation->ident2icao($q_item);
595
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
596
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
597
-		    $additional_query .= ")";
573
+			$additional_query .= " AND (";
574
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
575
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
576
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
577
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
578
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
579
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
580
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
581
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
582
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
583
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
584
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
585
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
586
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
587
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
588
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
589
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
590
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
591
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
592
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
593
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
594
+			$translate = $Translation->ident2icao($q_item);
595
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
596
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
597
+			$additional_query .= ")";
598
+		}
598 599
 		}
599
-	    }
600 600
 	}
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
605
-	    if (!is_string($registration))
606
-	    {
604
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
605
+		if (!is_string($registration))
606
+		{
607 607
 		return false;
608
-	    } else {
608
+		} else {
609 609
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
610
-	    }
610
+		}
611 611
 	}
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
616
-	    if (!is_string($aircraft_icao))
617
-	    {
615
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
616
+		if (!is_string($aircraft_icao))
617
+		{
618 618
 		return false;
619
-	    } else {
619
+		} else {
620 620
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
621
-	    }
621
+		}
622 622
 	}
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
627
-	    if (!is_string($aircraft_manufacturer))
628
-	    {
626
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
627
+		if (!is_string($aircraft_manufacturer))
628
+		{
629 629
 		return false;
630
-	    } else {
630
+		} else {
631 631
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
632
-	    }
632
+		}
633 633
 	}
634 634
 	
635 635
 	if ($highlights == "true")
636 636
 	{
637
-	    if (!is_string($highlights))
638
-	    {
637
+		if (!is_string($highlights))
638
+		{
639 639
 		return false;
640
-	    } else {
640
+		} else {
641 641
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
642
-	    }
642
+		}
643 643
 	}
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
648
-	    if (!is_string($airline_icao))
649
-	    {
647
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
648
+		if (!is_string($airline_icao))
649
+		{
650 650
 		return false;
651
-	    } else {
651
+		} else {
652 652
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
653
-	    }
653
+		}
654 654
 	}
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
-	    if (!is_string($airline_country))
660
-	    {
658
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
+		if (!is_string($airline_country))
660
+		{
661 661
 		return false;
662
-	    } else {
662
+		} else {
663 663
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
664
-	    }
664
+		}
665 665
 	}
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
670
-	    if (!is_string($airline_type))
671
-	    {
669
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
670
+		if (!is_string($airline_type))
671
+		{
672 672
 		return false;
673
-	    } else {
673
+		} else {
674 674
 		if ($airline_type == "passenger")
675 675
 		{
676
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
676
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
677 677
 		}
678 678
 		if ($airline_type == "cargo")
679 679
 		{
680
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
680
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
681 681
 		}
682 682
 		if ($airline_type == "military")
683 683
 		{
684
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
684
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
685
+		}
685 686
 		}
686
-	    }
687 687
 	}
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
-	    if (!is_string($airport))
693
-	    {
691
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
+		if (!is_string($airport))
693
+		{
694 694
 		return false;
695
-	    } else {
695
+		} else {
696 696
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
697
-	    }
697
+		}
698 698
 	}
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
703
-	    if (!is_string($airport_country))
704
-	    {
702
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
703
+		if (!is_string($airport_country))
704
+		{
705 705
 		return false;
706
-	    } else {
706
+		} else {
707 707
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
708
-	    }
708
+		}
709 709
 	}
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
714
-	    if (!is_string($callsign))
715
-	    {
713
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
714
+		if (!is_string($callsign))
715
+		{
716 716
 		return false;
717
-	    } else {
717
+		} else {
718 718
 		$translate = $Translation->ident2icao($callsign);
719 719
 		if ($translate != $callsign) {
720 720
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -722,99 +722,99 @@  discard block
 block discarded – undo
722 722
 		} else {
723 723
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
724 724
 		}
725
-	    }
725
+		}
726 726
 	}
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
731
-	    if (!is_string($owner))
732
-	    {
730
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
731
+		if (!is_string($owner))
732
+		{
733 733
 		return false;
734
-	    } else {
734
+		} else {
735 735
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
736
-	    }
736
+		}
737 737
 	}
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
742
-	    if (!is_string($pilot_name))
743
-	    {
741
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
742
+		if (!is_string($pilot_name))
743
+		{
744 744
 		return false;
745
-	    } else {
745
+		} else {
746 746
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
747
-	    }
747
+		}
748 748
 	}
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
753
-	    if (!is_string($pilot_id))
754
-	    {
752
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
753
+		if (!is_string($pilot_id))
754
+		{
755 755
 		return false;
756
-	    } else {
756
+		} else {
757 757
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
758
-	    }
758
+		}
759 759
 	}
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
764
-	    if (!is_string($departure_airport_route))
765
-	    {
763
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
764
+		if (!is_string($departure_airport_route))
765
+		{
766 766
 		return false;
767
-	    } else {
767
+		} else {
768 768
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
769
-	    }
769
+		}
770 770
 	}
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
775
-	    if (!is_string($arrival_airport_route))
776
-	    {
774
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
775
+		if (!is_string($arrival_airport_route))
776
+		{
777 777
 		return false;
778
-	    } else {
778
+		} else {
779 779
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
780
-	    }
780
+		}
781 781
 	}
782 782
 	
783 783
 	if ($altitude != "")
784 784
 	{
785
-	    $altitude_array = explode(",", $altitude);
785
+		$altitude_array = explode(",", $altitude);
786 786
 	    
787
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
789 789
 	    
790 790
 
791
-	    if ($altitude_array[1] != "")
792
-	    {                
791
+		if ($altitude_array[1] != "")
792
+		{                
793 793
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
794 794
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
795 795
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
796
-	    } else {
796
+		} else {
797 797
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
798 798
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
799
-	    }
799
+		}
800 800
 	}
801 801
 	
802 802
 	if ($date_posted != "")
803 803
 	{
804
-	    $date_array = explode(",", $date_posted);
804
+		$date_array = explode(",", $date_posted);
805 805
 	    
806
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
806
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
808 808
 	    
809
-	    if ($globalTimezone != '') {
809
+		if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
811 811
 		$datetime = new DateTime();
812 812
 		$offset = $datetime->format('P');
813
-	    } else $offset = '+00:00';
813
+		} else $offset = '+00:00';
814 814
 
815 815
 
816
-	    if ($date_array[1] != "")
817
-	    {                
816
+		if ($date_array[1] != "")
817
+		{                
818 818
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
819 819
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
820 820
 		if ($globalDBdriver == 'mysql') {
@@ -822,28 +822,28 @@  discard block
 block discarded – undo
822 822
 		} else {
823 823
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
824 824
 		}
825
-	    } else {
825
+		} else {
826 826
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
827
-                if ($globalDBdriver == 'mysql') {
827
+				if ($globalDBdriver == 'mysql') {
828 828
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
829 829
 		} else {
830 830
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
831 831
 		}
832
-	    }
832
+		}
833 833
 	}
834 834
 	
835 835
 	if ($limit != "")
836 836
 	{
837
-	    $limit_array = explode(",", $limit);
837
+		$limit_array = explode(",", $limit);
838 838
 	    
839
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
839
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
841 841
 	    
842
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843
-	    {
842
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843
+		{
844 844
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
845 845
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
846
-	    }
846
+		}
847 847
 	}
848 848
 	
849 849
 
@@ -874,33 +874,33 @@  discard block
 block discarded – undo
874 874
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
875 875
 
876 876
 	return $spotter_array;
877
-    }
877
+	}
878 878
 
879
-    public function deleteSpotterArchiveData()
880
-    {
879
+	public function deleteSpotterArchiveData()
880
+	{
881 881
 		global $globalArchiveKeepMonths, $globalDBdriver;
882
-                date_default_timezone_set('UTC');
883
-                if ($globalDBdriver == 'mysql') {
882
+				date_default_timezone_set('UTC');
883
+				if ($globalDBdriver == 'mysql') {
884 884
 			$query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
885 885
 		} else {
886 886
 			$query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
887 887
 		}
888
-                try {
889
-                        $sth = $this->db->prepare($query);
890
-                        $sth->execute();
891
-                } catch(PDOException $e) {
892
-                        return "error";
893
-                }
888
+				try {
889
+						$sth = $this->db->prepare($query);
890
+						$sth->execute();
891
+				} catch(PDOException $e) {
892
+						return "error";
893
+				}
894 894
 	}
895 895
 
896
-    /**
897
-    * Gets all the spotter information based on the callsign
898
-    *
899
-    * @return Array the spotter information
900
-    *
901
-    */
902
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
903
-    {
896
+	/**
897
+	 * Gets all the spotter information based on the callsign
898
+	 *
899
+	 * @return Array the spotter information
900
+	 *
901
+	 */
902
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
903
+	{
904 904
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
905 905
 	
906 906
 	date_default_timezone_set('UTC');
@@ -912,35 +912,35 @@  discard block
 block discarded – undo
912 912
 	
913 913
 	if ($ident != "")
914 914
 	{
915
-	    if (!is_string($ident))
916
-	    {
915
+		if (!is_string($ident))
916
+		{
917 917
 		return false;
918
-	    } else {
918
+		} else {
919 919
 		$additional_query = " AND (spotter_archive_output.ident = :ident)";
920 920
 		$query_values = array(':ident' => $ident);
921
-	    }
921
+		}
922 922
 	}
923 923
 	
924 924
 	if ($limit != "")
925 925
 	{
926
-	    $limit_array = explode(",", $limit);
926
+		$limit_array = explode(",", $limit);
927 927
 	    
928
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
928
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
930 930
 	    
931
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932
-	    {
931
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932
+		{
933 933
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
934 934
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
935
-	    }
935
+		}
936 936
 	}
937 937
 
938 938
 	if ($sort != "")
939 939
 	{
940
-	    $search_orderby_array = $Spotter->getOrderBy();
941
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
940
+		$search_orderby_array = $Spotter->getOrderBy();
941
+		$orderby_query = $search_orderby_array[$sort]['sql'];
942 942
 	} else {
943
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
943
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
944 944
 	}
945 945
 
946 946
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -948,17 +948,17 @@  discard block
 block discarded – undo
948 948
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
949 949
 
950 950
 	return $spotter_array;
951
-    }
951
+	}
952 952
 
953 953
 
954
-    /**
955
-    * Gets all the spotter information based on the owner
956
-    *
957
-    * @return Array the spotter information
958
-    *
959
-    */
960
-    public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
961
-    {
954
+	/**
955
+	 * Gets all the spotter information based on the owner
956
+	 *
957
+	 * @return Array the spotter information
958
+	 *
959
+	 */
960
+	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
961
+	{
962 962
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
963 963
 	
964 964
 	date_default_timezone_set('UTC');
@@ -970,35 +970,35 @@  discard block
 block discarded – undo
970 970
 	
971 971
 	if ($owner != "")
972 972
 	{
973
-	    if (!is_string($owner))
974
-	    {
973
+		if (!is_string($owner))
974
+		{
975 975
 		return false;
976
-	    } else {
976
+		} else {
977 977
 		$additional_query = " AND (spotter_archive_output.owner = :owner)";
978 978
 		$query_values = array(':owner' => $owner);
979
-	    }
979
+		}
980 980
 	}
981 981
 	
982 982
 	if ($limit != "")
983 983
 	{
984
-	    $limit_array = explode(",", $limit);
984
+		$limit_array = explode(",", $limit);
985 985
 	    
986
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
988 988
 	    
989
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990
-	    {
989
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990
+		{
991 991
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
992 992
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
993
-	    }
993
+		}
994 994
 	}
995 995
 
996 996
 	if ($sort != "")
997 997
 	{
998
-	    $search_orderby_array = $Spotter->getOrderBy();
999
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
998
+		$search_orderby_array = $Spotter->getOrderBy();
999
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1000 1000
 	} else {
1001
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1001
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1002 1002
 	}
1003 1003
 
1004 1004
 	$query = $global_query." WHERE spotter_archive_output.owner <> '' ".$additional_query." ".$orderby_query;
@@ -1006,16 +1006,16 @@  discard block
 block discarded – undo
1006 1006
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1007 1007
 
1008 1008
 	return $spotter_array;
1009
-    }
1010
-
1011
-    /**
1012
-    * Gets all the spotter information based on the pilot
1013
-    *
1014
-    * @return Array the spotter information
1015
-    *
1016
-    */
1017
-    public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1018
-    {
1009
+	}
1010
+
1011
+	/**
1012
+	 * Gets all the spotter information based on the pilot
1013
+	 *
1014
+	 * @return Array the spotter information
1015
+	 *
1016
+	 */
1017
+	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1018
+	{
1019 1019
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1020 1020
 	
1021 1021
 	date_default_timezone_set('UTC');
@@ -1033,24 +1033,24 @@  discard block
 block discarded – undo
1033 1033
 	
1034 1034
 	if ($limit != "")
1035 1035
 	{
1036
-	    $limit_array = explode(",", $limit);
1036
+		$limit_array = explode(",", $limit);
1037 1037
 	    
1038
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1039
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1038
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1039
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1040 1040
 	    
1041
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1042
-	    {
1041
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1042
+		{
1043 1043
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1044 1044
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1045
-	    }
1045
+		}
1046 1046
 	}
1047 1047
 
1048 1048
 	if ($sort != "")
1049 1049
 	{
1050
-	    $search_orderby_array = $Spotter->getOrderBy();
1051
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1050
+		$search_orderby_array = $Spotter->getOrderBy();
1051
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1052 1052
 	} else {
1053
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1053
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1054 1054
 	}
1055 1055
 
1056 1056
 	$query = $global_query." WHERE spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1058,16 +1058,16 @@  discard block
 block discarded – undo
1058 1058
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1059 1059
 
1060 1060
 	return $spotter_array;
1061
-    }
1062
-
1063
-    /**
1064
-    * Gets all number of flight over countries
1065
-    *
1066
-    * @return Array the airline country list
1067
-    *
1068
-    */
1069
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1070
-    {
1061
+	}
1062
+
1063
+	/**
1064
+	 * Gets all number of flight over countries
1065
+	 *
1066
+	 * @return Array the airline country list
1067
+	 *
1068
+	 */
1069
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1070
+	{
1071 1071
 	global $globalDBdriver;
1072 1072
 	/*
1073 1073
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1077,14 +1077,14 @@  discard block
 block discarded – undo
1077 1077
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1078 1078
 		    FROM countries c, spotter_archive s
1079 1079
 		    WHERE c.iso2 = s.over_country ";
1080
-                if ($olderthanmonths > 0) {
1081
-            		if ($globalDBdriver == 'mysql') {
1080
+				if ($olderthanmonths > 0) {
1081
+					if ($globalDBdriver == 'mysql') {
1082 1082
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1083 1083
 			} else {
1084 1084
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1085 1085
 			}
1086 1086
 		}
1087
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1087
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1088 1088
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1089 1089
 	if ($limit) $query .= " LIMIT 0,10";
1090 1090
       
@@ -1097,23 +1097,23 @@  discard block
 block discarded – undo
1097 1097
         
1098 1098
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1099 1099
 	{
1100
-	    $temp_array['flight_count'] = $row['nb'];
1101
-	    $temp_array['flight_country'] = $row['name'];
1102
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1103
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1104
-	    $flight_array[] = $temp_array;
1100
+		$temp_array['flight_count'] = $row['nb'];
1101
+		$temp_array['flight_country'] = $row['name'];
1102
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1103
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1104
+		$flight_array[] = $temp_array;
1105 1105
 	}
1106 1106
 	return $flight_array;
1107
-    }
1108
-
1109
-    /**
1110
-    * Gets last spotter information based on a particular callsign
1111
-    *
1112
-    * @return Array the spotter information
1113
-    *
1114
-    */
1115
-    public function getDateArchiveSpotterDataById($id,$date)
1116
-    {
1107
+	}
1108
+
1109
+	/**
1110
+	 * Gets last spotter information based on a particular callsign
1111
+	 *
1112
+	 * @return Array the spotter information
1113
+	 *
1114
+	 */
1115
+	public function getDateArchiveSpotterDataById($id,$date)
1116
+	{
1117 1117
 	$Spotter = new Spotter($this->db);
1118 1118
 	date_default_timezone_set('UTC');
1119 1119
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1121,16 +1121,16 @@  discard block
 block discarded – undo
1121 1121
 	$date = date('c',$date);
1122 1122
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1123 1123
 	return $spotter_array;
1124
-    }
1125
-
1126
-    /**
1127
-    * Gets all the spotter information based on a particular callsign
1128
-    *
1129
-    * @return Array the spotter information
1130
-    *
1131
-    */
1132
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1133
-    {
1124
+	}
1125
+
1126
+	/**
1127
+	 * Gets all the spotter information based on a particular callsign
1128
+	 *
1129
+	 * @return Array the spotter information
1130
+	 *
1131
+	 */
1132
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1133
+	{
1134 1134
 	$Spotter = new Spotter($this->db);
1135 1135
 	date_default_timezone_set('UTC');
1136 1136
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1138,16 +1138,16 @@  discard block
 block discarded – undo
1138 1138
 	$date = date('c',$date);
1139 1139
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1140 1140
 	return $spotter_array;
1141
-    }
1142
-
1143
-    /**
1144
-    * Gets all the spotter information based on the airport
1145
-    *
1146
-    * @return Array the spotter information
1147
-    *
1148
-    */
1149
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1150
-    {
1141
+	}
1142
+
1143
+	/**
1144
+	 * Gets all the spotter information based on the airport
1145
+	 *
1146
+	 * @return Array the spotter information
1147
+	 *
1148
+	 */
1149
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1150
+	{
1151 1151
 	global $global_query;
1152 1152
 	$Spotter = new Spotter();
1153 1153
 	date_default_timezone_set('UTC');
@@ -1158,35 +1158,35 @@  discard block
 block discarded – undo
1158 1158
 	
1159 1159
 	if ($airport != "")
1160 1160
 	{
1161
-	    if (!is_string($airport))
1162
-	    {
1161
+		if (!is_string($airport))
1162
+		{
1163 1163
 		return false;
1164
-	    } else {
1164
+		} else {
1165 1165
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1166 1166
 		$query_values = array(':airport' => $airport);
1167
-	    }
1167
+		}
1168 1168
 	}
1169 1169
 	
1170 1170
 	if ($limit != "")
1171 1171
 	{
1172
-	    $limit_array = explode(",", $limit);
1172
+		$limit_array = explode(",", $limit);
1173 1173
 	    
1174
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1175
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1174
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1175
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1176 1176
 	    
1177
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1178
-	    {
1177
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1178
+		{
1179 1179
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1180 1180
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1181
-	    }
1181
+		}
1182 1182
 	}
1183 1183
 	
1184 1184
 	if ($sort != "")
1185 1185
 	{
1186
-	    $search_orderby_array = $Spotter->getOrderBy();
1187
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1186
+		$search_orderby_array = $Spotter->getOrderBy();
1187
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1188 1188
 	} else {
1189
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1189
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1190 1190
 	}
1191 1191
 
1192 1192
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1194,6 +1194,6 @@  discard block
 block discarded – undo
1194 1194
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1195 1195
 
1196 1196
 	return $spotter_array;
1197
-    }
1197
+	}
1198 1198
 }
1199 1199
 ?>
1200 1200
\ No newline at end of file
Please login to merge, or discard this patch.