Completed
Push — master ( 48d981...ca573a )
by Yannick
07:38
created
pilot-sub-menu.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?>" <?php if (strtolower($current_page) == "pilot-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 <!--
8 8
 		<li class="dropdown">
9
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
10 10
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
11 11
 		    </a>
12 12
 		    <ul class="dropdown-menu" role="menu">
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		    </ul>
17 17
 		</li>
18 18
 		<li class="dropdown">
19
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
19
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
20 20
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
21 21
 		    </a>
22 22
 		    <ul class="dropdown-menu" role="menu">
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 			  <li><a href="<?php print $globalURL; ?>/ident/statistics/arrival-airport-country/<?php print $_GET['ident']; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
27 27
 		    </ul>
28 28
 		</li>
29
-		<li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
30
-		<li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
30
+		<li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
31 31
 -->
32 32
 	</ul>
33 33
 </div>
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Spotter.php 2 patches
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.
Spacing   +1166 added lines, -1166 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,45 +59,45 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
100
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
110
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119 119
 			if ($filter_query_where == '') {
120
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
120
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
121 121
 			} else {
122
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
122
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
123 123
 			}
124 124
 		}
125 125
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	* @return Array the spotter information
138 138
 	*
139 139
 	*/
140
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
140
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
143 143
 		$Image = new Image($this->db);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$sth = $this->db->prepare($query.$limitQuery);
168 168
 			$sth->execute($params);
169 169
 		} catch (PDOException $e) {
170
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
170
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
171 171
 			exit();
172 172
 		}
173 173
 		
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$spotter_array = array();
178 178
 		
179 179
 
180
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
180
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
181 181
 		{
182 182
 			$num_rows++;
183 183
 			$temp_array = array();
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			if (isset($row['route_stop'])) {
223 223
 				$temp_array['route_stop'] = $row['route_stop'];
224 224
 				if ($row['route_stop'] != '') {
225
-					$allroute = explode(' ',$row['route_stop']);
225
+					$allroute = explode(' ', $row['route_stop']);
226 226
 			
227 227
 					foreach ($allroute as $route) {
228 228
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 				{
278 278
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
279 279
 				} else {
280
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
280
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
281 281
 				}
282 282
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
283
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
284
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
283
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
284
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
285 285
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
286 286
 			}
287 287
 			
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 316
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 317
 					if (is_numeric(substr($row['ident'], 2, 1))) {
318
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
318
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
319 319
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
320
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
320
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
321 321
 					} else {
322 322
 						$airline_array = $this->getAllAirlineInfo('NA');
323 323
 					}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 			}
356 356
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
357
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
357
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
358 358
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
359 359
 				if (count($acars_array) > 0) {
360 360
 					$temp_array['acars'] = $acars_array;
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 372
 			}
373 373
 
374
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
374
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 375
 			{
376 376
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
377
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
378
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
379 379
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
380 380
 				if (count($image_array) > 0) {
381 381
 					$temp_array['image'] = $image_array[0]['image'];
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
400 400
 			}
401 401
 			
402
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
402
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
403 403
 				if ($schedules === true) {
404 404
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
405 405
 					//print_r($schedule_array);
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			if (isset($row['squawk'])) {
482 482
 				$temp_array['squawk'] = $row['squawk'];
483 483
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
484
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
485
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
486 486
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
488
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
489
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
490 490
 			}
491 491
     			
492 492
 			$temp_array['query_number_rows'] = $num_rows;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	* @return Array the spotter information
506 506
 	*
507 507
 	*/
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())
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;
511 511
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 		$query_values = array();
517 517
 		$additional_query = '';
518
-		$filter_query = $this->getFilter($filters,true,true);
518
+		$filter_query = $this->getFilter($filters, true, true);
519 519
 		if ($q != "")
520 520
 		{
521 521
 			if (!is_string($q))
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 				return false;
524 524
 			} else {
525 525
 				$q_array = explode(" ", $q);
526
-				foreach ($q_array as $q_item){
527
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
526
+				foreach ($q_array as $q_item) {
527
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
528 528
 					$additional_query .= " AND (";
529 529
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530 530
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -556,37 +556,37 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($registration != "")
558 558
 		{
559
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
559
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($registration))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.registration = :registration";
565
-				$query_values = array_merge($query_values,array(':registration' => $registration));
565
+				$query_values = array_merge($query_values, array(':registration' => $registration));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($aircraft_icao != "")
570 570
 		{
571
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
571
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($aircraft_icao))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
577
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
577
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
578 578
 			}
579 579
 		}
580 580
 
581 581
 		if ($aircraft_manufacturer != "")
582 582
 		{
583
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
583
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
584 584
 			if (!is_string($aircraft_manufacturer))
585 585
 			{
586 586
 				return false;
587 587
 			} else {
588 588
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
589
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
589
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
590 590
 			}
591 591
 		}
592 592
 
@@ -602,25 +602,25 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if ($airline_icao != "")
604 604
 		{
605
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
605
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($airline_icao))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
611
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
611
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($airline_country != "")
616 616
 		{
617
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
617
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($airline_country))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
623
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
623
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
624 624
 			}
625 625
 		}
626 626
 
@@ -647,31 +647,31 @@  discard block
 block discarded – undo
647 647
 
648 648
 		if ($airport != "")
649 649
 		{
650
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
650
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
651 651
 			if (!is_string($airport))
652 652
 			{
653 653
 				return false;
654 654
 			} else {
655 655
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
656
-				$query_values = array_merge($query_values,array(':airport' => $airport));
656
+				$query_values = array_merge($query_values, array(':airport' => $airport));
657 657
 			}
658 658
 		}
659 659
 
660 660
 		if ($airport_country != "")
661 661
 		{
662
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
662
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
663 663
 			if (!is_string($airport_country))
664 664
 			{
665 665
 				return false;
666 666
 			} else {
667 667
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
668
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
668
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
669 669
 			}
670 670
 		}
671 671
     
672 672
 		if ($callsign != "")
673 673
 		{
674
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
674
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
675 675
 			if (!is_string($callsign))
676 676
 			{
677 677
 				return false;
@@ -679,79 +679,79 @@  discard block
 block discarded – undo
679 679
 				$translate = $Translation->ident2icao($callsign);
680 680
 				if ($translate != $callsign) {
681 681
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
682
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
682
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
683 683
 				} else {
684 684
 					$additional_query .= " AND spotter_output.ident = :callsign";
685
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
685
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
686 686
 				}
687 687
 			}
688 688
 		}
689 689
 
690 690
 		if ($owner != "")
691 691
 		{
692
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
692
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($owner))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND spotter_output.owner_name = :owner";
698
-				$query_values = array_merge($query_values,array(':owner' => $owner));
698
+				$query_values = array_merge($query_values, array(':owner' => $owner));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($pilot_name != "")
703 703
 		{
704
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
704
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($pilot_name))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
710
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
710
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
711 711
 			}
712 712
 		}
713 713
 
714 714
 		if ($pilot_id != "")
715 715
 		{
716
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
716
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
717 717
 			if (!is_string($pilot_id))
718 718
 			{
719 719
 				return false;
720 720
 			} else {
721 721
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
722
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
722
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
723 723
 			}
724 724
 		}
725 725
 
726 726
 		if ($departure_airport_route != "")
727 727
 		{
728
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
728
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
729 729
 			if (!is_string($departure_airport_route))
730 730
 			{
731 731
 				return false;
732 732
 			} else {
733 733
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
734
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
734
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
735 735
 			}
736 736
 		}
737 737
 
738 738
 		if ($arrival_airport_route != "")
739 739
 		{
740
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
740
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
741 741
 			if (!is_string($arrival_airport_route))
742 742
 			{
743 743
 				return false;
744 744
 			} else {
745 745
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
746
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
746
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
747 747
 			}
748 748
 		}
749 749
 
750 750
 		if ($altitude != "")
751 751
 		{
752 752
 			$altitude_array = explode(",", $altitude);
753
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
754
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
753
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
754
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
755 755
 
756 756
 			if ($altitude_array[1] != "")
757 757
 			{                
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ($date_posted != "")
768 768
 		{
769 769
 			$date_array = explode(",", $date_posted);
770
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
771
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
770
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
771
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
772 772
 
773 773
 			if ($globalTimezone != '') {
774 774
 				date_default_timezone_set($globalTimezone);
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 		{
800 800
 			$limit_array = explode(",", $limit);
801 801
 			
802
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
803
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
802
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
803
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
804 804
 			
805 805
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
806 806
 			{
@@ -829,23 +829,23 @@  discard block
 block discarded – undo
829 829
 
830 830
 
831 831
 		if ($origLat != "" && $origLon != "" && $dist != "") {
832
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
832
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
833 833
 
834 834
 			if ($globalDBdriver == 'mysql') {
835
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
835
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
836 836
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
837 837
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
838 838
 			} else {
839
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
839
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
840 840
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
841 841
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
842 842
 			}
843 843
 		} else {		
844
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
844
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
845 845
 					".$additional_query."
846 846
 					".$orderby_query;
847 847
 		}
848
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
848
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
849 849
 		return $spotter_array;
850 850
 	}
851 851
 	
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		{
869 869
 			$limit_array = explode(",", $limit);
870 870
 			
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			
874 874
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
875 875
 			{
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
 			$orderby_query = " ORDER BY spotter_output.date DESC";
887 887
 		}
888 888
 
889
-		$query  = $global_query.$filter_query." ".$orderby_query;
889
+		$query = $global_query.$filter_query." ".$orderby_query;
890 890
 
891
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
891
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
892 892
 
893 893
 		return $spotter_array;
894 894
 	}
@@ -934,34 +934,34 @@  discard block
 block discarded – undo
934 934
 			{
935 935
 				return false;
936 936
 			} else {
937
-				if ($interval == "30m"){
937
+				if ($interval == "30m") {
938 938
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
939
-				} else if ($interval == "1h"){
939
+				} else if ($interval == "1h") {
940 940
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
941
-				} else if ($interval == "3h"){
941
+				} else if ($interval == "3h") {
942 942
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
943
-				} else if ($interval == "6h"){
943
+				} else if ($interval == "6h") {
944 944
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
945
-				} else if ($interval == "12h"){
945
+				} else if ($interval == "12h") {
946 946
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
947
-				} else if ($interval == "24h"){
947
+				} else if ($interval == "24h") {
948 948
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
949
-				} else if ($interval == "7d"){
949
+				} else if ($interval == "7d") {
950 950
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
951
-				} else if ($interval == "30d"){
951
+				} else if ($interval == "30d") {
952 952
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
953 953
 				} 
954 954
 			}
955 955
 		}
956 956
 
957
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
957
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
958 958
                    WHERE spotter_output.latitude <> '' 
959 959
 				   AND spotter_output.longitude <> '' 
960 960
                    ".$additional_query."
961 961
                    HAVING distance < :radius  
962 962
 				   ORDER BY distance";
963 963
 
964
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
964
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
965 965
 
966 966
 		return $spotter_array;
967 967
 	}
@@ -973,21 +973,21 @@  discard block
 block discarded – undo
973 973
 	* @return Array the spotter information
974 974
 	*
975 975
 	*/
976
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
976
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
979 979
 		
980 980
 		date_default_timezone_set('UTC');
981 981
 
982
-		$filter_query = $this->getFilter($filter,true,true);
982
+		$filter_query = $this->getFilter($filter, true, true);
983 983
 
984 984
 		$limit_query = '';
985 985
 		if ($limit != "")
986 986
 		{
987 987
 			$limit_array = explode(",", $limit);
988 988
 			
989
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
990
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
989
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
991 991
 			
992 992
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
993 993
 			{
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1005 1005
 		}
1006 1006
 
1007
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1007
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1008 1008
 
1009 1009
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1010 1010
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 		global $global_query;
1024 1024
 		
1025 1025
 		date_default_timezone_set('UTC');
1026
-		$filter_query = $this->getFilter($filter,true,true);
1026
+		$filter_query = $this->getFilter($filter, true, true);
1027 1027
 
1028 1028
 		$limit_query = '';
1029 1029
 		if ($limit != "")
1030 1030
 		{
1031 1031
 			$limit_array = explode(",", $limit);
1032 1032
 			
1033
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1034
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1034
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1035 1035
 			
1036 1036
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1037 1037
 			{
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1049 1049
 		}
1050 1050
 
1051
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1051
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1052 1052
 
1053 1053
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1054 1054
 
@@ -1062,20 +1062,20 @@  discard block
 block discarded – undo
1062 1062
 	* @return Array the spotter information
1063 1063
 	*
1064 1064
 	*/
1065
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1065
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
1068 1068
 		
1069 1069
 		date_default_timezone_set('UTC');
1070
-		$filter_query = $this->getFilter($filter,true,true);
1070
+		$filter_query = $this->getFilter($filter, true, true);
1071 1071
 		
1072 1072
 		$limit_query = '';
1073 1073
 		if ($limit != "")
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1095
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114 1114
 		
1115
-		$filter_query = $this->getFilter($filter,true,true);
1115
+		$filter_query = $this->getFilter($filter, true, true);
1116 1116
 		
1117 1117
 		$limit_query = '';
1118 1118
 		
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 		{
1121 1121
 			$limit_array = explode(",", $limit);
1122 1122
 			
1123
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1124
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1123
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1124
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1125 1125
 			
1126 1126
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1127 1127
 			{
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1139 1139
 		}
1140 1140
 
1141
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1141
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1142 1142
 
1143 1143
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1144 1144
 
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 		global $global_query;
1158 1158
 		
1159 1159
 		date_default_timezone_set('UTC');
1160
-		$filter_query = $this->getFilter($filter,true,true);
1160
+		$filter_query = $this->getFilter($filter, true, true);
1161 1161
 		$limit_query = '';
1162 1162
 		if ($limit != "")
1163 1163
 		{
1164 1164
 			$limit_array = explode(",", $limit);
1165 1165
 			
1166
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1167
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1167
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1168 1168
 			
1169 1169
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1170 1170
 			{
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1182 1182
 		}
1183 1183
 
1184
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1184
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1185 1185
 
1186 1186
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1187 1187
 
@@ -1205,9 +1205,9 @@  discard block
 block discarded – undo
1205 1205
 		$query_values = array(':id' => $id);
1206 1206
 
1207 1207
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1208
-		$query  = $global_query." WHERE ".$additional_query." ";
1208
+		$query = $global_query." WHERE ".$additional_query." ";
1209 1209
 
1210
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1210
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1211 1211
 
1212 1212
 		return $spotter_array;
1213 1213
 	}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		{
1246 1246
 			$limit_array = explode(",", $limit);
1247 1247
 			
1248
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1249
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1250 1250
 			
1251 1251
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252 1252
 			{
@@ -1300,8 +1300,8 @@  discard block
 block discarded – undo
1300 1300
 		{
1301 1301
 			$limit_array = explode(",", $limit);
1302 1302
 			
1303
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1304
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1303
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1304
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1305 1305
 			
1306 1306
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1307 1307
 			{
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
 		{
1356 1356
 			$limit_array = explode(",", $limit);
1357 1357
 			
1358
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1359
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1358
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1359
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1360 1360
 			
1361 1361
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1362 1362
 			{
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 		$query_values = array();
1398 1398
 		$limit_query = '';
1399 1399
 		$additional_query = '';
1400
-		$filter_query = $this->getFilter($filter,true,true);
1400
+		$filter_query = $this->getFilter($filter, true, true);
1401 1401
 		
1402 1402
 		if ($aircraft_type != "")
1403 1403
 		{
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		{
1415 1415
 			$limit_array = explode(",", $limit);
1416 1416
 			
1417
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1418
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1417
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1418
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1419 1419
 			
1420 1420
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1421 1421
 			{
@@ -1471,8 +1471,8 @@  discard block
 block discarded – undo
1471 1471
 		{
1472 1472
 			$limit_array = explode(",", $limit);
1473 1473
 			
1474
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1475
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1474
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1475
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1476 1476
 			
1477 1477
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1478 1478
 			{
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 		} else {
1489 1489
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1490 1490
 		}
1491
-		$filter_query = $this->getFilter($filter,true,true);
1491
+		$filter_query = $this->getFilter($filter, true, true);
1492 1492
 
1493 1493
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1494 1494
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 	* @return Array the spotter information
1508 1508
 	*
1509 1509
 	*/
1510
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1510
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1511 1511
 	{
1512 1512
 		global $global_query;
1513 1513
 		
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 		$query_values = array();
1517 1517
 		$limit_query = '';
1518 1518
 		$additional_query = '';
1519
-		$filter_query = $this->getFilter($filters,true,true);
1519
+		$filter_query = $this->getFilter($filters, true, true);
1520 1520
 		
1521 1521
 		if ($airline != "")
1522 1522
 		{
@@ -1533,8 +1533,8 @@  discard block
 block discarded – undo
1533 1533
 		{
1534 1534
 			$limit_array = explode(",", $limit);
1535 1535
 			
1536
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1537
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1536
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1537
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1538 1538
 			
1539 1539
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1540 1540
 			{
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 	* @return Array the spotter information
1565 1565
 	*
1566 1566
 	*/
1567
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1567
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1568 1568
 	{
1569 1569
 		global $global_query;
1570 1570
 		
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 		$query_values = array();
1573 1573
 		$limit_query = '';
1574 1574
 		$additional_query = '';
1575
-		$filter_query = $this->getFilter($filters,true,true);
1575
+		$filter_query = $this->getFilter($filters, true, true);
1576 1576
 		
1577 1577
 		if ($airport != "")
1578 1578
 		{
@@ -1589,8 +1589,8 @@  discard block
 block discarded – undo
1589 1589
 		{
1590 1590
 			$limit_array = explode(",", $limit);
1591 1591
 			
1592
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1593
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1592
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1593
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1594 1594
 			
1595 1595
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1596 1596
 			{
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 	* @return Array the spotter information
1623 1623
 	*
1624 1624
 	*/
1625
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1625
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1626 1626
 	{
1627 1627
 		global $global_query, $globalTimezone, $globalDBdriver;
1628 1628
 		
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 		$limit_query = '';
1631 1631
 		$additional_query = '';
1632 1632
 
1633
-		$filter_query = $this->getFilter($filter,true,true);
1633
+		$filter_query = $this->getFilter($filter, true, true);
1634 1634
 		
1635 1635
 		if ($date != "")
1636 1636
 		{
@@ -1659,8 +1659,8 @@  discard block
 block discarded – undo
1659 1659
 		{
1660 1660
 			$limit_array = explode(",", $limit);
1661 1661
 			
1662
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1663
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1662
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1663
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1664 1664
 			
1665 1665
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1666 1666
 			{
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
 	* @return Array the spotter information
1691 1691
 	*
1692 1692
 	*/
1693
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1693
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1694 1694
 	{
1695 1695
 		global $global_query;
1696 1696
 		
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 		$query_values = array();
1700 1700
 		$limit_query = '';
1701 1701
 		$additional_query = '';
1702
-		$filter_query = $this->getFilter($filters,true,true);
1702
+		$filter_query = $this->getFilter($filters, true, true);
1703 1703
 		if ($country != "")
1704 1704
 		{
1705 1705
 			if (!is_string($country))
@@ -1716,8 +1716,8 @@  discard block
 block discarded – undo
1716 1716
 		{
1717 1717
 			$limit_array = explode(",", $limit);
1718 1718
 			
1719
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1720
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1719
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1720
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1721 1721
 			
1722 1722
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1723 1723
 			{
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 		$query_values = array();
1758 1758
 		$additional_query = '';
1759 1759
 		$limit_query = '';
1760
-		$filter_query = $this->getFilter($filters,true,true);
1760
+		$filter_query = $this->getFilter($filters, true, true);
1761 1761
 		
1762 1762
 		if ($aircraft_manufacturer != "")
1763 1763
 		{
@@ -1774,8 +1774,8 @@  discard block
 block discarded – undo
1774 1774
 		{
1775 1775
 			$limit_array = explode(",", $limit);
1776 1776
 			
1777
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1778
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1777
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1778
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1779 1779
 			
1780 1780
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1781 1781
 			{
@@ -1817,14 +1817,14 @@  discard block
 block discarded – undo
1817 1817
 		$query_values = array();
1818 1818
 		$additional_query = '';
1819 1819
 		$limit_query = '';
1820
-		$filter_query = $this->getFilter($filters,true,true);
1820
+		$filter_query = $this->getFilter($filters, true, true);
1821 1821
 		if ($departure_airport_icao != "")
1822 1822
 		{
1823 1823
 			if (!is_string($departure_airport_icao))
1824 1824
 			{
1825 1825
 				return false;
1826 1826
 			} else {
1827
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1827
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1828 1828
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1829 1829
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1830 1830
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1837,10 +1837,10 @@  discard block
 block discarded – undo
1837 1837
 			{
1838 1838
 				return false;
1839 1839
 			} else {
1840
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1840
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1841 1841
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1842 1842
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1843
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1843
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1844 1844
 			}
1845 1845
 		}
1846 1846
 		
@@ -1848,8 +1848,8 @@  discard block
 block discarded – undo
1848 1848
 		{
1849 1849
 			$limit_array = explode(",", $limit);
1850 1850
 			
1851
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1852
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1851
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1852
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1853 1853
 			
1854 1854
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1855 1855
 			{
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
 		global $global_query;
1889 1889
 		
1890 1890
 		date_default_timezone_set('UTC');
1891
-		$filter_query = $this->getFilter($filter,true,true);
1891
+		$filter_query = $this->getFilter($filter, true, true);
1892 1892
 		$limit_query = '';
1893 1893
 		
1894 1894
 		if ($limit != "")
1895 1895
 		{
1896 1896
 			$limit_array = explode(",", $limit);
1897 1897
 			
1898
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1899
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1898
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1899
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1900 1900
 			
1901 1901
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1902 1902
 			{
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1914 1914
 		}
1915 1915
 
1916
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1916
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1917 1917
 
1918 1918
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1919 1919
 
@@ -1926,19 +1926,19 @@  discard block
 block discarded – undo
1926 1926
 	* @return String the highlight text
1927 1927
 	*
1928 1928
 	*/
1929
-	public function getHighlightByRegistration($registration,$filter = array())
1929
+	public function getHighlightByRegistration($registration, $filter = array())
1930 1930
 	{
1931 1931
 		global $global_query;
1932 1932
 		
1933 1933
 		date_default_timezone_set('UTC');
1934
-		$filter_query = $this->getFilter($filter,true,true);
1935
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1934
+		$filter_query = $this->getFilter($filter, true, true);
1935
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1936 1936
 		
1937
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1937
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1938 1938
 		$sth = $this->db->prepare($query);
1939 1939
 		$sth->execute(array(':registration' => $registration));
1940 1940
 
1941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1942 1942
 		{
1943 1943
 			$highlight = $row['highlight'];
1944 1944
 		}
@@ -1954,14 +1954,14 @@  discard block
 block discarded – undo
1954 1954
 	* @return String usage
1955 1955
 	*
1956 1956
 	*/
1957
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1957
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1958 1958
 	{
1959 1959
 		
1960
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1961
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1960
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1961
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1962 1962
 
1963 1963
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1964
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1964
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1965 1965
 		
1966 1966
 		$sth = $this->db->prepare($query);
1967 1967
 		$sth->execute($query_values);
@@ -1983,9 +1983,9 @@  discard block
 block discarded – undo
1983 1983
 	public function getAirportIcao($airport_iata = '')
1984 1984
 	{
1985 1985
 		
1986
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1986
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1987 1987
 
1988
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1988
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1989 1989
 		$query_values = array(':airport' => $airport_iata);
1990 1990
 		
1991 1991
 		$sth = $this->db->prepare($query);
@@ -2007,12 +2007,12 @@  discard block
 block discarded – undo
2007 2007
 	* @return Float distance to the airport
2008 2008
 	*
2009 2009
 	*/
2010
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2010
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2011 2011
 	{
2012 2012
 		
2013
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2013
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2014 2014
 
2015
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2015
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2016 2016
 		$query_values = array(':airport' => $airport_icao);
2017 2017
 		$sth = $this->db->prepare($query);
2018 2018
 		$sth->execute($query_values);
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 			$airport_latitude = $row['latitude'];
2023 2023
 			$airport_longitude = $row['longitude'];
2024 2024
 			$Common = new Common();
2025
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2025
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2026 2026
 		} else return '';
2027 2027
 	}
2028 2028
 	
@@ -2036,11 +2036,11 @@  discard block
 block discarded – undo
2036 2036
 	public function getAllAirportInfo($airport = '')
2037 2037
 	{
2038 2038
 		
2039
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2039
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2040 2040
 
2041 2041
 		$query_values = array();
2042 2042
 		if ($airport == 'NA') {
2043
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
2043
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
2044 2044
 		} elseif ($airport == '') {
2045 2045
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
2046 2046
 		} else {
@@ -2088,14 +2088,14 @@  discard block
 block discarded – undo
2088 2088
 	{
2089 2089
 		$lst_countries = '';
2090 2090
 		foreach ($countries as $country) {
2091
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2091
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2092 2092
 			if ($lst_countries == '') {
2093 2093
 				$lst_countries = "'".$country."'";
2094 2094
 			} else {
2095 2095
 				$lst_countries .= ",'".$country."'";
2096 2096
 			}
2097 2097
 		}
2098
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2098
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2099 2099
 		
2100 2100
 		$sth = $this->db->prepare($query);
2101 2101
 		$sth->execute();
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 		$airport_array = array();
2104 2104
 		$temp_array = array();
2105 2105
 		
2106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2107 2107
 		{
2108 2108
 			$temp_array['name'] = $row['name'];
2109 2109
 			$temp_array['city'] = $row['city'];
@@ -2131,10 +2131,10 @@  discard block
 block discarded – undo
2131 2131
 	{
2132 2132
 		global $globalDBdriver;
2133 2133
 		if (is_array($coord)) {
2134
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2135
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2136
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2137
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2134
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2135
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2136
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2137
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2138 2138
 		} else return array();
2139 2139
 		if ($globalDBdriver == 'mysql') {
2140 2140
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
     
2147 2147
 		$airport_array = array();
2148 2148
 		
2149
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2149
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2150 2150
 		{
2151 2151
 			$temp_array = $row;
2152 2152
 
@@ -2166,13 +2166,13 @@  discard block
 block discarded – undo
2166 2166
 	public function getAllWaypointsInfobyCoord($coord)
2167 2167
 	{
2168 2168
 		if (is_array($coord)) {
2169
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2170
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2171
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2172
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2169
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2170
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2171
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2172
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2173 2173
 		} else return array();
2174 2174
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2175
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2175
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2176 2176
 		//$query  = "SELECT waypoints.* FROM waypoints";
2177 2177
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2178 2178
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
     
2185 2185
 		$waypoints_array = array();
2186 2186
 		
2187
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2187
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2188 2188
 		{
2189 2189
 			$temp_array = $row;
2190 2190
 
@@ -2206,10 +2206,10 @@  discard block
 block discarded – undo
2206 2206
 	{
2207 2207
 		global $globalUseRealAirlines;
2208 2208
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2209
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2209
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2210 2210
 		if ($airline_icao == 'NA') {
2211 2211
 			$airline_array = array();
2212
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2212
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2213 2213
 			return $airline_array;
2214 2214
 		} else {
2215 2215
 			if (strlen($airline_icao) == 2) {
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 			if ($fromsource === NULL) {
2231 2231
 				$sth->execute(array(':airline_icao' => $airline_icao));
2232 2232
 			} else {
2233
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2233
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2234 2234
 			}
2235 2235
                         /*
2236 2236
 			$airline_array = array();
@@ -2272,13 +2272,13 @@  discard block
 block discarded – undo
2272 2272
 	{
2273 2273
 		global $globalUseRealAirlines;
2274 2274
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2275
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2276
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2276
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2277 2277
 		$sth = $this->db->prepare($query);
2278 2278
 		if ($fromsource === NULL) {
2279 2279
 			$sth->execute(array(':airline_name' => $airline_name));
2280 2280
 		} else {
2281
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2281
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2282 2282
 		}
2283 2283
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2284 2284
 		if (empty($result) && $fromsource !== NULL) {
@@ -2303,12 +2303,12 @@  discard block
 block discarded – undo
2303 2303
 	*/
2304 2304
 	public function getAllAircraftInfo($aircraft_type)
2305 2305
 	{
2306
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2306
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2307 2307
 
2308 2308
 		if ($aircraft_type == 'NA') {
2309
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2309
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2310 2310
 		}
2311
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2311
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2312 2312
 		
2313 2313
 		$sth = $this->db->prepare($query);
2314 2314
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 	*/
2341 2341
 	public function getAircraftIcao($aircraft_type)
2342 2342
 	{
2343
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2343
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2344 2344
 		$all_aircraft = array('737-300' => 'B733',
2345 2345
 				'777-200' => 'B772',
2346 2346
 				'777-200ER' => 'B772',
@@ -2352,10 +2352,10 @@  discard block
 block discarded – undo
2352 2352
 				'A380' => 'A388');
2353 2353
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2354 2354
 
2355
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2355
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2356 2356
 		$aircraft_type = strtoupper($aircraft_type);
2357 2357
 		$sth = $this->db->prepare($query);
2358
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2358
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2359 2359
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2360 2360
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2361 2361
 		else return '';
@@ -2370,9 +2370,9 @@  discard block
 block discarded – undo
2370 2370
 	*/
2371 2371
 	public function getAllAircraftType($aircraft_modes)
2372 2372
 	{
2373
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2373
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2374 2374
 
2375
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2375
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2376 2376
 		
2377 2377
 		$sth = $this->db->prepare($query);
2378 2378
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2395,9 +2395,9 @@  discard block
 block discarded – undo
2395 2395
 	*/
2396 2396
 	public function getAllAircraftTypeByRegistration($registration)
2397 2397
 	{
2398
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2398
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2399 2399
 
2400
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2400
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2401 2401
 		
2402 2402
 		$sth = $this->db->prepare($query);
2403 2403
 		$sth->execute(array(':registration' => $registration));
@@ -2418,9 +2418,9 @@  discard block
 block discarded – undo
2418 2418
 	*/
2419 2419
 	public function getAllIDByRegistration($registration)
2420 2420
 	{
2421
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2421
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2422 2422
 
2423
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2423
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2424 2424
 		
2425 2425
 		$sth = $this->db->prepare($query);
2426 2426
 		$sth->execute(array(':registration' => $registration));
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
 		$idarray = array();
2429 2429
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2430 2430
 			$date = $row['date'];
2431
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2431
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2432 2432
 		}
2433 2433
 		return $idarray;
2434 2434
 	}
@@ -2442,8 +2442,8 @@  discard block
 block discarded – undo
2442 2442
 	*/
2443 2443
 	public function getOperator($operator)
2444 2444
 	{
2445
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2446
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2445
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2446
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2447 2447
 		
2448 2448
 		$sth = $this->db->prepare($query);
2449 2449
 		$sth->execute(array(':operator' => $operator));
@@ -2464,9 +2464,9 @@  discard block
 block discarded – undo
2464 2464
 	*/
2465 2465
 	public function getRouteInfo($callsign)
2466 2466
 	{
2467
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2467
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2468 2468
                 if ($callsign == '') return array();
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";
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);
2472 2472
 		$sth->execute(array(':callsign' => $callsign));
@@ -2487,9 +2487,9 @@  discard block
 block discarded – undo
2487 2487
 	*/
2488 2488
 	public function getAircraftInfoByRegistration($registration)
2489 2489
 	{
2490
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2490
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2491 2491
 
2492
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2492
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2493 2493
 		
2494 2494
 		$sth = $this->db->prepare($query);
2495 2495
 		$sth->execute(array(':registration' => $registration));
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
 		$aircraft_array = array();
2498 2498
 		$temp_array = array();
2499 2499
 		
2500
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2500
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2501 2501
 		{
2502 2502
 			$temp_array['airline_icao'] = $row['airline_icao'];
2503 2503
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2519,7 +2519,7 @@  discard block
 block discarded – undo
2519 2519
 	*/
2520 2520
 	public function getAircraftOwnerByRegistration($registration)
2521 2521
 	{
2522
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2522
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2523 2523
 		$Connection = new Connection($this->db);
2524 2524
 		if ($Connection->tableExists('aircraft_owner')) {
2525 2525
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
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 ";
2544
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2544
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2545 2545
 		
2546 2546
 		$sth = $this->db->prepare($query);
2547 2547
 		$sth->execute();
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
 		$manufacturer_array = array();
2589 2589
 		$temp_array = array();
2590 2590
 		
2591
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2591
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2592 2592
 		{
2593 2593
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2594 2594
 
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
 		$aircraft_array = array();
2626 2626
 		$temp_array = array();
2627 2627
 		
2628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2629 2629
 		{
2630 2630
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2631 2631
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2646,8 +2646,8 @@  discard block
 block discarded – undo
2646 2646
 	*/
2647 2647
 	public function getAllAircraftRegistrations($filters = array())
2648 2648
 	{
2649
-		$filter_query = $this->getFilter($filters,true,true);
2650
-		$query  = "SELECT DISTINCT spotter_output.registration 
2649
+		$filter_query = $this->getFilter($filters, true, true);
2650
+		$query = "SELECT DISTINCT spotter_output.registration 
2651 2651
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2652 2652
 				ORDER BY spotter_output.registration ASC";
2653 2653
 
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
 		$aircraft_array = array();
2658 2658
 		$temp_array = array();
2659 2659
 		
2660
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2660
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2661 2661
 		{
2662 2662
 			$temp_array['registration'] = $row['registration'];
2663 2663
 
@@ -2674,11 +2674,11 @@  discard block
 block discarded – undo
2674 2674
 	* @return Array list of source name
2675 2675
 	*
2676 2676
 	*/
2677
-	public function getAllSourceName($type = '',$filters = array())
2677
+	public function getAllSourceName($type = '', $filters = array())
2678 2678
 	{
2679
-		$filter_query = $this->getFilter($filters,true,true);
2679
+		$filter_query = $this->getFilter($filters, true, true);
2680 2680
 		$query_values = array();
2681
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2681
+		$query = "SELECT DISTINCT spotter_output.source_name 
2682 2682
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2683 2683
 		if ($type != '') {
2684 2684
 			$query_values = array(':type' => $type);
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
 		$source_array = array();
2694 2694
 		$temp_array = array();
2695 2695
 		
2696
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2696
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2697 2697
 		{
2698 2698
 			$temp_array['source_name'] = $row['source_name'];
2699 2699
 			$source_array[] = $temp_array;
@@ -2709,11 +2709,11 @@  discard block
 block discarded – undo
2709 2709
 	* @return Array list of airline names
2710 2710
 	*
2711 2711
 	*/
2712
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2712
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2713 2713
 	{
2714
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2715
-		$filter_query = $this->getFilter($filters,true,true);
2716
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2714
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2715
+		$filter_query = $this->getFilter($filters, true, true);
2716
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2717 2717
 		if ($airline_type == '' || $airline_type == 'all') {
2718 2718
 			/*
2719 2719
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
 				$query_data = array(':forsource' => $forsource);
2733 2733
 			}
2734 2734
 		} else {
2735
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2735
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2736 2736
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2737 2737
 					AND spotter_output.airline_type = :airline_type 
2738 2738
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2745,7 +2745,7 @@  discard block
 block discarded – undo
2745 2745
 		$airline_array = array();
2746 2746
 		$temp_array = array();
2747 2747
 		
2748
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2748
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2749 2749
 		{
2750 2750
 			$temp_array['airline_icao'] = $row['airline_icao'];
2751 2751
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2762,10 +2762,10 @@  discard block
 block discarded – undo
2762 2762
 	* @return Array list of alliance names
2763 2763
 	*
2764 2764
 	*/
2765
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2765
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2766 2766
 	{
2767
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2768
-		$filter_query = $this->getFilter($filters,true,true);
2767
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2768
+		$filter_query = $this->getFilter($filters, true, true);
2769 2769
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2770 2770
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2771 2771
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2793,8 +2793,8 @@  discard block
 block discarded – undo
2793 2793
 	*/
2794 2794
 	public function getAllAirlineCountries($filters = array())
2795 2795
 	{
2796
-		$filter_query = $this->getFilter($filters,true,true);
2797
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2796
+		$filter_query = $this->getFilter($filters, true, true);
2797
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2798 2798
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2799 2799
 				ORDER BY spotter_output.airline_country ASC";
2800 2800
 		
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
 		$airline_array = array();
2806 2806
 		$temp_array = array();
2807 2807
 		
2808
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2808
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2809 2809
 		{
2810 2810
 			$temp_array['airline_country'] = $row['airline_country'];
2811 2811
 
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	*/
2826 2826
 	public function getAllAirportNames($filters = array())
2827 2827
 	{
2828
-		$filter_query = $this->getFilter($filters,true,true);
2828
+		$filter_query = $this->getFilter($filters, true, true);
2829 2829
 		$airport_array = array();
2830
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2830
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2831 2831
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2832 2832
 				ORDER BY spotter_output.departure_airport_city ASC";
2833 2833
 		
@@ -2836,7 +2836,7 @@  discard block
 block discarded – undo
2836 2836
 		$sth->execute();
2837 2837
 
2838 2838
 		$temp_array = array();
2839
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2839
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2840 2840
 		{
2841 2841
 			$temp_array['airport_icao'] = $row['airport_icao'];
2842 2842
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2846,14 +2846,14 @@  discard block
 block discarded – undo
2846 2846
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2847 2847
 		}
2848 2848
 
2849
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2849
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2850 2850
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2851 2851
 								ORDER BY spotter_output.arrival_airport_city ASC";
2852 2852
 					
2853 2853
 		$sth = $this->db->prepare($query);
2854 2854
 		$sth->execute();
2855 2855
 
2856
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2856
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2857 2857
 			{
2858 2858
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2859 2859
 		//	{
@@ -2893,21 +2893,21 @@  discard block
 block discarded – undo
2893 2893
    
2894 2894
 		$temp_array = array();
2895 2895
 		
2896
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2896
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2897 2897
 		{
2898 2898
 			$temp_array['airport_country'] = $row['airport_country'];
2899 2899
 
2900 2900
 			$airport_array[$row['airport_country']] = $temp_array;
2901 2901
 		}
2902
-		$filter_query = $this->getFilter($filters,true,true);
2903
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2902
+		$filter_query = $this->getFilter($filters, true, true);
2903
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2904 2904
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2905 2905
 								ORDER BY spotter_output.arrival_airport_country ASC";
2906 2906
 					
2907 2907
 		$sth = $this->db->prepare($query);
2908 2908
 		$sth->execute();
2909 2909
 		
2910
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2910
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2911 2911
 		{
2912 2912
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2913 2913
 			{
@@ -2930,9 +2930,9 @@  discard block
 block discarded – undo
2930 2930
 	*/
2931 2931
 	public function getAllCountries($filters = array())
2932 2932
 	{
2933
-		$Connection= new Connection($this->db);
2933
+		$Connection = new Connection($this->db);
2934 2934
 		if ($Connection->tableExists('countries')) {
2935
-			$query  = "SELECT countries.name AS airport_country
2935
+			$query = "SELECT countries.name AS airport_country
2936 2936
 				FROM countries
2937 2937
 				ORDER BY countries.name ASC";
2938 2938
 			$sth = $this->db->prepare($query);
@@ -2941,14 +2941,14 @@  discard block
 block discarded – undo
2941 2941
 			$temp_array = array();
2942 2942
 			$country_array = array();
2943 2943
 		
2944
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2944
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2945 2945
 			{
2946 2946
 				$temp_array['country'] = $row['airport_country'];
2947 2947
 				$country_array[$row['airport_country']] = $temp_array;
2948 2948
 			}
2949 2949
 		} else {
2950
-			$filter_query = $this->getFilter($filters,true,true);
2951
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2950
+			$filter_query = $this->getFilter($filters, true, true);
2951
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2952 2952
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2953 2953
 								ORDER BY spotter_output.departure_airport_country ASC";
2954 2954
 
@@ -2957,20 +2957,20 @@  discard block
 block discarded – undo
2957 2957
    
2958 2958
 			$temp_array = array();
2959 2959
 			$country_array = array();
2960
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2960
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2961 2961
 			{
2962 2962
 				$temp_array['country'] = $row['airport_country'];
2963 2963
 				$country_array[$row['airport_country']] = $temp_array;
2964 2964
 			}
2965 2965
 
2966
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2966
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2967 2967
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2968 2968
 								ORDER BY spotter_output.arrival_airport_country ASC";
2969 2969
 					
2970 2970
 		$sth = $this->db->prepare($query);
2971 2971
 		$sth->execute();
2972 2972
 		
2973
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2973
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2974 2974
 		{
2975 2975
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2976 2976
 			{
@@ -2980,14 +2980,14 @@  discard block
 block discarded – undo
2980 2980
 			}
2981 2981
 		}
2982 2982
 		
2983
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2983
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2984 2984
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2985 2985
 								ORDER BY spotter_output.airline_country ASC";
2986 2986
 					
2987 2987
 		$sth = $this->db->prepare($query);
2988 2988
 		$sth->execute();
2989 2989
 		
2990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2991 2991
 		{
2992 2992
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2993 2993
 			{
@@ -3011,8 +3011,8 @@  discard block
 block discarded – undo
3011 3011
 	*/
3012 3012
 	public function getAllIdents($filters = array())
3013 3013
 	{
3014
-		$filter_query = $this->getFilter($filters,true,true);
3015
-		$query  = "SELECT DISTINCT spotter_output.ident
3014
+		$filter_query = $this->getFilter($filters, true, true);
3015
+		$query = "SELECT DISTINCT spotter_output.ident
3016 3016
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3017 3017
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3018 3018
 
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
 		$ident_array = array();
3023 3023
 		$temp_array = array();
3024 3024
 		
3025
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3025
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3026 3026
 		{
3027 3027
 			$temp_array['ident'] = $row['ident'];
3028 3028
 			$ident_array[] = $temp_array;
@@ -3036,9 +3036,9 @@  discard block
 block discarded – undo
3036 3036
 	* @return Array number, icao, name and city of airports
3037 3037
 	*/
3038 3038
 
3039
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3039
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3040 3040
 		global $globalTimezone, $globalDBdriver;
3041
-		$filter_query = $this->getFilter($filters,true,true);
3041
+		$filter_query = $this->getFilter($filters, true, true);
3042 3042
 		if ($globalTimezone != '') {
3043 3043
 			date_default_timezone_set($globalTimezone);
3044 3044
 			$datetime = new DateTime();
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
 
3104 3104
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3105 3105
 		global $globalTimezone, $globalDBdriver;
3106
-		$filter_query = $this->getFilter($filters,true,true);
3106
+		$filter_query = $this->getFilter($filters, true, true);
3107 3107
 		if ($globalTimezone != '') {
3108 3108
 			date_default_timezone_set($globalTimezone);
3109 3109
 			$datetime = new DateTime();
@@ -3187,7 +3187,7 @@  discard block
 block discarded – undo
3187 3187
 
3188 3188
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3189 3189
 		global $globalTimezone, $globalDBdriver;
3190
-		$filter_query = $this->getFilter($filters,true,true);
3190
+		$filter_query = $this->getFilter($filters, true, true);
3191 3191
 		if ($globalTimezone != '') {
3192 3192
 			date_default_timezone_set($globalTimezone);
3193 3193
 			$datetime = new DateTime();
@@ -3220,9 +3220,9 @@  discard block
 block discarded – undo
3220 3220
 	* @return Array number, icao, name and city of airports
3221 3221
 	*/
3222 3222
 
3223
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3223
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3224 3224
 		global $globalTimezone, $globalDBdriver;
3225
-		$filter_query = $this->getFilter($filters,true,true);
3225
+		$filter_query = $this->getFilter($filters, true, true);
3226 3226
 		if ($globalTimezone != '') {
3227 3227
 			date_default_timezone_set($globalTimezone);
3228 3228
 			$datetime = new DateTime();
@@ -3354,12 +3354,12 @@  discard block
 block discarded – undo
3354 3354
 		} else $offset = '+00:00';
3355 3355
 
3356 3356
 		if ($globalDBdriver == 'mysql') {
3357
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3357
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3358 3358
 								FROM spotter_output
3359 3359
 								WHERE spotter_output.date <> '' 
3360 3360
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3361 3361
 		} else {
3362
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3362
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3363 3363
 								FROM spotter_output
3364 3364
 								WHERE spotter_output.date <> '' 
3365 3365
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3371,7 +3371,7 @@  discard block
 block discarded – undo
3371 3371
 		$date_array = array();
3372 3372
 		$temp_array = array();
3373 3373
 		
3374
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3374
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3375 3375
 		{
3376 3376
 			$temp_array['date'] = $row['date'];
3377 3377
 
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
 	*/
3392 3392
 	public function getAllRoutes()
3393 3393
 	{
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 
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 
3395 3395
 				FROM spotter_output
3396 3396
 				WHERE spotter_output.ident <> '' 
3397 3397
 				GROUP BY route
@@ -3402,7 +3402,7 @@  discard block
 block discarded – undo
3402 3402
 
3403 3403
 		$routes_array = array();
3404 3404
 		$temp_array = array();
3405
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3405
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3406 3406
 		{
3407 3407
 			$temp_array['route'] = $row['route'];
3408 3408
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3421,21 +3421,21 @@  discard block
 block discarded – undo
3421 3421
 	* @return String success or false
3422 3422
 	*
3423 3423
 	*/	
3424
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3424
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3425 3425
 	{
3426 3426
 		if (!is_numeric(substr($ident, 0, 3)))
3427 3427
 		{
3428 3428
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3429
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3429
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3430 3430
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3431
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3431
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3432 3432
 			} else {
3433 3433
 				$airline_array = $this->getAllAirlineInfo("NA");
3434 3434
 			}
3435 3435
 			if (count($airline_array) == 0) {
3436 3436
 				$airline_array = $this->getAllAirlineInfo("NA");
3437 3437
 			}
3438
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3438
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3439 3439
 				$airline_array = $this->getAllAirlineInfo("NA");
3440 3440
 			}
3441 3441
 		} else {
@@ -3448,7 +3448,7 @@  discard block
 block discarded – undo
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);
@@ -3469,11 +3469,11 @@  discard block
 block discarded – undo
3469 3469
 	* @return String success or false
3470 3470
 	*
3471 3471
 	*/	
3472
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
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);
@@ -3513,7 +3513,7 @@  discard block
 block discarded – undo
3513 3513
 	* @param String $verticalrate vertival rate of flight
3514 3514
 	* @return String success or false
3515 3515
 	*/
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 = '')
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;
3519 3519
 		
@@ -3537,13 +3537,13 @@  discard block
 block discarded – undo
3537 3537
 				if ($ModeS != '') {
3538 3538
 					$timeelapsed = microtime(true);
3539 3539
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3540
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3540
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3541 3541
 				} else {
3542
-					$myhex = explode('-',$flightaware_id);
3542
+					$myhex = explode('-', $flightaware_id);
3543 3543
 					if (count($myhex) > 0) {
3544 3544
 						$timeelapsed = microtime(true);
3545 3545
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3546
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3546
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3547 3547
 					}
3548 3548
 				}
3549 3549
 			}
@@ -3565,24 +3565,24 @@  discard block
 block discarded – undo
3565 3565
 				{
3566 3566
 					$timeelapsed = microtime(true);
3567 3567
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3568
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3568
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3569 3569
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3570
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3570
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3571 3571
 					} else {
3572 3572
 						$airline_array = $this->getAllAirlineInfo("NA");
3573 3573
 					}
3574 3574
 					if (count($airline_array) == 0) {
3575 3575
 						$airline_array = $this->getAllAirlineInfo("NA");
3576 3576
 					}
3577
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3577
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3578 3578
 						$airline_array = $this->getAllAirlineInfo("NA");
3579 3579
 					}
3580
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3580
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3581 3581
 
3582 3582
 				} else {
3583 3583
 					$timeelapsed = microtime(true);
3584 3584
 					$airline_array = $this->getAllAirlineInfo("NA");
3585
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3585
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3586 3586
 				}
3587 3587
 			}
3588 3588
 		} else $airline_array = array();
@@ -3599,27 +3599,27 @@  discard block
 block discarded – undo
3599 3599
 				{
3600 3600
 					$timeelapsed = microtime(true);
3601 3601
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3602
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3602
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3603 3603
 				} else {
3604 3604
 					$timeelapsed = microtime(true);
3605 3605
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3606
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3607 3607
 				}
3608 3608
 			}
3609 3609
 		} else {
3610 3610
 			if ($ModeS != '') {
3611 3611
 				$timeelapsed = microtime(true);
3612 3612
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3613
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3613
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3614 3614
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3615 3615
 				{
3616 3616
 					$timeelapsed = microtime(true);
3617 3617
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3618
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3618
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3619 3619
 				} else {
3620 3620
 					$timeelapsed = microtime(true);
3621 3621
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3622
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3622
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3623 3623
 				}
3624 3624
 			}
3625 3625
 		}
@@ -3635,7 +3635,7 @@  discard block
 block discarded – undo
3635 3635
 			} else {
3636 3636
 				$timeelapsed = microtime(true);
3637 3637
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3638
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3638
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3639 3639
 			}
3640 3640
 		}
3641 3641
 		
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
 			} else {
3651 3651
 				$timeelapsed = microtime(true);
3652 3652
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3653
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3653
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3654 3654
 			}
3655 3655
 		}
3656 3656
 
@@ -3713,7 +3713,7 @@  discard block
 block discarded – undo
3713 3713
 		{
3714 3714
 			$timeelapsed = microtime(true);
3715 3715
 			$image_array = $Image->getSpotterImage($registration);
3716
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3716
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3717 3717
 			if (!isset($image_array[0]['registration']))
3718 3718
 			{
3719 3719
 				//echo "Add image !!!! \n";
@@ -3721,7 +3721,7 @@  discard block
 block discarded – undo
3721 3721
 			}
3722 3722
 			$timeelapsed = microtime(true);
3723 3723
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3724
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3724
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3725 3725
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3726 3726
 		}
3727 3727
     
@@ -3729,33 +3729,33 @@  discard block
 block discarded – undo
3729 3729
 		{
3730 3730
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3731 3731
             		else $airline_icao = '';
3732
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3732
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3733 3733
 			if (!isset($image_array[0]['registration']))
3734 3734
 			{
3735 3735
 				//echo "Add image !!!! \n";
3736
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3736
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3737 3737
 			}
3738 3738
 		}
3739 3739
     
3740
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3741
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3742
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3743
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3744
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3745
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3746
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3747
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3748
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3749
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3750
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3751
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3752
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3753
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3754
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3755
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3756
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3757
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3758
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3740
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3741
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3742
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3743
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3744
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3745
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3746
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3747
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3748
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3749
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3750
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3751
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3752
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3753
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3754
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3755
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3756
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3757
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3758
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3759 3759
 	
3760 3760
 		if (count($airline_array) == 0) 
3761 3761
 		{
@@ -3783,7 +3783,7 @@  discard block
 block discarded – undo
3783 3783
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3784 3784
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3785 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) 
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 3789
                 $airline_name = $airline_array[0]['name'];
@@ -3793,7 +3793,7 @@  discard block
 block discarded – undo
3793 3793
 		if ($airline_type == '') {
3794 3794
 			$timeelapsed = microtime(true);
3795 3795
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3796
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
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 3799
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3805,7 +3805,7 @@  discard block
 block discarded – undo
3805 3805
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3806 3806
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3807 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);
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
 		        
@@ -3831,13 +3831,13 @@  discard block
 block discarded – undo
3831 3831
 	{
3832 3832
 		global $globalDBdriver, $globalTimezone;
3833 3833
 		if ($globalDBdriver == 'mysql') {
3834
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3834
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3835 3835
 								WHERE spotter_output.ident = :ident 
3836 3836
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3837 3837
 								AND spotter_output.date < UTC_TIMESTAMP()";
3838 3838
 			$query_data = array(':ident' => $ident);
3839 3839
 		} else {
3840
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3840
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3841 3841
 								WHERE spotter_output.ident = :ident 
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'";
@@ -3846,8 +3846,8 @@  discard block
 block discarded – undo
3846 3846
 		
3847 3847
 		$sth = $this->db->prepare($query);
3848 3848
 		$sth->execute($query_data);
3849
-    		$ident_result='';
3850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3849
+    		$ident_result = '';
3850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3851 3851
 		{
3852 3852
 			$ident_result = $row['ident'];
3853 3853
 		}
@@ -3873,8 +3873,8 @@  discard block
 block discarded – undo
3873 3873
 				return false;
3874 3874
 			} else {
3875 3875
 				$q_array = explode(" ", $q);
3876
-				foreach ($q_array as $q_item){
3877
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3876
+				foreach ($q_array as $q_item) {
3877
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3878 3878
 					$additional_query .= " AND (";
3879 3879
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3880 3880
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3889,11 +3889,11 @@  discard block
 block discarded – undo
3889 3889
 			}
3890 3890
 		}
3891 3891
 		if ($globalDBdriver == 'mysql') {
3892
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3892
+			$query = "SELECT spotter_output.* FROM spotter_output 
3893 3893
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3894 3894
 				AND spotter_output.date < UTC_TIMESTAMP()";
3895 3895
 		} else {
3896
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3896
+			$query = "SELECT spotter_output.* FROM spotter_output 
3897 3897
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3898 3898
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3899 3899
 		}
@@ -3910,11 +3910,11 @@  discard block
 block discarded – undo
3910 3910
 	* @return Array the airline list
3911 3911
 	*
3912 3912
 	*/
3913
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3913
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3914 3914
 	{
3915 3915
 		global $globalDBdriver;
3916
-		$filter_query = $this->getFilter($filters,true,true);
3917
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3916
+		$filter_query = $this->getFilter($filters, true, true);
3917
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3918 3918
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3919 3919
 		if ($olderthanmonths > 0) {
3920 3920
 			if ($globalDBdriver == 'mysql') {
@@ -3934,28 +3934,28 @@  discard block
 block discarded – undo
3934 3934
 		if ($year != '') {
3935 3935
 			if ($globalDBdriver == 'mysql') {
3936 3936
 				$query .= " AND YEAR(spotter_output.date) = :year";
3937
-				$query_values = array_merge($query_values,array(':year' => $year));
3937
+				$query_values = array_merge($query_values, array(':year' => $year));
3938 3938
 			} else {
3939 3939
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
3940
-				$query_values = array_merge($query_values,array(':year' => $year));
3940
+				$query_values = array_merge($query_values, array(':year' => $year));
3941 3941
 			}
3942 3942
 		}
3943 3943
 		if ($month != '') {
3944 3944
 			if ($globalDBdriver == 'mysql') {
3945 3945
 				$query .= " AND MONTH(spotter_output.date) = :month";
3946
-				$query_values = array_merge($query_values,array(':month' => $month));
3946
+				$query_values = array_merge($query_values, array(':month' => $month));
3947 3947
 			} else {
3948 3948
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
3949
-				$query_values = array_merge($query_values,array(':month' => $month));
3949
+				$query_values = array_merge($query_values, array(':month' => $month));
3950 3950
 			}
3951 3951
 		}
3952 3952
 		if ($day != '') {
3953 3953
 			if ($globalDBdriver == 'mysql') {
3954 3954
 				$query .= " AND DAY(spotter_output.date) = :day";
3955
-				$query_values = array_merge($query_values,array(':day' => $day));
3955
+				$query_values = array_merge($query_values, array(':day' => $day));
3956 3956
 			} else {
3957 3957
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
3958
-				$query_values = array_merge($query_values,array(':day' => $day));
3958
+				$query_values = array_merge($query_values, array(':day' => $day));
3959 3959
 			}
3960 3960
 		}
3961 3961
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -3965,7 +3965,7 @@  discard block
 block discarded – undo
3965 3965
 		$sth->execute($query_values);
3966 3966
 		$airline_array = array();
3967 3967
 		$temp_array = array();
3968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3969 3969
 		{
3970 3970
 			$temp_array['airline_name'] = $row['airline_name'];
3971 3971
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3982,11 +3982,11 @@  discard block
 block discarded – undo
3982 3982
 	* @return Array the pilots list
3983 3983
 	*
3984 3984
 	*/
3985
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
3985
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3986 3986
 	{
3987 3987
 		global $globalDBdriver;
3988
-		$filter_query = $this->getFilter($filters,true,true);
3989
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3988
+		$filter_query = $this->getFilter($filters, true, true);
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 3991
                 if ($olderthanmonths > 0) {
3992 3992
             		if ($globalDBdriver == 'mysql') {
@@ -4006,28 +4006,28 @@  discard block
 block discarded – undo
4006 4006
 		if ($year != '') {
4007 4007
 			if ($globalDBdriver == 'mysql') {
4008 4008
 				$query .= " AND YEAR(spotter_output.date) = :year";
4009
-				$query_values = array_merge($query_values,array(':year' => $year));
4009
+				$query_values = array_merge($query_values, array(':year' => $year));
4010 4010
 			} else {
4011 4011
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4012
-				$query_values = array_merge($query_values,array(':year' => $year));
4012
+				$query_values = array_merge($query_values, array(':year' => $year));
4013 4013
 			}
4014 4014
 		}
4015 4015
 		if ($month != '') {
4016 4016
 			if ($globalDBdriver == 'mysql') {
4017 4017
 				$query .= " AND MONTH(spotter_output.date) = :month";
4018
-				$query_values = array_merge($query_values,array(':month' => $month));
4018
+				$query_values = array_merge($query_values, array(':month' => $month));
4019 4019
 			} else {
4020 4020
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4021
-				$query_values = array_merge($query_values,array(':month' => $month));
4021
+				$query_values = array_merge($query_values, array(':month' => $month));
4022 4022
 			}
4023 4023
 		}
4024 4024
 		if ($day != '') {
4025 4025
 			if ($globalDBdriver == 'mysql') {
4026 4026
 				$query .= " AND DAY(spotter_output.date) = :day";
4027
-				$query_values = array_merge($query_values,array(':day' => $day));
4027
+				$query_values = array_merge($query_values, array(':day' => $day));
4028 4028
 			} else {
4029 4029
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4030
-				$query_values = array_merge($query_values,array(':day' => $day));
4030
+				$query_values = array_merge($query_values, array(':day' => $day));
4031 4031
 			}
4032 4032
 		}
4033 4033
 		
@@ -4039,7 +4039,7 @@  discard block
 block discarded – undo
4039 4039
 		$sth->execute($query_values);
4040 4040
 		$airline_array = array();
4041 4041
 		$temp_array = array();
4042
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4042
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4043 4043
 		{
4044 4044
 			$temp_array['pilot_name'] = $row['pilot_name'];
4045 4045
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4059,7 +4059,7 @@  discard block
 block discarded – undo
4059 4059
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4060 4060
 	{
4061 4061
 		global $globalDBdriver;
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
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 4064
                 if ($olderthanmonths > 0) {
4065 4065
             		if ($globalDBdriver == 'mysql') {
@@ -4085,7 +4085,7 @@  discard block
 block discarded – undo
4085 4085
 		$airline_array = array();
4086 4086
 		$temp_array = array();
4087 4087
         
4088
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4088
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4089 4089
 		{
4090 4090
 			$temp_array['pilot_name'] = $row['pilot_name'];
4091 4091
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4103,11 +4103,11 @@  discard block
 block discarded – undo
4103 4103
 	* @return Array the pilots list
4104 4104
 	*
4105 4105
 	*/
4106
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4106
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4107 4107
 	{
4108 4108
 		global $globalDBdriver;
4109
-		$filter_query = $this->getFilter($filters,true,true);
4110
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4109
+		$filter_query = $this->getFilter($filters, true, true);
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 4112
                 if ($olderthanmonths > 0) {
4113 4113
             		if ($globalDBdriver == 'mysql') {
@@ -4127,28 +4127,28 @@  discard block
 block discarded – undo
4127 4127
 		if ($year != '') {
4128 4128
 			if ($globalDBdriver == 'mysql') {
4129 4129
 				$query .= " AND YEAR(spotter_output.date) = :year";
4130
-				$query_values = array_merge($query_values,array(':year' => $year));
4130
+				$query_values = array_merge($query_values, array(':year' => $year));
4131 4131
 			} else {
4132 4132
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4133
-				$query_values = array_merge($query_values,array(':year' => $year));
4133
+				$query_values = array_merge($query_values, array(':year' => $year));
4134 4134
 			}
4135 4135
 		}
4136 4136
 		if ($month != '') {
4137 4137
 			if ($globalDBdriver == 'mysql') {
4138 4138
 				$query .= " AND MONTH(spotter_output.date) = :month";
4139
-				$query_values = array_merge($query_values,array(':month' => $month));
4139
+				$query_values = array_merge($query_values, array(':month' => $month));
4140 4140
 			} else {
4141 4141
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4142
-				$query_values = array_merge($query_values,array(':month' => $month));
4142
+				$query_values = array_merge($query_values, array(':month' => $month));
4143 4143
 			}
4144 4144
 		}
4145 4145
 		if ($day != '') {
4146 4146
 			if ($globalDBdriver == 'mysql') {
4147 4147
 				$query .= " AND DAY(spotter_output.date) = :day";
4148
-				$query_values = array_merge($query_values,array(':day' => $day));
4148
+				$query_values = array_merge($query_values, array(':day' => $day));
4149 4149
 			} else {
4150 4150
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4151
-				$query_values = array_merge($query_values,array(':day' => $day));
4151
+				$query_values = array_merge($query_values, array(':day' => $day));
4152 4152
 			}
4153 4153
 		}
4154 4154
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4158,7 +4158,7 @@  discard block
 block discarded – undo
4158 4158
 		$sth->execute($query_values);
4159 4159
 		$airline_array = array();
4160 4160
 		$temp_array = array();
4161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4162 4162
 		{
4163 4163
 			$temp_array['owner_name'] = $row['owner_name'];
4164 4164
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4173,11 +4173,11 @@  discard block
 block discarded – undo
4173 4173
 	* @return Array the pilots list
4174 4174
 	*
4175 4175
 	*/
4176
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4176
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4177 4177
 	{
4178 4178
 		global $globalDBdriver;
4179
-		$filter_query = $this->getFilter($filters,true,true);
4180
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4179
+		$filter_query = $this->getFilter($filters, true, true);
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 4182
                 if ($olderthanmonths > 0) {
4183 4183
             		if ($globalDBdriver == 'mysql') {
@@ -4203,7 +4203,7 @@  discard block
 block discarded – undo
4203 4203
 		$airline_array = array();
4204 4204
 		$temp_array = array();
4205 4205
         
4206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4207 4207
 		{
4208 4208
 			$temp_array['owner_name'] = $row['owner_name'];
4209 4209
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4219,11 +4219,11 @@  discard block
 block discarded – undo
4219 4219
 	* @return Array the airline list
4220 4220
 	*
4221 4221
 	*/
4222
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4222
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4223 4223
 	{
4224
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4225
-		$filter_query = $this->getFilter($filters,true,true);
4226
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4224
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4225
+		$filter_query = $this->getFilter($filters, true, true);
4226
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4227 4227
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4228 4228
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4229 4229
 			    ORDER BY airline_count DESC";
@@ -4235,7 +4235,7 @@  discard block
 block discarded – undo
4235 4235
 		$airline_array = array();
4236 4236
 		$temp_array = array();
4237 4237
         
4238
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4238
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4239 4239
 		{
4240 4240
 			$temp_array['airline_name'] = $row['airline_name'];
4241 4241
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
 	* @return Array the airline country list
4256 4256
 	*
4257 4257
 	*/
4258
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4258
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4259 4259
 	{
4260
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4261
-		$filter_query = $this->getFilter($filters,true,true);
4262
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4260
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4261
+		$filter_query = $this->getFilter($filters, true, true);
4262
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4263 4263
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4264 4264
                     GROUP BY spotter_output.airline_country
4265 4265
 					ORDER BY airline_country_count DESC
@@ -4272,7 +4272,7 @@  discard block
 block discarded – undo
4272 4272
 		$airline_country_array = array();
4273 4273
 		$temp_array = array();
4274 4274
         
4275
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4275
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4276 4276
 		{
4277 4277
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4278 4278
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4291,11 +4291,11 @@  discard block
 block discarded – undo
4291 4291
 	* @return Array the airline list
4292 4292
 	*
4293 4293
 	*/
4294
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4294
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4295 4295
 	{
4296
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4297
-		$filter_query = $this->getFilter($filters,true,true);
4298
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4296
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4297
+		$filter_query = $this->getFilter($filters, true, true);
4298
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4299 4299
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4300 4300
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4301 4301
 		    ORDER BY airline_count DESC";
@@ -4307,7 +4307,7 @@  discard block
 block discarded – undo
4307 4307
 		$airline_array = array();
4308 4308
 		$temp_array = array();
4309 4309
         
4310
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4310
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4311 4311
 		{
4312 4312
 			$temp_array['airline_name'] = $row['airline_name'];
4313 4313
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4326,11 +4326,11 @@  discard block
 block discarded – undo
4326 4326
 	* @return Array the airline country list
4327 4327
 	*
4328 4328
 	*/
4329
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4329
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4330 4330
 	{
4331
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4332
-		$filter_query = $this->getFilter($filters,true,true);
4333
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4331
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4332
+		$filter_query = $this->getFilter($filters, true, true);
4333
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4334 4334
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4335 4335
 					GROUP BY spotter_output.airline_country
4336 4336
 					ORDER BY airline_country_count DESC
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
 		$airline_country_array = array();
4344 4344
 		$temp_array = array();
4345 4345
         
4346
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4346
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4347 4347
 		{
4348 4348
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4349 4349
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4360,11 +4360,11 @@  discard block
 block discarded – undo
4360 4360
 	* @return Array the airline list
4361 4361
 	*
4362 4362
 	*/
4363
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4363
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4364 4364
 	{
4365
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4366
-		$filter_query = $this->getFilter($filters,true,true);
4367
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4365
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4366
+		$filter_query = $this->getFilter($filters, true, true);
4367
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4368 4368
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4369 4369
 					GROUP BY spotter_output.airline_name
4370 4370
 					ORDER BY airline_count DESC";
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
 		$airline_array = array();
4376 4376
 		$temp_array = array();
4377 4377
         
4378
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4378
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4379 4379
 		{
4380 4380
 			$temp_array['airline_name'] = $row['airline_name'];
4381 4381
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4395,11 +4395,11 @@  discard block
 block discarded – undo
4395 4395
 	* @return Array the airline country list
4396 4396
 	*
4397 4397
 	*/
4398
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4398
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4399 4399
 	{
4400
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4401
-		$filter_query = $this->getFilter($filters,true,true);
4402
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4400
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4401
+		$filter_query = $this->getFilter($filters, true, true);
4402
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4403 4403
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4404 4404
 					GROUP BY spotter_output.airline_country
4405 4405
 					ORDER BY airline_country_count DESC
@@ -4412,7 +4412,7 @@  discard block
 block discarded – undo
4412 4412
 		$airline_country_array = array();
4413 4413
 		$temp_array = array();
4414 4414
         
4415
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4415
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4416 4416
 		{
4417 4417
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4418 4418
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4428,11 +4428,11 @@  discard block
 block discarded – undo
4428 4428
 	* @return Array the airline list
4429 4429
 	*
4430 4430
 	*/
4431
-	public function countAllAirlinesByDate($date,$filters = array())
4431
+	public function countAllAirlinesByDate($date, $filters = array())
4432 4432
 	{
4433 4433
 		global $globalTimezone, $globalDBdriver;
4434
-		$filter_query = $this->getFilter($filters,true,true);
4435
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4434
+		$filter_query = $this->getFilter($filters, true, true);
4435
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4436 4436
 		if ($globalTimezone != '') {
4437 4437
 			date_default_timezone_set($globalTimezone);
4438 4438
 			$datetime = new DateTime($date);
@@ -4440,12 +4440,12 @@  discard block
 block discarded – undo
4440 4440
 		} else $offset = '+00:00';
4441 4441
 
4442 4442
 		if ($globalDBdriver == 'mysql') {
4443
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4443
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4444 4444
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4445 4445
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4446 4446
 					ORDER BY airline_count DESC";
4447 4447
 		} else {
4448
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4448
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4449 4449
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4450 4450
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4451 4451
 					ORDER BY airline_count DESC";
@@ -4456,7 +4456,7 @@  discard block
 block discarded – undo
4456 4456
 
4457 4457
 		$airline_array = array();
4458 4458
 		$temp_array = array();
4459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4460 4460
 		{
4461 4461
 			$temp_array['airline_name'] = $row['airline_name'];
4462 4462
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4476,11 +4476,11 @@  discard block
 block discarded – undo
4476 4476
 	* @return Array the airline country list
4477 4477
 	*
4478 4478
 	*/
4479
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4479
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4480 4480
 	{
4481 4481
 		global $globalTimezone, $globalDBdriver;
4482
-		$filter_query = $this->getFilter($filters,true,true);
4483
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4482
+		$filter_query = $this->getFilter($filters, true, true);
4483
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4484 4484
 		if ($globalTimezone != '') {
4485 4485
 			date_default_timezone_set($globalTimezone);
4486 4486
 			$datetime = new DateTime($date);
@@ -4488,13 +4488,13 @@  discard block
 block discarded – undo
4488 4488
 		} else $offset = '+00:00';
4489 4489
 		
4490 4490
 		if ($globalDBdriver == 'mysql') {
4491
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4491
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4492 4492
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4493 4493
 					GROUP BY spotter_output.airline_country
4494 4494
 					ORDER BY airline_country_count DESC
4495 4495
 					LIMIT 10 OFFSET 0";
4496 4496
 		} else {
4497
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4497
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4498 4498
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4499 4499
 					GROUP BY spotter_output.airline_country
4500 4500
 					ORDER BY airline_country_count DESC
@@ -4506,7 +4506,7 @@  discard block
 block discarded – undo
4506 4506
  
4507 4507
 		$airline_country_array = array();
4508 4508
 		$temp_array = array();
4509
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4509
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4510 4510
 		{
4511 4511
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4512 4512
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4523,11 +4523,11 @@  discard block
 block discarded – undo
4523 4523
 	* @return Array the airline list
4524 4524
 	*
4525 4525
 	*/
4526
-	public function countAllAirlinesByIdent($ident,$filters = array())
4526
+	public function countAllAirlinesByIdent($ident, $filters = array())
4527 4527
 	{
4528
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4529
-		$filter_query = $this->getFilter($filters,true,true);
4530
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4528
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4529
+		$filter_query = $this->getFilter($filters, true, true);
4530
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4531 4531
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4532 4532
 				GROUP BY spotter_output.airline_name
4533 4533
 				ORDER BY airline_count DESC";
@@ -4539,7 +4539,7 @@  discard block
 block discarded – undo
4539 4539
 		$airline_array = array();
4540 4540
 		$temp_array = array();
4541 4541
         
4542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4543 4543
 		{
4544 4544
 			$temp_array['airline_name'] = $row['airline_name'];
4545 4545
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4557,25 +4557,25 @@  discard block
 block discarded – undo
4557 4557
 	* @return Array the airline list
4558 4558
 	*
4559 4559
 	*/
4560
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4560
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4561 4561
 	{
4562
-		$filter_query = $this->getFilter($filters,true,true);
4563
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4564
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4562
+		$filter_query = $this->getFilter($filters, true, true);
4563
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4564
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4565 4565
 
4566
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4566
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4567 4567
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4568 4568
 					GROUP BY spotter_output.airline_name
4569 4569
 					ORDER BY airline_count DESC";
4570 4570
       
4571 4571
 		
4572 4572
 		$sth = $this->db->prepare($query);
4573
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4573
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4574 4574
       
4575 4575
 		$airline_array = array();
4576 4576
 		$temp_array = array();
4577 4577
         
4578
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4578
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4579 4579
 		{
4580 4580
 			$temp_array['airline_name'] = $row['airline_name'];
4581 4581
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4593,13 +4593,13 @@  discard block
 block discarded – undo
4593 4593
 	* @return Array the airline country list
4594 4594
 	*
4595 4595
 	*/
4596
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4596
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4597 4597
 	{
4598
-		$filter_query = $this->getFilter($filters,true,true);
4599
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4600
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4598
+		$filter_query = $this->getFilter($filters, true, true);
4599
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4600
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4601 4601
       
4602
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4602
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4603 4603
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4604 4604
 				GROUP BY spotter_output.airline_country
4605 4605
 				ORDER BY airline_country_count DESC
@@ -4607,11 +4607,11 @@  discard block
 block discarded – undo
4607 4607
       
4608 4608
 		
4609 4609
 		$sth = $this->db->prepare($query);
4610
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4610
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4611 4611
       
4612 4612
 		$airline_country_array = array();
4613 4613
 		$temp_array = array();
4614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4615 4615
 		{
4616 4616
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4617 4617
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4629,11 +4629,11 @@  discard block
 block discarded – undo
4629 4629
 	* @return Array the airline list
4630 4630
 	*
4631 4631
 	*/
4632
-	public function countAllAirlinesByCountry($country,$filters = array())
4632
+	public function countAllAirlinesByCountry($country, $filters = array())
4633 4633
 	{
4634
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4635
-		$filter_query = $this->getFilter($filters,true,true);
4636
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4634
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4635
+		$filter_query = $this->getFilter($filters, true, true);
4636
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4637 4637
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4638 4638
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4639 4639
 			    ORDER BY airline_count DESC";
@@ -4644,7 +4644,7 @@  discard block
 block discarded – undo
4644 4644
 
4645 4645
 		$airline_array = array();
4646 4646
 		$temp_array = array();
4647
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4647
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4648 4648
 		{
4649 4649
 			$temp_array['airline_name'] = $row['airline_name'];
4650 4650
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4663,11 +4663,11 @@  discard block
 block discarded – undo
4663 4663
 	* @return Array the airline country list
4664 4664
 	*
4665 4665
 	*/
4666
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4666
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4667 4667
 	{
4668
-		$filter_query = $this->getFilter($filters,true,true);
4669
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4670
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4668
+		$filter_query = $this->getFilter($filters, true, true);
4669
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4670
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4671 4671
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4672 4672
 				GROUP BY spotter_output.airline_country
4673 4673
 				ORDER BY airline_country_count DESC
@@ -4679,7 +4679,7 @@  discard block
 block discarded – undo
4679 4679
 
4680 4680
 		$airline_country_array = array();
4681 4681
 		$temp_array = array();
4682
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4682
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4683 4683
 		{
4684 4684
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4685 4685
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4699,35 +4699,35 @@  discard block
 block discarded – undo
4699 4699
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4700 4700
 	{
4701 4701
 		global $globalDBdriver;
4702
-		$filter_query = $this->getFilter($filters,true,true);
4703
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4702
+		$filter_query = $this->getFilter($filters, true, true);
4703
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4704 4704
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4705 4705
 		$query_values = array();
4706 4706
 		if ($year != '') {
4707 4707
 			if ($globalDBdriver == 'mysql') {
4708 4708
 				$query .= " AND YEAR(spotter_output.date) = :year";
4709
-				$query_values = array_merge($query_values,array(':year' => $year));
4709
+				$query_values = array_merge($query_values, array(':year' => $year));
4710 4710
 			} else {
4711 4711
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4712
-				$query_values = array_merge($query_values,array(':year' => $year));
4712
+				$query_values = array_merge($query_values, array(':year' => $year));
4713 4713
 			}
4714 4714
 		}
4715 4715
 		if ($month != '') {
4716 4716
 			if ($globalDBdriver == 'mysql') {
4717 4717
 				$query .= " AND MONTH(spotter_output.date) = :month";
4718
-				$query_values = array_merge($query_values,array(':month' => $month));
4718
+				$query_values = array_merge($query_values, array(':month' => $month));
4719 4719
 			} else {
4720 4720
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4721
-				$query_values = array_merge($query_values,array(':month' => $month));
4721
+				$query_values = array_merge($query_values, array(':month' => $month));
4722 4722
 			}
4723 4723
 		}
4724 4724
 		if ($day != '') {
4725 4725
 			if ($globalDBdriver == 'mysql') {
4726 4726
 				$query .= " AND DAY(spotter_output.date) = :day";
4727
-				$query_values = array_merge($query_values,array(':day' => $day));
4727
+				$query_values = array_merge($query_values, array(':day' => $day));
4728 4728
 			} else {
4729 4729
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4730
-				$query_values = array_merge($query_values,array(':day' => $day));
4730
+				$query_values = array_merge($query_values, array(':day' => $day));
4731 4731
 			}
4732 4732
 		}
4733 4733
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4739,7 +4739,7 @@  discard block
 block discarded – undo
4739 4739
 
4740 4740
 		$airline_array = array();
4741 4741
 		$temp_array = array();
4742
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4742
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4743 4743
 		{
4744 4744
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4745 4745
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4755,11 +4755,11 @@  discard block
 block discarded – undo
4755 4755
 	* @return Array the airline country list
4756 4756
 	*
4757 4757
 	*/
4758
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4758
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4759 4759
 	{
4760 4760
 		global $globalDBdriver;
4761 4761
 		//$filter_query = $this->getFilter($filters,true,true);
4762
-		$Connection= new Connection($this->db);
4762
+		$Connection = new Connection($this->db);
4763 4763
 		if (!$Connection->tableExists('countries')) return array();
4764 4764
 		/*
4765 4765
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4774,7 +4774,7 @@  discard block
 block discarded – undo
4774 4774
 */
4775 4775
 		require_once('class.SpotterLive.php');
4776 4776
 		$SpotterLive = new SpotterLive();
4777
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4777
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4778 4778
 		$filter_query .= ' over_country IS NOT NULL';
4779 4779
                 if ($olderthanmonths > 0) {
4780 4780
 			if ($globalDBdriver == 'mysql') {
@@ -4801,7 +4801,7 @@  discard block
 block discarded – undo
4801 4801
 		$flight_array = array();
4802 4802
 		$temp_array = array();
4803 4803
         
4804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4805 4805
 		{
4806 4806
 			$temp_array['flight_count'] = $row['nb'];
4807 4807
 			$temp_array['flight_country'] = $row['name'];
@@ -4819,11 +4819,11 @@  discard block
 block discarded – undo
4819 4819
 	* @return Array the aircraft list
4820 4820
 	*
4821 4821
 	*/
4822
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4822
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4823 4823
 	{
4824 4824
 		global $globalDBdriver;
4825
-		$filter_query = $this->getFilter($filters,true,true);
4826
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4825
+		$filter_query = $this->getFilter($filters, true, true);
4826
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4827 4827
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4828 4828
 		if ($olderthanmonths > 0) {
4829 4829
 			if ($globalDBdriver == 'mysql') {
@@ -4843,28 +4843,28 @@  discard block
 block discarded – undo
4843 4843
 		if ($year != '') {
4844 4844
 			if ($globalDBdriver == 'mysql') {
4845 4845
 				$query .= " AND YEAR(spotter_output.date) = :year";
4846
-				$query_values = array_merge($query_values,array(':year' => $year));
4846
+				$query_values = array_merge($query_values, array(':year' => $year));
4847 4847
 			} else {
4848 4848
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4849
-				$query_values = array_merge($query_values,array(':year' => $year));
4849
+				$query_values = array_merge($query_values, array(':year' => $year));
4850 4850
 			}
4851 4851
 		}
4852 4852
 		if ($month != '') {
4853 4853
 			if ($globalDBdriver == 'mysql') {
4854 4854
 				$query .= " AND MONTH(spotter_output.date) = :month";
4855
-				$query_values = array_merge($query_values,array(':month' => $month));
4855
+				$query_values = array_merge($query_values, array(':month' => $month));
4856 4856
 			} else {
4857 4857
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4858
-				$query_values = array_merge($query_values,array(':month' => $month));
4858
+				$query_values = array_merge($query_values, array(':month' => $month));
4859 4859
 			}
4860 4860
 		}
4861 4861
 		if ($day != '') {
4862 4862
 			if ($globalDBdriver == 'mysql') {
4863 4863
 				$query .= " AND DAY(spotter_output.date) = :day";
4864
-				$query_values = array_merge($query_values,array(':day' => $day));
4864
+				$query_values = array_merge($query_values, array(':day' => $day));
4865 4865
 			} else {
4866 4866
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4867
-				$query_values = array_merge($query_values,array(':day' => $day));
4867
+				$query_values = array_merge($query_values, array(':day' => $day));
4868 4868
 			}
4869 4869
 		}
4870 4870
 
@@ -4876,7 +4876,7 @@  discard block
 block discarded – undo
4876 4876
 
4877 4877
 		$aircraft_array = array();
4878 4878
 		$temp_array = array();
4879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4880 4880
 		{
4881 4881
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4882 4882
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4893,11 +4893,11 @@  discard block
 block discarded – undo
4893 4893
 	* @return Array the aircraft list
4894 4894
 	*
4895 4895
 	*/
4896
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4896
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4897 4897
 	{
4898 4898
 		global $globalDBdriver;
4899
-		$filter_query = $this->getFilter($filters,true,true);
4900
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4899
+		$filter_query = $this->getFilter($filters, true, true);
4900
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4901 4901
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4902 4902
 		if ($olderthanmonths > 0) {
4903 4903
 			if ($globalDBdriver == 'mysql') {
@@ -4917,28 +4917,28 @@  discard block
 block discarded – undo
4917 4917
 		if ($year != '') {
4918 4918
 			if ($globalDBdriver == 'mysql') {
4919 4919
 				$query .= " AND YEAR(spotter_output.date) = :year";
4920
-				$query_values = array_merge($query_values,array(':year' => $year));
4920
+				$query_values = array_merge($query_values, array(':year' => $year));
4921 4921
 			} else {
4922 4922
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4923
-				$query_values = array_merge($query_values,array(':year' => $year));
4923
+				$query_values = array_merge($query_values, array(':year' => $year));
4924 4924
 			}
4925 4925
 		}
4926 4926
 		if ($month != '') {
4927 4927
 			if ($globalDBdriver == 'mysql') {
4928 4928
 				$query .= " AND MONTH(spotter_output.date) = :month";
4929
-				$query_values = array_merge($query_values,array(':month' => $month));
4929
+				$query_values = array_merge($query_values, array(':month' => $month));
4930 4930
 			} else {
4931 4931
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4932
-				$query_values = array_merge($query_values,array(':month' => $month));
4932
+				$query_values = array_merge($query_values, array(':month' => $month));
4933 4933
 			}
4934 4934
 		}
4935 4935
 		if ($day != '') {
4936 4936
 			if ($globalDBdriver == 'mysql') {
4937 4937
 				$query .= " AND DAY(spotter_output.date) = :day";
4938
-				$query_values = array_merge($query_values,array(':day' => $day));
4938
+				$query_values = array_merge($query_values, array(':day' => $day));
4939 4939
 			} else {
4940 4940
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4941
-				$query_values = array_merge($query_values,array(':day' => $day));
4941
+				$query_values = array_merge($query_values, array(':day' => $day));
4942 4942
 			}
4943 4943
 		}
4944 4944
 
@@ -4950,7 +4950,7 @@  discard block
 block discarded – undo
4950 4950
 
4951 4951
 		$aircraft_array = array();
4952 4952
 		$temp_array = array();
4953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4954 4954
 		{
4955 4955
 			$temp_array['airline_icao'] = $row['airline_icao'];
4956 4956
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4968,11 +4968,11 @@  discard block
 block discarded – undo
4968 4968
 	* @return Array the aircraft list
4969 4969
 	*
4970 4970
 	*/
4971
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4971
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4972 4972
 	{
4973 4973
 		global $globalDBdriver;
4974
-		$filter_query = $this->getFilter($filters,true,true);
4975
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4974
+		$filter_query = $this->getFilter($filters, true, true);
4975
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4976 4976
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4977 4977
 		if ($olderthanmonths > 0) {
4978 4978
 			if ($globalDBdriver == 'mysql') {
@@ -4997,7 +4997,7 @@  discard block
 block discarded – undo
4997 4997
 
4998 4998
 		$aircraft_array = array();
4999 4999
 		$temp_array = array();
5000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5001 5001
 		{
5002 5002
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5003 5003
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5016,13 +5016,13 @@  discard block
 block discarded – undo
5016 5016
 	* @return Array the aircraft list
5017 5017
 	*
5018 5018
 	*/
5019
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5019
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5020 5020
 	{
5021 5021
 		$Image = new Image($this->db);
5022
-		$filter_query = $this->getFilter($filters,true,true);
5023
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5022
+		$filter_query = $this->getFilter($filters, true, true);
5023
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5024 5024
 
5025
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5025
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5026 5026
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5027 5027
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5028 5028
 				ORDER BY registration_count DESC";
@@ -5033,14 +5033,14 @@  discard block
 block discarded – undo
5033 5033
 		$aircraft_array = array();
5034 5034
 		$temp_array = array();
5035 5035
         
5036
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5036
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5037 5037
 		{
5038 5038
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5039 5039
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5040 5040
 			$temp_array['registration'] = $row['registration'];
5041 5041
 			$temp_array['airline_name'] = $row['airline_name'];
5042 5042
 			$temp_array['image_thumbnail'] = "";
5043
-			if($row['registration'] != "")
5043
+			if ($row['registration'] != "")
5044 5044
 			{
5045 5045
 				$image_array = $Image->getSpotterImage($row['registration']);
5046 5046
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5059,11 +5059,11 @@  discard block
 block discarded – undo
5059 5059
 	* @return Array the aircraft list
5060 5060
 	*
5061 5061
 	*/
5062
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5062
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5063 5063
 	{
5064
-		$filter_query = $this->getFilter($filters,true,true);
5065
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5066
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5064
+		$filter_query = $this->getFilter($filters, true, true);
5065
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5066
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5067 5067
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5068 5068
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5069 5069
 			    ORDER BY aircraft_icao_count DESC";
@@ -5074,7 +5074,7 @@  discard block
 block discarded – undo
5074 5074
 		$aircraft_array = array();
5075 5075
 		$temp_array = array();
5076 5076
 
5077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5078 5078
 		{
5079 5079
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5080 5080
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5092,13 +5092,13 @@  discard block
 block discarded – undo
5092 5092
 	* @return Array the aircraft list
5093 5093
 	*
5094 5094
 	*/
5095
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5095
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5096 5096
 	{
5097
-		$filter_query = $this->getFilter($filters,true,true);
5097
+		$filter_query = $this->getFilter($filters, true, true);
5098 5098
 		$Image = new Image($this->db);
5099
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5099
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5100 5100
 
5101
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5101
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5102 5102
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5103 5103
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5104 5104
 			    ORDER BY registration_count DESC";
@@ -5108,14 +5108,14 @@  discard block
 block discarded – undo
5108 5108
 
5109 5109
 		$aircraft_array = array();
5110 5110
 		$temp_array = array();
5111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5112 5112
 		{
5113 5113
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5114 5114
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5115 5115
 			$temp_array['registration'] = $row['registration'];
5116 5116
 			$temp_array['airline_name'] = $row['airline_name'];
5117 5117
 			$temp_array['image_thumbnail'] = "";
5118
-			if($row['registration'] != "")
5118
+			if ($row['registration'] != "")
5119 5119
 			{
5120 5120
 				$image_array = $Image->getSpotterImage($row['registration']);
5121 5121
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5134,11 +5134,11 @@  discard block
 block discarded – undo
5134 5134
 	* @return Array the aircraft list
5135 5135
 	*
5136 5136
 	*/
5137
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5137
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5138 5138
 	{
5139
-		$filter_query = $this->getFilter($filters,true,true);
5140
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5141
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5139
+		$filter_query = $this->getFilter($filters, true, true);
5140
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5141
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5142 5142
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5143 5143
 				GROUP BY spotter_output.aircraft_manufacturer 
5144 5144
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5149,7 +5149,7 @@  discard block
 block discarded – undo
5149 5149
 		$aircraft_array = array();
5150 5150
 		$temp_array = array();
5151 5151
 
5152
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5152
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5153 5153
 		{
5154 5154
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5155 5155
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5166,12 +5166,12 @@  discard block
 block discarded – undo
5166 5166
 	* @return Array the aircraft list
5167 5167
 	*
5168 5168
 	*/
5169
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5169
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5170 5170
 	{
5171
-		$filter_query = $this->getFilter($filters,true,true);
5172
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5171
+		$filter_query = $this->getFilter($filters, true, true);
5172
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5173 5173
 
5174
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5174
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5175 5175
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
5176 5176
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5177 5177
 				ORDER BY aircraft_icao_count DESC";
@@ -5181,7 +5181,7 @@  discard block
 block discarded – undo
5181 5181
 
5182 5182
 		$aircraft_array = array();
5183 5183
 		$temp_array = array();
5184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5185 5185
 		{
5186 5186
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5187 5187
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5199,13 +5199,13 @@  discard block
 block discarded – undo
5199 5199
 	* @return Array the aircraft list
5200 5200
 	*
5201 5201
 	*/
5202
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5202
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5203 5203
 	{
5204
-		$filter_query = $this->getFilter($filters,true,true);
5204
+		$filter_query = $this->getFilter($filters, true, true);
5205 5205
 		$Image = new Image($this->db);
5206
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5206
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5207 5207
 
5208
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5208
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5209 5209
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5210 5210
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5211 5211
 		    ORDER BY registration_count DESC";
@@ -5215,14 +5215,14 @@  discard block
 block discarded – undo
5215 5215
 
5216 5216
 		$aircraft_array = array();
5217 5217
 		$temp_array = array();
5218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5219 5219
 		{
5220 5220
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5221 5221
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5222 5222
 			$temp_array['registration'] = $row['registration'];
5223 5223
 			$temp_array['airline_name'] = $row['airline_name'];
5224 5224
 			$temp_array['image_thumbnail'] = "";
5225
-			if($row['registration'] != "")
5225
+			if ($row['registration'] != "")
5226 5226
 			{
5227 5227
 				$image_array = $Image->getSpotterImage($row['registration']);
5228 5228
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5240,11 +5240,11 @@  discard block
 block discarded – undo
5240 5240
 	* @return Array the aircraft list
5241 5241
 	*
5242 5242
 	*/
5243
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5243
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5244 5244
 	{
5245
-		$filter_query = $this->getFilter($filters,true,true);
5246
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5247
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5245
+		$filter_query = $this->getFilter($filters, true, true);
5246
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5247
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5248 5248
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
5249 5249
                     GROUP BY spotter_output.aircraft_manufacturer 
5250 5250
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5255,7 +5255,7 @@  discard block
 block discarded – undo
5255 5255
 
5256 5256
 		$aircraft_array = array();
5257 5257
 		$temp_array = array();
5258
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5258
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5259 5259
 		{
5260 5260
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5261 5261
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5270,12 +5270,12 @@  discard block
 block discarded – undo
5270 5270
 	* @return Array the aircraft list
5271 5271
 	*
5272 5272
 	*/
5273
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5273
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5274 5274
 	{
5275
-		$filter_query = $this->getFilter($filters,true,true);
5276
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5275
+		$filter_query = $this->getFilter($filters, true, true);
5276
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5277 5277
 
5278
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5278
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5279 5279
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5280 5280
                     GROUP BY spotter_output.aircraft_name 
5281 5281
 					ORDER BY aircraft_icao_count DESC";
@@ -5284,7 +5284,7 @@  discard block
 block discarded – undo
5284 5284
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5285 5285
 		$aircraft_array = array();
5286 5286
 		$temp_array = array();
5287
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5287
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5288 5288
 		{
5289 5289
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5290 5290
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5303,11 +5303,11 @@  discard block
 block discarded – undo
5303 5303
 	*/
5304 5304
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5305 5305
 	{
5306
-		$filter_query = $this->getFilter($filters,true,true);
5306
+		$filter_query = $this->getFilter($filters, true, true);
5307 5307
 		$Image = new Image($this->db);
5308
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5308
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5309 5309
 
5310
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5310
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5311 5311
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5312 5312
                     GROUP BY spotter_output.registration 
5313 5313
 					ORDER BY registration_count DESC";
@@ -5317,14 +5317,14 @@  discard block
 block discarded – undo
5317 5317
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5318 5318
 		$aircraft_array = array();
5319 5319
 		$temp_array = array();
5320
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5320
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5321 5321
 		{
5322 5322
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5323 5323
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5324 5324
 			$temp_array['registration'] = $row['registration'];
5325 5325
 			$temp_array['airline_name'] = $row['airline_name'];
5326 5326
 			$temp_array['image_thumbnail'] = "";
5327
-			if($row['registration'] != "")
5327
+			if ($row['registration'] != "")
5328 5328
 			{
5329 5329
 				$image_array = $Image->getSpotterImage($row['registration']);
5330 5330
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5341,11 +5341,11 @@  discard block
 block discarded – undo
5341 5341
 	* @return Array the aircraft list
5342 5342
 	*
5343 5343
 	*/
5344
-	public function countAllAircraftTypesByDate($date,$filters = array())
5344
+	public function countAllAircraftTypesByDate($date, $filters = array())
5345 5345
 	{
5346 5346
 		global $globalTimezone, $globalDBdriver;
5347
-		$filter_query = $this->getFilter($filters,true,true);
5348
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5347
+		$filter_query = $this->getFilter($filters, true, true);
5348
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5349 5349
 		if ($globalTimezone != '') {
5350 5350
 			date_default_timezone_set($globalTimezone);
5351 5351
 			$datetime = new DateTime($date);
@@ -5353,12 +5353,12 @@  discard block
 block discarded – undo
5353 5353
 		} else $offset = '+00:00';
5354 5354
 
5355 5355
 		if ($globalDBdriver == 'mysql') {
5356
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5356
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5357 5357
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5358 5358
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5359 5359
 					ORDER BY aircraft_icao_count DESC";
5360 5360
 		} else {
5361
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5361
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5362 5362
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5363 5363
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5364 5364
 					ORDER BY aircraft_icao_count DESC";
@@ -5369,7 +5369,7 @@  discard block
 block discarded – undo
5369 5369
 
5370 5370
 		$aircraft_array = array();
5371 5371
 		$temp_array = array();
5372
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5372
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5373 5373
 		{
5374 5374
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5375 5375
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5387,12 +5387,12 @@  discard block
 block discarded – undo
5387 5387
 	* @return Array the aircraft list
5388 5388
 	*
5389 5389
 	*/
5390
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5390
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5391 5391
 	{
5392 5392
 		global $globalTimezone, $globalDBdriver;
5393
-		$filter_query = $this->getFilter($filters,true,true);
5393
+		$filter_query = $this->getFilter($filters, true, true);
5394 5394
 		$Image = new Image($this->db);
5395
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5395
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5396 5396
 		if ($globalTimezone != '') {
5397 5397
 			date_default_timezone_set($globalTimezone);
5398 5398
 			$datetime = new DateTime($date);
@@ -5400,12 +5400,12 @@  discard block
 block discarded – undo
5400 5400
 		} else $offset = '+00:00';
5401 5401
 
5402 5402
 		if ($globalDBdriver == 'mysql') {
5403
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5403
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5404 5404
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5405 5405
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5406 5406
 					ORDER BY registration_count DESC";
5407 5407
 		} else {
5408
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5408
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5409 5409
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5410 5410
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5411 5411
 					ORDER BY registration_count DESC";
@@ -5416,14 +5416,14 @@  discard block
 block discarded – undo
5416 5416
 
5417 5417
 		$aircraft_array = array();
5418 5418
 		$temp_array = array();
5419
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5419
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5420 5420
 		{
5421 5421
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5422 5422
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5423 5423
 			$temp_array['registration'] = $row['registration'];
5424 5424
 			$temp_array['airline_name'] = $row['airline_name'];
5425 5425
 			$temp_array['image_thumbnail'] = "";
5426
-			if($row['registration'] != "")
5426
+			if ($row['registration'] != "")
5427 5427
 			{
5428 5428
 				$image_array = $Image->getSpotterImage($row['registration']);
5429 5429
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5442,11 +5442,11 @@  discard block
 block discarded – undo
5442 5442
 	* @return Array the aircraft manufacturer list
5443 5443
 	*
5444 5444
 	*/
5445
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5445
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5446 5446
 	{
5447 5447
 		global $globalTimezone, $globalDBdriver;
5448
-		$filter_query = $this->getFilter($filters,true,true);
5449
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5448
+		$filter_query = $this->getFilter($filters, true, true);
5449
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5450 5450
 		if ($globalTimezone != '') {
5451 5451
 			date_default_timezone_set($globalTimezone);
5452 5452
 			$datetime = new DateTime($date);
@@ -5454,12 +5454,12 @@  discard block
 block discarded – undo
5454 5454
 		} else $offset = '+00:00';
5455 5455
 
5456 5456
 		if ($globalDBdriver == 'mysql') {
5457
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5457
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5458 5458
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5459 5459
 				GROUP BY spotter_output.aircraft_manufacturer 
5460 5460
 				ORDER BY aircraft_manufacturer_count DESC";
5461 5461
 		} else {
5462
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5462
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5463 5463
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5464 5464
 				GROUP BY spotter_output.aircraft_manufacturer 
5465 5465
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5471,7 +5471,7 @@  discard block
 block discarded – undo
5471 5471
 		$aircraft_array = array();
5472 5472
 		$temp_array = array();
5473 5473
 
5474
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5474
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5475 5475
 		{
5476 5476
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5477 5477
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5488,11 +5488,11 @@  discard block
 block discarded – undo
5488 5488
 	* @return Array the aircraft list
5489 5489
 	*
5490 5490
 	*/
5491
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5491
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5492 5492
 	{
5493
-		$filter_query = $this->getFilter($filters,true,true);
5494
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5495
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5493
+		$filter_query = $this->getFilter($filters, true, true);
5494
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5495
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5496 5496
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5497 5497
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5498 5498
 				ORDER BY aircraft_icao_count DESC";
@@ -5503,7 +5503,7 @@  discard block
 block discarded – undo
5503 5503
 		$aircraft_array = array();
5504 5504
 		$temp_array = array();
5505 5505
 
5506
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5506
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5507 5507
 		{
5508 5508
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5509 5509
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5521,13 +5521,13 @@  discard block
 block discarded – undo
5521 5521
 	* @return Array the aircraft list
5522 5522
 	*
5523 5523
 	*/
5524
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5524
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5525 5525
 	{
5526
-		$filter_query = $this->getFilter($filters,true,true);
5526
+		$filter_query = $this->getFilter($filters, true, true);
5527 5527
 		$Image = new Image($this->db);
5528
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5528
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5529 5529
 
5530
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5530
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5531 5531
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5532 5532
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5533 5533
 		    ORDER BY registration_count DESC";
@@ -5539,14 +5539,14 @@  discard block
 block discarded – undo
5539 5539
 		$aircraft_array = array();
5540 5540
 		$temp_array = array();
5541 5541
         
5542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5543 5543
 		{
5544 5544
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5545 5545
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5546 5546
 			$temp_array['registration'] = $row['registration'];
5547 5547
 			$temp_array['airline_name'] = $row['airline_name'];
5548 5548
 			$temp_array['image_thumbnail'] = "";
5549
-			if($row['registration'] != "")
5549
+			if ($row['registration'] != "")
5550 5550
 			{
5551 5551
 				$image_array = $Image->getSpotterImage($row['registration']);
5552 5552
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5565,11 +5565,11 @@  discard block
 block discarded – undo
5565 5565
 	* @return Array the aircraft manufacturer list
5566 5566
 	*
5567 5567
 	*/
5568
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5568
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5569 5569
 	{
5570
-		$filter_query = $this->getFilter($filters,true,true);
5571
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5572
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5570
+		$filter_query = $this->getFilter($filters, true, true);
5571
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5572
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5573 5573
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5574 5574
                     GROUP BY spotter_output.aircraft_manufacturer 
5575 5575
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5579,7 +5579,7 @@  discard block
 block discarded – undo
5579 5579
 		$sth->execute(array(':ident' => $ident));
5580 5580
 		$aircraft_array = array();
5581 5581
 		$temp_array = array();
5582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5583 5583
 		{
5584 5584
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5585 5585
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5595,24 +5595,24 @@  discard block
 block discarded – undo
5595 5595
 	* @return Array the aircraft list
5596 5596
 	*
5597 5597
 	*/
5598
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5598
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5599 5599
 	{
5600
-		$filter_query = $this->getFilter($filters,true,true);
5601
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5602
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5600
+		$filter_query = $this->getFilter($filters, true, true);
5601
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5602
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5603 5603
 		
5604 5604
 
5605
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5605
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5606 5606
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5607 5607
                     GROUP BY spotter_output.aircraft_name 
5608 5608
 					ORDER BY aircraft_icao_count DESC";
5609 5609
  
5610 5610
 		
5611 5611
 		$sth = $this->db->prepare($query);
5612
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5612
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5613 5613
 		$aircraft_array = array();
5614 5614
 		$temp_array = array();
5615
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5615
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5616 5616
 		{
5617 5617
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5618 5618
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5628,33 +5628,33 @@  discard block
 block discarded – undo
5628 5628
 	* @return Array the aircraft list
5629 5629
 	*
5630 5630
 	*/
5631
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5631
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5632 5632
 	{
5633
-		$filter_query = $this->getFilter($filters,true,true);
5633
+		$filter_query = $this->getFilter($filters, true, true);
5634 5634
 		$Image = new Image($this->db);
5635
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5636
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5635
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5636
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5637 5637
 
5638
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5638
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5639 5639
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5640 5640
                     GROUP BY spotter_output.registration 
5641 5641
 					ORDER BY registration_count DESC";
5642 5642
 
5643 5643
 		
5644 5644
 		$sth = $this->db->prepare($query);
5645
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5645
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5646 5646
       
5647 5647
 		$aircraft_array = array();
5648 5648
 		$temp_array = array();
5649 5649
         
5650
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5650
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5651 5651
 		{
5652 5652
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5653 5653
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5654 5654
 			$temp_array['registration'] = $row['registration'];
5655 5655
 			$temp_array['airline_name'] = $row['airline_name'];
5656 5656
 			$temp_array['image_thumbnail'] = "";
5657
-			if($row['registration'] != "")
5657
+			if ($row['registration'] != "")
5658 5658
 			{
5659 5659
 				$image_array = $Image->getSpotterImage($row['registration']);
5660 5660
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5674,25 +5674,25 @@  discard block
 block discarded – undo
5674 5674
 	* @return Array the aircraft manufacturer list
5675 5675
 	*
5676 5676
 	*/
5677
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5677
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5678 5678
 	{
5679
-		$filter_query = $this->getFilter($filters,true,true);
5680
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5681
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5679
+		$filter_query = $this->getFilter($filters, true, true);
5680
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5681
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5682 5682
 
5683
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5683
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5684 5684
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5685 5685
                     GROUP BY spotter_output.aircraft_manufacturer 
5686 5686
 					ORDER BY aircraft_manufacturer_count DESC";
5687 5687
 
5688 5688
 		
5689 5689
 		$sth = $this->db->prepare($query);
5690
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5690
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5691 5691
       
5692 5692
 		$aircraft_array = array();
5693 5693
 		$temp_array = array();
5694 5694
         
5695
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5695
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5696 5696
 		{
5697 5697
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5698 5698
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5712,11 +5712,11 @@  discard block
 block discarded – undo
5712 5712
 	* @return Array the aircraft list
5713 5713
 	*
5714 5714
 	*/
5715
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5715
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5716 5716
 	{
5717
-		$filter_query = $this->getFilter($filters,true,true);
5718
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5719
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5717
+		$filter_query = $this->getFilter($filters, true, true);
5718
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5719
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5720 5720
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5721 5721
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5722 5722
 			    ORDER BY aircraft_icao_count DESC";
@@ -5728,7 +5728,7 @@  discard block
 block discarded – undo
5728 5728
 		$aircraft_array = array();
5729 5729
 		$temp_array = array();
5730 5730
         
5731
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5731
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5732 5732
 		{
5733 5733
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5734 5734
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5747,12 +5747,12 @@  discard block
 block discarded – undo
5747 5747
 	* @return Array the aircraft list
5748 5748
 	*
5749 5749
 	*/
5750
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5750
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5751 5751
 	{
5752
-		$filter_query = $this->getFilter($filters,true,true);
5752
+		$filter_query = $this->getFilter($filters, true, true);
5753 5753
 		$Image = new Image($this->db);
5754
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5755
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5754
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5755
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5756 5756
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5757 5757
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5758 5758
 			    ORDER BY registration_count DESC";
@@ -5764,14 +5764,14 @@  discard block
 block discarded – undo
5764 5764
 		$aircraft_array = array();
5765 5765
 		$temp_array = array();
5766 5766
         
5767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5768 5768
 		{
5769 5769
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5770 5770
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5771 5771
 			$temp_array['registration'] = $row['registration'];
5772 5772
 			$temp_array['airline_name'] = $row['airline_name'];
5773 5773
 			$temp_array['image_thumbnail'] = "";
5774
-			if($row['registration'] != "")
5774
+			if ($row['registration'] != "")
5775 5775
 			{
5776 5776
 				$image_array = $Image->getSpotterImage($row['registration']);
5777 5777
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5791,11 +5791,11 @@  discard block
 block discarded – undo
5791 5791
 	* @return Array the aircraft manufacturer list
5792 5792
 	*
5793 5793
 	*/
5794
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5794
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5795 5795
 	{
5796
-		$filter_query = $this->getFilter($filters,true,true);
5797
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5798
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5796
+		$filter_query = $this->getFilter($filters, true, true);
5797
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5798
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5799 5799
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5800 5800
                     GROUP BY spotter_output.aircraft_manufacturer 
5801 5801
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5807,7 +5807,7 @@  discard block
 block discarded – undo
5807 5807
 		$aircraft_array = array();
5808 5808
 		$temp_array = array();
5809 5809
         
5810
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5810
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5811 5811
 		{
5812 5812
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5813 5813
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5826,38 +5826,38 @@  discard block
 block discarded – undo
5826 5826
 	* @return Array the aircraft list
5827 5827
 	*
5828 5828
 	*/
5829
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
5829
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
5830 5830
 	{
5831 5831
 		global $globalDBdriver;
5832
-		$filter_query = $this->getFilter($filters,true,true);
5833
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5832
+		$filter_query = $this->getFilter($filters, true, true);
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 5835
                 $query_values = array();
5836 5836
 		if ($year != '') {
5837 5837
 			if ($globalDBdriver == 'mysql') {
5838 5838
 				$query .= " AND YEAR(spotter_output.date) = :year";
5839
-				$query_values = array_merge($query_values,array(':year' => $year));
5839
+				$query_values = array_merge($query_values, array(':year' => $year));
5840 5840
 			} else {
5841 5841
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5842
-				$query_values = array_merge($query_values,array(':year' => $year));
5842
+				$query_values = array_merge($query_values, array(':year' => $year));
5843 5843
 			}
5844 5844
 		}
5845 5845
 		if ($month != '') {
5846 5846
 			if ($globalDBdriver == 'mysql') {
5847 5847
 				$query .= " AND MONTH(spotter_output.date) = :month";
5848
-				$query_values = array_merge($query_values,array(':month' => $month));
5848
+				$query_values = array_merge($query_values, array(':month' => $month));
5849 5849
 			} else {
5850 5850
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5851
-				$query_values = array_merge($query_values,array(':month' => $month));
5851
+				$query_values = array_merge($query_values, array(':month' => $month));
5852 5852
 			}
5853 5853
 		}
5854 5854
 		if ($day != '') {
5855 5855
 			if ($globalDBdriver == 'mysql') {
5856 5856
 				$query .= " AND DAY(spotter_output.date) = :day";
5857
-				$query_values = array_merge($query_values,array(':day' => $day));
5857
+				$query_values = array_merge($query_values, array(':day' => $day));
5858 5858
 			} else {
5859 5859
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5860
-				$query_values = array_merge($query_values,array(':day' => $day));
5860
+				$query_values = array_merge($query_values, array(':day' => $day));
5861 5861
 			}
5862 5862
 		}
5863 5863
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -5871,7 +5871,7 @@  discard block
 block discarded – undo
5871 5871
 		$manufacturer_array = array();
5872 5872
 		$temp_array = array();
5873 5873
         
5874
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5874
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5875 5875
 		{
5876 5876
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5877 5877
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5890,12 +5890,12 @@  discard block
 block discarded – undo
5890 5890
 	* @return Array the aircraft list
5891 5891
 	*
5892 5892
 	*/
5893
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
5893
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5894 5894
 	{
5895 5895
 		global $globalDBdriver;
5896 5896
 		$Image = new Image($this->db);
5897
-		$filter_query = $this->getFilter($filters,true,true);
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    
5897
+		$filter_query = $this->getFilter($filters, true, true);
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 5900
                 if ($olderthanmonths > 0) {
5901 5901
             		if ($globalDBdriver == 'mysql') {
@@ -5915,28 +5915,28 @@  discard block
 block discarded – undo
5915 5915
 		if ($year != '') {
5916 5916
 			if ($globalDBdriver == 'mysql') {
5917 5917
 				$query .= " AND YEAR(spotter_output.date) = :year";
5918
-				$query_values = array_merge($query_values,array(':year' => $year));
5918
+				$query_values = array_merge($query_values, array(':year' => $year));
5919 5919
 			} else {
5920 5920
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5921
-				$query_values = array_merge($query_values,array(':year' => $year));
5921
+				$query_values = array_merge($query_values, array(':year' => $year));
5922 5922
 			}
5923 5923
 		}
5924 5924
 		if ($month != '') {
5925 5925
 			if ($globalDBdriver == 'mysql') {
5926 5926
 				$query .= " AND MONTH(spotter_output.date) = :month";
5927
-				$query_values = array_merge($query_values,array(':month' => $month));
5927
+				$query_values = array_merge($query_values, array(':month' => $month));
5928 5928
 			} else {
5929 5929
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5930
-				$query_values = array_merge($query_values,array(':month' => $month));
5930
+				$query_values = array_merge($query_values, array(':month' => $month));
5931 5931
 			}
5932 5932
 		}
5933 5933
 		if ($day != '') {
5934 5934
 			if ($globalDBdriver == 'mysql') {
5935 5935
 				$query .= " AND DAY(spotter_output.date) = :day";
5936
-				$query_values = array_merge($query_values,array(':day' => $day));
5936
+				$query_values = array_merge($query_values, array(':day' => $day));
5937 5937
 			} else {
5938 5938
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5939
-				$query_values = array_merge($query_values,array(':day' => $day));
5939
+				$query_values = array_merge($query_values, array(':day' => $day));
5940 5940
 			}
5941 5941
 		}
5942 5942
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -5948,7 +5948,7 @@  discard block
 block discarded – undo
5948 5948
 		$aircraft_array = array();
5949 5949
 		$temp_array = array();
5950 5950
         
5951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5952 5952
 		{
5953 5953
 			$temp_array['registration'] = $row['registration'];
5954 5954
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5956,7 +5956,7 @@  discard block
 block discarded – undo
5956 5956
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5957 5957
 			$temp_array['airline_name'] = $row['airline_name'];
5958 5958
 			$temp_array['image_thumbnail'] = "";
5959
-			if($row['registration'] != "")
5959
+			if ($row['registration'] != "")
5960 5960
 			{
5961 5961
 				$image_array = $Image->getSpotterImage($row['registration']);
5962 5962
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5975,12 +5975,12 @@  discard block
 block discarded – undo
5975 5975
 	* @return Array the aircraft list
5976 5976
 	*
5977 5977
 	*/
5978
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5978
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5979 5979
 	{
5980 5980
 		global $globalDBdriver;
5981
-		$filter_query = $this->getFilter($filters,true,true);
5981
+		$filter_query = $this->getFilter($filters, true, true);
5982 5982
 		$Image = new Image($this->db);
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    
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 5985
                 if ($olderthanmonths > 0) {
5986 5986
             		if ($globalDBdriver == 'mysql') {
@@ -6008,7 +6008,7 @@  discard block
 block discarded – undo
6008 6008
 		$aircraft_array = array();
6009 6009
 		$temp_array = array();
6010 6010
         
6011
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6011
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6012 6012
 		{
6013 6013
 			$temp_array['registration'] = $row['registration'];
6014 6014
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6017,7 +6017,7 @@  discard block
 block discarded – undo
6017 6017
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6018 6018
 			$temp_array['airline_name'] = $row['airline_name'];
6019 6019
 			$temp_array['image_thumbnail'] = "";
6020
-			if($row['registration'] != "")
6020
+			if ($row['registration'] != "")
6021 6021
 			{
6022 6022
 				$image_array = $Image->getSpotterImage($row['registration']);
6023 6023
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6036,11 +6036,11 @@  discard block
 block discarded – undo
6036 6036
 	* @return Array the airport list
6037 6037
 	*
6038 6038
 	*/
6039
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6039
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6040 6040
 	{
6041 6041
 		global $globalDBdriver;
6042
-		$filter_query = $this->getFilter($filters,true,true);
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 
6042
+		$filter_query = $this->getFilter($filters, true, true);
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 6045
                 if ($olderthanmonths > 0) {
6046 6046
             		if ($globalDBdriver == 'mysql') {
@@ -6060,28 +6060,28 @@  discard block
 block discarded – undo
6060 6060
 		if ($year != '') {
6061 6061
 			if ($globalDBdriver == 'mysql') {
6062 6062
 				$query .= " AND YEAR(spotter_output.date) = :year";
6063
-				$query_values = array_merge($query_values,array(':year' => $year));
6063
+				$query_values = array_merge($query_values, array(':year' => $year));
6064 6064
 			} else {
6065 6065
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6066
-				$query_values = array_merge($query_values,array(':year' => $year));
6066
+				$query_values = array_merge($query_values, array(':year' => $year));
6067 6067
 			}
6068 6068
 		}
6069 6069
 		if ($month != '') {
6070 6070
 			if ($globalDBdriver == 'mysql') {
6071 6071
 				$query .= " AND MONTH(spotter_output.date) = :month";
6072
-				$query_values = array_merge($query_values,array(':month' => $month));
6072
+				$query_values = array_merge($query_values, array(':month' => $month));
6073 6073
 			} else {
6074 6074
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6075
-				$query_values = array_merge($query_values,array(':month' => $month));
6075
+				$query_values = array_merge($query_values, array(':month' => $month));
6076 6076
 			}
6077 6077
 		}
6078 6078
 		if ($day != '') {
6079 6079
 			if ($globalDBdriver == 'mysql') {
6080 6080
 				$query .= " AND DAY(spotter_output.date) = :day";
6081
-				$query_values = array_merge($query_values,array(':day' => $day));
6081
+				$query_values = array_merge($query_values, array(':day' => $day));
6082 6082
 			} else {
6083 6083
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6084
-				$query_values = array_merge($query_values,array(':day' => $day));
6084
+				$query_values = array_merge($query_values, array(':day' => $day));
6085 6085
 			}
6086 6086
 		}
6087 6087
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6093,7 +6093,7 @@  discard block
 block discarded – undo
6093 6093
 
6094 6094
 		$airport_array = array();
6095 6095
 		$temp_array = array();
6096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6097 6097
 		{
6098 6098
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6099 6099
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6112,11 +6112,11 @@  discard block
 block discarded – undo
6112 6112
 	* @return Array the airport list
6113 6113
 	*
6114 6114
 	*/
6115
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6115
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6116 6116
 	{
6117 6117
 		global $globalDBdriver;
6118
-		$filter_query = $this->getFilter($filters,true,true);
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 
6118
+		$filter_query = $this->getFilter($filters, true, true);
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 6121
                 if ($olderthanmonths > 0) {
6122 6122
             		if ($globalDBdriver == 'mysql') {
@@ -6145,7 +6145,7 @@  discard block
 block discarded – undo
6145 6145
 		$airport_array = array();
6146 6146
 		$temp_array = array();
6147 6147
         
6148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6149 6149
 		{
6150 6150
 			$temp_array['airline_icao'] = $row['airline_icao'];
6151 6151
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6165,11 +6165,11 @@  discard block
 block discarded – undo
6165 6165
 	* @return Array the airport list
6166 6166
 	*
6167 6167
 	*/
6168
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6168
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6169 6169
 	{
6170 6170
 		global $globalDBdriver;
6171
-		$filter_query = $this->getFilter($filters,true,true);
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
6171
+		$filter_query = $this->getFilter($filters, true, true);
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 6174
                 if ($olderthanmonths > 0) {
6175 6175
             		if ($globalDBdriver == 'mysql') {
@@ -6189,28 +6189,28 @@  discard block
 block discarded – undo
6189 6189
 		if ($year != '') {
6190 6190
 			if ($globalDBdriver == 'mysql') {
6191 6191
 				$query .= " AND YEAR(spotter_output.date) = :year";
6192
-				$query_values = array_merge($query_values,array(':year' => $year));
6192
+				$query_values = array_merge($query_values, array(':year' => $year));
6193 6193
 			} else {
6194 6194
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6195
-				$query_values = array_merge($query_values,array(':year' => $year));
6195
+				$query_values = array_merge($query_values, array(':year' => $year));
6196 6196
 			}
6197 6197
 		}
6198 6198
 		if ($month != '') {
6199 6199
 			if ($globalDBdriver == 'mysql') {
6200 6200
 				$query .= " AND MONTH(spotter_output.date) = :month";
6201
-				$query_values = array_merge($query_values,array(':month' => $month));
6201
+				$query_values = array_merge($query_values, array(':month' => $month));
6202 6202
 			} else {
6203 6203
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6204
-				$query_values = array_merge($query_values,array(':month' => $month));
6204
+				$query_values = array_merge($query_values, array(':month' => $month));
6205 6205
 			}
6206 6206
 		}
6207 6207
 		if ($day != '') {
6208 6208
 			if ($globalDBdriver == 'mysql') {
6209 6209
 				$query .= " AND DAY(spotter_output.date) = :day";
6210
-				$query_values = array_merge($query_values,array(':day' => $day));
6210
+				$query_values = array_merge($query_values, array(':day' => $day));
6211 6211
 			} else {
6212 6212
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6213
-				$query_values = array_merge($query_values,array(':day' => $day));
6213
+				$query_values = array_merge($query_values, array(':day' => $day));
6214 6214
 			}
6215 6215
 		}
6216 6216
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6223,7 +6223,7 @@  discard block
 block discarded – undo
6223 6223
 		$airport_array = array();
6224 6224
 		$temp_array = array();
6225 6225
         
6226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6227 6227
 		{
6228 6228
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6229 6229
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6242,11 +6242,11 @@  discard block
 block discarded – undo
6242 6242
 	* @return Array the airport list
6243 6243
 	*
6244 6244
 	*/
6245
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6245
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6246 6246
 	{
6247 6247
 		global $globalDBdriver;
6248
-		$filter_query = $this->getFilter($filters,true,true);
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
6248
+		$filter_query = $this->getFilter($filters, true, true);
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 6251
                 if ($olderthanmonths > 0) {
6252 6252
             		if ($globalDBdriver == 'mysql') {
@@ -6275,7 +6275,7 @@  discard block
 block discarded – undo
6275 6275
 		$airport_array = array();
6276 6276
 		$temp_array = array();
6277 6277
         
6278
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6278
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6279 6279
 		{
6280 6280
 			$temp_array['airline_icao'] = $row['airline_icao'];
6281 6281
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6295,11 +6295,11 @@  discard block
 block discarded – undo
6295 6295
 	* @return Array the airport list
6296 6296
 	*
6297 6297
 	*/
6298
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6298
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6299 6299
 	{
6300
-		$filter_query = $this->getFilter($filters,true,true);
6301
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6302
-		$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 
6300
+		$filter_query = $this->getFilter($filters, true, true);
6301
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6302
+		$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 
6303 6303
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6304 6304
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6305 6305
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6311,7 +6311,7 @@  discard block
 block discarded – undo
6311 6311
 		$airport_array = array();
6312 6312
 		$temp_array = array();
6313 6313
         
6314
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6314
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6315 6315
 		{
6316 6316
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6317 6317
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6333,11 +6333,11 @@  discard block
 block discarded – undo
6333 6333
 	* @return Array the airport list
6334 6334
 	*
6335 6335
 	*/
6336
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6336
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6337 6337
 	{
6338
-		$filter_query = $this->getFilter($filters,true,true);
6339
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6340
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6338
+		$filter_query = $this->getFilter($filters, true, true);
6339
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6340
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6341 6341
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6342 6342
                     GROUP BY spotter_output.departure_airport_country
6343 6343
 					ORDER BY airport_departure_country_count DESC";
@@ -6349,7 +6349,7 @@  discard block
 block discarded – undo
6349 6349
 		$airport_array = array();
6350 6350
 		$temp_array = array();
6351 6351
         
6352
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6352
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6353 6353
 		{
6354 6354
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6355 6355
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6368,11 +6368,11 @@  discard block
 block discarded – undo
6368 6368
 	* @return Array the airport list
6369 6369
 	*
6370 6370
 	*/
6371
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6371
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6372 6372
 	{
6373
-		$filter_query = $this->getFilter($filters,true,true);
6374
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6375
-		$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 
6373
+		$filter_query = $this->getFilter($filters, true, true);
6374
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6375
+		$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 
6376 6376
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6377 6377
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6378 6378
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6384,7 +6384,7 @@  discard block
 block discarded – undo
6384 6384
 		$airport_array = array();
6385 6385
 		$temp_array = array();
6386 6386
         
6387
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6387
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6388 6388
 		{
6389 6389
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6390 6390
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6405,11 +6405,11 @@  discard block
 block discarded – undo
6405 6405
 	* @return Array the airport list
6406 6406
 	*
6407 6407
 	*/
6408
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6408
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6409 6409
 	{
6410
-		$filter_query = $this->getFilter($filters,true,true);
6411
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6412
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6410
+		$filter_query = $this->getFilter($filters, true, true);
6411
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6412
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6413 6413
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6414 6414
                     GROUP BY spotter_output.departure_airport_country
6415 6415
 					ORDER BY airport_departure_country_count DESC";
@@ -6421,7 +6421,7 @@  discard block
 block discarded – undo
6421 6421
 		$airport_array = array();
6422 6422
 		$temp_array = array();
6423 6423
         
6424
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6424
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6425 6425
 		{
6426 6426
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6427 6427
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6439,11 +6439,11 @@  discard block
 block discarded – undo
6439 6439
 	* @return Array the airport list
6440 6440
 	*
6441 6441
 	*/
6442
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6442
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6443 6443
 	{
6444
-		$filter_query = $this->getFilter($filters,true,true);
6445
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6446
-		$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 
6444
+		$filter_query = $this->getFilter($filters, true, true);
6445
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6446
+		$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 
6447 6447
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
6448 6448
                     GROUP BY spotter_output.departure_airport_icao
6449 6449
 					ORDER BY airport_departure_icao_count DESC";
@@ -6455,7 +6455,7 @@  discard block
 block discarded – undo
6455 6455
 		$airport_array = array();
6456 6456
 		$temp_array = array();
6457 6457
         
6458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6459 6459
 		{
6460 6460
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6461 6461
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6476,11 +6476,11 @@  discard block
 block discarded – undo
6476 6476
 	* @return Array the airport list
6477 6477
 	*
6478 6478
 	*/
6479
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6479
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6480 6480
 	{
6481
-		$filter_query = $this->getFilter($filters,true,true);
6482
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6483
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6481
+		$filter_query = $this->getFilter($filters, true, true);
6482
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6483
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6484 6484
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6485 6485
                     GROUP BY spotter_output.departure_airport_country
6486 6486
 					ORDER BY airport_departure_country_count DESC";
@@ -6492,7 +6492,7 @@  discard block
 block discarded – undo
6492 6492
 		$airport_array = array();
6493 6493
 		$temp_array = array();
6494 6494
         
6495
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6495
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6496 6496
 		{
6497 6497
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6498 6498
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6510,11 +6510,11 @@  discard block
 block discarded – undo
6510 6510
 	* @return Array the airport list
6511 6511
 	*
6512 6512
 	*/
6513
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6513
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6514 6514
 	{
6515
-		$filter_query = $this->getFilter($filters,true,true);
6516
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6517
-		$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 
6515
+		$filter_query = $this->getFilter($filters, true, true);
6516
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6517
+		$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 
6518 6518
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
6519 6519
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6520 6520
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6526,7 +6526,7 @@  discard block
 block discarded – undo
6526 6526
 		$airport_array = array();
6527 6527
 		$temp_array = array();
6528 6528
         
6529
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6529
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6530 6530
 		{
6531 6531
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6532 6532
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6547,11 +6547,11 @@  discard block
 block discarded – undo
6547 6547
 	* @return Array the airport list
6548 6548
 	*
6549 6549
 	*/
6550
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6550
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6551 6551
 	{
6552
-		$filter_query = $this->getFilter($filters,true,true);
6553
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6554
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6552
+		$filter_query = $this->getFilter($filters, true, true);
6553
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6554
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6555 6555
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6556 6556
                     GROUP BY spotter_output.departure_airport_country
6557 6557
 					ORDER BY airport_departure_country_count DESC";
@@ -6563,7 +6563,7 @@  discard block
 block discarded – undo
6563 6563
 		$airport_array = array();
6564 6564
 		$temp_array = array();
6565 6565
         
6566
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6566
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6567 6567
 		{
6568 6568
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6569 6569
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6582,11 +6582,11 @@  discard block
 block discarded – undo
6582 6582
 	* @return Array the airport list
6583 6583
 	*
6584 6584
 	*/
6585
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6585
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6586 6586
 	{
6587
-		$filter_query = $this->getFilter($filters,true,true);
6588
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6589
-		$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 
6587
+		$filter_query = $this->getFilter($filters, true, true);
6588
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6589
+		$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 
6590 6590
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
6591 6591
                     GROUP BY spotter_output.departure_airport_icao
6592 6592
 					ORDER BY airport_departure_icao_count DESC";
@@ -6598,7 +6598,7 @@  discard block
 block discarded – undo
6598 6598
 		$airport_array = array();
6599 6599
 		$temp_array = array();
6600 6600
         
6601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6602 6602
 		{
6603 6603
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6604 6604
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6619,11 +6619,11 @@  discard block
 block discarded – undo
6619 6619
 	* @return Array the airport list
6620 6620
 	*
6621 6621
 	*/
6622
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6622
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6623 6623
 	{
6624
-		$filter_query = $this->getFilter($filters,true,true);
6625
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6626
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6624
+		$filter_query = $this->getFilter($filters, true, true);
6625
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6626
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6627 6627
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6628 6628
                     GROUP BY spotter_output.departure_airport_country
6629 6629
 					ORDER BY airport_departure_country_count DESC";
@@ -6635,7 +6635,7 @@  discard block
 block discarded – undo
6635 6635
 		$airport_array = array();
6636 6636
 		$temp_array = array();
6637 6637
         
6638
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6638
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6639 6639
 		{
6640 6640
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6641 6641
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6653,11 +6653,11 @@  discard block
 block discarded – undo
6653 6653
 	* @return Array the airport list
6654 6654
 	*
6655 6655
 	*/
6656
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6656
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6657 6657
 	{
6658 6658
 		global $globalTimezone, $globalDBdriver;
6659
-		$filter_query = $this->getFilter($filters,true,true);
6660
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6659
+		$filter_query = $this->getFilter($filters, true, true);
6660
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6661 6661
 		if ($globalTimezone != '') {
6662 6662
 			date_default_timezone_set($globalTimezone);
6663 6663
 			$datetime = new DateTime($date);
@@ -6665,12 +6665,12 @@  discard block
 block discarded – undo
6665 6665
 		} else $offset = '+00:00';
6666 6666
 
6667 6667
 		if ($globalDBdriver == 'mysql') {
6668
-			$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 
6668
+			$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 
6669 6669
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6670 6670
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6671 6671
 					ORDER BY airport_departure_icao_count DESC";
6672 6672
 		} else {
6673
-			$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 
6673
+			$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 
6674 6674
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6675 6675
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6676 6676
 					ORDER BY airport_departure_icao_count DESC";
@@ -6682,7 +6682,7 @@  discard block
 block discarded – undo
6682 6682
 		$airport_array = array();
6683 6683
 		$temp_array = array();
6684 6684
         
6685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6686 6686
 		{
6687 6687
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6688 6688
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6703,11 +6703,11 @@  discard block
 block discarded – undo
6703 6703
 	* @return Array the airport list
6704 6704
 	*
6705 6705
 	*/
6706
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6706
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6707 6707
 	{
6708 6708
 		global $globalTimezone, $globalDBdriver;
6709
-		$filter_query = $this->getFilter($filters,true,true);
6710
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6709
+		$filter_query = $this->getFilter($filters, true, true);
6710
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6711 6711
 		if ($globalTimezone != '') {
6712 6712
 			date_default_timezone_set($globalTimezone);
6713 6713
 			$datetime = new DateTime($date);
@@ -6715,12 +6715,12 @@  discard block
 block discarded – undo
6715 6715
 		} else $offset = '+00:00';
6716 6716
 
6717 6717
 		if ($globalDBdriver == 'mysql') {
6718
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6718
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6719 6719
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6720 6720
 					GROUP BY spotter_output.departure_airport_country
6721 6721
 					ORDER BY airport_departure_country_count DESC";
6722 6722
 		} else {
6723
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6723
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6724 6724
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6725 6725
 					GROUP BY spotter_output.departure_airport_country
6726 6726
 					ORDER BY airport_departure_country_count DESC";
@@ -6732,7 +6732,7 @@  discard block
 block discarded – undo
6732 6732
 		$airport_array = array();
6733 6733
 		$temp_array = array();
6734 6734
         
6735
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6735
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6736 6736
 		{
6737 6737
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6738 6738
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6750,11 +6750,11 @@  discard block
 block discarded – undo
6750 6750
 	* @return Array the airport list
6751 6751
 	*
6752 6752
 	*/
6753
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6753
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6754 6754
 	{
6755
-		$filter_query = $this->getFilter($filters,true,true);
6756
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6757
-		$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 
6755
+		$filter_query = $this->getFilter($filters, true, true);
6756
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6757
+		$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 
6758 6758
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
6759 6759
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6760 6760
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6766,7 +6766,7 @@  discard block
 block discarded – undo
6766 6766
 		$airport_array = array();
6767 6767
 		$temp_array = array();
6768 6768
         
6769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6770 6770
 		{
6771 6771
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6772 6772
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6788,11 +6788,11 @@  discard block
 block discarded – undo
6788 6788
 	* @return Array the airport list
6789 6789
 	*
6790 6790
 	*/
6791
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6791
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6792 6792
 	{
6793
-		$filter_query = $this->getFilter($filters,true,true);
6794
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6795
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6793
+		$filter_query = $this->getFilter($filters, true, true);
6794
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6795
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6796 6796
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6797 6797
                     GROUP BY spotter_output.departure_airport_country
6798 6798
 					ORDER BY airport_departure_country_count DESC";
@@ -6804,7 +6804,7 @@  discard block
 block discarded – undo
6804 6804
 		$airport_array = array();
6805 6805
 		$temp_array = array();
6806 6806
         
6807
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6807
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6808 6808
 		{
6809 6809
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6810 6810
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6823,12 +6823,12 @@  discard block
 block discarded – undo
6823 6823
 	* @return Array the airport list
6824 6824
 	*
6825 6825
 	*/
6826
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6826
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6827 6827
 	{
6828
-		$filter_query = $this->getFilter($filters,true,true);
6829
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6828
+		$filter_query = $this->getFilter($filters, true, true);
6829
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6830 6830
 
6831
-		$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 
6831
+		$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 
6832 6832
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6833 6833
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6834 6834
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6840,7 +6840,7 @@  discard block
 block discarded – undo
6840 6840
 		$airport_array = array();
6841 6841
 		$temp_array = array();
6842 6842
         
6843
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6843
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6844 6844
 		{
6845 6845
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6846 6846
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6861,11 +6861,11 @@  discard block
 block discarded – undo
6861 6861
 	* @return Array the airport list
6862 6862
 	*
6863 6863
 	*/
6864
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6864
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6865 6865
 	{
6866
-		$filter_query = $this->getFilter($filters,true,true);
6867
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6868
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6866
+		$filter_query = $this->getFilter($filters, true, true);
6867
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6868
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6869 6869
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6870 6870
                     GROUP BY spotter_output.departure_airport_country
6871 6871
 					ORDER BY airport_departure_country_count DESC";
@@ -6877,7 +6877,7 @@  discard block
 block discarded – undo
6877 6877
 		$airport_array = array();
6878 6878
 		$temp_array = array();
6879 6879
         
6880
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6880
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6881 6881
 		{
6882 6882
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6883 6883
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6900,11 +6900,11 @@  discard block
 block discarded – undo
6900 6900
 	* @return Array the airport list
6901 6901
 	*
6902 6902
 	*/
6903
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
6903
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
6904 6904
 	{
6905 6905
 		global $globalDBdriver;
6906
-		$filter_query = $this->getFilter($filters,true,true);
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 
6906
+		$filter_query = $this->getFilter($filters, true, true);
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 6909
                 if ($olderthanmonths > 0) {
6910 6910
             		if ($globalDBdriver == 'mysql') {
@@ -6924,28 +6924,28 @@  discard block
 block discarded – undo
6924 6924
 		if ($year != '') {
6925 6925
 			if ($globalDBdriver == 'mysql') {
6926 6926
 				$query .= " AND YEAR(spotter_output.date) = :year";
6927
-				$query_values = array_merge($query_values,array(':year' => $year));
6927
+				$query_values = array_merge($query_values, array(':year' => $year));
6928 6928
 			} else {
6929 6929
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6930
-				$query_values = array_merge($query_values,array(':year' => $year));
6930
+				$query_values = array_merge($query_values, array(':year' => $year));
6931 6931
 			}
6932 6932
 		}
6933 6933
 		if ($month != '') {
6934 6934
 			if ($globalDBdriver == 'mysql') {
6935 6935
 				$query .= " AND MONTH(spotter_output.date) = :month";
6936
-				$query_values = array_merge($query_values,array(':month' => $month));
6936
+				$query_values = array_merge($query_values, array(':month' => $month));
6937 6937
 			} else {
6938 6938
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6939
-				$query_values = array_merge($query_values,array(':month' => $month));
6939
+				$query_values = array_merge($query_values, array(':month' => $month));
6940 6940
 			}
6941 6941
 		}
6942 6942
 		if ($day != '') {
6943 6943
 			if ($globalDBdriver == 'mysql') {
6944 6944
 				$query .= " AND DAY(spotter_output.date) = :day";
6945
-				$query_values = array_merge($query_values,array(':day' => $day));
6945
+				$query_values = array_merge($query_values, array(':day' => $day));
6946 6946
 			} else {
6947 6947
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6948
-				$query_values = array_merge($query_values,array(':day' => $day));
6948
+				$query_values = array_merge($query_values, array(':day' => $day));
6949 6949
 			}
6950 6950
 		}
6951 6951
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -6959,7 +6959,7 @@  discard block
 block discarded – undo
6959 6959
 		$airport_array = array();
6960 6960
 		$temp_array = array();
6961 6961
         
6962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6963 6963
 		{
6964 6964
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6965 6965
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6982,11 +6982,11 @@  discard block
 block discarded – undo
6982 6982
 	* @return Array the airport list
6983 6983
 	*
6984 6984
 	*/
6985
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6985
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6986 6986
 	{
6987 6987
 		global $globalDBdriver;
6988
-		$filter_query = $this->getFilter($filters,true,true);
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 
6988
+		$filter_query = $this->getFilter($filters, true, true);
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 6991
                 if ($olderthanmonths > 0) {
6992 6992
             		if ($globalDBdriver == 'mysql') {
@@ -7016,7 +7016,7 @@  discard block
 block discarded – undo
7016 7016
 		$airport_array = array();
7017 7017
 		$temp_array = array();
7018 7018
         
7019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7020 7020
 		{
7021 7021
 			$temp_array['airline_icao'] = $row['airline_icao'];
7022 7022
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7041,11 +7041,11 @@  discard block
 block discarded – undo
7041 7041
 	* @return Array the airport list
7042 7042
 	*
7043 7043
 	*/
7044
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7044
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7045 7045
 	{
7046 7046
 		global $globalDBdriver;
7047
-		$filter_query = $this->getFilter($filters,true,true);
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 
7047
+		$filter_query = $this->getFilter($filters, true, true);
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 7050
                 if ($olderthanmonths > 0) {
7051 7051
             		if ($globalDBdriver == 'mysql') {
@@ -7065,28 +7065,28 @@  discard block
 block discarded – undo
7065 7065
 		if ($year != '') {
7066 7066
 			if ($globalDBdriver == 'mysql') {
7067 7067
 				$query .= " AND YEAR(spotter_output.date) = :year";
7068
-				$query_values = array_merge($query_values,array(':year' => $year));
7068
+				$query_values = array_merge($query_values, array(':year' => $year));
7069 7069
 			} else {
7070 7070
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7071
-				$query_values = array_merge($query_values,array(':year' => $year));
7071
+				$query_values = array_merge($query_values, array(':year' => $year));
7072 7072
 			}
7073 7073
 		}
7074 7074
 		if ($month != '') {
7075 7075
 			if ($globalDBdriver == 'mysql') {
7076 7076
 				$query .= " AND MONTH(spotter_output.date) = :month";
7077
-				$query_values = array_merge($query_values,array(':month' => $month));
7077
+				$query_values = array_merge($query_values, array(':month' => $month));
7078 7078
 			} else {
7079 7079
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7080
-				$query_values = array_merge($query_values,array(':month' => $month));
7080
+				$query_values = array_merge($query_values, array(':month' => $month));
7081 7081
 			}
7082 7082
 		}
7083 7083
 		if ($day != '') {
7084 7084
 			if ($globalDBdriver == 'mysql') {
7085 7085
 				$query .= " AND DAY(spotter_output.date) = :day";
7086
-				$query_values = array_merge($query_values,array(':day' => $day));
7086
+				$query_values = array_merge($query_values, array(':day' => $day));
7087 7087
 			} else {
7088 7088
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7089
-				$query_values = array_merge($query_values,array(':day' => $day));
7089
+				$query_values = array_merge($query_values, array(':day' => $day));
7090 7090
 			}
7091 7091
 		}
7092 7092
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7099,7 +7099,7 @@  discard block
 block discarded – undo
7099 7099
       
7100 7100
 		$airport_array = array();
7101 7101
 		$temp_array = array();
7102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7103 7103
 		{
7104 7104
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7105 7105
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	* @return Array the airport list
7123 7123
 	*
7124 7124
 	*/
7125
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7125
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7126 7126
 	{
7127 7127
 		global $globalDBdriver;
7128
-		$filter_query = $this->getFilter($filters,true,true);
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 
7128
+		$filter_query = $this->getFilter($filters, true, true);
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 7131
                 if ($olderthanmonths > 0) {
7132 7132
             		if ($globalDBdriver == 'mysql') {
@@ -7156,7 +7156,7 @@  discard block
 block discarded – undo
7156 7156
 		$airport_array = array();
7157 7157
 		$temp_array = array();
7158 7158
         
7159
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7159
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7160 7160
 		{
7161 7161
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7162 7162
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7182,9 +7182,9 @@  discard block
 block discarded – undo
7182 7182
 	*/
7183 7183
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7184 7184
 	{
7185
-		$filter_query = $this->getFilter($filters,true,true);
7186
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7187
-		$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 
7185
+		$filter_query = $this->getFilter($filters, true, true);
7186
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7187
+		$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 
7188 7188
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7189 7189
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7190 7190
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7195,7 +7195,7 @@  discard block
 block discarded – undo
7195 7195
 		$airport_array = array();
7196 7196
 		$temp_array = array();
7197 7197
         
7198
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7198
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7199 7199
 		{
7200 7200
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7201 7201
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7216,12 +7216,12 @@  discard block
 block discarded – undo
7216 7216
 	* @return Array the airport list
7217 7217
 	*
7218 7218
 	*/
7219
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7219
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7220 7220
 	{
7221
-		$filter_query = $this->getFilter($filters,true,true);
7222
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7221
+		$filter_query = $this->getFilter($filters, true, true);
7222
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7223 7223
 					
7224
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7224
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7225 7225
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7226 7226
                     GROUP BY spotter_output.arrival_airport_country
7227 7227
 					ORDER BY airport_arrival_country_count DESC";
@@ -7233,7 +7233,7 @@  discard block
 block discarded – undo
7233 7233
 		$airport_array = array();
7234 7234
 		$temp_array = array();
7235 7235
         
7236
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7236
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7237 7237
 		{
7238 7238
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7239 7239
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7251,11 +7251,11 @@  discard block
 block discarded – undo
7251 7251
 	* @return Array the airport list
7252 7252
 	*
7253 7253
 	*/
7254
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7254
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7255 7255
 	{
7256
-		$filter_query = $this->getFilter($filters,true,true);
7257
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7258
-		$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 
7256
+		$filter_query = $this->getFilter($filters, true, true);
7257
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7258
+		$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 
7259 7259
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7260 7260
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7261 7261
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7267,7 +7267,7 @@  discard block
 block discarded – undo
7267 7267
 		$airport_array = array();
7268 7268
 		$temp_array = array();
7269 7269
         
7270
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7270
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7271 7271
 		{
7272 7272
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7273 7273
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7289,11 +7289,11 @@  discard block
 block discarded – undo
7289 7289
 	* @return Array the airport list
7290 7290
 	*
7291 7291
 	*/
7292
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7292
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7293 7293
 	{
7294
-		$filter_query = $this->getFilter($filters,true,true);
7295
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7296
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7294
+		$filter_query = $this->getFilter($filters, true, true);
7295
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7296
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7297 7297
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7298 7298
                     GROUP BY spotter_output.arrival_airport_country
7299 7299
 					ORDER BY airport_arrival_country_count DESC";
@@ -7305,7 +7305,7 @@  discard block
 block discarded – undo
7305 7305
 		$airport_array = array();
7306 7306
 		$temp_array = array();
7307 7307
         
7308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7309 7309
 		{
7310 7310
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7311 7311
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7323,12 +7323,12 @@  discard block
 block discarded – undo
7323 7323
 	* @return Array the airport list
7324 7324
 	*
7325 7325
 	*/
7326
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7326
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
7327 7327
 	{
7328
-		$filter_query = $this->getFilter($filters,true,true);
7329
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7328
+		$filter_query = $this->getFilter($filters, true, true);
7329
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7330 7330
 
7331
-		$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 
7331
+		$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 
7332 7332
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
7333 7333
                     GROUP BY spotter_output.arrival_airport_icao
7334 7334
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7340,7 +7340,7 @@  discard block
 block discarded – undo
7340 7340
 		$airport_array = array();
7341 7341
 		$temp_array = array();
7342 7342
         
7343
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7343
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7344 7344
 		{
7345 7345
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7346 7346
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7361,11 +7361,11 @@  discard block
 block discarded – undo
7361 7361
 	* @return Array the airport list
7362 7362
 	*
7363 7363
 	*/
7364
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7364
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
7365 7365
 	{
7366
-		$filter_query = $this->getFilter($filters,true,true);
7367
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7368
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7366
+		$filter_query = $this->getFilter($filters, true, true);
7367
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7368
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7369 7369
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
7370 7370
                     GROUP BY spotter_output.arrival_airport_country
7371 7371
 					ORDER BY airport_arrival_country_count DESC";
@@ -7377,7 +7377,7 @@  discard block
 block discarded – undo
7377 7377
 		$airport_array = array();
7378 7378
 		$temp_array = array();
7379 7379
         
7380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7381 7381
 		{
7382 7382
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7383 7383
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7396,11 +7396,11 @@  discard block
 block discarded – undo
7396 7396
 	* @return Array the airport list
7397 7397
 	*
7398 7398
 	*/
7399
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7399
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
7400 7400
 	{
7401
-		$filter_query = $this->getFilter($filters,true,true);
7402
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7403
-		$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 
7401
+		$filter_query = $this->getFilter($filters, true, true);
7402
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7403
+		$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 
7404 7404
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7405 7405
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7406 7406
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7412,7 +7412,7 @@  discard block
 block discarded – undo
7412 7412
 		$airport_array = array();
7413 7413
 		$temp_array = array();
7414 7414
         
7415
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7415
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7416 7416
 		{
7417 7417
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7418 7418
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7433,11 +7433,11 @@  discard block
 block discarded – undo
7433 7433
 	* @return Array the airport list
7434 7434
 	*
7435 7435
 	*/
7436
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7436
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7437 7437
 	{
7438
-		$filter_query = $this->getFilter($filters,true,true);
7439
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7440
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7438
+		$filter_query = $this->getFilter($filters, true, true);
7439
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7440
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7441 7441
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7442 7442
                     GROUP BY spotter_output.arrival_airport_country
7443 7443
 					ORDER BY airport_arrival_country_count DESC";
@@ -7449,7 +7449,7 @@  discard block
 block discarded – undo
7449 7449
 		$airport_array = array();
7450 7450
 		$temp_array = array();
7451 7451
         
7452
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7452
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7453 7453
 		{
7454 7454
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7455 7455
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7467,11 +7467,11 @@  discard block
 block discarded – undo
7467 7467
 	* @return Array the airport list
7468 7468
 	*
7469 7469
 	*/
7470
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7470
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7471 7471
 	{
7472
-		$filter_query = $this->getFilter($filters,true,true);
7473
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7474
-		$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 
7472
+		$filter_query = $this->getFilter($filters, true, true);
7473
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7474
+		$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 
7475 7475
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7476 7476
                     GROUP BY spotter_output.arrival_airport_icao
7477 7477
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7483,7 +7483,7 @@  discard block
 block discarded – undo
7483 7483
 		$airport_array = array();
7484 7484
 		$temp_array = array();
7485 7485
         
7486
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7486
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7487 7487
 		{
7488 7488
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7489 7489
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7505,11 +7505,11 @@  discard block
 block discarded – undo
7505 7505
 	* @return Array the airport list
7506 7506
 	*
7507 7507
 	*/
7508
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7508
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7509 7509
 	{
7510
-		$filter_query = $this->getFilter($filters,true,true);
7511
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7512
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7510
+		$filter_query = $this->getFilter($filters, true, true);
7511
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7512
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7513 7513
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7514 7514
                     GROUP BY spotter_output.arrival_airport_country
7515 7515
 					ORDER BY airport_arrival_country_count DESC";
@@ -7521,7 +7521,7 @@  discard block
 block discarded – undo
7521 7521
 		$airport_array = array();
7522 7522
 		$temp_array = array();
7523 7523
         
7524
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7524
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7525 7525
 		{
7526 7526
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7527 7527
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7540,11 +7540,11 @@  discard block
 block discarded – undo
7540 7540
 	* @return Array the airport list
7541 7541
 	*
7542 7542
 	*/
7543
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7543
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7544 7544
 	{
7545 7545
 		global $globalTimezone, $globalDBdriver;
7546
-		$filter_query = $this->getFilter($filters,true,true);
7547
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7546
+		$filter_query = $this->getFilter($filters, true, true);
7547
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7548 7548
 		if ($globalTimezone != '') {
7549 7549
 			date_default_timezone_set($globalTimezone);
7550 7550
 			$datetime = new DateTime($date);
@@ -7552,12 +7552,12 @@  discard block
 block discarded – undo
7552 7552
 		} else $offset = '+00:00';
7553 7553
 
7554 7554
 		if ($globalDBdriver == 'mysql') {
7555
-			$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 
7555
+			$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 
7556 7556
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7557 7557
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7558 7558
 					ORDER BY airport_arrival_icao_count DESC";
7559 7559
 		} else {
7560
-			$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 
7560
+			$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 
7561 7561
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7562 7562
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7563 7563
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7569,7 +7569,7 @@  discard block
 block discarded – undo
7569 7569
 		$airport_array = array();
7570 7570
 		$temp_array = array();
7571 7571
         
7572
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7572
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7573 7573
 		{
7574 7574
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7575 7575
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7593,8 +7593,8 @@  discard block
 block discarded – undo
7593 7593
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7594 7594
 	{
7595 7595
 		global $globalTimezone, $globalDBdriver;
7596
-		$filter_query = $this->getFilter($filters,true,true);
7597
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7596
+		$filter_query = $this->getFilter($filters, true, true);
7597
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7598 7598
 		if ($globalTimezone != '') {
7599 7599
 			date_default_timezone_set($globalTimezone);
7600 7600
 			$datetime = new DateTime($date);
@@ -7602,12 +7602,12 @@  discard block
 block discarded – undo
7602 7602
 		} else $offset = '+00:00';
7603 7603
 
7604 7604
 		if ($globalDBdriver == 'mysql') {
7605
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7605
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7606 7606
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7607 7607
 					GROUP BY spotter_output.arrival_airport_country
7608 7608
 					ORDER BY airport_arrival_country_count DESC";
7609 7609
 		} else {
7610
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7610
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7611 7611
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7612 7612
 					GROUP BY spotter_output.arrival_airport_country
7613 7613
 					ORDER BY airport_arrival_country_count DESC";
@@ -7619,7 +7619,7 @@  discard block
 block discarded – undo
7619 7619
 		$airport_array = array();
7620 7620
 		$temp_array = array();
7621 7621
         
7622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7623 7623
 		{
7624 7624
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7625 7625
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7637,11 +7637,11 @@  discard block
 block discarded – undo
7637 7637
 	* @return Array the airport list
7638 7638
 	*
7639 7639
 	*/
7640
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7640
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7641 7641
 	{
7642
-		$filter_query = $this->getFilter($filters,true,true);
7643
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7644
-		$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 
7642
+		$filter_query = $this->getFilter($filters, true, true);
7643
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7644
+		$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 
7645 7645
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7646 7646
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7647 7647
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7653,7 +7653,7 @@  discard block
 block discarded – undo
7653 7653
 		$airport_array = array();
7654 7654
 		$temp_array = array();
7655 7655
         
7656
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7656
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7657 7657
 		{
7658 7658
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7659 7659
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7676,9 +7676,9 @@  discard block
 block discarded – undo
7676 7676
 	*/
7677 7677
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7678 7678
 	{
7679
-		$filter_query = $this->getFilter($filters,true,true);
7680
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7681
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7679
+		$filter_query = $this->getFilter($filters, true, true);
7680
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7681
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7682 7682
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7683 7683
                     GROUP BY spotter_output.arrival_airport_country
7684 7684
 					ORDER BY airport_arrival_country_count DESC";
@@ -7690,7 +7690,7 @@  discard block
 block discarded – undo
7690 7690
 		$airport_array = array();
7691 7691
 		$temp_array = array();
7692 7692
         
7693
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7693
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7694 7694
 		{
7695 7695
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7696 7696
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7709,11 +7709,11 @@  discard block
 block discarded – undo
7709 7709
 	* @return Array the airport list
7710 7710
 	*
7711 7711
 	*/
7712
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7712
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7713 7713
 	{
7714
-		$filter_query = $this->getFilter($filters,true,true);
7715
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7716
-		$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 
7714
+		$filter_query = $this->getFilter($filters, true, true);
7715
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7716
+		$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 
7717 7717
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7718 7718
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7719 7719
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7725,7 +7725,7 @@  discard block
 block discarded – undo
7725 7725
 		$airport_array = array();
7726 7726
 		$temp_array = array();
7727 7727
         
7728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7729 7729
 		{
7730 7730
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7731 7731
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7746,12 +7746,12 @@  discard block
 block discarded – undo
7746 7746
 	* @return Array the airport list
7747 7747
 	*
7748 7748
 	*/
7749
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7749
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7750 7750
 	{
7751 7751
 		global $globalDBdriver;
7752
-		$filter_query = $this->getFilter($filters,true,true);
7753
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7754
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7752
+		$filter_query = $this->getFilter($filters, true, true);
7753
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7754
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7755 7755
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7756 7756
                     GROUP BY spotter_output.arrival_airport_country
7757 7757
 					ORDER BY airport_arrival_country_count DESC";
@@ -7763,7 +7763,7 @@  discard block
 block discarded – undo
7763 7763
 		$airport_array = array();
7764 7764
 		$temp_array = array();
7765 7765
         
7766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7767 7767
 		{
7768 7768
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7769 7769
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7782,38 +7782,38 @@  discard block
 block discarded – undo
7782 7782
 	* @return Array the airport departure list
7783 7783
 	*
7784 7784
 	*/
7785
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
7785
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
7786 7786
 	{
7787 7787
 		global $globalDBdriver;
7788
-		$filter_query = $this->getFilter($filters,true,true);
7789
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7788
+		$filter_query = $this->getFilter($filters, true, true);
7789
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7790 7790
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
7791 7791
 		$query_values = array();
7792 7792
 		if ($year != '') {
7793 7793
 			if ($globalDBdriver == 'mysql') {
7794 7794
 				$query .= " AND YEAR(spotter_output.date) = :year";
7795
-				$query_values = array_merge($query_values,array(':year' => $year));
7795
+				$query_values = array_merge($query_values, array(':year' => $year));
7796 7796
 			} else {
7797 7797
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7798
-				$query_values = array_merge($query_values,array(':year' => $year));
7798
+				$query_values = array_merge($query_values, array(':year' => $year));
7799 7799
 			}
7800 7800
 		}
7801 7801
 		if ($month != '') {
7802 7802
 			if ($globalDBdriver == 'mysql') {
7803 7803
 				$query .= " AND MONTH(spotter_output.date) = :month";
7804
-				$query_values = array_merge($query_values,array(':month' => $month));
7804
+				$query_values = array_merge($query_values, array(':month' => $month));
7805 7805
 			} else {
7806 7806
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7807
-				$query_values = array_merge($query_values,array(':month' => $month));
7807
+				$query_values = array_merge($query_values, array(':month' => $month));
7808 7808
 			}
7809 7809
 		}
7810 7810
 		if ($day != '') {
7811 7811
 			if ($globalDBdriver == 'mysql') {
7812 7812
 				$query .= " AND DAY(spotter_output.date) = :day";
7813
-				$query_values = array_merge($query_values,array(':day' => $day));
7813
+				$query_values = array_merge($query_values, array(':day' => $day));
7814 7814
 			} else {
7815 7815
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7816
-				$query_values = array_merge($query_values,array(':day' => $day));
7816
+				$query_values = array_merge($query_values, array(':day' => $day));
7817 7817
 			}
7818 7818
 		}
7819 7819
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7827,7 +7827,7 @@  discard block
 block discarded – undo
7827 7827
 		$airport_array = array();
7828 7828
 		$temp_array = array();
7829 7829
         
7830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7831 7831
 		{
7832 7832
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7833 7833
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7845,38 +7845,38 @@  discard block
 block discarded – undo
7845 7845
 	* @return Array the airport arrival list
7846 7846
 	*
7847 7847
 	*/
7848
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
7848
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
7849 7849
 	{
7850 7850
 		global $globalDBdriver;
7851
-		$filter_query = $this->getFilter($filters,true,true);
7852
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7851
+		$filter_query = $this->getFilter($filters, true, true);
7852
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7853 7853
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7854 7854
 		$query_values = array();
7855 7855
 		if ($year != '') {
7856 7856
 			if ($globalDBdriver == 'mysql') {
7857 7857
 				$query .= " AND YEAR(spotter_output.date) = :year";
7858
-				$query_values = array_merge($query_values,array(':year' => $year));
7858
+				$query_values = array_merge($query_values, array(':year' => $year));
7859 7859
 			} else {
7860 7860
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7861
-				$query_values = array_merge($query_values,array(':year' => $year));
7861
+				$query_values = array_merge($query_values, array(':year' => $year));
7862 7862
 			}
7863 7863
 		}
7864 7864
 		if ($month != '') {
7865 7865
 			if ($globalDBdriver == 'mysql') {
7866 7866
 				$query .= " AND MONTH(spotter_output.date) = :month";
7867
-				$query_values = array_merge($query_values,array(':month' => $month));
7867
+				$query_values = array_merge($query_values, array(':month' => $month));
7868 7868
 			} else {
7869 7869
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7870
-				$query_values = array_merge($query_values,array(':month' => $month));
7870
+				$query_values = array_merge($query_values, array(':month' => $month));
7871 7871
 			}
7872 7872
 		}
7873 7873
 		if ($day != '') {
7874 7874
 			if ($globalDBdriver == 'mysql') {
7875 7875
 				$query .= " AND DAY(spotter_output.date) = :day";
7876
-				$query_values = array_merge($query_values,array(':day' => $day));
7876
+				$query_values = array_merge($query_values, array(':day' => $day));
7877 7877
 			} else {
7878 7878
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7879
-				$query_values = array_merge($query_values,array(':day' => $day));
7879
+				$query_values = array_merge($query_values, array(':day' => $day));
7880 7880
 			}
7881 7881
 		}
7882 7882
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7890,7 +7890,7 @@  discard block
 block discarded – undo
7890 7890
 		$airport_array = array();
7891 7891
 		$temp_array = array();
7892 7892
         
7893
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7893
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7894 7894
 		{
7895 7895
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7896 7896
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7913,8 +7913,8 @@  discard block
 block discarded – undo
7913 7913
 	*/
7914 7914
 	public function countAllRoutes($filters = array())
7915 7915
 	{
7916
-		$filter_query = $this->getFilter($filters,true,true);
7917
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7916
+		$filter_query = $this->getFilter($filters, true, true);
7917
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7918 7918
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
7919 7919
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7920 7920
                     ORDER BY route_count DESC
@@ -7927,7 +7927,7 @@  discard block
 block discarded – undo
7927 7927
 		$routes_array = array();
7928 7928
 		$temp_array = array();
7929 7929
         
7930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7931 7931
 		{
7932 7932
 			$temp_array['route_count'] = $row['route_count'];
7933 7933
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7954,11 +7954,11 @@  discard block
 block discarded – undo
7954 7954
 	* @return Array the route list
7955 7955
 	*
7956 7956
 	*/
7957
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7957
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7958 7958
 	{
7959
-		$filter_query = $this->getFilter($filters,true,true);
7960
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7961
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7959
+		$filter_query = $this->getFilter($filters, true, true);
7960
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7961
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7962 7962
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7963 7963
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7964 7964
 			    ORDER BY route_count DESC";
@@ -7969,7 +7969,7 @@  discard block
 block discarded – undo
7969 7969
 		$routes_array = array();
7970 7970
 		$temp_array = array();
7971 7971
         
7972
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7972
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7973 7973
 		{
7974 7974
 			$temp_array['route_count'] = $row['route_count'];
7975 7975
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7996,9 +7996,9 @@  discard block
 block discarded – undo
7996 7996
 	*/
7997 7997
 	public function countAllRoutesByRegistration($registration, $filters = array())
7998 7998
 	{
7999
-		$filter_query = $this->getFilter($filters,true,true);
7999
+		$filter_query = $this->getFilter($filters, true, true);
8000 8000
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8001
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8001
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8002 8002
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8003 8003
                     GROUP BY route
8004 8004
                     ORDER BY route_count DESC";
@@ -8010,7 +8010,7 @@  discard block
 block discarded – undo
8010 8010
 		$routes_array = array();
8011 8011
 		$temp_array = array();
8012 8012
         
8013
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8013
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8014 8014
 		{
8015 8015
 			$temp_array['route_count'] = $row['route_count'];
8016 8016
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8038,9 +8038,9 @@  discard block
 block discarded – undo
8038 8038
 	*/
8039 8039
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8040 8040
 	{
8041
-		$filter_query = $this->getFilter($filters,true,true);
8042
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8043
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8041
+		$filter_query = $this->getFilter($filters, true, true);
8042
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8043
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8044 8044
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8045 8045
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8046 8046
 			    ORDER BY route_count DESC";
@@ -8052,7 +8052,7 @@  discard block
 block discarded – undo
8052 8052
 		$routes_array = array();
8053 8053
 		$temp_array = array();
8054 8054
         
8055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8056 8056
 		{
8057 8057
 			$temp_array['route_count'] = $row['route_count'];
8058 8058
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8080,9 +8080,9 @@  discard block
 block discarded – undo
8080 8080
 	*/
8081 8081
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8082 8082
 	{
8083
-		$filter_query = $this->getFilter($filters,true,true);
8084
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8085
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8083
+		$filter_query = $this->getFilter($filters, true, true);
8084
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8085
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8086 8086
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8087 8087
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8088 8088
 			    ORDER BY route_count DESC";
@@ -8093,7 +8093,7 @@  discard block
 block discarded – undo
8093 8093
 		$routes_array = array();
8094 8094
 		$temp_array = array();
8095 8095
         
8096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8097 8097
 		{
8098 8098
 			$temp_array['route_count'] = $row['route_count'];
8099 8099
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8121,9 +8121,9 @@  discard block
 block discarded – undo
8121 8121
 	*/
8122 8122
 	public function countAllRoutesByCountry($country, $filters = array())
8123 8123
 	{
8124
-		$filter_query = $this->getFilter($filters,true,true);
8125
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8126
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8124
+		$filter_query = $this->getFilter($filters, true, true);
8125
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8126
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8127 8127
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8128 8128
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8129 8129
 			    ORDER BY route_count DESC";
@@ -8134,7 +8134,7 @@  discard block
 block discarded – undo
8134 8134
 		$routes_array = array();
8135 8135
 		$temp_array = array();
8136 8136
         
8137
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8137
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8138 8138
 		{
8139 8139
 			$temp_array['route_count'] = $row['route_count'];
8140 8140
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8162,8 +8162,8 @@  discard block
 block discarded – undo
8162 8162
 	public function countAllRoutesByDate($date, $filters = array())
8163 8163
 	{
8164 8164
 		global $globalTimezone, $globalDBdriver;
8165
-		$filter_query = $this->getFilter($filters,true,true);
8166
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8165
+		$filter_query = $this->getFilter($filters, true, true);
8166
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8167 8167
 		if ($globalTimezone != '') {
8168 8168
 			date_default_timezone_set($globalTimezone);
8169 8169
 			$datetime = new DateTime($date);
@@ -8171,12 +8171,12 @@  discard block
 block discarded – undo
8171 8171
 		} else $offset = '+00:00';
8172 8172
 		
8173 8173
 		if ($globalDBdriver == 'mysql') {
8174
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8174
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8175 8175
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8176 8176
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8177 8177
 				    ORDER BY route_count DESC";
8178 8178
 		} else {
8179
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8179
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8180 8180
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8181 8181
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8182 8182
 				    ORDER BY route_count DESC";
@@ -8188,7 +8188,7 @@  discard block
 block discarded – undo
8188 8188
 		$routes_array = array();
8189 8189
 		$temp_array = array();
8190 8190
         
8191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8192 8192
 		{
8193 8193
 			$temp_array['route_count'] = $row['route_count'];
8194 8194
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8215,9 +8215,9 @@  discard block
 block discarded – undo
8215 8215
 	*/
8216 8216
 	public function countAllRoutesByIdent($ident, $filters = array())
8217 8217
 	{
8218
-		$filter_query = $this->getFilter($filters,true,true);
8219
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8220
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8218
+		$filter_query = $this->getFilter($filters, true, true);
8219
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8220
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8221 8221
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
8222 8222
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8223 8223
                     ORDER BY route_count DESC";
@@ -8229,7 +8229,7 @@  discard block
 block discarded – undo
8229 8229
 		$routes_array = array();
8230 8230
 		$temp_array = array();
8231 8231
         
8232
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8232
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8233 8233
 		{
8234 8234
 			$temp_array['route_count'] = $row['route_count'];
8235 8235
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8256,9 +8256,9 @@  discard block
 block discarded – undo
8256 8256
 	*/
8257 8257
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8258 8258
 	{
8259
-		$filter_query = $this->getFilter($filters,true,true);
8260
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8261
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8259
+		$filter_query = $this->getFilter($filters, true, true);
8260
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8261
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8262 8262
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
8263 8263
                     GROUP BY route
8264 8264
                     ORDER BY route_count DESC";
@@ -8270,7 +8270,7 @@  discard block
 block discarded – undo
8270 8270
 		$routes_array = array();
8271 8271
 		$temp_array = array();
8272 8272
         
8273
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8273
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8274 8274
 		{
8275 8275
 			$temp_array['route_count'] = $row['route_count'];
8276 8276
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8298,8 +8298,8 @@  discard block
 block discarded – undo
8298 8298
 	*/
8299 8299
 	public function countAllRoutesWithWaypoints($filters = array())
8300 8300
 	{
8301
-		$filter_query = $this->getFilter($filters,true,true);
8302
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8301
+		$filter_query = $this->getFilter($filters, true, true);
8302
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8303 8303
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
8304 8304
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8305 8305
                     ORDER BY route_count DESC
@@ -8312,7 +8312,7 @@  discard block
 block discarded – undo
8312 8312
 		$routes_array = array();
8313 8313
 		$temp_array = array();
8314 8314
         
8315
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8315
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8316 8316
 		{
8317 8317
 			$temp_array['spotter_id'] = $row['spotter_id'];
8318 8318
 			$temp_array['route_count'] = $row['route_count'];
@@ -8337,11 +8337,11 @@  discard block
 block discarded – undo
8337 8337
 	* @return Array the callsign list
8338 8338
 	*
8339 8339
 	*/
8340
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8340
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
8341 8341
 	{
8342 8342
 		global $globalDBdriver;
8343
-		$filter_query = $this->getFilter($filters,true,true);
8344
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8343
+		$filter_query = $this->getFilter($filters, true, true);
8344
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8345 8345
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8346 8346
 		 if ($olderthanmonths > 0) {
8347 8347
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -8355,28 +8355,28 @@  discard block
 block discarded – undo
8355 8355
 		if ($year != '') {
8356 8356
 			if ($globalDBdriver == 'mysql') {
8357 8357
 				$query .= " AND YEAR(spotter_output.date) = :year";
8358
-				$query_values = array_merge($query_values,array(':year' => $year));
8358
+				$query_values = array_merge($query_values, array(':year' => $year));
8359 8359
 			} else {
8360 8360
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8361
-				$query_values = array_merge($query_values,array(':year' => $year));
8361
+				$query_values = array_merge($query_values, array(':year' => $year));
8362 8362
 			}
8363 8363
 		}
8364 8364
 		if ($month != '') {
8365 8365
 			if ($globalDBdriver == 'mysql') {
8366 8366
 				$query .= " AND MONTH(spotter_output.date) = :month";
8367
-				$query_values = array_merge($query_values,array(':month' => $month));
8367
+				$query_values = array_merge($query_values, array(':month' => $month));
8368 8368
 			} else {
8369 8369
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8370
-				$query_values = array_merge($query_values,array(':month' => $month));
8370
+				$query_values = array_merge($query_values, array(':month' => $month));
8371 8371
 			}
8372 8372
 		}
8373 8373
 		if ($day != '') {
8374 8374
 			if ($globalDBdriver == 'mysql') {
8375 8375
 				$query .= " AND DAY(spotter_output.date) = :day";
8376
-				$query_values = array_merge($query_values,array(':day' => $day));
8376
+				$query_values = array_merge($query_values, array(':day' => $day));
8377 8377
 			} else {
8378 8378
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8379
-				$query_values = array_merge($query_values,array(':day' => $day));
8379
+				$query_values = array_merge($query_values, array(':day' => $day));
8380 8380
 			}
8381 8381
 		}
8382 8382
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -8388,7 +8388,7 @@  discard block
 block discarded – undo
8388 8388
 		$callsign_array = array();
8389 8389
 		$temp_array = array();
8390 8390
         
8391
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8391
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8392 8392
 		{
8393 8393
 			$temp_array['callsign_icao'] = $row['ident'];
8394 8394
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8410,8 +8410,8 @@  discard block
 block discarded – undo
8410 8410
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8411 8411
 	{
8412 8412
 		global $globalDBdriver;
8413
-		$filter_query = $this->getFilter($filters,true,true);
8414
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8413
+		$filter_query = $this->getFilter($filters, true, true);
8414
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8415 8415
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8416 8416
 		 if ($olderthanmonths > 0) {
8417 8417
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -8430,7 +8430,7 @@  discard block
 block discarded – undo
8430 8430
 		$callsign_array = array();
8431 8431
 		$temp_array = array();
8432 8432
         
8433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8434 8434
 		{
8435 8435
 			$temp_array['callsign_icao'] = $row['ident'];
8436 8436
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8484,7 +8484,7 @@  discard block
 block discarded – undo
8484 8484
 		$date_array = array();
8485 8485
 		$temp_array = array();
8486 8486
         
8487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8488 8488
 		{
8489 8489
 			$temp_array['date_name'] = $row['date_name'];
8490 8490
 			$temp_array['date_count'] = $row['date_count'];
@@ -8509,15 +8509,15 @@  discard block
 block discarded – undo
8509 8509
 			$datetime = new DateTime();
8510 8510
 			$offset = $datetime->format('P');
8511 8511
 		} else $offset = '+00:00';
8512
-		$filter_query = $this->getFilter($filters,true,true);
8512
+		$filter_query = $this->getFilter($filters, true, true);
8513 8513
 		if ($globalDBdriver == 'mysql') {
8514
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8514
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8515 8515
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8516 8516
 								GROUP BY spotter_output.airline_icao, date_name 
8517 8517
 								ORDER BY date_count DESC
8518 8518
 								LIMIT 10 OFFSET 0";
8519 8519
 		} else {
8520
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8520
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8521 8521
 								FROM spotter_output 
8522 8522
 								WHERE spotter_output.airline_icao <> '' 
8523 8523
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -8532,7 +8532,7 @@  discard block
 block discarded – undo
8532 8532
 		$date_array = array();
8533 8533
 		$temp_array = array();
8534 8534
         
8535
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8535
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8536 8536
 		{
8537 8537
 			$temp_array['date_name'] = $row['date_name'];
8538 8538
 			$temp_array['date_count'] = $row['date_count'];
@@ -8558,7 +8558,7 @@  discard block
 block discarded – undo
8558 8558
 			$datetime = new DateTime();
8559 8559
 			$offset = $datetime->format('P');
8560 8560
 		} else $offset = '+00:00';
8561
-		$filter_query = $this->getFilter($filters,true,true);
8561
+		$filter_query = $this->getFilter($filters, true, true);
8562 8562
 		if ($globalDBdriver == 'mysql') {
8563 8563
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8564 8564
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -8579,7 +8579,7 @@  discard block
 block discarded – undo
8579 8579
 		$date_array = array();
8580 8580
 		$temp_array = array();
8581 8581
         
8582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8583 8583
 		{
8584 8584
 			$temp_array['date_name'] = $row['date_name'];
8585 8585
 			$temp_array['date_count'] = $row['date_count'];
@@ -8604,7 +8604,7 @@  discard block
 block discarded – undo
8604 8604
 			$datetime = new DateTime();
8605 8605
 			$offset = $datetime->format('P');
8606 8606
 		} else $offset = '+00:00';
8607
-		$filter_query = $this->getFilter($filters,true,true);
8607
+		$filter_query = $this->getFilter($filters, true, true);
8608 8608
 		if ($globalDBdriver == 'mysql') {
8609 8609
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8610 8610
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -8625,7 +8625,7 @@  discard block
 block discarded – undo
8625 8625
 		$date_array = array();
8626 8626
 		$temp_array = array();
8627 8627
         
8628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8629 8629
 		{
8630 8630
 			$temp_array['date_name'] = $row['date_name'];
8631 8631
 			$temp_array['date_count'] = $row['date_count'];
@@ -8646,7 +8646,7 @@  discard block
 block discarded – undo
8646 8646
 	public function countAllDatesLastMonthByAirlines($filters = array())
8647 8647
 	{
8648 8648
 		global $globalTimezone, $globalDBdriver;
8649
-		$filter_query = $this->getFilter($filters,true,true);
8649
+		$filter_query = $this->getFilter($filters, true, true);
8650 8650
 		if ($globalTimezone != '') {
8651 8651
 			date_default_timezone_set($globalTimezone);
8652 8652
 			$datetime = new DateTime();
@@ -8654,13 +8654,13 @@  discard block
 block discarded – undo
8654 8654
 		} else $offset = '+00:00';
8655 8655
 		
8656 8656
 		if ($globalDBdriver == 'mysql') {
8657
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8657
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8658 8658
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8659 8659
 								GROUP BY spotter_output.airline_icao, date_name 
8660 8660
 								ORDER BY spotter_output.date ASC";
8661 8661
 			$query_data = array(':offset' => $offset);
8662 8662
 		} else {
8663
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8663
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8664 8664
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8665 8665
 								GROUP BY spotter_output.airline_icao, date_name 
8666 8666
 								ORDER BY date_name ASC";
@@ -8673,7 +8673,7 @@  discard block
 block discarded – undo
8673 8673
 		$date_array = array();
8674 8674
 		$temp_array = array();
8675 8675
         
8676
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8676
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8677 8677
 		{
8678 8678
 			$temp_array['date_name'] = $row['date_name'];
8679 8679
 			$temp_array['date_count'] = $row['date_count'];
@@ -8720,7 +8720,7 @@  discard block
 block discarded – undo
8720 8720
 		$date_array = array();
8721 8721
 		$temp_array = array();
8722 8722
         
8723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8724 8724
 		{
8725 8725
 			$temp_array['month_name'] = $row['month_name'];
8726 8726
 			$temp_array['year_name'] = $row['year_name'];
@@ -8741,7 +8741,7 @@  discard block
 block discarded – undo
8741 8741
 	public function countAllMonthsByAirlines($filters = array())
8742 8742
 	{
8743 8743
 		global $globalTimezone, $globalDBdriver;
8744
-		$filter_query = $this->getFilter($filters,true,true);
8744
+		$filter_query = $this->getFilter($filters, true, true);
8745 8745
 		if ($globalTimezone != '') {
8746 8746
 			date_default_timezone_set($globalTimezone);
8747 8747
 			$datetime = new DateTime();
@@ -8749,12 +8749,12 @@  discard block
 block discarded – undo
8749 8749
 		} else $offset = '+00:00';
8750 8750
 
8751 8751
 		if ($globalDBdriver == 'mysql') {
8752
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8752
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8753 8753
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8754 8754
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8755 8755
 								ORDER BY date_count DESC";
8756 8756
 		} else {
8757
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8757
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8758 8758
 								FROM spotter_output 
8759 8759
 								WHERE spotter_output.airline_icao <> '' 
8760 8760
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8768,7 +8768,7 @@  discard block
 block discarded – undo
8768 8768
 		$date_array = array();
8769 8769
 		$temp_array = array();
8770 8770
         
8771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8772 8772
 		{
8773 8773
 			$temp_array['month_name'] = $row['month_name'];
8774 8774
 			$temp_array['year_name'] = $row['year_name'];
@@ -8795,14 +8795,14 @@  discard block
 block discarded – undo
8795 8795
 			$datetime = new DateTime();
8796 8796
 			$offset = $datetime->format('P');
8797 8797
 		} else $offset = '+00:00';
8798
-		$filter_query = $this->getFilter($filters,true,true);
8798
+		$filter_query = $this->getFilter($filters, true, true);
8799 8799
 		if ($globalDBdriver == 'mysql') {
8800
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8800
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8801 8801
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8802 8802
 								GROUP BY year_name, month_name 
8803 8803
 								ORDER BY date_count DESC";
8804 8804
 		} else {
8805
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8805
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8806 8806
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8807 8807
 								GROUP BY year_name, month_name 
8808 8808
 								ORDER BY date_count DESC";
@@ -8814,7 +8814,7 @@  discard block
 block discarded – undo
8814 8814
 		$date_array = array();
8815 8815
 		$temp_array = array();
8816 8816
         
8817
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8817
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8818 8818
 		{
8819 8819
 			$temp_array['month_name'] = $row['month_name'];
8820 8820
 			$temp_array['year_name'] = $row['year_name'];
@@ -8840,15 +8840,15 @@  discard block
 block discarded – undo
8840 8840
 			$datetime = new DateTime();
8841 8841
 			$offset = $datetime->format('P');
8842 8842
 		} else $offset = '+00:00';
8843
-		$filter_query = $this->getFilter($filters,true,true);
8843
+		$filter_query = $this->getFilter($filters, true, true);
8844 8844
 
8845 8845
 		if ($globalDBdriver == 'mysql') {
8846
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8846
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8847 8847
 								FROM spotter_output".$filter_query." owner_name <> ''
8848 8848
 								GROUP BY year_name, month_name
8849 8849
 								ORDER BY date_count DESC";
8850 8850
 		} else {
8851
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8851
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8852 8852
 								FROM spotter_output".$filter_query." owner_name <> ''
8853 8853
 								GROUP BY year_name, month_name
8854 8854
 								ORDER BY date_count DESC";
@@ -8860,7 +8860,7 @@  discard block
 block discarded – undo
8860 8860
 		$date_array = array();
8861 8861
 		$temp_array = array();
8862 8862
         
8863
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8863
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8864 8864
 		{
8865 8865
 			$temp_array['month_name'] = $row['month_name'];
8866 8866
 			$temp_array['year_name'] = $row['year_name'];
@@ -8881,7 +8881,7 @@  discard block
 block discarded – undo
8881 8881
 	public function countAllMonthsOwnersByAirlines($filters = array())
8882 8882
 	{
8883 8883
 		global $globalTimezone, $globalDBdriver;
8884
-		$filter_query = $this->getFilter($filters,true,true);
8884
+		$filter_query = $this->getFilter($filters, true, true);
8885 8885
 		if ($globalTimezone != '') {
8886 8886
 			date_default_timezone_set($globalTimezone);
8887 8887
 			$datetime = new DateTime();
@@ -8889,12 +8889,12 @@  discard block
 block discarded – undo
8889 8889
 		} else $offset = '+00:00';
8890 8890
 
8891 8891
 		if ($globalDBdriver == 'mysql') {
8892
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8892
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8893 8893
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8894 8894
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8895 8895
 								ORDER BY date_count DESC";
8896 8896
 		} else {
8897
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8897
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8898 8898
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8899 8899
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8900 8900
 								ORDER BY date_count DESC";
@@ -8906,7 +8906,7 @@  discard block
 block discarded – undo
8906 8906
 		$date_array = array();
8907 8907
 		$temp_array = array();
8908 8908
         
8909
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8909
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8910 8910
 		{
8911 8911
 			$temp_array['month_name'] = $row['month_name'];
8912 8912
 			$temp_array['year_name'] = $row['year_name'];
@@ -8933,15 +8933,15 @@  discard block
 block discarded – undo
8933 8933
 			$datetime = new DateTime();
8934 8934
 			$offset = $datetime->format('P');
8935 8935
 		} else $offset = '+00:00';
8936
-		$filter_query = $this->getFilter($filters,true,true);
8936
+		$filter_query = $this->getFilter($filters, true, true);
8937 8937
 
8938 8938
 		if ($globalDBdriver == 'mysql') {
8939
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8939
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8940 8940
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8941 8941
 								GROUP BY year_name, month_name
8942 8942
 								ORDER BY date_count DESC";
8943 8943
 		} else {
8944
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8944
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8945 8945
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8946 8946
 								GROUP BY year_name, month_name
8947 8947
 								ORDER BY date_count DESC";
@@ -8953,7 +8953,7 @@  discard block
 block discarded – undo
8953 8953
 		$date_array = array();
8954 8954
 		$temp_array = array();
8955 8955
         
8956
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8956
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8957 8957
 		{
8958 8958
 			$temp_array['month_name'] = $row['month_name'];
8959 8959
 			$temp_array['year_name'] = $row['year_name'];
@@ -8974,7 +8974,7 @@  discard block
 block discarded – undo
8974 8974
 	public function countAllMonthsPilotsByAirlines($filters = array())
8975 8975
 	{
8976 8976
 		global $globalTimezone, $globalDBdriver;
8977
-		$filter_query = $this->getFilter($filters,true,true);
8977
+		$filter_query = $this->getFilter($filters, true, true);
8978 8978
 		if ($globalTimezone != '') {
8979 8979
 			date_default_timezone_set($globalTimezone);
8980 8980
 			$datetime = new DateTime();
@@ -8982,12 +8982,12 @@  discard block
 block discarded – undo
8982 8982
 		} else $offset = '+00:00';
8983 8983
 
8984 8984
 		if ($globalDBdriver == 'mysql') {
8985
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8985
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8986 8986
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8987 8987
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8988 8988
 								ORDER BY date_count DESC";
8989 8989
 		} else {
8990
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8990
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8991 8991
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8992 8992
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8993 8993
 								ORDER BY date_count DESC";
@@ -8999,7 +8999,7 @@  discard block
 block discarded – undo
8999 8999
 		$date_array = array();
9000 9000
 		$temp_array = array();
9001 9001
         
9002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9003 9003
 		{
9004 9004
 			$temp_array['month_name'] = $row['month_name'];
9005 9005
 			$temp_array['year_name'] = $row['year_name'];
@@ -9021,7 +9021,7 @@  discard block
 block discarded – undo
9021 9021
 	public function countAllMonthsAirlines($filters = array())
9022 9022
 	{
9023 9023
 		global $globalTimezone, $globalDBdriver;
9024
-		$filter_query = $this->getFilter($filters,true,true);
9024
+		$filter_query = $this->getFilter($filters, true, true);
9025 9025
 		if ($globalTimezone != '') {
9026 9026
 			date_default_timezone_set($globalTimezone);
9027 9027
 			$datetime = new DateTime();
@@ -9029,12 +9029,12 @@  discard block
 block discarded – undo
9029 9029
 		} else $offset = '+00:00';
9030 9030
 
9031 9031
 		if ($globalDBdriver == 'mysql') {
9032
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9032
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9033 9033
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9034 9034
 								GROUP BY year_name, month_name
9035 9035
 								ORDER BY date_count DESC";
9036 9036
 		} else {
9037
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9037
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9038 9038
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9039 9039
 								GROUP BY year_name, month_name
9040 9040
 								ORDER BY date_count DESC";
@@ -9046,7 +9046,7 @@  discard block
 block discarded – undo
9046 9046
 		$date_array = array();
9047 9047
 		$temp_array = array();
9048 9048
         
9049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9050 9050
 		{
9051 9051
 			$temp_array['month_name'] = $row['month_name'];
9052 9052
 			$temp_array['year_name'] = $row['year_name'];
@@ -9072,15 +9072,15 @@  discard block
 block discarded – undo
9072 9072
 			$datetime = new DateTime();
9073 9073
 			$offset = $datetime->format('P');
9074 9074
 		} else $offset = '+00:00';
9075
-		$filter_query = $this->getFilter($filters,true,true);
9075
+		$filter_query = $this->getFilter($filters, true, true);
9076 9076
 
9077 9077
 		if ($globalDBdriver == 'mysql') {
9078
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9078
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9079 9079
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9080 9080
 								GROUP BY year_name, month_name
9081 9081
 								ORDER BY date_count DESC";
9082 9082
 		} else {
9083
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9083
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9084 9084
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9085 9085
 								GROUP BY year_name, month_name
9086 9086
 								ORDER BY date_count DESC";
@@ -9092,7 +9092,7 @@  discard block
 block discarded – undo
9092 9092
 		$date_array = array();
9093 9093
 		$temp_array = array();
9094 9094
         
9095
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9095
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9096 9096
 		{
9097 9097
 			$temp_array['month_name'] = $row['month_name'];
9098 9098
 			$temp_array['year_name'] = $row['year_name'];
@@ -9114,7 +9114,7 @@  discard block
 block discarded – undo
9114 9114
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9115 9115
 	{
9116 9116
 		global $globalTimezone, $globalDBdriver;
9117
-		$filter_query = $this->getFilter($filters,true,true);
9117
+		$filter_query = $this->getFilter($filters, true, true);
9118 9118
 		if ($globalTimezone != '') {
9119 9119
 			date_default_timezone_set($globalTimezone);
9120 9120
 			$datetime = new DateTime();
@@ -9122,12 +9122,12 @@  discard block
 block discarded – undo
9122 9122
 		} else $offset = '+00:00';
9123 9123
 
9124 9124
 		if ($globalDBdriver == 'mysql') {
9125
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9125
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9126 9126
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9127 9127
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9128 9128
 								ORDER BY date_count DESC";
9129 9129
 		} else {
9130
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9130
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9131 9131
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
9132 9132
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9133 9133
 								ORDER BY date_count DESC";
@@ -9139,7 +9139,7 @@  discard block
 block discarded – undo
9139 9139
 		$date_array = array();
9140 9140
 		$temp_array = array();
9141 9141
         
9142
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9142
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9143 9143
 		{
9144 9144
 			$temp_array['month_name'] = $row['month_name'];
9145 9145
 			$temp_array['year_name'] = $row['year_name'];
@@ -9166,15 +9166,15 @@  discard block
 block discarded – undo
9166 9166
 			$datetime = new DateTime();
9167 9167
 			$offset = $datetime->format('P');
9168 9168
 		} else $offset = '+00:00';
9169
-		$filter_query = $this->getFilter($filters,true,true);
9169
+		$filter_query = $this->getFilter($filters, true, true);
9170 9170
 
9171 9171
 		if ($globalDBdriver == 'mysql') {
9172
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9172
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9173 9173
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9174 9174
 								GROUP BY year_name, month_name
9175 9175
 								ORDER BY date_count DESC";
9176 9176
 		} else {
9177
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9177
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9178 9178
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9179 9179
 								GROUP BY year_name, month_name
9180 9180
 								ORDER BY date_count DESC";
@@ -9186,7 +9186,7 @@  discard block
 block discarded – undo
9186 9186
 		$date_array = array();
9187 9187
 		$temp_array = array();
9188 9188
         
9189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9190 9190
 		{
9191 9191
 			$temp_array['month_name'] = $row['month_name'];
9192 9192
 			$temp_array['year_name'] = $row['year_name'];
@@ -9208,7 +9208,7 @@  discard block
 block discarded – undo
9208 9208
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9209 9209
 	{
9210 9210
 		global $globalTimezone, $globalDBdriver;
9211
-		$filter_query = $this->getFilter($filters,true,true);
9211
+		$filter_query = $this->getFilter($filters, true, true);
9212 9212
 		if ($globalTimezone != '') {
9213 9213
 			date_default_timezone_set($globalTimezone);
9214 9214
 			$datetime = new DateTime();
@@ -9216,12 +9216,12 @@  discard block
 block discarded – undo
9216 9216
 		} else $offset = '+00:00';
9217 9217
 
9218 9218
 		if ($globalDBdriver == 'mysql') {
9219
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9219
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9220 9220
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9221 9221
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9222 9222
 								ORDER BY date_count DESC";
9223 9223
 		} else {
9224
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9224
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9225 9225
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9226 9226
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9227 9227
 								ORDER BY date_count DESC";
@@ -9233,7 +9233,7 @@  discard block
 block discarded – undo
9233 9233
 		$date_array = array();
9234 9234
 		$temp_array = array();
9235 9235
         
9236
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9236
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9237 9237
 		{
9238 9238
 			$temp_array['month_name'] = $row['month_name'];
9239 9239
 			$temp_array['year_name'] = $row['year_name'];
@@ -9261,7 +9261,7 @@  discard block
 block discarded – undo
9261 9261
 			$datetime = new DateTime();
9262 9262
 			$offset = $datetime->format('P');
9263 9263
 		} else $offset = '+00:00';
9264
-		$filter_query = $this->getFilter($filters,true,true);
9264
+		$filter_query = $this->getFilter($filters, true, true);
9265 9265
 		if ($globalDBdriver == 'mysql') {
9266 9266
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
9267 9267
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -9282,7 +9282,7 @@  discard block
 block discarded – undo
9282 9282
 		$date_array = array();
9283 9283
 		$temp_array = array();
9284 9284
         
9285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9286 9286
 		{
9287 9287
 			$temp_array['year_name'] = $row['year_name'];
9288 9288
 			$temp_array['month_name'] = $row['month_name'];
@@ -9302,7 +9302,7 @@  discard block
 block discarded – undo
9302 9302
 	* @return Array the hour list
9303 9303
 	*
9304 9304
 	*/
9305
-	public function countAllHours($orderby,$filters = array())
9305
+	public function countAllHours($orderby, $filters = array())
9306 9306
 	{
9307 9307
 		global $globalTimezone, $globalDBdriver;
9308 9308
 		if ($globalTimezone != '') {
@@ -9350,7 +9350,7 @@  discard block
 block discarded – undo
9350 9350
 		$hour_array = array();
9351 9351
 		$temp_array = array();
9352 9352
         
9353
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9353
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9354 9354
 		{
9355 9355
 			$temp_array['hour_name'] = $row['hour_name'];
9356 9356
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9370,7 +9370,7 @@  discard block
 block discarded – undo
9370 9370
 	public function countAllHoursByAirlines($orderby, $filters = array())
9371 9371
 	{
9372 9372
 		global $globalTimezone, $globalDBdriver;
9373
-		$filter_query = $this->getFilter($filters,true,true);
9373
+		$filter_query = $this->getFilter($filters, true, true);
9374 9374
 		if ($globalTimezone != '') {
9375 9375
 			date_default_timezone_set($globalTimezone);
9376 9376
 			$datetime = new DateTime();
@@ -9388,7 +9388,7 @@  discard block
 block discarded – undo
9388 9388
 		}
9389 9389
 		
9390 9390
 		if ($globalDBdriver == 'mysql') {
9391
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9391
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9392 9392
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9393 9393
 								GROUP BY spotter_output.airline_icao, hour_name 
9394 9394
 								".$orderby_sql;
@@ -9401,7 +9401,7 @@  discard block
 block discarded – undo
9401 9401
   */    
9402 9402
 		$query_data = array(':offset' => $offset);
9403 9403
 		} else {
9404
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9404
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9405 9405
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9406 9406
 								GROUP BY spotter_output.airline_icao, hour_name 
9407 9407
 								".$orderby_sql;
@@ -9414,7 +9414,7 @@  discard block
 block discarded – undo
9414 9414
 		$hour_array = array();
9415 9415
 		$temp_array = array();
9416 9416
         
9417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9418 9418
 		{
9419 9419
 			$temp_array['hour_name'] = $row['hour_name'];
9420 9420
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9437,34 +9437,34 @@  discard block
 block discarded – undo
9437 9437
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9438 9438
 	{
9439 9439
 		global $globalTimezone, $globalDBdriver;
9440
-		$filter_query = $this->getFilter($filters,true,true);
9440
+		$filter_query = $this->getFilter($filters, true, true);
9441 9441
 		if ($globalTimezone != '') {
9442 9442
 			date_default_timezone_set($globalTimezone);
9443 9443
 			$datetime = new DateTime();
9444 9444
 			$offset = $datetime->format('P');
9445 9445
 		} else $offset = '+00:00';
9446 9446
 
9447
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9447
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
9448 9448
 
9449 9449
 		if ($globalDBdriver == 'mysql') {
9450
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9450
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9451 9451
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9452 9452
 								GROUP BY hour_name 
9453 9453
 								ORDER BY hour_name ASC";
9454 9454
 		} else {
9455
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9455
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9456 9456
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9457 9457
 								GROUP BY hour_name 
9458 9458
 								ORDER BY hour_name ASC";
9459 9459
 		}
9460 9460
 		
9461 9461
 		$sth = $this->db->prepare($query);
9462
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
9462
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
9463 9463
       
9464 9464
 		$hour_array = array();
9465 9465
 		$temp_array = array();
9466 9466
         
9467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9468 9468
 		{
9469 9469
 			$temp_array['hour_name'] = $row['hour_name'];
9470 9470
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9487,8 +9487,8 @@  discard block
 block discarded – undo
9487 9487
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
9488 9488
 	{
9489 9489
 		global $globalTimezone, $globalDBdriver;
9490
-		$filter_query = $this->getFilter($filters,true,true);
9491
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
9490
+		$filter_query = $this->getFilter($filters, true, true);
9491
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
9492 9492
 		if ($globalTimezone != '') {
9493 9493
 			date_default_timezone_set($globalTimezone);
9494 9494
 			$datetime = new DateTime();
@@ -9496,24 +9496,24 @@  discard block
 block discarded – undo
9496 9496
 		} else $offset = '+00:00';
9497 9497
 
9498 9498
 		if ($globalDBdriver == 'mysql') {
9499
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9499
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9500 9500
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
9501 9501
 								GROUP BY hour_name 
9502 9502
 								ORDER BY hour_name ASC";
9503 9503
 		} else {
9504
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9504
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9505 9505
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
9506 9506
 								GROUP BY hour_name 
9507 9507
 								ORDER BY hour_name ASC";
9508 9508
 		}
9509 9509
 		
9510 9510
 		$sth = $this->db->prepare($query);
9511
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
9511
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
9512 9512
       
9513 9513
 		$hour_array = array();
9514 9514
 		$temp_array = array();
9515 9515
         
9516
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9516
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9517 9517
 		{
9518 9518
 			$temp_array['hour_name'] = $row['hour_name'];
9519 9519
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9534,8 +9534,8 @@  discard block
 block discarded – undo
9534 9534
 	public function countAllHoursByRegistration($registration, $filters = array())
9535 9535
 	{
9536 9536
 		global $globalTimezone, $globalDBdriver;
9537
-		$filter_query = $this->getFilter($filters,true,true);
9538
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9537
+		$filter_query = $this->getFilter($filters, true, true);
9538
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9539 9539
 		if ($globalTimezone != '') {
9540 9540
 			date_default_timezone_set($globalTimezone);
9541 9541
 			$datetime = new DateTime();
@@ -9543,24 +9543,24 @@  discard block
 block discarded – undo
9543 9543
 		} else $offset = '+00:00';
9544 9544
 
9545 9545
 		if ($globalDBdriver == 'mysql') {
9546
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9546
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9547 9547
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9548 9548
 								GROUP BY hour_name 
9549 9549
 								ORDER BY hour_name ASC";
9550 9550
 		} else {
9551
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9551
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9552 9552
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9553 9553
 								GROUP BY hour_name 
9554 9554
 								ORDER BY hour_name ASC";
9555 9555
 		}
9556 9556
 		
9557 9557
 		$sth = $this->db->prepare($query);
9558
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
9558
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
9559 9559
       
9560 9560
 		$hour_array = array();
9561 9561
 		$temp_array = array();
9562 9562
         
9563
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9563
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9564 9564
 		{
9565 9565
 			$temp_array['hour_name'] = $row['hour_name'];
9566 9566
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9581,8 +9581,8 @@  discard block
 block discarded – undo
9581 9581
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9582 9582
 	{
9583 9583
 		global $globalTimezone, $globalDBdriver;
9584
-		$filter_query = $this->getFilter($filters,true,true);
9585
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
9584
+		$filter_query = $this->getFilter($filters, true, true);
9585
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
9586 9586
 		if ($globalTimezone != '') {
9587 9587
 			date_default_timezone_set($globalTimezone);
9588 9588
 			$datetime = new DateTime();
@@ -9590,24 +9590,24 @@  discard block
 block discarded – undo
9590 9590
 		} else $offset = '+00:00';
9591 9591
 
9592 9592
 		if ($globalDBdriver == 'mysql') {
9593
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9593
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9594 9594
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9595 9595
 								GROUP BY hour_name 
9596 9596
 								ORDER BY hour_name ASC";
9597 9597
 		} else {
9598
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9598
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9599 9599
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9600 9600
 								GROUP BY hour_name 
9601 9601
 								ORDER BY hour_name ASC";
9602 9602
 		}
9603 9603
 		
9604 9604
 		$sth = $this->db->prepare($query);
9605
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
9605
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
9606 9606
       
9607 9607
 		$hour_array = array();
9608 9608
 		$temp_array = array();
9609 9609
         
9610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9611 9611
 		{
9612 9612
 			$temp_array['hour_name'] = $row['hour_name'];
9613 9613
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9626,11 +9626,11 @@  discard block
 block discarded – undo
9626 9626
 	* @return Array the hour list
9627 9627
 	*
9628 9628
 	*/
9629
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9629
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
9630 9630
 	{
9631 9631
 		global $globalTimezone, $globalDBdriver;
9632
-		$filter_query = $this->getFilter($filters,true,true);
9633
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9632
+		$filter_query = $this->getFilter($filters, true, true);
9633
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9634 9634
 		if ($globalTimezone != '') {
9635 9635
 			date_default_timezone_set($globalTimezone);
9636 9636
 			$datetime = new DateTime();
@@ -9638,24 +9638,24 @@  discard block
 block discarded – undo
9638 9638
 		} else $offset = '+00:00';
9639 9639
 
9640 9640
 		if ($globalDBdriver == 'mysql') {
9641
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9641
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9642 9642
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9643 9643
 								GROUP BY hour_name 
9644 9644
 								ORDER BY hour_name ASC";
9645 9645
 		} else {
9646
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9646
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9647 9647
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9648 9648
 								GROUP BY hour_name 
9649 9649
 								ORDER BY hour_name ASC";
9650 9650
 		}
9651 9651
 		
9652 9652
 		$sth = $this->db->prepare($query);
9653
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9653
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9654 9654
       
9655 9655
 		$hour_array = array();
9656 9656
 		$temp_array = array();
9657 9657
         
9658
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9658
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9659 9659
 		{
9660 9660
 			$temp_array['hour_name'] = $row['hour_name'];
9661 9661
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9677,8 +9677,8 @@  discard block
 block discarded – undo
9677 9677
 	public function countAllHoursByDate($date, $filters = array())
9678 9678
 	{
9679 9679
 		global $globalTimezone, $globalDBdriver;
9680
-		$filter_query = $this->getFilter($filters,true,true);
9681
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9680
+		$filter_query = $this->getFilter($filters, true, true);
9681
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9682 9682
 		if ($globalTimezone != '') {
9683 9683
 			date_default_timezone_set($globalTimezone);
9684 9684
 			$datetime = new DateTime($date);
@@ -9686,12 +9686,12 @@  discard block
 block discarded – undo
9686 9686
 		} else $offset = '+00:00';
9687 9687
 
9688 9688
 		if ($globalDBdriver == 'mysql') {
9689
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9689
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9690 9690
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9691 9691
 								GROUP BY hour_name 
9692 9692
 								ORDER BY hour_name ASC";
9693 9693
 		} else {
9694
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9694
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9695 9695
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9696 9696
 								GROUP BY hour_name 
9697 9697
 								ORDER BY hour_name ASC";
@@ -9703,7 +9703,7 @@  discard block
 block discarded – undo
9703 9703
 		$hour_array = array();
9704 9704
 		$temp_array = array();
9705 9705
         
9706
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9706
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9707 9707
 		{
9708 9708
 			$temp_array['hour_name'] = $row['hour_name'];
9709 9709
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9725,8 +9725,8 @@  discard block
 block discarded – undo
9725 9725
 	public function countAllHoursByIdent($ident, $filters = array())
9726 9726
 	{
9727 9727
 		global $globalTimezone, $globalDBdriver;
9728
-		$filter_query = $this->getFilter($filters,true,true);
9729
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9728
+		$filter_query = $this->getFilter($filters, true, true);
9729
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9730 9730
 		if ($globalTimezone != '') {
9731 9731
 			date_default_timezone_set($globalTimezone);
9732 9732
 			$datetime = new DateTime();
@@ -9734,12 +9734,12 @@  discard block
 block discarded – undo
9734 9734
 		} else $offset = '+00:00';
9735 9735
 
9736 9736
 		if ($globalDBdriver == 'mysql') {
9737
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9737
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9738 9738
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9739 9739
 								GROUP BY hour_name 
9740 9740
 								ORDER BY hour_name ASC";
9741 9741
 		} else {
9742
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9742
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9743 9743
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9744 9744
 								GROUP BY hour_name 
9745 9745
 								ORDER BY hour_name ASC";
@@ -9747,12 +9747,12 @@  discard block
 block discarded – undo
9747 9747
       
9748 9748
 		
9749 9749
 		$sth = $this->db->prepare($query);
9750
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9750
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9751 9751
       
9752 9752
 		$hour_array = array();
9753 9753
 		$temp_array = array();
9754 9754
         
9755
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9755
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9756 9756
 		{
9757 9757
 			$temp_array['hour_name'] = $row['hour_name'];
9758 9758
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9771,12 +9771,12 @@  discard block
 block discarded – undo
9771 9771
 	* @return Array the hour list
9772 9772
 	*
9773 9773
 	*/
9774
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9774
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9775 9775
 	{
9776 9776
 		global $globalTimezone, $globalDBdriver;
9777
-		$filter_query = $this->getFilter($filters,true,true);
9778
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9779
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9777
+		$filter_query = $this->getFilter($filters, true, true);
9778
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9779
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9780 9780
 		if ($globalTimezone != '') {
9781 9781
 			date_default_timezone_set($globalTimezone);
9782 9782
 			$datetime = new DateTime();
@@ -9784,24 +9784,24 @@  discard block
 block discarded – undo
9784 9784
 		} else $offset = '+00:00';
9785 9785
 
9786 9786
 		if ($globalDBdriver == 'mysql') {
9787
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9787
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9788 9788
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9789 9789
 								GROUP BY hour_name 
9790 9790
 								ORDER BY hour_name ASC";
9791 9791
 		} else {
9792
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9792
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9793 9793
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9794 9794
 								GROUP BY hour_name 
9795 9795
 								ORDER BY hour_name ASC";
9796 9796
 		}
9797 9797
 		
9798 9798
 		$sth = $this->db->prepare($query);
9799
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9799
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9800 9800
       
9801 9801
 		$hour_array = array();
9802 9802
 		$temp_array = array();
9803 9803
         
9804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9805 9805
 		{
9806 9806
 			$temp_array['hour_name'] = $row['hour_name'];
9807 9807
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9822,8 +9822,8 @@  discard block
 block discarded – undo
9822 9822
 	public function countAllHoursByCountry($country, $filters = array())
9823 9823
 	{
9824 9824
 		global $globalTimezone, $globalDBdriver;
9825
-		$filter_query = $this->getFilter($filters,true,true);
9826
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9825
+		$filter_query = $this->getFilter($filters, true, true);
9826
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9827 9827
 		if ($globalTimezone != '') {
9828 9828
 			date_default_timezone_set($globalTimezone);
9829 9829
 			$datetime = new DateTime();
@@ -9831,24 +9831,24 @@  discard block
 block discarded – undo
9831 9831
 		} else $offset = '+00:00';
9832 9832
 
9833 9833
 		if ($globalDBdriver == 'mysql') {
9834
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9834
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9835 9835
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9836 9836
 								GROUP BY hour_name 
9837 9837
 								ORDER BY hour_name ASC";
9838 9838
 		} else {
9839
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9839
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9840 9840
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9841 9841
 								GROUP BY hour_name 
9842 9842
 								ORDER BY hour_name ASC";
9843 9843
 		}
9844 9844
 		
9845 9845
 		$sth = $this->db->prepare($query);
9846
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9846
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9847 9847
       
9848 9848
 		$hour_array = array();
9849 9849
 		$temp_array = array();
9850 9850
         
9851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9852 9852
 		{
9853 9853
 			$temp_array['hour_name'] = $row['hour_name'];
9854 9854
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9868,29 +9868,29 @@  discard block
 block discarded – undo
9868 9868
 	* @return Integer the number of aircrafts
9869 9869
 	*
9870 9870
 	*/
9871
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
9871
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
9872 9872
 	{
9873 9873
 		global $globalDBdriver;
9874
-		$filter_query = $this->getFilter($filters,true,true);
9875
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9874
+		$filter_query = $this->getFilter($filters, true, true);
9875
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9876 9876
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9877 9877
 		$query_values = array();
9878 9878
 		if ($year != '') {
9879 9879
 			if ($globalDBdriver == 'mysql') {
9880 9880
 				$query .= " AND YEAR(spotter_output.date) = :year";
9881
-				$query_values = array_merge($query_values,array(':year' => $year));
9881
+				$query_values = array_merge($query_values, array(':year' => $year));
9882 9882
 			} else {
9883 9883
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9884
-				$query_values = array_merge($query_values,array(':year' => $year));
9884
+				$query_values = array_merge($query_values, array(':year' => $year));
9885 9885
 			}
9886 9886
 		}
9887 9887
 		if ($month != '') {
9888 9888
 			if ($globalDBdriver == 'mysql') {
9889 9889
 				$query .= " AND MONTH(spotter_output.date) = :month";
9890
-				$query_values = array_merge($query_values,array(':month' => $month));
9890
+				$query_values = array_merge($query_values, array(':month' => $month));
9891 9891
 			} else {
9892 9892
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9893
-				$query_values = array_merge($query_values,array(':month' => $month));
9893
+				$query_values = array_merge($query_values, array(':month' => $month));
9894 9894
 			}
9895 9895
 		}
9896 9896
 
@@ -9905,29 +9905,29 @@  discard block
 block discarded – undo
9905 9905
 	* @return Integer the number of aircrafts
9906 9906
 	*
9907 9907
 	*/
9908
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
9908
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
9909 9909
 	{
9910 9910
 		global $globalDBdriver;
9911
-		$filter_query = $this->getFilter($filters,true,true);
9912
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9911
+		$filter_query = $this->getFilter($filters, true, true);
9912
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9913 9913
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9914 9914
 		$query_values = array();
9915 9915
 		if ($year != '') {
9916 9916
 			if ($globalDBdriver == 'mysql') {
9917 9917
 				$query .= " AND YEAR(spotter_output.date) = :year";
9918
-				$query_values = array_merge($query_values,array(':year' => $year));
9918
+				$query_values = array_merge($query_values, array(':year' => $year));
9919 9919
 			} else {
9920 9920
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9921
-				$query_values = array_merge($query_values,array(':year' => $year));
9921
+				$query_values = array_merge($query_values, array(':year' => $year));
9922 9922
 			}
9923 9923
 		}
9924 9924
 		if ($month != '') {
9925 9925
 			if ($globalDBdriver == 'mysql') {
9926 9926
 				$query .= " AND MONTH(spotter_output.date) = :month";
9927
-				$query_values = array_merge($query_values,array(':month' => $month));
9927
+				$query_values = array_merge($query_values, array(':month' => $month));
9928 9928
 			} else {
9929 9929
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9930
-				$query_values = array_merge($query_values,array(':month' => $month));
9930
+				$query_values = array_merge($query_values, array(':month' => $month));
9931 9931
 			}
9932 9932
 		}
9933 9933
 		
@@ -9942,29 +9942,29 @@  discard block
 block discarded – undo
9942 9942
 	* @return Integer the number of pilots
9943 9943
 	*
9944 9944
 	*/
9945
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
9945
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
9946 9946
 	{
9947 9947
 		global $globalDBdriver;
9948
-		$filter_query = $this->getFilter($filters,true,true);
9949
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9948
+		$filter_query = $this->getFilter($filters, true, true);
9949
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9950 9950
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9951 9951
 		$query_values = array();
9952 9952
 		if ($year != '') {
9953 9953
 			if ($globalDBdriver == 'mysql') {
9954 9954
 				$query .= " AND YEAR(spotter_output.date) = :year";
9955
-				$query_values = array_merge($query_values,array(':year' => $year));
9955
+				$query_values = array_merge($query_values, array(':year' => $year));
9956 9956
 			} else {
9957 9957
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9958
-				$query_values = array_merge($query_values,array(':year' => $year));
9958
+				$query_values = array_merge($query_values, array(':year' => $year));
9959 9959
 			}
9960 9960
 		}
9961 9961
 		if ($month != '') {
9962 9962
 			if ($globalDBdriver == 'mysql') {
9963 9963
 				$query .= " AND MONTH(spotter_output.date) = :month";
9964
-				$query_values = array_merge($query_values,array(':month' => $month));
9964
+				$query_values = array_merge($query_values, array(':month' => $month));
9965 9965
 			} else {
9966 9966
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9967
-				$query_values = array_merge($query_values,array(':month' => $month));
9967
+				$query_values = array_merge($query_values, array(':month' => $month));
9968 9968
 			}
9969 9969
 		}
9970 9970
 		$sth = $this->db->prepare($query);
@@ -9978,29 +9978,29 @@  discard block
 block discarded – undo
9978 9978
 	* @return Integer the number of owners
9979 9979
 	*
9980 9980
 	*/
9981
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
9981
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
9982 9982
 	{
9983 9983
 		global $globalDBdriver;
9984
-		$filter_query = $this->getFilter($filters,true,true);
9985
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9984
+		$filter_query = $this->getFilter($filters, true, true);
9985
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9986 9986
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9987 9987
 		$query_values = array();
9988 9988
 		if ($year != '') {
9989 9989
 			if ($globalDBdriver == 'mysql') {
9990 9990
 				$query .= " AND YEAR(spotter_output.date) = :year";
9991
-				$query_values = array_merge($query_values,array(':year' => $year));
9991
+				$query_values = array_merge($query_values, array(':year' => $year));
9992 9992
 			} else {
9993 9993
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9994
-				$query_values = array_merge($query_values,array(':year' => $year));
9994
+				$query_values = array_merge($query_values, array(':year' => $year));
9995 9995
 			}
9996 9996
 		}
9997 9997
 		if ($month != '') {
9998 9998
 			if ($globalDBdriver == 'mysql') {
9999 9999
 				$query .= " AND MONTH(spotter_output.date) = :month";
10000
-				$query_values = array_merge($query_values,array(':month' => $month));
10000
+				$query_values = array_merge($query_values, array(':month' => $month));
10001 10001
 			} else {
10002 10002
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10003
-				$query_values = array_merge($query_values,array(':month' => $month));
10003
+				$query_values = array_merge($query_values, array(':month' => $month));
10004 10004
 			}
10005 10005
 		}
10006 10006
 		$sth = $this->db->prepare($query);
@@ -10015,32 +10015,32 @@  discard block
 block discarded – undo
10015 10015
 	* @return Integer the number of flights
10016 10016
 	*
10017 10017
 	*/
10018
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10018
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10019 10019
 	{
10020 10020
 		global $globalDBdriver;
10021
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10021
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10022 10022
 		$query_values = array();
10023 10023
 		$query = '';
10024 10024
 		if ($year != '') {
10025 10025
 			if ($globalDBdriver == 'mysql') {
10026 10026
 				$query .= " AND YEAR(spotter_output.date) = :year";
10027
-				$query_values = array_merge($query_values,array(':year' => $year));
10027
+				$query_values = array_merge($query_values, array(':year' => $year));
10028 10028
 			} else {
10029 10029
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10030
-				$query_values = array_merge($query_values,array(':year' => $year));
10030
+				$query_values = array_merge($query_values, array(':year' => $year));
10031 10031
 			}
10032 10032
 		}
10033 10033
 		if ($month != '') {
10034 10034
 			if ($globalDBdriver == 'mysql') {
10035 10035
 				$query .= " AND MONTH(spotter_output.date) = :month";
10036
-				$query_values = array_merge($query_values,array(':month' => $month));
10036
+				$query_values = array_merge($query_values, array(':month' => $month));
10037 10037
 			} else {
10038 10038
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10039
-				$query_values = array_merge($query_values,array(':month' => $month));
10039
+				$query_values = array_merge($query_values, array(':month' => $month));
10040 10040
 			}
10041 10041
 		}
10042 10042
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10043
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10043
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10044 10044
 		
10045 10045
 		//echo $query;
10046 10046
 		$sth = $this->db->prepare($queryi);
@@ -10054,29 +10054,29 @@  discard block
 block discarded – undo
10054 10054
 	* @return Integer the number of flights
10055 10055
 	*
10056 10056
 	*/
10057
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10057
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
10058 10058
 	{
10059 10059
 		global $globalDBdriver;
10060
-		$filter_query = $this->getFilter($filters,true,true);
10061
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10060
+		$filter_query = $this->getFilter($filters, true, true);
10061
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10062 10062
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
10063 10063
 		$query_values = array();
10064 10064
 		if ($year != '') {
10065 10065
 			if ($globalDBdriver == 'mysql') {
10066 10066
 				$query .= " AND YEAR(spotter_output.date) = :year";
10067
-				$query_values = array_merge($query_values,array(':year' => $year));
10067
+				$query_values = array_merge($query_values, array(':year' => $year));
10068 10068
 			} else {
10069 10069
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10070
-				$query_values = array_merge($query_values,array(':year' => $year));
10070
+				$query_values = array_merge($query_values, array(':year' => $year));
10071 10071
 			}
10072 10072
 		}
10073 10073
 		if ($month != '') {
10074 10074
 			if ($globalDBdriver == 'mysql') {
10075 10075
 				$query .= " AND MONTH(spotter_output.date) = :month";
10076
-				$query_values = array_merge($query_values,array(':month' => $month));
10076
+				$query_values = array_merge($query_values, array(':month' => $month));
10077 10077
 			} else {
10078 10078
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10079
-				$query_values = array_merge($query_values,array(':month' => $month));
10079
+				$query_values = array_merge($query_values, array(':month' => $month));
10080 10080
 			}
10081 10081
 		}
10082 10082
       
@@ -10093,10 +10093,10 @@  discard block
 block discarded – undo
10093 10093
 	* @return Integer the number of airlines
10094 10094
 	*
10095 10095
 	*/
10096
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10096
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
10097 10097
 	{
10098 10098
 		global $globalDBdriver;
10099
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10099
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10100 10100
 							FROM spotter_output";
10101 10101
       
10102 10102
 		$query_values = array();
@@ -10104,23 +10104,23 @@  discard block
 block discarded – undo
10104 10104
 		if ($year != '') {
10105 10105
 			if ($globalDBdriver == 'mysql') {
10106 10106
 				$query .= " AND YEAR(spotter_output.date) = :year";
10107
-				$query_values = array_merge($query_values,array(':year' => $year));
10107
+				$query_values = array_merge($query_values, array(':year' => $year));
10108 10108
 			} else {
10109 10109
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10110
-				$query_values = array_merge($query_values,array(':year' => $year));
10110
+				$query_values = array_merge($query_values, array(':year' => $year));
10111 10111
 			}
10112 10112
 		}
10113 10113
 		if ($month != '') {
10114 10114
 			if ($globalDBdriver == 'mysql') {
10115 10115
 				$query .= " AND MONTH(spotter_output.date) = :month";
10116
-				$query_values = array_merge($query_values,array(':month' => $month));
10116
+				$query_values = array_merge($query_values, array(':month' => $month));
10117 10117
 			} else {
10118 10118
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10119
-				$query_values = array_merge($query_values,array(':month' => $month));
10119
+				$query_values = array_merge($query_values, array(':month' => $month));
10120 10120
 			}
10121 10121
 		}
10122 10122
                 if ($query == '') $queryi .= $this->getFilter($filters);
10123
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10123
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10124 10124
 
10125 10125
 
10126 10126
 		$sth = $this->db->prepare($queryi);
@@ -10138,7 +10138,7 @@  discard block
 block discarded – undo
10138 10138
 	public function countAllHoursFromToday($filters = array())
10139 10139
 	{
10140 10140
 		global $globalTimezone, $globalDBdriver;
10141
-		$filter_query = $this->getFilter($filters,true,true);
10141
+		$filter_query = $this->getFilter($filters, true, true);
10142 10142
 		if ($globalTimezone != '') {
10143 10143
 			date_default_timezone_set($globalTimezone);
10144 10144
 			$datetime = new DateTime();
@@ -10146,12 +10146,12 @@  discard block
 block discarded – undo
10146 10146
 		} else $offset = '+00:00';
10147 10147
 
10148 10148
 		if ($globalDBdriver == 'mysql') {
10149
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10149
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10150 10150
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
10151 10151
 								GROUP BY hour_name 
10152 10152
 								ORDER BY hour_name ASC";
10153 10153
 		} else {
10154
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10154
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10155 10155
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
10156 10156
 								GROUP BY hour_name 
10157 10157
 								ORDER BY hour_name ASC";
@@ -10163,7 +10163,7 @@  discard block
 block discarded – undo
10163 10163
 		$hour_array = array();
10164 10164
 		$temp_array = array();
10165 10165
         
10166
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10166
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10167 10167
 		{
10168 10168
 			$temp_array['hour_name'] = $row['hour_name'];
10169 10169
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10182,14 +10182,14 @@  discard block
 block discarded – undo
10182 10182
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10183 10183
 	{
10184 10184
 		global $global_query, $globalDBdriver, $globalTimezone;
10185
-		$filter_query = $this->getFilter($filters,true,true);
10185
+		$filter_query = $this->getFilter($filters, true, true);
10186 10186
 		date_default_timezone_set('UTC');
10187 10187
 		$limit_query = '';
10188 10188
 		if ($limit != "")
10189 10189
 		{
10190 10190
 			$limit_array = explode(",", $limit);
10191
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
10192
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
10191
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
10192
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
10193 10193
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
10194 10194
 			{
10195 10195
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -10242,7 +10242,7 @@  discard block
 block discarded – undo
10242 10242
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
10243 10243
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
10244 10244
 			//echo $query;
10245
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
10245
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
10246 10246
 			/*
10247 10247
 			$sth = $this->db->prepare($query);
10248 10248
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -10261,9 +10261,9 @@  discard block
 block discarded – undo
10261 10261
 	*/
10262 10262
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10263 10263
 	{
10264
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
10264
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
10265 10265
 
10266
-		$query  = "SELECT spotter_output.spotter_id
10266
+		$query = "SELECT spotter_output.spotter_id
10267 10267
 								FROM spotter_output 
10268 10268
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
10269 10269
         
@@ -10271,7 +10271,7 @@  discard block
 block discarded – undo
10271 10271
 		$sth = $this->db->prepare($query);
10272 10272
 		$sth->execute();
10273 10273
 
10274
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10274
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10275 10275
 		{
10276 10276
 			return $row['spotter_id'];
10277 10277
 		}
@@ -10296,23 +10296,23 @@  discard block
 block discarded – undo
10296 10296
 		}
10297 10297
 		
10298 10298
 		$current_date = date("Y-m-d H:i:s");
10299
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
10299
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
10300 10300
 		
10301 10301
 		$diff = abs(strtotime($current_date) - strtotime($date));
10302 10302
 
10303
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
10303
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
10304 10304
 		$years = $time_array['years'];
10305 10305
 		
10306
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
10306
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
10307 10307
 		$months = $time_array['months'];
10308 10308
 		
10309
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
10309
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
10310 10310
 		$days = $time_array['days'];
10311
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
10311
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
10312 10312
 		$hours = $time_array['hours'];
10313
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
10313
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
10314 10314
 		$minutes = $time_array['minutes'];
10315
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10315
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10316 10316
 		
10317 10317
 		return $time_array;	
10318 10318
 	}	
@@ -10338,63 +10338,63 @@  discard block
 block discarded – undo
10338 10338
 			$temp_array['direction_degree'] = $direction;
10339 10339
 			$temp_array['direction_shortname'] = "N";
10340 10340
 			$temp_array['direction_fullname'] = "North";
10341
-		} elseif ($direction >= 22.5 && $direction < 45){
10341
+		} elseif ($direction >= 22.5 && $direction < 45) {
10342 10342
 			$temp_array['direction_degree'] = $direction;
10343 10343
 			$temp_array['direction_shortname'] = "NNE";
10344 10344
 			$temp_array['direction_fullname'] = "North-Northeast";
10345
-		} elseif ($direction >= 45 && $direction < 67.5){
10345
+		} elseif ($direction >= 45 && $direction < 67.5) {
10346 10346
 			$temp_array['direction_degree'] = $direction;
10347 10347
 			$temp_array['direction_shortname'] = "NE";
10348 10348
 			$temp_array['direction_fullname'] = "Northeast";
10349
-		} elseif ($direction >= 67.5 && $direction < 90){
10349
+		} elseif ($direction >= 67.5 && $direction < 90) {
10350 10350
 			$temp_array['direction_degree'] = $direction;
10351 10351
 			$temp_array['direction_shortname'] = "ENE";
10352 10352
 			$temp_array['direction_fullname'] = "East-Northeast";
10353
-		} elseif ($direction >= 90 && $direction < 112.5){
10353
+		} elseif ($direction >= 90 && $direction < 112.5) {
10354 10354
 			$temp_array['direction_degree'] = $direction;
10355 10355
 			$temp_array['direction_shortname'] = "E";
10356 10356
 			$temp_array['direction_fullname'] = "East";
10357
-		} elseif ($direction >= 112.5 && $direction < 135){
10357
+		} elseif ($direction >= 112.5 && $direction < 135) {
10358 10358
 			$temp_array['direction_degree'] = $direction;
10359 10359
 			$temp_array['direction_shortname'] = "ESE";
10360 10360
 			$temp_array['direction_fullname'] = "East-Southeast";
10361
-		} elseif ($direction >= 135 && $direction < 157.5){
10361
+		} elseif ($direction >= 135 && $direction < 157.5) {
10362 10362
 			$temp_array['direction_degree'] = $direction;
10363 10363
 			$temp_array['direction_shortname'] = "SE";
10364 10364
 			$temp_array['direction_fullname'] = "Southeast";
10365
-		} elseif ($direction >= 157.5 && $direction < 180){
10365
+		} elseif ($direction >= 157.5 && $direction < 180) {
10366 10366
 			$temp_array['direction_degree'] = $direction;
10367 10367
 			$temp_array['direction_shortname'] = "SSE";
10368 10368
 			$temp_array['direction_fullname'] = "South-Southeast";
10369
-		} elseif ($direction >= 180 && $direction < 202.5){
10369
+		} elseif ($direction >= 180 && $direction < 202.5) {
10370 10370
 			$temp_array['direction_degree'] = $direction;
10371 10371
 			$temp_array['direction_shortname'] = "S";
10372 10372
 			$temp_array['direction_fullname'] = "South";
10373
-		} elseif ($direction >= 202.5 && $direction < 225){
10373
+		} elseif ($direction >= 202.5 && $direction < 225) {
10374 10374
 			$temp_array['direction_degree'] = $direction;
10375 10375
 			$temp_array['direction_shortname'] = "SSW";
10376 10376
 			$temp_array['direction_fullname'] = "South-Southwest";
10377
-		} elseif ($direction >= 225 && $direction < 247.5){
10377
+		} elseif ($direction >= 225 && $direction < 247.5) {
10378 10378
 			$temp_array['direction_degree'] = $direction;
10379 10379
 			$temp_array['direction_shortname'] = "SW";
10380 10380
 			$temp_array['direction_fullname'] = "Southwest";
10381
-		} elseif ($direction >= 247.5 && $direction < 270){
10381
+		} elseif ($direction >= 247.5 && $direction < 270) {
10382 10382
 			$temp_array['direction_degree'] = $direction;
10383 10383
 			$temp_array['direction_shortname'] = "WSW";
10384 10384
 			$temp_array['direction_fullname'] = "West-Southwest";
10385
-		} elseif ($direction >= 270 && $direction < 292.5){
10385
+		} elseif ($direction >= 270 && $direction < 292.5) {
10386 10386
 			$temp_array['direction_degree'] = $direction;
10387 10387
 			$temp_array['direction_shortname'] = "W";
10388 10388
 			$temp_array['direction_fullname'] = "West";
10389
-		} elseif ($direction >= 292.5 && $direction < 315){
10389
+		} elseif ($direction >= 292.5 && $direction < 315) {
10390 10390
 			$temp_array['direction_degree'] = $direction;
10391 10391
 			$temp_array['direction_shortname'] = "WNW";
10392 10392
 			$temp_array['direction_fullname'] = "West-Northwest";
10393
-		} elseif ($direction >= 315 && $direction < 337.5){
10393
+		} elseif ($direction >= 315 && $direction < 337.5) {
10394 10394
 			$temp_array['direction_degree'] = $direction;
10395 10395
 			$temp_array['direction_shortname'] = "NW";
10396 10396
 			$temp_array['direction_fullname'] = "Northwest";
10397
-		} elseif ($direction >= 337.5 && $direction < 360){
10397
+		} elseif ($direction >= 337.5 && $direction < 360) {
10398 10398
 			$temp_array['direction_degree'] = $direction;
10399 10399
 			$temp_array['direction_shortname'] = "NNW";
10400 10400
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -10447,9 +10447,9 @@  discard block
 block discarded – undo
10447 10447
 	*/
10448 10448
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
10449 10449
 	{
10450
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
10450
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
10451 10451
 	
10452
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
10452
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
10453 10453
 		
10454 10454
 		$sth = $this->db->prepare($query);
10455 10455
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -10472,9 +10472,9 @@  discard block
 block discarded – undo
10472 10472
 	*/
10473 10473
 	public function getAircraftTypeBymodeS($aircraft_modes)
10474 10474
 	{
10475
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
10475
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
10476 10476
 	
10477
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
10477
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
10478 10478
 		
10479 10479
 		$sth = $this->db->prepare($query);
10480 10480
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -10495,11 +10495,11 @@  discard block
 block discarded – undo
10495 10495
 	* @param Float $longitude longitute of the flight
10496 10496
 	* @return String the countrie
10497 10497
 	*/
10498
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
10498
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
10499 10499
 	{
10500 10500
 		global $globalDBdriver, $globalDebug;
10501
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
10502
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
10501
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
10502
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
10503 10503
 	
10504 10504
 		$Connection = new Connection($this->db);
10505 10505
 		if (!$Connection->tableExists('countries')) return '';
@@ -10539,7 +10539,7 @@  discard block
 block discarded – undo
10539 10539
 	public function getCountryFromISO2($iso2)
10540 10540
 	{
10541 10541
 		global $globalDBdriver, $globalDebug;
10542
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
10542
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
10543 10543
 	
10544 10544
 		$Connection = new Connection($this->db);
10545 10545
 		if (!$Connection->tableExists('countries')) return '';
@@ -10571,19 +10571,19 @@  discard block
 block discarded – undo
10571 10571
 	*/
10572 10572
 	public function convertAircraftRegistration($registration)
10573 10573
 	{
10574
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10574
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10575 10575
 		$registration_prefix = '';
10576 10576
 		$registration_1 = substr($registration, 0, 1);
10577 10577
 		$registration_2 = substr($registration, 0, 2);
10578 10578
 
10579 10579
 		//first get the prefix based on two characters
10580
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
10580
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
10581 10581
       
10582 10582
 		
10583 10583
 		$sth = $this->db->prepare($query);
10584 10584
 		$sth->execute(array(':registration_2' => $registration_2));
10585 10585
         
10586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10587 10587
 		{
10588 10588
 			$registration_prefix = $row['registration_prefix'];
10589 10589
 		}
@@ -10591,11 +10591,11 @@  discard block
 block discarded – undo
10591 10591
 		//if we didn't find a two chracter prefix lets just search the one with one character
10592 10592
 		if ($registration_prefix == '')
10593 10593
 		{
10594
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
10594
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
10595 10595
 			$sth = $this->db->prepare($query);
10596 10596
 			$sth->execute(array(':registration_1' => $registration_1));
10597 10597
 	        
10598
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10598
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10599 10599
 			{
10600 10600
 				$registration_prefix = $row['registration_prefix'];
10601 10601
 			}
@@ -10609,7 +10609,7 @@  discard block
 block discarded – undo
10609 10609
 			} else {
10610 10610
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
10611 10611
 			}
10612
-		} else if(strlen($registration_prefix) == 2){
10612
+		} else if (strlen($registration_prefix) == 2) {
10613 10613
 			if (0 === strpos($registration, 'N')) {
10614 10614
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
10615 10615
 			} else {
@@ -10628,17 +10628,17 @@  discard block
 block discarded – undo
10628 10628
 	*/
10629 10629
 	public function countryFromAircraftRegistration($registration)
10630 10630
 	{
10631
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10631
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10632 10632
 		
10633 10633
 		$registration_prefix = '';
10634
-		$registration_test = explode('-',$registration);
10634
+		$registration_test = explode('-', $registration);
10635 10635
 		$country = '';
10636 10636
 		if ($registration_test[0] != $registration) {
10637 10637
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10638 10638
 	      
10639 10639
 			$sth = $this->db->prepare($query);
10640 10640
 			$sth->execute(array(':registration_1' => $registration_test[0]));
10641
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10641
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10642 10642
 			{
10643 10643
 				//$registration_prefix = $row['registration_prefix'];
10644 10644
 				$country = $row['country'];
@@ -10649,13 +10649,13 @@  discard block
 block discarded – undo
10649 10649
 
10650 10650
 			$country = '';
10651 10651
 			//first get the prefix based on two characters
10652
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10652
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10653 10653
       
10654 10654
 			
10655 10655
 			$sth = $this->db->prepare($query);
10656 10656
 			$sth->execute(array(':registration_2' => $registration_2));
10657 10657
         
10658
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10658
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10659 10659
 			{
10660 10660
 				$registration_prefix = $row['registration_prefix'];
10661 10661
 				$country = $row['country'];
@@ -10664,12 +10664,12 @@  discard block
 block discarded – undo
10664 10664
 			//if we didn't find a two chracter prefix lets just search the one with one character
10665 10665
 			if ($registration_prefix == "")
10666 10666
 			{
10667
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10667
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10668 10668
 	      
10669 10669
 				$sth = $this->db->prepare($query);
10670 10670
 				$sth->execute(array(':registration_1' => $registration_1));
10671 10671
 	        
10672
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10672
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10673 10673
 				{
10674 10674
 					//$registration_prefix = $row['registration_prefix'];
10675 10675
 					$country = $row['country'];
@@ -10689,17 +10689,17 @@  discard block
 block discarded – undo
10689 10689
 	*/
10690 10690
 	public function registrationPrefixFromAircraftRegistration($registration)
10691 10691
 	{
10692
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10692
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10693 10693
 		
10694 10694
 		$registration_prefix = '';
10695
-		$registration_test = explode('-',$registration);
10695
+		$registration_test = explode('-', $registration);
10696 10696
 		//$country = '';
10697 10697
 		if ($registration_test[0] != $registration) {
10698
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10698
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10699 10699
 	      
10700 10700
 			$sth = $this->db->prepare($query);
10701 10701
 			$sth->execute(array(':registration_1' => $registration_test[0]));
10702
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10702
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10703 10703
 			{
10704 10704
 				$registration_prefix = $row['registration_prefix'];
10705 10705
 				//$country = $row['country'];
@@ -10709,13 +10709,13 @@  discard block
 block discarded – undo
10709 10709
 		        $registration_2 = substr($registration, 0, 2);
10710 10710
 
10711 10711
 			//first get the prefix based on two characters
10712
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10712
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10713 10713
       
10714 10714
 			
10715 10715
 			$sth = $this->db->prepare($query);
10716 10716
 			$sth->execute(array(':registration_2' => $registration_2));
10717 10717
         
10718
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10718
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10719 10719
 			{
10720 10720
 				$registration_prefix = $row['registration_prefix'];
10721 10721
 				//$country = $row['country'];
@@ -10724,12 +10724,12 @@  discard block
 block discarded – undo
10724 10724
 			//if we didn't find a two chracter prefix lets just search the one with one character
10725 10725
 			if ($registration_prefix == "")
10726 10726
 			{
10727
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10727
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10728 10728
 	      
10729 10729
 				$sth = $this->db->prepare($query);
10730 10730
 				$sth->execute(array(':registration_1' => $registration_1));
10731 10731
 	        
10732
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10732
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10733 10733
 				{
10734 10734
 					$registration_prefix = $row['registration_prefix'];
10735 10735
 					//$country = $row['country'];
@@ -10750,13 +10750,13 @@  discard block
 block discarded – undo
10750 10750
 	*/
10751 10751
 	public function countryFromAircraftRegistrationCode($registration)
10752 10752
 	{
10753
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10753
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10754 10754
 		
10755 10755
 		$country = '';
10756
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10756
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10757 10757
 		$sth = $this->db->prepare($query);
10758 10758
 		$sth->execute(array(':registration' => $registration));
10759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10760 10760
 		{
10761 10761
 			$country = $row['country'];
10762 10762
 		}
@@ -10769,9 +10769,9 @@  discard block
 block discarded – undo
10769 10769
 	* @param String $flightaware_id flightaware_id from spotter_output table
10770 10770
 	* @param String $highlight New highlight value
10771 10771
 	*/
10772
-	public function setHighlightFlight($flightaware_id,$highlight) {
10772
+	public function setHighlightFlight($flightaware_id, $highlight) {
10773 10773
 		
10774
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10774
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10775 10775
 		$sth = $this->db->prepare($query);
10776 10776
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
10777 10777
 	}
@@ -10783,13 +10783,13 @@  discard block
 block discarded – undo
10783 10783
 	* @param String $date Date of spotted aircraft
10784 10784
 	* @param String $highlight New highlight value
10785 10785
 	*/
10786
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
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)";
10789 10789
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
10790 10790
 		} else {
10791 10791
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
10792
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
10792
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
10793 10793
 		}
10794 10794
 		$sth = $this->db->prepare($query);
10795 10795
 		$sth->execute($query_values);
@@ -10819,7 +10819,7 @@  discard block
 block discarded – undo
10819 10819
 		
10820 10820
 		$bitly_data = json_decode($bitly_data);
10821 10821
 		$bitly_url = '';
10822
-		if ($bitly_data->status_txt = "OK"){
10822
+		if ($bitly_data->status_txt = "OK") {
10823 10823
 			$bitly_url = $bitly_data->data->url;
10824 10824
 		}
10825 10825
 
@@ -10829,7 +10829,7 @@  discard block
 block discarded – undo
10829 10829
 
10830 10830
 	public function getOrderBy()
10831 10831
 	{
10832
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
10832
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
10833 10833
 		
10834 10834
 		return $orderby;
10835 10835
 		
@@ -10963,14 +10963,14 @@  discard block
 block discarded – undo
10963 10963
 		}
10964 10964
 		$sth = $this->db->prepare($query);
10965 10965
 		$sth->execute();
10966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10967 10967
 		{
10968 10968
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10969 10969
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10970 10970
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10971
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10971
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10972 10972
 				$sthu = $this->db->prepare($update_query);
10973
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
10973
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
10974 10974
 			}
10975 10975
 		}
10976 10976
 		
@@ -10983,7 +10983,7 @@  discard block
 block discarded – undo
10983 10983
 		}
10984 10984
 		$sth = $this->db->prepare($query);
10985 10985
 		$sth->execute();
10986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10987 10987
 		{
10988 10988
 			if (is_numeric(substr($row['ident'], -1, 1)))
10989 10989
 			{
@@ -10992,11 +10992,11 @@  discard block
 block discarded – undo
10992 10992
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10993 10993
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10994 10994
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10995
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10995
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10996 10996
 				if (isset($airline_array[0]['name'])) {
10997
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10997
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10998 10998
 					$sthu = $this->db->prepare($update_query);
10999
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10999
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
11000 11000
 				}
11001 11001
 			}
11002 11002
 		}
@@ -11016,18 +11016,18 @@  discard block
 block discarded – undo
11016 11016
 		}
11017 11017
 		$sth = $this->db->prepare($query);
11018 11018
 		$sth->execute();
11019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11020 11020
 		{
11021 11021
 			if ($row['aircraft_icao'] != '') {
11022 11022
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11023
-				if ($row['registration'] != ""){
11023
+				if ($row['registration'] != "") {
11024 11024
 					$image_array = $Image->getSpotterImage($row['registration']);
11025 11025
 					if (!isset($image_array[0]['registration'])) {
11026 11026
 						$Image->addSpotterImage($row['registration']);
11027 11027
 					}
11028 11028
 				}
11029 11029
 				if (count($aircraft_name) > 0) {
11030
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11030
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11031 11031
 					$sthu = $this->db->prepare($update_query);
11032 11032
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11033 11033
 				}
@@ -11042,10 +11042,10 @@  discard block
 block discarded – undo
11042 11042
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
11043 11043
 		$sth = $this->db->prepare($query);
11044 11044
 		$sth->execute();
11045
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11045
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11046 11046
 		{
11047 11047
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
11048
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
11048
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
11049 11049
 				$airport_icao = '';
11050 11050
 				 if (isset($closestAirports[0])) {
11051 11051
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -11059,7 +11059,7 @@  discard block
 block discarded – undo
11059 11059
 								break;
11060 11060
 							}
11061 11061
 						}
11062
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11062
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
11063 11063
 						$airport_icao = $closestAirports[0]['icao'];
11064 11064
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
11065 11065
 					} else {
@@ -11070,28 +11070,28 @@  discard block
 block discarded – undo
11070 11070
 				}
11071 11071
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11072 11072
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
11073
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11073
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11074 11074
 					$sthu = $this->db->prepare($update_query);
11075
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
11075
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
11076 11076
 				}
11077 11077
 			}
11078 11078
 		}
11079 11079
 	}
11080 11080
 	
11081
-	public function closestAirports($origLat,$origLon,$dist = 10) {
11081
+	public function closestAirports($origLat, $origLon, $dist = 10) {
11082 11082
 		global $globalDBdriver;
11083
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
11083
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
11084 11084
 /*
11085 11085
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
11086 11086
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11087 11087
                       having distance < $dist ORDER BY distance limit 100;";
11088 11088
 */
11089 11089
 		if ($globalDBdriver == 'mysql') {
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 
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 11093
                 } else {
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 
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
     		}
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 2 patches
Indentation   +618 added lines, -618 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');
@@ -1027,35 +1027,35 @@  discard block
 block discarded – undo
1027 1027
 	
1028 1028
 	if ($owner != "")
1029 1029
 	{
1030
-	    if (!is_string($owner))
1031
-	    {
1030
+		if (!is_string($owner))
1031
+		{
1032 1032
 		return false;
1033
-	    } else {
1033
+		} else {
1034 1034
 		$additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)";
1035 1035
 		$query_values = array(':pilot' => $pilot);
1036
-	    }
1036
+		}
1037 1037
 	}
1038 1038
 	
1039 1039
 	if ($limit != "")
1040 1040
 	{
1041
-	    $limit_array = explode(",", $limit);
1041
+		$limit_array = explode(",", $limit);
1042 1042
 	    
1043
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1044
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1043
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1044
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1045 1045
 	    
1046
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1047
-	    {
1046
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1047
+		{
1048 1048
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1049 1049
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1050
-	    }
1050
+		}
1051 1051
 	}
1052 1052
 
1053 1053
 	if ($sort != "")
1054 1054
 	{
1055
-	    $search_orderby_array = $Spotter->getOrderBy();
1056
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1055
+		$search_orderby_array = $Spotter->getOrderBy();
1056
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1057 1057
 	} else {
1058
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1058
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1059 1059
 	}
1060 1060
 
1061 1061
 	$query = $global_query." WHERE spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1063,16 +1063,16 @@  discard block
 block discarded – undo
1063 1063
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1064 1064
 
1065 1065
 	return $spotter_array;
1066
-    }
1067
-
1068
-    /**
1069
-    * Gets all number of flight over countries
1070
-    *
1071
-    * @return Array the airline country list
1072
-    *
1073
-    */
1074
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1075
-    {
1066
+	}
1067
+
1068
+	/**
1069
+	 * Gets all number of flight over countries
1070
+	 *
1071
+	 * @return Array the airline country list
1072
+	 *
1073
+	 */
1074
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1075
+	{
1076 1076
 	global $globalDBdriver;
1077 1077
 	/*
1078 1078
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1082,14 +1082,14 @@  discard block
 block discarded – undo
1082 1082
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1083 1083
 		    FROM countries c, spotter_archive s
1084 1084
 		    WHERE c.iso2 = s.over_country ";
1085
-                if ($olderthanmonths > 0) {
1086
-            		if ($globalDBdriver == 'mysql') {
1085
+				if ($olderthanmonths > 0) {
1086
+					if ($globalDBdriver == 'mysql') {
1087 1087
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1088 1088
 			} else {
1089 1089
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1090 1090
 			}
1091 1091
 		}
1092
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1092
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1093 1093
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1094 1094
 	if ($limit) $query .= " LIMIT 0,10";
1095 1095
       
@@ -1102,23 +1102,23 @@  discard block
 block discarded – undo
1102 1102
         
1103 1103
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1104 1104
 	{
1105
-	    $temp_array['flight_count'] = $row['nb'];
1106
-	    $temp_array['flight_country'] = $row['name'];
1107
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1108
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1109
-	    $flight_array[] = $temp_array;
1105
+		$temp_array['flight_count'] = $row['nb'];
1106
+		$temp_array['flight_country'] = $row['name'];
1107
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1108
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1109
+		$flight_array[] = $temp_array;
1110 1110
 	}
1111 1111
 	return $flight_array;
1112
-    }
1113
-
1114
-    /**
1115
-    * Gets last spotter information based on a particular callsign
1116
-    *
1117
-    * @return Array the spotter information
1118
-    *
1119
-    */
1120
-    public function getDateArchiveSpotterDataById($id,$date)
1121
-    {
1112
+	}
1113
+
1114
+	/**
1115
+	 * Gets last spotter information based on a particular callsign
1116
+	 *
1117
+	 * @return Array the spotter information
1118
+	 *
1119
+	 */
1120
+	public function getDateArchiveSpotterDataById($id,$date)
1121
+	{
1122 1122
 	$Spotter = new Spotter($this->db);
1123 1123
 	date_default_timezone_set('UTC');
1124 1124
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1126,16 +1126,16 @@  discard block
 block discarded – undo
1126 1126
 	$date = date('c',$date);
1127 1127
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1128 1128
 	return $spotter_array;
1129
-    }
1130
-
1131
-    /**
1132
-    * Gets all the spotter information based on a particular callsign
1133
-    *
1134
-    * @return Array the spotter information
1135
-    *
1136
-    */
1137
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1138
-    {
1129
+	}
1130
+
1131
+	/**
1132
+	 * Gets all the spotter information based on a particular callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1138
+	{
1139 1139
 	$Spotter = new Spotter($this->db);
1140 1140
 	date_default_timezone_set('UTC');
1141 1141
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1143,16 +1143,16 @@  discard block
 block discarded – undo
1143 1143
 	$date = date('c',$date);
1144 1144
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1145 1145
 	return $spotter_array;
1146
-    }
1147
-
1148
-    /**
1149
-    * Gets all the spotter information based on the airport
1150
-    *
1151
-    * @return Array the spotter information
1152
-    *
1153
-    */
1154
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1155
-    {
1146
+	}
1147
+
1148
+	/**
1149
+	 * Gets all the spotter information based on the airport
1150
+	 *
1151
+	 * @return Array the spotter information
1152
+	 *
1153
+	 */
1154
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1155
+	{
1156 1156
 	global $global_query;
1157 1157
 	$Spotter = new Spotter();
1158 1158
 	date_default_timezone_set('UTC');
@@ -1163,35 +1163,35 @@  discard block
 block discarded – undo
1163 1163
 	
1164 1164
 	if ($airport != "")
1165 1165
 	{
1166
-	    if (!is_string($airport))
1167
-	    {
1166
+		if (!is_string($airport))
1167
+		{
1168 1168
 		return false;
1169
-	    } else {
1169
+		} else {
1170 1170
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1171 1171
 		$query_values = array(':airport' => $airport);
1172
-	    }
1172
+		}
1173 1173
 	}
1174 1174
 	
1175 1175
 	if ($limit != "")
1176 1176
 	{
1177
-	    $limit_array = explode(",", $limit);
1177
+		$limit_array = explode(",", $limit);
1178 1178
 	    
1179
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1180
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1179
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1180
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1181 1181
 	    
1182
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1183
-	    {
1182
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1183
+		{
1184 1184
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1185 1185
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1186
-	    }
1186
+		}
1187 1187
 	}
1188 1188
 	
1189 1189
 	if ($sort != "")
1190 1190
 	{
1191
-	    $search_orderby_array = $Spotter->getOrderBy();
1192
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1191
+		$search_orderby_array = $Spotter->getOrderBy();
1192
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1193 1193
 	} else {
1194
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1194
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1195 1195
 	}
1196 1196
 
1197 1197
 	$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;
@@ -1199,6 +1199,6 @@  discard block
 block discarded – undo
1199 1199
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1200 1200
 
1201 1201
 	return $spotter_array;
1202
-    }
1202
+	}
1203 1203
 }
1204 1204
 ?>
1205 1205
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@  discard block
 block discarded – undo
13 13
     * @param Array $filter the filter
14 14
     * @return Array the SQL part
15 15
     */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
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])) {
20 20
 		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 			$filters = $globalStatsFilters[$globalFilterName];
22 22
 		} else {
23
-			$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
23
+			$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
24 24
 		}
25 25
 	}
26
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
26
+	if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
27 27
 	$filter_query_join = '';
28 28
 	$filter_query_where = '';
29
-	foreach($filters as $flt) {
29
+	foreach ($filters as $flt) {
30 30
 	    if (isset($flt['airlines']) && !empty($flt['airlines'])) {
31 31
 		if ($flt['airlines'][0] != '') {
32 32
 		    if (isset($flt['source'])) {
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";
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 34
 		    } else {
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";
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 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 45
 	    }
46 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 53
 	    if ($filter['airlines'][0] != '') {
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";
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
 	
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 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 68
 	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
69 69
 	}
70 70
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
71 71
 	    if ($filter_query_where == '') {
72
-		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72
+		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
73 73
 	    } else {
74
-		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
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';
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
 	// Spotter_archive
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 = '') {
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 = '') {
85 85
 		require_once(dirname(__FILE__).'/class.Spotter.php');
86 86
 		if ($over_country == '') {
87 87
 			$Spotter = new Spotter($this->db);
88
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
88
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
89 89
 			if (!empty($data_country)) $country = $data_country['iso2'];
90 90
 			else $country = '';
91 91
 		} else $country = $over_country;
92
-		if ($airline_type === NULL) $airline_type ='';
92
+		if ($airline_type === NULL) $airline_type = '';
93 93
 	
94 94
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
95 95
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
96 96
 
97 97
 		// Route is not added in spotter_archive
98
-		$query  = "INSERT INTO spotter_archive (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,over_country,source_name)
98
+		$query = "INSERT INTO spotter_archive (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,over_country,source_name)
99 99
 		        VALUES (: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, :over_country, :source_name)";
100 100
 
101
-		$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_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
101
+		$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_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			return "error : ".$e->getMessage();
107 107
 		}
108 108
 		return "success";
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 
123 123
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
124 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";
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 129
                 return $spotter_array;
130 130
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
144 144
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
145 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";
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
                   /*
@@ -156,7 +156,7 @@  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));
159
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
160 160
 
161 161
                 return $spotter_array;
162 162
         }
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
         {
172 172
                 date_default_timezone_set('UTC');
173 173
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
174
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
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 178
                 try {
179 179
                         $sth = $this->db->prepare($query);
180 180
                         $sth->execute(array(':id' => $id));
181
-                } catch(PDOException $e) {
181
+                } catch (PDOException $e) {
182 182
                         echo $e->getMessage();
183 183
                         die;
184 184
                 }
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
         {
198 198
                 date_default_timezone_set('UTC');
199 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";
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 204
                 try {
205 205
                         $sth = $this->db->prepare($query);
206 206
                         $sth->execute(array(':id' => $id));
207
-                } catch(PDOException $e) {
207
+                } catch (PDOException $e) {
208 208
                         echo $e->getMessage();
209 209
                         die;
210 210
                 }
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
                 date_default_timezone_set('UTC');
227 227
 
228 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";
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 231
                 try {
232 232
                         $sth = $this->db->prepare($query);
233 233
                         $sth->execute(array(':ident' => $ident));
234
-                } catch(PDOException $e) {
234
+                } catch (PDOException $e) {
235 235
                         echo $e->getMessage();
236 236
                         die;
237 237
                 }
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
                 date_default_timezone_set('UTC');
253 253
 
254 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";
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 257
                 try {
258 258
                         $sth = $this->db->prepare($query);
259 259
                         $sth->execute(array(':id' => $id));
260
-                } catch(PDOException $e) {
260
+                } catch (PDOException $e) {
261 261
                         echo $e->getMessage();
262 262
                         die;
263 263
                 }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 date_default_timezone_set('UTC');
279 279
 
280 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";
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 283
                 try {
284 284
                         $sth = $this->db->prepare($query);
285 285
                         $sth->execute(array(':id' => $id));
286
-                } catch(PDOException $e) {
286
+                } catch (PDOException $e) {
287 287
                         echo $e->getMessage();
288 288
                         die;
289 289
                 }
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
                 date_default_timezone_set('UTC');
306 306
 
307 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";
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 311
                 try {
312 312
                         $sth = $this->db->prepare($query);
313 313
                         $sth->execute(array(':ident' => $ident));
314
-                } catch(PDOException $e) {
314
+                } catch (PDOException $e) {
315 315
                         echo $e->getMessage();
316 316
                         die;
317 317
                 }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         * @return Array the spotter information
329 329
         *
330 330
         */
331
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
331
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
332 332
         {
333 333
     		$Spotter = new Spotter($this->db);
334 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";
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 339
                 return $spotter_array;
340 340
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                 try {
348 348
                         $sth = $this->db->prepare($query);
349 349
                         $sth->execute();
350
-                } catch(PDOException $e) {
350
+                } catch (PDOException $e) {
351 351
                         echo $e->getMessage();
352 352
                         die;
353 353
                 }
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
         * @return Array the spotter information
360 360
         *
361 361
         */
362
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
362
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
363 363
         {
364 364
                 global $globalDBdriver, $globalLiveInterval;
365 365
                 date_default_timezone_set('UTC');
366 366
 
367 367
                 $filter_query = '';
368 368
                 if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
370 370
                 }
371 371
                 // Use spotter_output also ?
372 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 ";
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 374
                 }
375 375
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376 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 377
                 }
378 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'])."')";
379
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
380 380
                 }
381 381
 
382 382
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
396 396
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
397 397
 */
398
-			$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 
398
+			$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 
399 399
 				    FROM spotter_archive 
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 403
                 } else {
404 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 
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."'".'
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 try {
413 413
                         $sth = $this->db->prepare($query);
414 414
                         $sth->execute();
415
-                } catch(PDOException $e) {
415
+                } catch (PDOException $e) {
416 416
                         echo $e->getMessage();
417 417
                         die;
418 418
                 }
@@ -427,24 +427,24 @@  discard block
 block discarded – undo
427 427
         * @return Array the spotter information
428 428
         *
429 429
         */
430
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
430
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
431 431
         {
432 432
                 global $globalDBdriver, $globalLiveInterval;
433 433
                 date_default_timezone_set('UTC');
434 434
 
435 435
                 $filter_query = '';
436 436
                 if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
438 438
                 }
439 439
                 // Should use spotter_output also ?
440 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 ";
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 442
                 }
443 443
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444 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 445
                 }
446 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'])."')";
447
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
448 448
                 }
449 449
 
450 450
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
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';
456 456
 			*/
457
-			$query  = 'SELECT a.aircraft_shadow, 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 
457
+			$query = 'SELECT a.aircraft_shadow, 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 
458 458
 				    FROM spotter_archive_output 
459 459
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
460 460
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
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."'".'
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 try {
482 482
                         $sth = $this->db->prepare($query);
483 483
                         $sth->execute();
484
-                } catch(PDOException $e) {
484
+                } catch (PDOException $e) {
485 485
                         echo $e->getMessage();
486 486
                         die;
487 487
                 }
@@ -496,23 +496,23 @@  discard block
 block discarded – undo
496 496
         * @return Array the spotter information
497 497
         *
498 498
         */
499
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
499
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
500 500
         {
501 501
                 global $globalDBdriver, $globalLiveInterval;
502 502
                 date_default_timezone_set('UTC');
503 503
 
504 504
                 $filter_query = '';
505 505
                 if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
507 507
                 }
508 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 ";
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 510
                 }
511 511
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512 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 513
                 }
514 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'])."')";
515
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
516 516
                 }
517 517
 
518 518
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 try {
528 528
                         $sth = $this->db->prepare($query);
529 529
                         $sth->execute();
530
-                } catch(PDOException $e) {
530
+                } catch (PDOException $e) {
531 531
                         echo $e->getMessage();
532 532
                         die;
533 533
                 }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     * @return Array the spotter information
548 548
     *
549 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())
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 551
     {
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572
-		foreach ($q_array as $q_item){
572
+		foreach ($q_array as $q_item) {
573 573
 		    $additional_query .= " AND (";
574 574
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
575 575
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
605 605
 	    if (!is_string($registration))
606 606
 	    {
607 607
 		return false;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
616 616
 	    if (!is_string($aircraft_icao))
617 617
 	    {
618 618
 		return false;
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
627 627
 	    if (!is_string($aircraft_manufacturer))
628 628
 	    {
629 629
 		return false;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 	    if (!is_string($airline_icao))
649 649
 	    {
650 650
 		return false;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
659 659
 	    if (!is_string($airline_country))
660 660
 	    {
661 661
 		return false;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
670 670
 	    if (!is_string($airline_type))
671 671
 	    {
672 672
 		return false;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
692 692
 	    if (!is_string($airport))
693 693
 	    {
694 694
 		return false;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
703 703
 	    if (!is_string($airport_country))
704 704
 	    {
705 705
 		return false;
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
714 714
 	    if (!is_string($callsign))
715 715
 	    {
716 716
 		return false;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
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)";
721
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
721
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
722 722
 		} else {
723 723
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
724 724
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
731 731
 	    if (!is_string($owner))
732 732
 	    {
733 733
 		return false;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
742 742
 	    if (!is_string($pilot_name))
743 743
 	    {
744 744
 		return false;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
753 753
 	    if (!is_string($pilot_id))
754 754
 	    {
755 755
 		return false;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
764 764
 	    if (!is_string($departure_airport_route))
765 765
 	    {
766 766
 		return false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
775 775
 	    if (!is_string($arrival_airport_route))
776 776
 	    {
777 777
 		return false;
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	{
785 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 791
 	    if ($altitude_array[1] != "")
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	{
804 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 809
 	    if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	{
837 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 842
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843 843
 	    {
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	
849 849
 
850 850
 	if ($origLat != "" && $origLon != "" && $dist != "") {
851
-		$dist = number_format($dist*0.621371,2,'.','');
852
-		$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
851
+		$dist = number_format($dist*0.621371, 2, '.', '');
852
+		$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
853 853
                           FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
854 854
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
855 855
 	} else {
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
867 867
 		}
868 868
 
869
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
869
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
870 870
 		    WHERE spotter_archive_output.ident <> '' 
871 871
 		    ".$additional_query."
872 872
 		    ".$filter_query.$orderby_query;
873 873
 	}
874
-	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
874
+	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
875 875
 
876 876
 	return $spotter_array;
877 877
     }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                 try {
889 889
                         $sth = $this->db->prepare($query);
890 890
                         $sth->execute();
891
-                } catch(PDOException $e) {
891
+                } catch (PDOException $e) {
892 892
                         return "error";
893 893
                 }
894 894
 	}
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
 	{
926 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 931
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932 932
 	    {
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
 	{
984 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 989
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990 990
 	    {
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	{
1041 1041
 	    $limit_array = explode(",", $limit);
1042 1042
 	    
1043
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1044
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1043
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1044
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1045 1045
 	    
1046 1046
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1047 1047
 	    {
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
     * @return Array the airline country list
1072 1072
     *
1073 1073
     */
1074
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1074
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1075 1075
     {
1076 1076
 	global $globalDBdriver;
1077 1077
 	/*
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 	$flight_array = array();
1101 1101
 	$temp_array = array();
1102 1102
         
1103
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1103
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1104 1104
 	{
1105 1105
 	    $temp_array['flight_count'] = $row['nb'];
1106 1106
 	    $temp_array['flight_country'] = $row['name'];
@@ -1117,14 +1117,14 @@  discard block
 block discarded – undo
1117 1117
     * @return Array the spotter information
1118 1118
     *
1119 1119
     */
1120
-    public function getDateArchiveSpotterDataById($id,$date)
1120
+    public function getDateArchiveSpotterDataById($id, $date)
1121 1121
     {
1122 1122
 	$Spotter = new Spotter($this->db);
1123 1123
 	date_default_timezone_set('UTC');
1124 1124
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1125
-	$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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1126
-	$date = date('c',$date);
1127
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1125
+	$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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1126
+	$date = date('c', $date);
1127
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1128 1128
 	return $spotter_array;
1129 1129
     }
1130 1130
 
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
     * @return Array the spotter information
1135 1135
     *
1136 1136
     */
1137
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1137
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1138 1138
     {
1139 1139
 	$Spotter = new Spotter($this->db);
1140 1140
 	date_default_timezone_set('UTC');
1141 1141
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1142
-	$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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1143
-	$date = date('c',$date);
1144
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1142
+	$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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1143
+	$date = date('c', $date);
1144
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1145 1145
 	return $spotter_array;
1146 1146
     }
1147 1147
 
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
     * @return Array the spotter information
1152 1152
     *
1153 1153
     */
1154
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1154
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1155 1155
     {
1156 1156
 	global $global_query;
1157 1157
 	$Spotter = new Spotter();
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	$query_values = array();
1160 1160
 	$limit_query = '';
1161 1161
 	$additional_query = '';
1162
-	$filter_query = $this->getFilter($filters,true,true);
1162
+	$filter_query = $this->getFilter($filters, true, true);
1163 1163
 	
1164 1164
 	if ($airport != "")
1165 1165
 	{
@@ -1176,8 +1176,8 @@  discard block
 block discarded – undo
1176 1176
 	{
1177 1177
 	    $limit_array = explode(",", $limit);
1178 1178
 	    
1179
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1180
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1179
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1180
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1181 1181
 	    
1182 1182
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1183 1183
 	    {
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 //require_once('require/class.SpotterLive.php');
7 7
 require_once('require/class.SpotterArchive.php');
8 8
 
9
-if (!isset($_GET['owner'])){
9
+if (!isset($_GET['owner'])) {
10 10
 	header('Location: '.$globalURL.'');
11 11
 } else {
12 12
 	$Spotter = new Spotter();
13 13
 	$SpotterArchive = new SpotterArchive();
14 14
 	$Translation = new Translation();
15 15
 	//calculuation for the pagination
16
-	if(!isset($_GET['limit']))
16
+	if (!isset($_GET['limit']))
17 17
 	{
18 18
 		$limit_start = 0;
19 19
 		$limit_end = 25;
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
 	
35 35
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
36 36
 	
37
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($sort != '') 
40 40
 	{
41
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort);
41
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort);
42 42
 		if (empty($spotter_array)) {
43
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort);
43
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort);
44 44
 		}
45 45
 	} else {
46
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference);
46
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference);
47 47
 		if (empty($spotter_array)) {
48
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference);
48
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference);
49 49
 		}
50 50
 	}
51 51
 
52 52
 	if (!empty($spotter_array))
53 53
 	{
54
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
54
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
55 55
 		$ident = $spotter_array[0]['ident'];
56 56
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57 57
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	
113 113
 		include('owner-sub-menu.php');
114 114
 		print '<div class="table column">';
115
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
115
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
116 116
 
117 117
 		include('table-output.php'); 
118 118
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@
 block discarded – undo
53 53
 	{
54 54
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
55 55
 		$ident = $spotter_array[0]['ident'];
56
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
56
+		if (isset($spotter_array[0]['latitude'])) {
57
+			$latitude = $spotter_array[0]['latitude'];
58
+		}
59
+		if (isset($spotter_array[0]['longitude'])) {
60
+			$longitude = $spotter_array[0]['longitude'];
61
+		}
58 62
 		require_once('header.php');
59 63
 		/*
60 64
 		if (isset($globalArchive) && $globalArchive) {
Please login to merge, or discard this patch.
owner-sub-menu.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?>" <?php if (strtolower($current_page) == "owner-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 <!--
8 8
 		<li class="dropdown">
9
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
10 10
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
11 11
 		    </a>
12 12
 		    <ul class="dropdown-menu" role="menu">
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		    </ul>
17 17
 		</li>
18 18
 		<li class="dropdown">
19
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
19
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
20 20
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
21 21
 		    </a>
22 22
 		    <ul class="dropdown-menu" role="menu">
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 			  <li><a href="<?php print $globalURL; ?>/ident/statistics/arrival-airport-country/<?php print $_GET['ident']; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
27 27
 		    </ul>
28 28
 		</li>
29
-		<li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
30
-		<li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
30
+		<li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $_GET['ident']; ?>" <?php if (strtolower($current_page) == "ident-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
31 31
 -->
32 32
 	</ul>
33 33
 </div>
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
owner-detailed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 //require_once('require/class.SpotterLive.php');
7 7
 require_once('require/class.SpotterArchive.php');
8 8
 
9
-if (!isset($_GET['owner'])){
9
+if (!isset($_GET['owner'])) {
10 10
 	header('Location: '.$globalURL.'');
11 11
 } else {
12 12
 	$Spotter = new Spotter();
13 13
 	$SpotterArchive = new SpotterArchive();
14 14
 	$Translation = new Translation();
15 15
 	//calculuation for the pagination
16
-	if(!isset($_GET['limit']))
16
+	if (!isset($_GET['limit']))
17 17
 	{
18 18
 		$limit_start = 0;
19 19
 		$limit_end = 25;
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
 	
35 35
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
36 36
 	
37
-	$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($sort != '') 
40 40
 	{
41
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort);
41
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort);
42 42
 		if (empty($spotter_array)) {
43
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort);
43
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort);
44 44
 		}
45 45
 	} else {
46
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference);
46
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference);
47 47
 		if (empty($spotter_array)) {
48
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($ident,$limit_start.",".$absolute_difference);
48
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($ident, $limit_start.",".$absolute_difference);
49 49
 		}
50 50
 	}
51 51
 
52 52
 	if (!empty($spotter_array))
53 53
 	{
54
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
54
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
55 55
 		$ident = $spotter_array[0]['ident'];
56 56
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57 57
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	
113 113
 		include('owner-sub-menu.php');
114 114
 		print '<div class="table column">';
115
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
115
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
116 116
 
117 117
 		include('table-output.php'); 
118 118
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@
 block discarded – undo
53 53
 	{
54 54
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
55 55
 		$ident = $spotter_array[0]['ident'];
56
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
56
+		if (isset($spotter_array[0]['latitude'])) {
57
+			$latitude = $spotter_array[0]['latitude'];
58
+		}
59
+		if (isset($spotter_array[0]['longitude'])) {
60
+			$longitude = $spotter_array[0]['longitude'];
61
+		}
58 62
 		require_once('header.php');
59 63
 		/*
60 64
 		if (isset($globalArchive) && $globalArchive) {
Please login to merge, or discard this patch.