Completed
Push — master ( 7b031c...3082e8 )
by Yannick
11:44
created
pilot-detailed.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@  discard block
 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) {
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 		*/
108 112
 		print '<div class="info column">';
109 113
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
110
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
114
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
115
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
116
+		}
111 117
 		print '</div>';
112 118
 	
113 119
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
pilot.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	header('Location: '.$globalURL.'/pilot/'.$_POST['pilot']);
10 10
 //} else if (isset($_GET['airport'])){
11 11
 } else {
12
-	$Spotter= new Spotter();
12
+	$Spotter = new Spotter();
13 13
 	$Stats = new Stats();
14 14
 	$title = _("Pilots");
15 15
 	require_once('header.php');
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	//ksort($pilot_names);
23 23
 	$previous = null;
24 24
 	print '<div class="alphabet-legend">';
25
-	foreach($pilot_names as $value) {
25
+	foreach ($pilot_names as $value) {
26 26
 		$firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1));
27
-		if($previous !== $firstLetter && $firstLetter != "'")
27
+		if ($previous !== $firstLetter && $firstLetter != "'")
28 28
 		{
29
-			if ($previous !== null){
29
+			if ($previous !== null) {
30 30
 				print ' | ';
31 31
 			}
32 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 	print '</div>';
37 37
 	$previous = null;
38
-	foreach($pilot_names as $value) {
38
+	foreach ($pilot_names as $value) {
39 39
 		$firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1));
40 40
 		if ($firstLetter != "")
41 41
 		{
42
-			if($previous !== $firstLetter && $firstLetter != "'")
42
+			if ($previous !== $firstLetter && $firstLetter != "'")
43 43
 			{
44
-				if ($previous !== null){
44
+				if ($previous !== null) {
45 45
 					print '</div>';
46 46
 				}
47 47
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 			}
32 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
33 33
 		}
34
-		if ($firstLetter != "'") $previous = $firstLetter;
34
+		if ($firstLetter != "'") {
35
+			$previous = $firstLetter;
36
+		}
35 37
 	}
36 38
 	print '</div>';
37 39
 	$previous = null;
@@ -46,10 +48,15 @@  discard block
 block discarded – undo
46 48
 				}
47 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
48 50
 			}
49
-			if ($firstLetter != "'") $previous = $firstLetter;
51
+			if ($firstLetter != "'") {
52
+				$previous = $firstLetter;
53
+			}
50 54
 			print '<div class="alphabet-item">';
51
-			if (isset($value['pilot_id']) && $value['pilot_id'] != '') print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
52
-			else print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
55
+			if (isset($value['pilot_id']) && $value['pilot_id'] != '') {
56
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
57
+			} else {
58
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
59
+			}
53 60
 			print '</a>';
54 61
 			print '</div>';
55 62
 		}
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($owner,$limit_start.",".$absolute_difference);
48
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $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.
owner.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	header('Location: '.$globalURL.'/owner/'.$_POST['owner']);
11 11
 //} else if (isset($_GET['airport'])){
12 12
 } else {
13
-	$Spotter= new Spotter();
13
+	$Spotter = new Spotter();
14 14
 	$Stats = new Stats();
15 15
 	$Common = new Common();
16 16
 	$title = _("Owners");
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	ksort($owner_names);
25 25
 	$previous = null;
26 26
 	print '<div class="alphabet-legend">';
27
-	foreach($owner_names as $value) {
27
+	foreach ($owner_names as $value) {
28 28
 		$firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1)));
29
-		if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
29
+		if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
30 30
 		{
31
-			if ($previous !== null){
31
+			if ($previous !== null) {
32 32
 				print ' | ';
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 	print '</div>';
39 39
 	$previous = null;
40
-	foreach($owner_names as $value) {
40
+	foreach ($owner_names as $value) {
41 41
 		$firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1)));
42 42
 		if ($firstLetter != "")
43 43
 		{
44
-			if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
44
+			if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
45 45
 			{
46
-				if ($previous !== null){
46
+				if ($previous !== null) {
47 47
 					print '</div>';
48 48
 				}
49 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
35 35
 		}
36
-		if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
36
+		if ($firstLetter != "'" && $firstLetter != '"') {
37
+			$previous = $firstLetter;
38
+		}
37 39
 	}
38 40
 	print '</div>';
39 41
 	$previous = null;
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 				}
49 51
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
50 52
 			}
51
-			if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
53
+			if ($firstLetter != "'" && $firstLetter != '"') {
54
+				$previous = $firstLetter;
55
+			}
52 56
 			print '<div class="alphabet-item">';
53 57
 			print '<a href="'.$globalURL.'/owner/'.$value['owner_name'].'">';
54 58
 			print $value['owner_name'];
Please login to merge, or discard this patch.
require/class.Common.php 3 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 	//protected $cookies = array();
7 7
 	
8 8
 	/**
9
-	* Get data from form result
10
-	* @param String $url form URL
11
-	* @param String $type type of submit form method (get or post)
12
-	* @param String|Array $data values form post method
13
-	* @param Array $headers header to submit with the form
14
-	* @return String the result
15
-	*/
9
+	 * Get data from form result
10
+	 * @param String $url form URL
11
+	 * @param String $type type of submit form method (get or post)
12
+	 * @param String|Array $data values form post method
13
+	 * @param Array $headers header to submit with the form
14
+	 * @return String the result
15
+	 */
16 16
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
17 17
 		$ch = curl_init();
18 18
 		curl_setopt($ch, CURLOPT_URL, $url);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
68 68
 			}
69 69
 		} else {
70
-		    return $result;
70
+			return $result;
71 71
 		}
72 72
 	}
73 73
 	
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 	
98 98
 	/**
99
-	* Convert a HTML table to an array
100
-	* @param String $data HTML page
101
-	* @return Array array of the tables in HTML page
102
-	*/
99
+	 * Convert a HTML table to an array
100
+	 * @param String $data HTML page
101
+	 * @return Array array of the tables in HTML page
102
+	 */
103 103
 	public function table2array($data) {
104 104
 		if (!is_string($data)) return array();
105 105
 		if ($data == '') return array();
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 	
135 135
 	/**
136
-	* Convert <p> part of a HTML page to an array
137
-	* @param String $data HTML page
138
-	* @return Array array of the <p> in HTML page
139
-	*/
136
+	 * Convert <p> part of a HTML page to an array
137
+	 * @param String $data HTML page
138
+	 * @return Array array of the <p> in HTML page
139
+	 */
140 140
 	public function text2array($data) {
141 141
 		$html = str_get_html($data);
142 142
 		if ($html === false) return array();
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	/**
154
-	* Give distance between 2 coordonnates
155
-	* @param Float $lat latitude of first point
156
-	* @param Float $lon longitude of first point
157
-	* @param Float $latc latitude of second point
158
-	* @param Float $lonc longitude of second point
159
-	* @param String $unit km else no unit used
160
-	* @return Float Distance in $unit
161
-	*/
154
+	 * Give distance between 2 coordonnates
155
+	 * @param Float $lat latitude of first point
156
+	 * @param Float $lon longitude of first point
157
+	 * @param Float $latc latitude of second point
158
+	 * @param Float $lonc longitude of second point
159
+	 * @param String $unit km else no unit used
160
+	 * @return Float Distance in $unit
161
+	 */
162 162
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163 163
 		if ($lat == $latc && $lon == $lonc) return 0;
164 164
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 	/**
179
-	* Check is distance realistic
180
-	* @param int $timeDifference the time between the reception of both messages
181
-	* @param float $distance distance covered
182
-	* @return whether distance is realistic
183
-	*/
179
+	 * Check is distance realistic
180
+	 * @param int $timeDifference the time between the reception of both messages
181
+	 * @param float $distance distance covered
182
+	 * @return whether distance is realistic
183
+	 */
184 184
 	public function withinThreshold ($timeDifference, $distance) {
185 185
 		$x = abs($timeDifference);
186 186
 		$d = abs($distance);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public function isInteger($input){
201
-	    return(ctype_digit(strval($input)));
201
+		return(ctype_digit(strval($input)));
202 202
 	}
203 203
 
204 204
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 	
216 216
 	/**
217
-	* Copy folder contents
218
-	* @param       string   $source    Source path
219
-	* @param       string   $dest      Destination path
220
-	* @return      bool     Returns true on success, false on failure
221
-	*/
217
+	 * Copy folder contents
218
+	 * @param       string   $source    Source path
219
+	 * @param       string   $dest      Destination path
220
+	 * @return      bool     Returns true on success, false on failure
221
+	 */
222 222
 	public function xcopy($source, $dest)
223 223
 	{
224 224
 		$files = glob($source.'*.*');
@@ -230,20 +230,20 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 	
232 232
 	/**
233
-	* Check if an url exist
234
-	* @param	String $url url to check
235
-	* @return	bool Return true on succes false on failure
236
-	*/
233
+	 * Check if an url exist
234
+	 * @param	String $url url to check
235
+	 * @return	bool Return true on succes false on failure
236
+	 */
237 237
 	public function urlexist($url){
238 238
 		$headers=get_headers($url);
239 239
 		return stripos($headers[0],"200 OK")?true:false;
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Convert hexa to string
244
-	* @param	String $hex data in hexa
245
-	* @return	String Return result
246
-	*/
243
+	 * Convert hexa to string
244
+	 * @param	String $hex data in hexa
245
+	 * @return	String Return result
246
+	 */
247 247
 	public function hex2str($hex) {
248 248
 		$str = '';
249 249
 		$hexln = strlen($hex);
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 	}
302 302
 	
303 303
 	/**
304
-	* Returns list of available locales
305
-	*
306
-	* @return array
304
+	 * Returns list of available locales
305
+	 *
306
+	 * @return array
307 307
 	 */
308 308
 	public function listLocaleDir()
309 309
 	{
@@ -398,100 +398,100 @@  discard block
 block discarded – undo
398 398
 	function remove_accents($string) {
399 399
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
400 400
 		$chars = array(
401
-		    // Decompositions for Latin-1 Supplement
402
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
403
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
404
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
405
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
406
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
407
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
408
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
409
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
410
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
411
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
412
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
413
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
414
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
415
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
416
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
417
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
418
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
419
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
420
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
421
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
422
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
423
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
424
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
425
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
426
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
427
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
428
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
429
-		    chr(195).chr(191) => 'y',
430
-		    // Decompositions for Latin Extended-A
431
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
432
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
433
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
434
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
435
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
436
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
437
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
438
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
439
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
440
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
441
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
442
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
443
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
444
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
445
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
446
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
447
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
448
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
449
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
450
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
451
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
452
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
453
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
457
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
460
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
461
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
462
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
463
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
464
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
465
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
466
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
467
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
468
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
469
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
479
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
482
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
483
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
484
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
485
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
486
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
487
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
488
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
489
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
490
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
491
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
492
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
493
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
494
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
401
+			// Decompositions for Latin-1 Supplement
402
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
403
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
404
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
405
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
406
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
407
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
408
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
409
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
410
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
411
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
412
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
413
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
414
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
415
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
416
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
417
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
418
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
419
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
420
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
421
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
422
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
423
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
424
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
425
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
426
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
427
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
428
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
429
+			chr(195).chr(191) => 'y',
430
+			// Decompositions for Latin Extended-A
431
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
432
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
433
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
434
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
435
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
436
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
437
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
438
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
439
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
440
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
441
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
442
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
443
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
444
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
445
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
446
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
447
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
448
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
449
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
450
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
451
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
452
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
453
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
457
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
460
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
461
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
462
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
463
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
464
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
465
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
466
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
467
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
468
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
469
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
479
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
482
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
483
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
484
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
485
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
486
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
487
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
488
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
489
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
490
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
491
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
492
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
493
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
494
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
495 495
 		);
496 496
 		$string = strtr($string, $chars);
497 497
 		return $string;
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 	* @param Array $headers header to submit with the form
14 14
 	* @return String the result
15 15
 	*/
16
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
16
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') {
17 17
 		$ch = curl_init();
18 18
 		curl_setopt($ch, CURLOPT_URL, $url);
19 19
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20 20
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
21 21
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
22
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
22
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
23 23
 		//curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
24 24
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
25 25
 		if ($useragent == '') {
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 		}
30 30
 		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31 31
 		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
32
-		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
32
+		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback"));
33 33
 		if ($type == 'post') {
34 34
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
35 35
 			if (is_array($data)) {
36 36
 				curl_setopt($ch, CURLOPT_POST, count($data));
37 37
 				$data_string = '';
38
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
38
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
39 39
 				rtrim($data_string, '&');
40 40
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
41 41
 			} else {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		if ($cookie != '') {
49 49
 			if (is_array($cookie)) {
50
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
50
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
51 51
 			} else {
52 52
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
53 53
 			}
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 		$result = curl_exec($ch);
59 59
 		$info = curl_getinfo($ch);
60 60
 		curl_close($ch);
61
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
61
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
62 62
 			echo "Cloudflare Detected\n";
63 63
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
64 64
 			$useragent = UAgent::random();
65 65
 			cloudflare::useUserAgent($useragent);
66 66
 			if ($clearanceCookie = cloudflare::bypass($url)) {
67
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
67
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
68 68
 			}
69 69
 		} else {
70 70
 		    return $result;
@@ -105,27 +105,27 @@  discard block
 block discarded – undo
105 105
 		if ($data == '') return array();
106 106
 		$html = str_get_html($data);
107 107
 		if ($html === false) return array();
108
-		$tabledata=array();
109
-		foreach($html->find('tr') as $element)
108
+		$tabledata = array();
109
+		foreach ($html->find('tr') as $element)
110 110
 		{
111 111
 			$td = array();
112
-			foreach( $element->find('th') as $row)
112
+			foreach ($element->find('th') as $row)
113 113
 			{
114 114
 				$td [] = trim($row->plaintext);
115 115
 			}
116
-			$td=array_filter($td);
116
+			$td = array_filter($td);
117 117
 			$tabledata[] = $td;
118 118
 
119 119
 			$td = array();
120 120
 			$tdi = array();
121
-			foreach( $element->find('td') as $row)
121
+			foreach ($element->find('td') as $row)
122 122
 			{
123 123
 				$td [] = trim($row->plaintext);
124 124
 				$tdi [] = trim($row->innertext);
125 125
 			}
126
-			$td=array_filter($td);
127
-			$tdi=array_filter($tdi);
128
-			$tabledata[]=array_merge($td,$tdi);
126
+			$td = array_filter($td);
127
+			$tdi = array_filter($tdi);
128
+			$tabledata[] = array_merge($td, $tdi);
129 129
 		}
130 130
 		$html->clear();
131 131
 		unset($html);
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	public function text2array($data) {
141 141
 		$html = str_get_html($data);
142 142
 		if ($html === false) return array();
143
-		$tabledata=array();
144
-		foreach($html->find('p') as $element)
143
+		$tabledata = array();
144
+		foreach ($html->find('p') as $element)
145 145
 		{
146 146
 			$tabledata [] = trim($element->plaintext);
147 147
 		}
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	*/
162 162
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163 163
 		if ($lat == $latc && $lon == $lonc) return 0;
164
-		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
164
+		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515;
165 165
 		if ($unit == "km") {
166
-			return round($dist * 1.609344);
166
+			return round($dist*1.609344);
167 167
 		} elseif ($unit == "m") {
168
-			return round($dist * 1.609344 * 1000);
168
+			return round($dist*1.609344*1000);
169 169
 		} elseif ($unit == "mile" || $unit == "mi") {
170 170
 			return round($dist);
171 171
 		} elseif ($unit == "nm") {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	* @param float $distance distance covered
182 182
 	* @return whether distance is realistic
183 183
 	*/
184
-	public function withinThreshold ($timeDifference, $distance) {
184
+	public function withinThreshold($timeDifference, $distance) {
185 185
 		$x = abs($timeDifference);
186 186
 		$d = abs($distance);
187 187
 		if ($x == 0 || $d == 0) return true;
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 		return ($array !== array_values($array));
198 198
 	}
199 199
 
200
-	public function isInteger($input){
200
+	public function isInteger($input) {
201 201
 	    return(ctype_digit(strval($input)));
202 202
 	}
203 203
 
204 204
 
205
-	public function convertDec($dms,$latlong) {
205
+	public function convertDec($dms, $latlong) {
206 206
 		if ($latlong == 'latitude') {
207 207
 			$deg = substr($dms, 0, 2);
208 208
 			$min = substr($dms, 2, 4);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			$deg = substr($dms, 0, 3);
211 211
 			$min = substr($dms, 3, 5);
212 212
 		}
213
-		return $deg+(($min*60)/3600);
213
+		return $deg + (($min*60)/3600);
214 214
 	}
215 215
 	
216 216
 	/**
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	public function xcopy($source, $dest)
223 223
 	{
224 224
 		$files = glob($source.'*.*');
225
-		foreach($files as $file){
226
-			$file_to_go = str_replace($source,$dest,$file);
225
+		foreach ($files as $file) {
226
+			$file_to_go = str_replace($source, $dest, $file);
227 227
 			copy($file, $file_to_go);
228 228
 		}
229 229
 		return true;
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 	* @param	String $url url to check
235 235
 	* @return	bool Return true on succes false on failure
236 236
 	*/
237
-	public function urlexist($url){
238
-		$headers=get_headers($url);
239
-		return stripos($headers[0],"200 OK")?true:false;
237
+	public function urlexist($url) {
238
+		$headers = get_headers($url);
239
+		return stripos($headers[0], "200 OK") ? true : false;
240 240
 	}
241 241
 	
242 242
 	/**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	public function hex2str($hex) {
248 248
 		$str = '';
249 249
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
250
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
251 251
 		return $str;
252 252
 	}
253 253
 	
@@ -256,33 +256,33 @@  discard block
 block discarded – undo
256 256
 		//difference in longitudinal coordinates
257 257
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
258 258
 		//difference in the phi of latitudinal coordinates
259
-		$dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4));
259
+		$dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4));
260 260
 		//we need to recalculate $dLon if it is greater than pi
261
-		if(abs($dLon) > pi()) {
262
-			if($dLon > 0) {
263
-				$dLon = (2 * pi() - $dLon) * -1;
261
+		if (abs($dLon) > pi()) {
262
+			if ($dLon > 0) {
263
+				$dLon = (2*pi() - $dLon)*-1;
264 264
 			} else {
265
-				$dLon = 2 * pi() + $dLon;
265
+				$dLon = 2*pi() + $dLon;
266 266
 			}
267 267
 		}
268 268
 		//return the angle, normalized
269
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
269
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
270 270
 	}
271 271
 	
272
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.1) {
272
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.1) {
273 273
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
274
-		$a = -($lon2-$lon1);
274
+		$a = -($lon2 - $lon1);
275 275
 		$b = $lat2 - $lat1;
276
-		$c = -($a*$lat1+$b*$lon1);
277
-		$d = $a*$lat3+$b*$lon3+$c;
276
+		$c = -($a*$lat1 + $b*$lon1);
277
+		$d = $a*$lat3 + $b*$lon3 + $c;
278 278
 		if ($d > -$approx && $d < $approx) return true;
279 279
 		else return false;
280 280
 	}
281 281
 	
282 282
 	public function array_merge_noappend() {
283 283
 		$output = array();
284
-		foreach(func_get_args() as $array) {
285
-			foreach($array as $key => $value) {
284
+		foreach (func_get_args() as $array) {
285
+			foreach ($array as $key => $value) {
286 286
 				$output[$key] = isset($output[$key]) ?
287 287
 				array_merge($output[$key], $value) : $value;
288 288
 			}
@@ -323,34 +323,34 @@  discard block
 block discarded – undo
323 323
 		return $result;
324 324
 	}
325 325
 
326
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){
326
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) {
327 327
 		global $globalMapRefresh;
328 328
 		$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
329 329
 		$r = 6378;
330 330
 		$latitude = deg2rad($latitude);
331 331
 		$longitude = deg2rad($longitude);
332 332
 		$bearing = deg2rad($heading); 
333
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
334
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
335
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
333
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
334
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
335
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
336 336
 	}
337 337
 	
338
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
338
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
339 339
 		// distance in meter
340 340
 		$R = 6378.14;
341
-		$latitude1 = $latitude * (M_PI/180);
342
-		$longitude1 = $longitude * (M_PI/180);
343
-		$brng = $bearing * (M_PI/180);
341
+		$latitude1 = $latitude*(M_PI/180);
342
+		$longitude1 = $longitude*(M_PI/180);
343
+		$brng = $bearing*(M_PI/180);
344 344
 		$d = $distance;
345 345
 
346 346
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
347
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
347
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
348 348
 
349
-		$latitude2 = $latitude2 * (180/M_PI);
350
-		$longitude2 = $longitude2 * (180/M_PI);
349
+		$latitude2 = $latitude2*(180/M_PI);
350
+		$longitude2 = $longitude2*(180/M_PI);
351 351
 
352
-		$flat = round ($latitude2,6);
353
-		$flong = round ($longitude2,6);
352
+		$flat = round($latitude2, 6);
353
+		$flong = round($longitude2, 6);
354 354
 /*
355 355
 		$dx = $distance*cos($bearing);
356 356
 		$dy = $distance*sin($bearing);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		$flong = $longitude + $dlong;
360 360
 		$flat = $latitude + $dlat;
361 361
 */
362
-		return array('latitude' => $flat,'longitude' => $flong);
362
+		return array('latitude' => $flat, 'longitude' => $flong);
363 363
 	}
364 364
 
365 365
 	/**
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 	 * @param integer $level GZIP compression level (default: 9)
374 374
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
375 375
 	 */
376
-	public function gzCompressFile($source, $level = 9){ 
377
-		$dest = $source . '.gz'; 
378
-		$mode = 'wb' . $level; 
376
+	public function gzCompressFile($source, $level = 9) { 
377
+		$dest = $source.'.gz'; 
378
+		$mode = 'wb'.$level; 
379 379
 		$error = false; 
380 380
 		if ($fp_out = gzopen($dest, $mode)) { 
381
-			if ($fp_in = fopen($source,'rb')) { 
381
+			if ($fp_in = fopen($source, 'rb')) { 
382 382
 				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
383
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
384 384
 				fclose($fp_in); 
385 385
 			} else {
386 386
 				$error = true; 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	} 
397 397
 	
398 398
 	function remove_accents($string) {
399
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
399
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
400 400
 		$chars = array(
401 401
 		    // Decompositions for Latin-1 Supplement
402 402
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454 454
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455 455
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
456
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
457 457
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458 458
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459 459
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470 470
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471 471
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
472
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
473
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
474
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
475
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
476
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
477
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
478
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
479 479
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480 480
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481 481
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
Please login to merge, or discard this patch.
Braces   +60 added lines, -25 removed lines patch added patch discarded remove patch
@@ -27,8 +27,11 @@  discard block
 block discarded – undo
27 27
 		} else {
28 28
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
29 29
 		}
30
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
30
+		if ($timeout == '') {
31
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
32
+		} else {
33
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
34
+		}
32 35
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
33 36
 		if ($type == 'post') {
34 37
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -74,8 +77,9 @@  discard block
 block discarded – undo
74 77
 	private function curlResponseHeaderCallback($ch, $headerLine) {
75 78
 		//global $cookies;
76 79
 		$cookies = array();
77
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
78
-			$cookies[] = $cookie;
80
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
81
+					$cookies[] = $cookie;
82
+		}
79 83
 		return strlen($headerLine); // Needed by curl
80 84
 	}
81 85
 
@@ -86,11 +90,15 @@  discard block
 block discarded – undo
86 90
 		curl_setopt($ch, CURLOPT_URL, $url);
87 91
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
88 92
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
89
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
93
+		if ($referer != '') {
94
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
95
+		}
90 96
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
91 97
 		curl_setopt($ch, CURLOPT_FILE, $fp);
92 98
 		curl_exec($ch);
93
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
99
+		if (curl_errno($ch) && $globalDebug) {
100
+			echo 'Download error: '.curl_error($ch);
101
+		}
94 102
 		curl_close($ch);
95 103
 		fclose($fp);
96 104
 	}
@@ -101,10 +109,16 @@  discard block
 block discarded – undo
101 109
 	* @return Array array of the tables in HTML page
102 110
 	*/
103 111
 	public function table2array($data) {
104
-		if (!is_string($data)) return array();
105
-		if ($data == '') return array();
112
+		if (!is_string($data)) {
113
+			return array();
114
+		}
115
+		if ($data == '') {
116
+			return array();
117
+		}
106 118
 		$html = str_get_html($data);
107
-		if ($html === false) return array();
119
+		if ($html === false) {
120
+			return array();
121
+		}
108 122
 		$tabledata=array();
109 123
 		foreach($html->find('tr') as $element)
110 124
 		{
@@ -139,7 +153,9 @@  discard block
 block discarded – undo
139 153
 	*/
140 154
 	public function text2array($data) {
141 155
 		$html = str_get_html($data);
142
-		if ($html === false) return array();
156
+		if ($html === false) {
157
+			return array();
158
+		}
143 159
 		$tabledata=array();
144 160
 		foreach($html->find('p') as $element)
145 161
 		{
@@ -160,7 +176,9 @@  discard block
 block discarded – undo
160 176
 	* @return Float Distance in $unit
161 177
 	*/
162 178
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163
-		if ($lat == $latc && $lon == $lonc) return 0;
179
+		if ($lat == $latc && $lon == $lonc) {
180
+			return 0;
181
+		}
164 182
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
165 183
 		if ($unit == "km") {
166 184
 			return round($dist * 1.609344);
@@ -184,10 +202,16 @@  discard block
 block discarded – undo
184 202
 	public function withinThreshold ($timeDifference, $distance) {
185 203
 		$x = abs($timeDifference);
186 204
 		$d = abs($distance);
187
-		if ($x == 0 || $d == 0) return true;
205
+		if ($x == 0 || $d == 0) {
206
+			return true;
207
+		}
188 208
 		// may be due to Internet jitter; distance is realistic
189
-		if ($x < 0.7 && $d < 2000) return true;
190
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
209
+		if ($x < 0.7 && $d < 2000) {
210
+			return true;
211
+		} else {
212
+			return $d/$x < 1500*0.27778;
213
+		}
214
+		// 1500 km/h max
191 215
 	}
192 216
 
193 217
 
@@ -247,7 +271,9 @@  discard block
 block discarded – undo
247 271
 	public function hex2str($hex) {
248 272
 		$str = '';
249 273
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
274
+		for($i=0;$i<$hexln;$i+=2) {
275
+			$str .= chr(hexdec(substr($hex,$i,2)));
276
+		}
251 277
 		return $str;
252 278
 	}
253 279
 	
@@ -275,8 +301,11 @@  discard block
 block discarded – undo
275 301
 		$b = $lat2 - $lat1;
276 302
 		$c = -($a*$lat1+$b*$lon1);
277 303
 		$d = $a*$lat3+$b*$lon3+$c;
278
-		if ($d > -$approx && $d < $approx) return true;
279
-		else return false;
304
+		if ($d > -$approx && $d < $approx) {
305
+			return true;
306
+		} else {
307
+			return false;
308
+		}
280 309
 	}
281 310
 	
282 311
 	public function array_merge_noappend() {
@@ -312,7 +341,9 @@  discard block
 block discarded – undo
312 341
 			return $result;
313 342
 		}
314 343
 		$handle = @opendir('./locale');
315
-		if ($handle === false) return $result;
344
+		if ($handle === false) {
345
+			return $result;
346
+		}
316 347
 		while (false !== ($file = readdir($handle))) {
317 348
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
318 349
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -379,8 +410,9 @@  discard block
 block discarded – undo
379 410
 		$error = false; 
380 411
 		if ($fp_out = gzopen($dest, $mode)) { 
381 412
 			if ($fp_in = fopen($source,'rb')) { 
382
-				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
413
+				while (!feof($fp_in)) {
414
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
415
+				}
384 416
 				fclose($fp_in); 
385 417
 			} else {
386 418
 				$error = true; 
@@ -389,14 +421,17 @@  discard block
 block discarded – undo
389 421
 		} else {
390 422
 			$error = true; 
391 423
 		}
392
-		if ($error)
393
-			return false; 
394
-		else
395
-			return $dest; 
424
+		if ($error) {
425
+					return false;
426
+		} else {
427
+					return $dest;
428
+		}
396 429
 	} 
397 430
 	
398 431
 	function remove_accents($string) {
399
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
432
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
433
+			return $string;
434
+		}
400 435
 		$chars = array(
401 436
 		    // Decompositions for Latin-1 Supplement
402 437
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
Please login to merge, or discard this patch.
require/class.Stats.php 3 patches
Indentation   +757 added lines, -757 removed lines patch added patch discarded remove patch
@@ -15,33 +15,33 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
21
+				$query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
43
-        public function deleteStats($filter_name = '') {
44
-        	/*
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43
+		public function deleteStats($filter_name = '') {
44
+			/*
45 45
         	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
@@ -50,106 +50,106 @@  discard block
 block discarded – undo
50 50
                         return "error : ".$e->getMessage();
51 51
                 }
52 52
                 */
53
-        	$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
54
-                 try {
55
-                        $sth = $this->db->prepare($query);
56
-                        $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-        }
61
-        public function deleteOldStats($filter_name = '') {
53
+			$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
54
+				 try {
55
+						$sth = $this->db->prepare($query);
56
+						$sth->execute(array(':filter_name' => $filter_name));
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+		}
61
+		public function deleteOldStats($filter_name = '') {
62 62
         	
63
-        	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
-                 try {
65
-                        $sth = $this->db->prepare($query);
66
-                        $sth->execute();
67
-                } catch(PDOException $e) {
68
-                        return "error : ".$e->getMessage();
69
-                }
63
+			$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
+				 try {
65
+						$sth = $this->db->prepare($query);
66
+						$sth->execute();
67
+				} catch(PDOException $e) {
68
+						return "error : ".$e->getMessage();
69
+				}
70 70
                 
71
-        	$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
72
-                 try {
73
-                        $sth = $this->db->prepare($query);
74
-                        $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
76
-                        return "error : ".$e->getMessage();
77
-                }
78
-        }
71
+			$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
72
+				 try {
73
+						$sth = $this->db->prepare($query);
74
+						$sth->execute(array(':filter_name' => $filter_name));
75
+				} catch(PDOException $e) {
76
+						return "error : ".$e->getMessage();
77
+				}
78
+		}
79 79
 	public function getAllAirlineNames($filter_name = '') {
80 80
 		if ($filter_name == '') $filter_name = $this->filter_name;
81
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
-                 try {
83
-                        $sth = $this->db->prepare($query);
84
-                        $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
86
-                        echo "error : ".$e->getMessage();
87
-                }
88
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
-                return $all;
90
-        }
81
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
+				 try {
83
+						$sth = $this->db->prepare($query);
84
+						$sth->execute(array(':filter_name' => $filter_name));
85
+				} catch(PDOException $e) {
86
+						echo "error : ".$e->getMessage();
87
+				}
88
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
+				return $all;
90
+		}
91 91
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
-                 try {
95
-                        $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
98
-                        echo "error : ".$e->getMessage();
99
-                }
100
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
-                return $all;
102
-        }
93
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
+				 try {
95
+						$sth = $this->db->prepare($query);
96
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
+				} catch(PDOException $e) {
98
+						echo "error : ".$e->getMessage();
99
+				}
100
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
+				return $all;
102
+		}
103 103
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
105
-                $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106
-                 try {
107
-                        $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
110
-                        echo "error : ".$e->getMessage();
111
-                }
112
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
-                return $all;
114
-        }
105
+				$query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106
+				 try {
107
+						$sth = $this->db->prepare($query);
108
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
+				} catch(PDOException $e) {
110
+						echo "error : ".$e->getMessage();
111
+				}
112
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
+				return $all;
114
+		}
115 115
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
117
-                $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118
-                 try {
119
-                        $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
122
-                        echo "error : ".$e->getMessage();
123
-                }
124
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
-                return $all;
126
-        }
117
+				$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118
+				 try {
119
+						$sth = $this->db->prepare($query);
120
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
+				} catch(PDOException $e) {
122
+						echo "error : ".$e->getMessage();
123
+				}
124
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
+				return $all;
126
+		}
127 127
 
128 128
 	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
129 129
 		if ($filter_name == '') $filter_name = $this->filter_name;
130
-                $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
131
-                 try {
132
-                        $sth = $this->db->prepare($query);
133
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
134
-                } catch(PDOException $e) {
135
-                        echo "error : ".$e->getMessage();
136
-                }
137
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
138
-                return $all;
139
-        }
130
+				$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
131
+				 try {
132
+						$sth = $this->db->prepare($query);
133
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
134
+				} catch(PDOException $e) {
135
+						echo "error : ".$e->getMessage();
136
+				}
137
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
138
+				return $all;
139
+		}
140 140
 
141 141
 	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
142 142
 		if ($filter_name == '') $filter_name = $this->filter_name;
143
-                $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
144
-                 try {
145
-                        $sth = $this->db->prepare($query);
146
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
147
-                } catch(PDOException $e) {
148
-                        echo "error : ".$e->getMessage();
149
-                }
150
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
151
-                return $all;
152
-        }
143
+				$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
144
+				 try {
145
+						$sth = $this->db->prepare($query);
146
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
147
+				} catch(PDOException $e) {
148
+						echo "error : ".$e->getMessage();
149
+				}
150
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
151
+				return $all;
152
+		}
153 153
 
154 154
 
155 155
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 			}
167 167
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
168 168
 		} else $all = array();
169
-                if (empty($all)) {
170
-            	    $filters = array('airlines' => array($stats_airline));
171
-            	    if ($filter_name != '') {
172
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
173
-            	    }
174
-            	    $Spotter = new Spotter($this->db);
175
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
176
-                }
177
-                return $all;
169
+				if (empty($all)) {
170
+					$filters = array('airlines' => array($stats_airline));
171
+					if ($filter_name != '') {
172
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
173
+					}
174
+					$Spotter = new Spotter($this->db);
175
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
176
+				}
177
+				return $all;
178 178
 	}
179 179
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
180 180
 		global $globalStatsFilters;
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 			}
191 191
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
192 192
 		} else $all = array();
193
-                if (empty($all)) {
194
-            		$Spotter = new Spotter($this->db);
195
-            		$filters = array();
196
-            		if ($filter_name != '') {
197
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
193
+				if (empty($all)) {
194
+					$Spotter = new Spotter($this->db);
195
+					$filters = array();
196
+					if ($filter_name != '') {
197
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
198 198
 			}
199
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
200
-                }
201
-                return $all;
199
+					$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
200
+				}
201
+				return $all;
202 202
 	}
203 203
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
204 204
 		global $globalStatsFilters;
@@ -239,37 +239,37 @@  discard block
 block discarded – undo
239 239
 			}
240 240
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
241 241
 		} else $all = array();
242
-                if (empty($all)) {
242
+				if (empty($all)) {
243 243
 			$filters = array('airlines' => array($stats_airline));
244 244
 			if ($filter_name != '') {
245
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
245
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
246 246
 			}
247 247
 			$Spotter = new Spotter($this->db);
248 248
 			$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month);
249
-                }
250
-                return $all;
249
+				}
250
+				return $all;
251 251
 	}
252 252
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
253 253
 		global $globalStatsFilters;
254 254
 		if ($filter_name == '') $filter_name = $this->filter_name;
255 255
 		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
256 256
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
257
-                 try {
258
-                        $sth = $this->db->prepare($query);
259
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
260
-                } catch(PDOException $e) {
261
-                        echo "error : ".$e->getMessage();
262
-                }
263
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
264
-                if (empty($all)) {
257
+				 try {
258
+						$sth = $this->db->prepare($query);
259
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
260
+				} catch(PDOException $e) {
261
+						echo "error : ".$e->getMessage();
262
+				}
263
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
264
+				if (empty($all)) {
265 265
 			$filters = array('airlines' => array($stats_airline));
266 266
 			if ($filter_name != '') {
267
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
267
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
268 268
 			}
269 269
 			$Spotter = new Spotter($this->db);
270 270
 			$all = $Spotter->countAllDepartureCountries($filters,$year,$month);
271
-                }
272
-                return $all;
271
+				}
272
+				return $all;
273 273
 	}
274 274
 
275 275
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 			}
287 287
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
288 288
 		} else $all = array();
289
-                if (empty($all)) {
290
-	                $Spotter = new Spotter($this->db);
291
-            		$filters = array();
292
-            		if ($filter_name != '') {
293
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
289
+				if (empty($all)) {
290
+					$Spotter = new Spotter($this->db);
291
+					$filters = array();
292
+					if ($filter_name != '') {
293
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
294 294
 			}
295 295
 
296
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
297
-                }
298
-                return $all;
296
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
297
+				}
298
+				return $all;
299 299
 	}
300 300
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
301 301
 		global $globalStatsFilters;
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 			}
312 312
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
313 313
 		} else $all = array();
314
-                if (empty($all)) {
314
+				if (empty($all)) {
315 315
 			$filters = array('airlines' => array($stats_airline));
316 316
 			if ($filter_name != '') {
317 317
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
318 318
 			}
319
-	                $Spotter = new Spotter($this->db);
320
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
321
-                }
322
-                return $all;
319
+					$Spotter = new Spotter($this->db);
320
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
321
+				}
322
+				return $all;
323 323
 	}
324 324
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
325 325
 		global $globalStatsFilters;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 					echo "error : ".$e->getMessage();
360 360
 				}
361 361
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
362
-                /*
362
+				/*
363 363
                 if (empty($all)) {
364 364
 	                $Spotter = new Spotter($this->db);
365 365
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -410,15 +410,15 @@  discard block
 block discarded – undo
410 410
 			}
411 411
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
412 412
 		} else $all = array();
413
-                if (empty($all)) {
413
+				if (empty($all)) {
414 414
 			$filters = array('airlines' => array($stats_airline));
415 415
 			if ($filter_name != '') {
416 416
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
417 417
 			}
418
-            		$Spotter = new Spotter($this->db);
419
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
420
-                }
421
-                return $all;
418
+					$Spotter = new Spotter($this->db);
419
+					$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
420
+				}
421
+				return $all;
422 422
 	}
423 423
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
424 424
 		global $globalStatsFilters;
@@ -434,33 +434,33 @@  discard block
 block discarded – undo
434 434
 			}
435 435
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
436 436
 		} else $all = array();
437
-                if (empty($all)) {
437
+				if (empty($all)) {
438 438
 			$filters = array('airlines' => array($stats_airline));
439
-            		if ($filter_name != '') {
440
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
441
-			}
442
-            		$Spotter = new Spotter($this->db);
443
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
444
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
445
-        		$all = array();
446
-        		foreach ($pall as $value) {
447
-        			$icao = $value['airport_departure_icao'];
448
-        			$all[$icao] = $value;
449
-        		}
439
+					if ($filter_name != '') {
440
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
441
+			}
442
+					$Spotter = new Spotter($this->db);
443
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
444
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
445
+				$all = array();
446
+				foreach ($pall as $value) {
447
+					$icao = $value['airport_departure_icao'];
448
+					$all[$icao] = $value;
449
+				}
450 450
         		
451
-        		foreach ($dall as $value) {
452
-        			$icao = $value['airport_departure_icao'];
453
-        			if (isset($all[$icao])) {
454
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
455
-        			} else $all[$icao] = $value;
456
-        		}
457
-        		$count = array();
458
-        		foreach ($all as $key => $row) {
459
-        			$count[$key] = $row['airport_departure_icao_count'];
460
-        		}
461
-        		array_multisort($count,SORT_DESC,$all);
462
-                }
463
-                return $all;
451
+				foreach ($dall as $value) {
452
+					$icao = $value['airport_departure_icao'];
453
+					if (isset($all[$icao])) {
454
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
455
+					} else $all[$icao] = $value;
456
+				}
457
+				$count = array();
458
+				foreach ($all as $key => $row) {
459
+					$count[$key] = $row['airport_departure_icao_count'];
460
+				}
461
+				array_multisort($count,SORT_DESC,$all);
462
+				}
463
+				return $all;
464 464
 	}
465 465
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
466 466
 		global $globalStatsFilters;
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
 			$Spotter = new Spotter($this->db);
485 485
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month);
486 486
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month);
487
-        		$all = array();
488
-        		foreach ($pall as $value) {
489
-        			$icao = $value['airport_arrival_icao'];
490
-        			$all[$icao] = $value;
491
-        		}
487
+				$all = array();
488
+				foreach ($pall as $value) {
489
+					$icao = $value['airport_arrival_icao'];
490
+					$all[$icao] = $value;
491
+				}
492 492
         		
493
-        		foreach ($dall as $value) {
494
-        			$icao = $value['airport_arrival_icao'];
495
-        			if (isset($all[$icao])) {
496
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
497
-        			} else $all[$icao] = $value;
498
-        		}
499
-        		$count = array();
500
-        		foreach ($all as $key => $row) {
501
-        			$count[$key] = $row['airport_arrival_icao_count'];
502
-        		}
503
-        		array_multisort($count,SORT_DESC,$all);
504
-                }
493
+				foreach ($dall as $value) {
494
+					$icao = $value['airport_arrival_icao'];
495
+					if (isset($all[$icao])) {
496
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
497
+					} else $all[$icao] = $value;
498
+				}
499
+				$count = array();
500
+				foreach ($all as $key => $row) {
501
+					$count[$key] = $row['airport_arrival_icao_count'];
502
+				}
503
+				array_multisort($count,SORT_DESC,$all);
504
+				}
505 505
  
506
-                return $all;
506
+				return $all;
507 507
 	}
508 508
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
509 509
 		global $globalDBdriver, $globalStatsFilters;
@@ -516,23 +516,23 @@  discard block
 block discarded – undo
516 516
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
517 517
 		}
518 518
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
519
-                 try {
520
-                        $sth = $this->db->prepare($query);
521
-                        $sth->execute($query_data);
522
-                } catch(PDOException $e) {
523
-                        echo "error : ".$e->getMessage();
524
-                }
525
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
526
-                if (empty($all)) {
519
+				 try {
520
+						$sth = $this->db->prepare($query);
521
+						$sth->execute($query_data);
522
+				} catch(PDOException $e) {
523
+						echo "error : ".$e->getMessage();
524
+				}
525
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
526
+				if (empty($all)) {
527 527
 			$filters = array('airlines' => array($stats_airline));
528 528
 			if ($filter_name != '') {
529 529
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
530 530
 			}
531
-            		$Spotter = new Spotter($this->db);
532
-            		$all = $Spotter->countAllMonthsLastYear($filters);
533
-                }
531
+					$Spotter = new Spotter($this->db);
532
+					$all = $Spotter->countAllMonthsLastYear($filters);
533
+				}
534 534
                 
535
-                return $all;
535
+				return $all;
536 536
 	}
537 537
 	
538 538
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -540,22 +540,22 @@  discard block
 block discarded – undo
540 540
 		if ($filter_name == '') $filter_name = $this->filter_name;
541 541
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
542 542
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
543
-                 try {
544
-                        $sth = $this->db->prepare($query);
545
-                        $sth->execute($query_data);
546
-                } catch(PDOException $e) {
547
-                        echo "error : ".$e->getMessage();
548
-                }
549
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
550
-                if (empty($all)) {
543
+				 try {
544
+						$sth = $this->db->prepare($query);
545
+						$sth->execute($query_data);
546
+				} catch(PDOException $e) {
547
+						echo "error : ".$e->getMessage();
548
+				}
549
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
550
+				if (empty($all)) {
551 551
 			$filters = array('airlines' => array($stats_airline));
552 552
 			if ($filter_name != '') {
553 553
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
554 554
 			}
555
-            		$Spotter = new Spotter($this->db);
556
-            		$all = $Spotter->countAllDatesLastMonth($filters);
557
-                }
558
-                return $all;
555
+					$Spotter = new Spotter($this->db);
556
+					$all = $Spotter->countAllDatesLastMonth($filters);
557
+				}
558
+				return $all;
559 559
 	}
560 560
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
561 561
 		global $globalDBdriver, $globalStatsFilters;
@@ -566,108 +566,108 @@  discard block
 block discarded – undo
566 566
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
567 567
 		}
568 568
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
569
-                 try {
570
-                        $sth = $this->db->prepare($query);
571
-                        $sth->execute($query_data);
572
-                } catch(PDOException $e) {
573
-                        echo "error : ".$e->getMessage();
574
-                }
575
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
576
-                if (empty($all)) {
569
+				 try {
570
+						$sth = $this->db->prepare($query);
571
+						$sth->execute($query_data);
572
+				} catch(PDOException $e) {
573
+						echo "error : ".$e->getMessage();
574
+				}
575
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
576
+				if (empty($all)) {
577 577
 			$filters = array('airlines' => array($stats_airline));
578 578
 			if ($filter_name != '') {
579 579
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
580 580
 			}
581
-            		$Spotter = new Spotter($this->db);
582
-            		$all = $Spotter->countAllDatesLast7Days($filters);
583
-                }
584
-                return $all;
581
+					$Spotter = new Spotter($this->db);
582
+					$all = $Spotter->countAllDatesLast7Days($filters);
583
+				}
584
+				return $all;
585 585
 	}
586 586
 	public function countAllDates($stats_airline = '',$filter_name = '') {
587 587
 		global $globalStatsFilters;
588 588
 		if ($filter_name == '') $filter_name = $this->filter_name;
589 589
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
590 590
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
591
-                 try {
592
-                        $sth = $this->db->prepare($query);
593
-                        $sth->execute($query_data);
594
-                } catch(PDOException $e) {
595
-                        echo "error : ".$e->getMessage();
596
-                }
597
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
598
-                if (empty($all)) {
591
+				 try {
592
+						$sth = $this->db->prepare($query);
593
+						$sth->execute($query_data);
594
+				} catch(PDOException $e) {
595
+						echo "error : ".$e->getMessage();
596
+				}
597
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
598
+				if (empty($all)) {
599 599
 			$filters = array('airlines' => array($stats_airline));
600 600
 			if ($filter_name != '') {
601
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
601
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
602 602
 			}
603
-            		$Spotter = new Spotter($this->db);
604
-            		$all = $Spotter->countAllDates($filters);
605
-                }
606
-                return $all;
603
+					$Spotter = new Spotter($this->db);
604
+					$all = $Spotter->countAllDates($filters);
605
+				}
606
+				return $all;
607 607
 	}
608 608
 	public function countAllDatesByAirlines($filter_name = '') {
609 609
 		global $globalStatsFilters;
610 610
 		if ($filter_name == '') $filter_name = $this->filter_name;
611 611
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
612 612
 		$query_data = array('filter_name' => $filter_name);
613
-                 try {
614
-                        $sth = $this->db->prepare($query);
615
-                        $sth->execute($query_data);
616
-                } catch(PDOException $e) {
617
-                        echo "error : ".$e->getMessage();
618
-                }
619
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
620
-                if (empty($all)) {
621
-            		$filters = array();
622
-            		if ($filter_name != '') {
623
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
613
+				 try {
614
+						$sth = $this->db->prepare($query);
615
+						$sth->execute($query_data);
616
+				} catch(PDOException $e) {
617
+						echo "error : ".$e->getMessage();
618
+				}
619
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
620
+				if (empty($all)) {
621
+					$filters = array();
622
+					if ($filter_name != '') {
623
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
624 624
 			}
625
-            		$Spotter = new Spotter($this->db);
626
-            		$all = $Spotter->countAllDatesByAirlines($filters);
627
-                }
628
-                return $all;
625
+					$Spotter = new Spotter($this->db);
626
+					$all = $Spotter->countAllDatesByAirlines($filters);
627
+				}
628
+				return $all;
629 629
 	}
630 630
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
631 631
 		global $globalStatsFilters;
632 632
 		if ($filter_name == '') $filter_name = $this->filter_name;
633
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
634
-                 try {
635
-                        $sth = $this->db->prepare($query);
636
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
637
-                } catch(PDOException $e) {
638
-                        echo "error : ".$e->getMessage();
639
-                }
640
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
641
-                if (empty($all)) {
633
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
634
+				 try {
635
+						$sth = $this->db->prepare($query);
636
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
637
+				} catch(PDOException $e) {
638
+						echo "error : ".$e->getMessage();
639
+				}
640
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
641
+				if (empty($all)) {
642 642
 			$filters = array('airlines' => array($stats_airline));
643 643
 			if ($filter_name != '') {
644 644
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
645 645
 			}
646
-            		$Spotter = new Spotter($this->db);
647
-            		$all = $Spotter->countAllMonths($filters);
648
-                }
649
-                return $all;
646
+					$Spotter = new Spotter($this->db);
647
+					$all = $Spotter->countAllMonths($filters);
648
+				}
649
+				return $all;
650 650
 	}
651 651
 	public function countAllMilitaryMonths($filter_name = '') {
652 652
 		global $globalStatsFilters;
653 653
 		if ($filter_name == '') $filter_name = $this->filter_name;
654
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
655
-                 try {
656
-                        $sth = $this->db->prepare($query);
657
-                        $sth->execute(array(':filter_name' => $filter_name));
658
-                } catch(PDOException $e) {
659
-                        echo "error : ".$e->getMessage();
660
-                }
661
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
662
-                if (empty($all)) {
663
-            		$filters = array();
664
-            		if ($filter_name != '') {
665
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
654
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
655
+				 try {
656
+						$sth = $this->db->prepare($query);
657
+						$sth->execute(array(':filter_name' => $filter_name));
658
+				} catch(PDOException $e) {
659
+						echo "error : ".$e->getMessage();
660
+				}
661
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
662
+				if (empty($all)) {
663
+					$filters = array();
664
+					if ($filter_name != '') {
665
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
666 666
 			}
667
-            		$Spotter = new Spotter($this->db);
668
-            		$all = $Spotter->countAllMilitaryMonths($filters);
669
-                }
670
-                return $all;
667
+					$Spotter = new Spotter($this->db);
668
+					$all = $Spotter->countAllMilitaryMonths($filters);
669
+				}
670
+				return $all;
671 671
 	}
672 672
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
673 673
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
684 684
 		}
685 685
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
686
-                 try {
687
-                        $sth = $this->db->prepare($query);
688
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
689
-                } catch(PDOException $e) {
690
-                        echo "error : ".$e->getMessage();
691
-                }
692
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
693
-                if (empty($all)) {
686
+				 try {
687
+						$sth = $this->db->prepare($query);
688
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
689
+				} catch(PDOException $e) {
690
+						echo "error : ".$e->getMessage();
691
+				}
692
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
693
+				if (empty($all)) {
694 694
 			$filters = array('airlines' => array($stats_airline));
695 695
 			if ($filter_name != '') {
696
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
696
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
697 697
 			}
698
-            		$Spotter = new Spotter($this->db);
699
-            		$all = $Spotter->countAllHours($orderby,$filters);
700
-                }
701
-                return $all;
698
+					$Spotter = new Spotter($this->db);
699
+					$all = $Spotter->countAllHours($orderby,$filters);
700
+				}
701
+				return $all;
702 702
 	}
703 703
 	
704 704
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 		if ($year == '') $year = date('Y');
723 723
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
724 724
 		if (empty($all)) {
725
-		        $filters = array();
726
-            		if ($filter_name != '') {
727
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
725
+				$filters = array();
726
+					if ($filter_name != '') {
727
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
728 728
 			}
729 729
 			$Spotter = new Spotter($this->db);
730 730
 			$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month);
@@ -776,9 +776,9 @@  discard block
 block discarded – undo
776 776
 			$all = $result[0]['nb_airline'];
777 777
 		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
778 778
 		if (empty($all)) {
779
-            		$filters = array();
780
-            		if ($filter_name != '') {
781
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
779
+					$filters = array();
780
+					if ($filter_name != '') {
781
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
782 782
 			}
783 783
 			$Spotter = new Spotter($this->db);
784 784
 			$all = $Spotter->countOverallAirlines($filters,$year,$month);
@@ -831,33 +831,33 @@  discard block
 block discarded – undo
831 831
 		if ($filter_name == '') $filter_name = $this->filter_name;
832 832
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
833 833
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
834
-                 try {
835
-                        $sth = $this->db->prepare($query);
836
-                        $sth->execute($query_values);
837
-                } catch(PDOException $e) {
838
-                        echo "error : ".$e->getMessage();
839
-                }
840
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
841
-                return $all;
834
+				 try {
835
+						$sth = $this->db->prepare($query);
836
+						$sth->execute($query_values);
837
+				} catch(PDOException $e) {
838
+						echo "error : ".$e->getMessage();
839
+				}
840
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
841
+				return $all;
842 842
 	}
843 843
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
844 844
 		if ($filter_name == '') $filter_name = $this->filter_name;
845
-                $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
846
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
847
-                 try {
848
-                        $sth = $this->db->prepare($query);
849
-                        $sth->execute($query_values);
850
-                } catch(PDOException $e) {
851
-                        echo "error : ".$e->getMessage();
852
-                }
853
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
854
-                return $all;
855
-        }
845
+				$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
846
+				$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
847
+				 try {
848
+						$sth = $this->db->prepare($query);
849
+						$sth->execute($query_values);
850
+				} catch(PDOException $e) {
851
+						echo "error : ".$e->getMessage();
852
+				}
853
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
854
+				return $all;
855
+		}
856 856
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858
-    		global $globalArchiveMonths, $globalDBdriver;
859
-    		if ($globalDBdriver == 'mysql') {
860
-    			if ($month == '') {
858
+			global $globalArchiveMonths, $globalDBdriver;
859
+			if ($globalDBdriver == 'mysql') {
860
+				if ($month == '') {
861 861
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
862 862
 				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
863 863
 			} else {
@@ -872,137 +872,137 @@  discard block
 block discarded – undo
872 872
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
873 873
 				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
874 874
 			}
875
-                }
876
-                 try {
877
-                        $sth = $this->db->prepare($query);
878
-                        $sth->execute($query_values);
879
-                } catch(PDOException $e) {
880
-                        echo "error : ".$e->getMessage();
881
-                }
882
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
883
-                return $all[0]['total'];
884
-        }
875
+				}
876
+				 try {
877
+						$sth = $this->db->prepare($query);
878
+						$sth->execute($query_values);
879
+				} catch(PDOException $e) {
880
+						echo "error : ".$e->getMessage();
881
+				}
882
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
883
+				return $all[0]['total'];
884
+		}
885 885
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
886
-    		global $globalArchiveMonths, $globalDBdriver;
886
+			global $globalArchiveMonths, $globalDBdriver;
887 887
 		if ($filter_name == '') $filter_name = $this->filter_name;
888
-    		if ($globalDBdriver == 'mysql') {
888
+			if ($globalDBdriver == 'mysql') {
889 889
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
890 890
 		} else {
891 891
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
892
-                }
893
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
894
-                 try {
895
-                        $sth = $this->db->prepare($query);
896
-                        $sth->execute($query_values);
897
-                } catch(PDOException $e) {
898
-                        echo "error : ".$e->getMessage();
899
-                }
900
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
901
-                return $all[0]['total'];
902
-        }
892
+				}
893
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
894
+				 try {
895
+						$sth = $this->db->prepare($query);
896
+						$sth->execute($query_values);
897
+				} catch(PDOException $e) {
898
+						echo "error : ".$e->getMessage();
899
+				}
900
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
901
+				return $all[0]['total'];
902
+		}
903 903
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
904
-    		global $globalArchiveMonths, $globalDBdriver;
904
+			global $globalArchiveMonths, $globalDBdriver;
905 905
 		if ($filter_name == '') $filter_name = $this->filter_name;
906
-    		if ($globalDBdriver == 'mysql') {
906
+			if ($globalDBdriver == 'mysql') {
907 907
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
908
-                } else {
908
+				} else {
909 909
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
910
-                }
911
-                 try {
912
-                        $sth = $this->db->prepare($query);
913
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
914
-                } catch(PDOException $e) {
915
-                        echo "error : ".$e->getMessage();
916
-                }
917
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
918
-                return $all[0]['total'];
919
-        }
910
+				}
911
+				 try {
912
+						$sth = $this->db->prepare($query);
913
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
914
+				} catch(PDOException $e) {
915
+						echo "error : ".$e->getMessage();
916
+				}
917
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
918
+				return $all[0]['total'];
919
+		}
920 920
 	public function getStatsAirlineTotal($filter_name = '') {
921
-    		global $globalArchiveMonths, $globalDBdriver;
921
+			global $globalArchiveMonths, $globalDBdriver;
922 922
 		if ($filter_name == '') $filter_name = $this->filter_name;
923
-    		if ($globalDBdriver == 'mysql') {
923
+			if ($globalDBdriver == 'mysql') {
924 924
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
925
-                } else {
925
+				} else {
926 926
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
927
-                }
928
-                 try {
929
-                        $sth = $this->db->prepare($query);
930
-                        $sth->execute(array(':filter_name' => $filter_name));
931
-                } catch(PDOException $e) {
932
-                        echo "error : ".$e->getMessage();
933
-                }
934
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
935
-                return $all[0]['total'];
936
-        }
927
+				}
928
+				 try {
929
+						$sth = $this->db->prepare($query);
930
+						$sth->execute(array(':filter_name' => $filter_name));
931
+				} catch(PDOException $e) {
932
+						echo "error : ".$e->getMessage();
933
+				}
934
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
935
+				return $all[0]['total'];
936
+		}
937 937
 	public function getStatsOwnerTotal($filter_name = '') {
938
-    		global $globalArchiveMonths, $globalDBdriver;
938
+			global $globalArchiveMonths, $globalDBdriver;
939 939
 		if ($filter_name == '') $filter_name = $this->filter_name;
940
-    		if ($globalDBdriver == 'mysql') {
940
+			if ($globalDBdriver == 'mysql') {
941 941
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
942 942
 		} else {
943 943
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
944
-                }
945
-                 try {
946
-                        $sth = $this->db->prepare($query);
947
-                        $sth->execute(array(':filter_name' => $filter_name));
948
-                } catch(PDOException $e) {
949
-                        echo "error : ".$e->getMessage();
950
-                }
951
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
952
-                return $all[0]['total'];
953
-        }
944
+				}
945
+				 try {
946
+						$sth = $this->db->prepare($query);
947
+						$sth->execute(array(':filter_name' => $filter_name));
948
+				} catch(PDOException $e) {
949
+						echo "error : ".$e->getMessage();
950
+				}
951
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
952
+				return $all[0]['total'];
953
+		}
954 954
 	public function getStatsPilotTotal($filter_name = '') {
955
-    		global $globalArchiveMonths, $globalDBdriver;
955
+			global $globalArchiveMonths, $globalDBdriver;
956 956
 		if ($filter_name == '') $filter_name = $this->filter_name;
957
-    		if ($globalDBdriver == 'mysql') {
958
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
959
-            	} else {
960
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
961
-            	}
962
-                 try {
963
-                        $sth = $this->db->prepare($query);
964
-                        $sth->execute(array(':filter_name' => $filter_name));
965
-                } catch(PDOException $e) {
966
-                        echo "error : ".$e->getMessage();
967
-                }
968
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
969
-                return $all[0]['total'];
970
-        }
957
+			if ($globalDBdriver == 'mysql') {
958
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
959
+				} else {
960
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
961
+				}
962
+				 try {
963
+						$sth = $this->db->prepare($query);
964
+						$sth->execute(array(':filter_name' => $filter_name));
965
+				} catch(PDOException $e) {
966
+						echo "error : ".$e->getMessage();
967
+				}
968
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
969
+				return $all[0]['total'];
970
+		}
971 971
 
972 972
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
973 973
 		global $globalDBdriver;
974 974
 		if ($filter_name == '') $filter_name = $this->filter_name;
975 975
 		if ($globalDBdriver == 'mysql') {
976 976
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
977
-                } else {
977
+				} else {
978 978
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
979 979
 		}
980
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
981
-                 try {
982
-                        $sth = $this->db->prepare($query);
983
-                        $sth->execute($query_values);
984
-                } catch(PDOException $e) {
985
-                        return "error : ".$e->getMessage();
986
-                }
987
-        }
980
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
981
+				 try {
982
+						$sth = $this->db->prepare($query);
983
+						$sth->execute($query_values);
984
+				} catch(PDOException $e) {
985
+						return "error : ".$e->getMessage();
986
+				}
987
+		}
988 988
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
989 989
 		global $globalDBdriver;
990 990
 		if ($filter_name == '') $filter_name = $this->filter_name;
991 991
 		if ($globalDBdriver == 'mysql') {
992 992
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
993 993
 		} else {
994
-            		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
994
+					//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
995 995
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
996
-                }
997
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
998
-                 try {
999
-                        $sth = $this->db->prepare($query);
1000
-                        $sth->execute($query_values);
1001
-                } catch(PDOException $e) {
1002
-                        return "error : ".$e->getMessage();
1003
-                }
1004
-        }
1005
-        /*
996
+				}
997
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
998
+				 try {
999
+						$sth = $this->db->prepare($query);
1000
+						$sth->execute($query_values);
1001
+				} catch(PDOException $e) {
1002
+						return "error : ".$e->getMessage();
1003
+				}
1004
+		}
1005
+		/*
1006 1006
 	public function getStatsSource($date,$stats_type = '') {
1007 1007
 		if ($stats_type == '') {
1008 1008
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -1071,25 +1071,25 @@  discard block
 block discarded – undo
1071 1071
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
1072 1072
 		} else {
1073 1073
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
1074
-                }
1075
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1076
-                 try {
1077
-                        $sth = $this->db->prepare($query);
1078
-                        $sth->execute($query_values);
1079
-                } catch(PDOException $e) {
1080
-                        return "error : ".$e->getMessage();
1081
-                }
1082
-        }
1083
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1084
-                $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1085
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1086
-                 try {
1087
-                        $sth = $this->db->prepare($query);
1088
-                        $sth->execute($query_values);
1089
-                } catch(PDOException $e) {
1090
-                        return "error : ".$e->getMessage();
1091
-                }
1092
-        }
1074
+				}
1075
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1076
+				 try {
1077
+						$sth = $this->db->prepare($query);
1078
+						$sth->execute($query_values);
1079
+				} catch(PDOException $e) {
1080
+						return "error : ".$e->getMessage();
1081
+				}
1082
+		}
1083
+	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1084
+				$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1085
+				$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1086
+				 try {
1087
+						$sth = $this->db->prepare($query);
1088
+						$sth->execute($query_values);
1089
+				} catch(PDOException $e) {
1090
+						return "error : ".$e->getMessage();
1091
+				}
1092
+		}
1093 1093
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
1094 1094
 		global $globalDBdriver;
1095 1095
 		if ($globalDBdriver == 'mysql') {
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
 				$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1106 1106
 			}
1107 1107
 		}
1108
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1109
-                 try {
1110
-                        $sth = $this->db->prepare($query);
1111
-                        $sth->execute($query_values);
1112
-                } catch(PDOException $e) {
1113
-                        return "error : ".$e->getMessage();
1114
-                }
1115
-        }
1108
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1109
+				 try {
1110
+						$sth = $this->db->prepare($query);
1111
+						$sth->execute($query_values);
1112
+				} catch(PDOException $e) {
1113
+						return "error : ".$e->getMessage();
1114
+				}
1115
+		}
1116 1116
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1117 1117
 		global $globalDBdriver;
1118 1118
 		if ($globalDBdriver == 'mysql') {
@@ -1128,14 +1128,14 @@  discard block
 block discarded – undo
1128 1128
 				$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1129 1129
 			}
1130 1130
 		}
1131
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1132
-                 try {
1133
-                        $sth = $this->db->prepare($query);
1134
-                        $sth->execute($query_values);
1135
-                } catch(PDOException $e) {
1136
-                        return "error : ".$e->getMessage();
1137
-                }
1138
-        }
1131
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1132
+				 try {
1133
+						$sth = $this->db->prepare($query);
1134
+						$sth->execute($query_values);
1135
+				} catch(PDOException $e) {
1136
+						return "error : ".$e->getMessage();
1137
+				}
1138
+		}
1139 1139
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1140 1140
 		global $globalDBdriver;
1141 1141
 		if ($globalDBdriver == 'mysql') {
@@ -1151,14 +1151,14 @@  discard block
 block discarded – undo
1151 1151
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1152 1152
 			}
1153 1153
 		}
1154
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1155
-                 try {
1156
-                        $sth = $this->db->prepare($query);
1157
-                        $sth->execute($query_values);
1158
-                } catch(PDOException $e) {
1159
-                        return "error : ".$e->getMessage();
1160
-                }
1161
-        }
1154
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1155
+				 try {
1156
+						$sth = $this->db->prepare($query);
1157
+						$sth->execute($query_values);
1158
+				} catch(PDOException $e) {
1159
+						return "error : ".$e->getMessage();
1160
+				}
1161
+		}
1162 1162
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1163 1163
 		global $globalDBdriver;
1164 1164
 		if ($globalDBdriver == 'mysql') {
@@ -1174,14 +1174,14 @@  discard block
 block discarded – undo
1174 1174
 				$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1175 1175
 			}
1176 1176
 		}
1177
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1178
-                 try {
1179
-                        $sth = $this->db->prepare($query);
1180
-                        $sth->execute($query_values);
1181
-                } catch(PDOException $e) {
1182
-                        return "error : ".$e->getMessage();
1183
-                }
1184
-        }
1177
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1178
+				 try {
1179
+						$sth = $this->db->prepare($query);
1180
+						$sth->execute($query_values);
1181
+				} catch(PDOException $e) {
1182
+						return "error : ".$e->getMessage();
1183
+				}
1184
+		}
1185 1185
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
1186 1186
 		global $globalDBdriver;
1187 1187
 		if ($globalDBdriver == 'mysql') {
@@ -1197,14 +1197,14 @@  discard block
 block discarded – undo
1197 1197
 				$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
1198 1198
 			}
1199 1199
 		}
1200
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1201
-                 try {
1202
-                        $sth = $this->db->prepare($query);
1203
-                        $sth->execute($query_values);
1204
-                } catch(PDOException $e) {
1205
-                        return "error : ".$e->getMessage();
1206
-                }
1207
-        }
1200
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1201
+				 try {
1202
+						$sth = $this->db->prepare($query);
1203
+						$sth->execute($query_values);
1204
+				} catch(PDOException $e) {
1205
+						return "error : ".$e->getMessage();
1206
+				}
1207
+		}
1208 1208
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
1209 1209
 		global $globalDBdriver;
1210 1210
 		if ($globalDBdriver == 'mysql') {
@@ -1220,14 +1220,14 @@  discard block
 block discarded – undo
1220 1220
 				$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1221 1221
 			}
1222 1222
 		}
1223
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1224
-                 try {
1225
-                        $sth = $this->db->prepare($query);
1226
-                        $sth->execute($query_values);
1227
-                } catch(PDOException $e) {
1228
-                        return "error : ".$e->getMessage();
1229
-                }
1230
-        }
1223
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1224
+				 try {
1225
+						$sth = $this->db->prepare($query);
1226
+						$sth->execute($query_values);
1227
+				} catch(PDOException $e) {
1228
+						return "error : ".$e->getMessage();
1229
+				}
1230
+		}
1231 1231
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
1232 1232
 		global $globalDBdriver;
1233 1233
 		if ($globalDBdriver == 'mysql') {
@@ -1243,14 +1243,14 @@  discard block
 block discarded – undo
1243 1243
 				$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1244 1244
 			}
1245 1245
 		}
1246
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1247
-                 try {
1248
-                        $sth = $this->db->prepare($query);
1249
-                        $sth->execute($query_values);
1250
-                } catch(PDOException $e) {
1251
-                        return "error : ".$e->getMessage();
1252
-                }
1253
-        }
1246
+				$query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1247
+				 try {
1248
+						$sth = $this->db->prepare($query);
1249
+						$sth->execute($query_values);
1250
+				} catch(PDOException $e) {
1251
+						return "error : ".$e->getMessage();
1252
+				}
1253
+		}
1254 1254
 	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
1255 1255
 		global $globalDBdriver;
1256 1256
 		if ($airport_icao != '') {
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
 			} catch(PDOException $e) {
1275 1275
 				return "error : ".$e->getMessage();
1276 1276
 			}
1277
-                }
1278
-        }
1277
+				}
1278
+		}
1279 1279
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1280 1280
 		global $globalDBdriver;
1281 1281
 		if ($airport_icao != '') {
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
 			} catch(PDOException $e) {
1292 1292
 				return "error : ".$e->getMessage();
1293 1293
 			}
1294
-                }
1295
-        }
1294
+				}
1295
+		}
1296 1296
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
1297 1297
 		global $globalDBdriver;
1298 1298
 		if ($airport_icao != '') {
@@ -1309,15 +1309,15 @@  discard block
 block discarded – undo
1309 1309
 					$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1310 1310
 				}
1311 1311
 			}
1312
-	                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1312
+					$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1313 1313
 			 try {
1314
-                    		$sth = $this->db->prepare($query);
1315
-	                        $sth->execute($query_values);
1316
-    		        } catch(PDOException $e) {
1317
-            		        return "error : ".$e->getMessage();
1318
-	                }
1319
-	        }
1320
-        }
1314
+							$sth = $this->db->prepare($query);
1315
+							$sth->execute($query_values);
1316
+					} catch(PDOException $e) {
1317
+							return "error : ".$e->getMessage();
1318
+					}
1319
+			}
1320
+		}
1321 1321
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1322 1322
 		global $globalDBdriver;
1323 1323
 		if ($airport_icao != '') {
@@ -1333,46 +1333,46 @@  discard block
 block discarded – undo
1333 1333
 			} catch(PDOException $e) {
1334 1334
 				return "error : ".$e->getMessage();
1335 1335
 			}
1336
-                }
1337
-        }
1336
+				}
1337
+		}
1338 1338
 
1339 1339
 	public function deleteStat($id) {
1340
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1341
-                $query_values = array(':id' => $id);
1342
-                 try {
1343
-                        $sth = $this->db->prepare($query);
1344
-                        $sth->execute($query_values);
1345
-                } catch(PDOException $e) {
1346
-                        return "error : ".$e->getMessage();
1347
-                }
1348
-        }
1340
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1341
+				$query_values = array(':id' => $id);
1342
+				 try {
1343
+						$sth = $this->db->prepare($query);
1344
+						$sth->execute($query_values);
1345
+				} catch(PDOException $e) {
1346
+						return "error : ".$e->getMessage();
1347
+				}
1348
+		}
1349 1349
 	public function deleteStatFlight($type) {
1350
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1351
-                $query_values = array(':type' => $type);
1352
-                 try {
1353
-                        $sth = $this->db->prepare($query);
1354
-                        $sth->execute($query_values);
1355
-                } catch(PDOException $e) {
1356
-                        return "error : ".$e->getMessage();
1357
-                }
1358
-        }
1350
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1351
+				$query_values = array(':type' => $type);
1352
+				 try {
1353
+						$sth = $this->db->prepare($query);
1354
+						$sth->execute($query_values);
1355
+				} catch(PDOException $e) {
1356
+						return "error : ".$e->getMessage();
1357
+				}
1358
+		}
1359 1359
 	public function deleteStatAirport($type) {
1360
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1361
-                $query_values = array(':type' => $type);
1362
-                 try {
1363
-                        $sth = $this->db->prepare($query);
1364
-                        $sth->execute($query_values);
1365
-                } catch(PDOException $e) {
1366
-                        return "error : ".$e->getMessage();
1367
-                }
1368
-        }
1360
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1361
+				$query_values = array(':type' => $type);
1362
+				 try {
1363
+						$sth = $this->db->prepare($query);
1364
+						$sth->execute($query_values);
1365
+				} catch(PDOException $e) {
1366
+						return "error : ".$e->getMessage();
1367
+				}
1368
+		}
1369 1369
         
1370
-        public function addOldStats() {
1371
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1372
-    		$Common = new Common();
1373
-    		$Connection = new Connection();
1374
-    		date_default_timezone_set('UTC');
1375
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1370
+		public function addOldStats() {
1371
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1372
+			$Common = new Common();
1373
+			$Connection = new Connection();
1374
+			date_default_timezone_set('UTC');
1375
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1376 1376
 			if ($globalDebug) echo 'Update stats !'."\n";
1377 1377
 			if (isset($last_update[0]['value'])) {
1378 1378
 				$last_update_day = $last_update[0]['value'];
@@ -1418,24 +1418,24 @@  discard block
 block discarded – undo
1418 1418
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1419 1419
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1420 1420
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1421
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1421
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1422 1422
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1423
-	        	$alldata = array();
1423
+				$alldata = array();
1424 1424
 	        	
1425
-    			foreach ($pall as $value) {
1426
-	        		$icao = $value['airport_departure_icao'];
1427
-    				$alldata[$icao] = $value;
1428
-	        	}
1429
-	        	foreach ($dall as $value) {
1430
-    				$icao = $value['airport_departure_icao'];
1431
-        			if (isset($alldata[$icao])) {
1432
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1433
-        			} else $alldata[$icao] = $value;
1434
-			}
1435
-    			$count = array();
1436
-    			foreach ($alldata as $key => $row) {
1437
-    				$count[$key] = $row['airport_departure_icao_count'];
1438
-        		}
1425
+				foreach ($pall as $value) {
1426
+					$icao = $value['airport_departure_icao'];
1427
+					$alldata[$icao] = $value;
1428
+				}
1429
+				foreach ($dall as $value) {
1430
+					$icao = $value['airport_departure_icao'];
1431
+					if (isset($alldata[$icao])) {
1432
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1433
+					} else $alldata[$icao] = $value;
1434
+			}
1435
+				$count = array();
1436
+				foreach ($alldata as $key => $row) {
1437
+					$count[$key] = $row['airport_departure_icao_count'];
1438
+				}
1439 1439
 			array_multisort($count,SORT_DESC,$alldata);
1440 1440
 			foreach ($alldata as $number) {
1441 1441
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
@@ -1443,25 +1443,25 @@  discard block
 block discarded – undo
1443 1443
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1444 1444
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1445 1445
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1446
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1446
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1447 1447
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1448
-	        	$alldata = array();
1449
-    			foreach ($pall as $value) {
1450
-	        		$icao = $value['airport_arrival_icao'];
1451
-    				$alldata[$icao] = $value;
1452
-	        	}
1453
-	        	foreach ($dall as $value) {
1454
-    				$icao = $value['airport_arrival_icao'];
1455
-        			if (isset($alldata[$icao])) {
1456
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1457
-	        		} else $alldata[$icao] = $value;
1458
-    			}
1459
-        		$count = array();
1460
-        		foreach ($alldata as $key => $row) {
1461
-        			$count[$key] = $row['airport_arrival_icao_count'];
1462
-	        	}
1463
-    			array_multisort($count,SORT_DESC,$alldata);
1464
-                        foreach ($alldata as $number) {
1448
+				$alldata = array();
1449
+				foreach ($pall as $value) {
1450
+					$icao = $value['airport_arrival_icao'];
1451
+					$alldata[$icao] = $value;
1452
+				}
1453
+				foreach ($dall as $value) {
1454
+					$icao = $value['airport_arrival_icao'];
1455
+					if (isset($alldata[$icao])) {
1456
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1457
+					} else $alldata[$icao] = $value;
1458
+				}
1459
+				$count = array();
1460
+				foreach ($alldata as $key => $row) {
1461
+					$count[$key] = $row['airport_arrival_icao_count'];
1462
+				}
1463
+				array_multisort($count,SORT_DESC,$alldata);
1464
+						foreach ($alldata as $number) {
1465 1465
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
1466 1466
 			}
1467 1467
 			if ($Connection->tableExists('countries')) {
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1522 1522
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1523 1523
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1524
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1525
-        		/*
1524
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1525
+				/*
1526 1526
 	        	$alldata = array();
1527 1527
     			foreach ($pall as $value) {
1528 1528
 	        		$icao = $value['departure_airport_icao'];
@@ -1541,29 +1541,29 @@  discard block
 block discarded – undo
1541 1541
 	        	}
1542 1542
     			array_multisort($count,SORT_DESC,$alldata);
1543 1543
     			*/
1544
-    			foreach ($dall as $value) {
1545
-    				$icao = $value['departure_airport_icao'];
1546
-    				$ddate = $value['date'];
1547
-    				$find = false;
1548
-    				foreach ($pall as $pvalue) {
1549
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1550
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1551
-    						$find = true;
1552
-    						break;
1553
-    					}
1554
-    				}
1555
-    				if ($find === false) {
1556
-    					$pall[] = $value;
1557
-    				}
1558
-    			}
1559
-    			$alldata = $pall;
1544
+				foreach ($dall as $value) {
1545
+					$icao = $value['departure_airport_icao'];
1546
+					$ddate = $value['date'];
1547
+					$find = false;
1548
+					foreach ($pall as $pvalue) {
1549
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1550
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1551
+							$find = true;
1552
+							break;
1553
+						}
1554
+					}
1555
+					if ($find === false) {
1556
+						$pall[] = $value;
1557
+					}
1558
+				}
1559
+				$alldata = $pall;
1560 1560
 			foreach ($alldata as $number) {
1561 1561
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1562 1562
 			}
1563 1563
 			echo '...Arrival'."\n";
1564 1564
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1565
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1566
-        		/*
1565
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1566
+				/*
1567 1567
 	        	$alldata = array();
1568 1568
     			foreach ($pall as $value) {
1569 1569
 	        		$icao = $value['arrival_airport_icao'];
@@ -1583,22 +1583,22 @@  discard block
 block discarded – undo
1583 1583
     			*/
1584 1584
 
1585 1585
 
1586
-    			foreach ($dall as $value) {
1587
-    				$icao = $value['arrival_airport_icao'];
1588
-    				$ddate = $value['date'];
1589
-    				$find = false;
1590
-    				foreach ($pall as $pvalue) {
1591
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1592
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1593
-    						$find = true;
1594
-    						break;
1595
-    					}
1596
-    				}
1597
-    				if ($find === false) {
1598
-    					$pall[] = $value;
1599
-    				}
1600
-    			}
1601
-    			$alldata = $pall;
1586
+				foreach ($dall as $value) {
1587
+					$icao = $value['arrival_airport_icao'];
1588
+					$ddate = $value['date'];
1589
+					$find = false;
1590
+					foreach ($pall as $pvalue) {
1591
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1592
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1593
+							$find = true;
1594
+							break;
1595
+						}
1596
+					}
1597
+					if ($find === false) {
1598
+						$pall[] = $value;
1599
+					}
1600
+				}
1601
+				$alldata = $pall;
1602 1602
 			foreach ($alldata as $number) {
1603 1603
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1604 1604
 			}
@@ -1665,51 +1665,51 @@  discard block
 block discarded – undo
1665 1665
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1666 1666
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1667 1667
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1668
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1668
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1669 1669
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1670
-	        	//$alldata = array();
1671
-    			foreach ($dall as $value) {
1672
-    				$icao = $value['airport_departure_icao'];
1673
-    				$dicao = $value['airline_icao'];
1674
-    				$find = false;
1675
-    				foreach ($pall as $pvalue) {
1676
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1677
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1678
-    						$find = true;
1679
-    						break;
1680
-    					}
1681
-    				}
1682
-    				if ($find === false) {
1683
-    					$pall[] = $value;
1684
-    				}
1685
-    			}
1686
-    			$alldata = $pall;
1670
+				//$alldata = array();
1671
+				foreach ($dall as $value) {
1672
+					$icao = $value['airport_departure_icao'];
1673
+					$dicao = $value['airline_icao'];
1674
+					$find = false;
1675
+					foreach ($pall as $pvalue) {
1676
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1677
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1678
+							$find = true;
1679
+							break;
1680
+						}
1681
+					}
1682
+					if ($find === false) {
1683
+						$pall[] = $value;
1684
+					}
1685
+				}
1686
+				$alldata = $pall;
1687 1687
 			foreach ($alldata as $number) {
1688 1688
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
1689 1689
 			}
1690 1690
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1691 1691
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1692 1692
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1693
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1693
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1694 1694
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1695
-	        	//$alldata = array();
1696
-    			foreach ($dall as $value) {
1697
-    				$icao = $value['airport_arrival_icao'];
1698
-    				$dicao = $value['airline_icao'];
1699
-    				$find = false;
1700
-    				foreach ($pall as $pvalue) {
1701
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1702
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1703
-    						$find = true;
1704
-    						break;
1705
-    					}
1706
-    				}
1707
-    				if ($find === false) {
1708
-    					$pall[] = $value;
1709
-    				}
1710
-    			}
1711
-    			$alldata = $pall;
1712
-                        foreach ($alldata as $number) {
1695
+				//$alldata = array();
1696
+				foreach ($dall as $value) {
1697
+					$icao = $value['airport_arrival_icao'];
1698
+					$dicao = $value['airline_icao'];
1699
+					$find = false;
1700
+					foreach ($pall as $pvalue) {
1701
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1702
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1703
+							$find = true;
1704
+							break;
1705
+						}
1706
+					}
1707
+					if ($find === false) {
1708
+						$pall[] = $value;
1709
+					}
1710
+				}
1711
+				$alldata = $pall;
1712
+						foreach ($alldata as $number) {
1713 1713
 				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
1714 1714
 			}
1715 1715
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
@@ -1742,47 +1742,47 @@  discard block
 block discarded – undo
1742 1742
 			}
1743 1743
 			if ($globalDebug) echo '...Departure'."\n";
1744 1744
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1745
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1746
-    			foreach ($dall as $value) {
1747
-    				$icao = $value['departure_airport_icao'];
1748
-    				$airline = $value['airline_icao'];
1749
-    				$ddate = $value['date'];
1750
-    				$find = false;
1751
-    				foreach ($pall as $pvalue) {
1752
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1753
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1754
-    						$find = true;
1755
-    						break;
1756
-    					}
1757
-    				}
1758
-    				if ($find === false) {
1759
-    					$pall[] = $value;
1760
-    				}
1761
-    			}
1762
-    			$alldata = $pall;
1745
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1746
+				foreach ($dall as $value) {
1747
+					$icao = $value['departure_airport_icao'];
1748
+					$airline = $value['airline_icao'];
1749
+					$ddate = $value['date'];
1750
+					$find = false;
1751
+					foreach ($pall as $pvalue) {
1752
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1753
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1754
+							$find = true;
1755
+							break;
1756
+						}
1757
+					}
1758
+					if ($find === false) {
1759
+						$pall[] = $value;
1760
+					}
1761
+				}
1762
+				$alldata = $pall;
1763 1763
 			foreach ($alldata as $number) {
1764 1764
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1765 1765
 			}
1766 1766
 			if ($globalDebug) echo '...Arrival'."\n";
1767 1767
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1768
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1769
-    			foreach ($dall as $value) {
1770
-    				$icao = $value['arrival_airport_icao'];
1771
-    				$airline = $value['airline_icao'];
1772
-    				$ddate = $value['date'];
1773
-    				$find = false;
1774
-    				foreach ($pall as $pvalue) {
1775
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1776
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1777
-    						$find = true;
1778
-    						break;
1779
-    					}
1780
-    				}
1781
-    				if ($find === false) {
1782
-    					$pall[] = $value;
1783
-    				}
1784
-    			}
1785
-    			$alldata = $pall;
1768
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1769
+				foreach ($dall as $value) {
1770
+					$icao = $value['arrival_airport_icao'];
1771
+					$airline = $value['airline_icao'];
1772
+					$ddate = $value['date'];
1773
+					$find = false;
1774
+					foreach ($pall as $pvalue) {
1775
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1776
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1777
+							$find = true;
1778
+							break;
1779
+						}
1780
+					}
1781
+					if ($find === false) {
1782
+						$pall[] = $value;
1783
+					}
1784
+				}
1785
+				$alldata = $pall;
1786 1786
 			foreach ($alldata as $number) {
1787 1787
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1788 1788
 			}
@@ -1853,44 +1853,44 @@  discard block
 block discarded – undo
1853 1853
 					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
1854 1854
 				}
1855 1855
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1856
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1857
-		        	$alldata = array();
1858
-	    			foreach ($pall as $value) {
1859
-		        		$icao = $value['airport_departure_icao'];
1860
-    					$alldata[$icao] = $value;
1861
-	    			}
1862
-		        	foreach ($dall as $value) {
1863
-	    				$icao = $value['airport_departure_icao'];
1864
-        				if (isset($alldata[$icao])) {
1865
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1866
-        				} else $alldata[$icao] = $value;
1867
-				}
1868
-	    			$count = array();
1869
-    				foreach ($alldata as $key => $row) {
1870
-    					$count[$key] = $row['airport_departure_icao_count'];
1871
-    				}
1856
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1857
+					$alldata = array();
1858
+					foreach ($pall as $value) {
1859
+						$icao = $value['airport_departure_icao'];
1860
+						$alldata[$icao] = $value;
1861
+					}
1862
+					foreach ($dall as $value) {
1863
+						$icao = $value['airport_departure_icao'];
1864
+						if (isset($alldata[$icao])) {
1865
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1866
+						} else $alldata[$icao] = $value;
1867
+				}
1868
+					$count = array();
1869
+					foreach ($alldata as $key => $row) {
1870
+						$count[$key] = $row['airport_departure_icao_count'];
1871
+					}
1872 1872
 				array_multisort($count,SORT_DESC,$alldata);
1873 1873
 				foreach ($alldata as $number) {
1874
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
1874
+						echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
1875 1875
 				}
1876 1876
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1877
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1877
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1878 1878
 				$alldata = array();
1879
-    				foreach ($pall as $value) {
1880
-		        		$icao = $value['airport_arrival_icao'];
1881
-    					$alldata[$icao] = $value;
1882
-	    			}
1883
-		        	foreach ($dall as $value) {
1884
-	    				$icao = $value['airport_arrival_icao'];
1885
-        				if (isset($alldata[$icao])) {
1886
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1887
-		        		} else $alldata[$icao] = $value;
1888
-	    			}
1889
-        			$count = array();
1890
-        			foreach ($alldata as $key => $row) {
1891
-    					$count[$key] = $row['airport_arrival_icao_count'];
1892
-		        	}
1893
-        			array_multisort($count,SORT_DESC,$alldata);
1879
+					foreach ($pall as $value) {
1880
+						$icao = $value['airport_arrival_icao'];
1881
+						$alldata[$icao] = $value;
1882
+					}
1883
+					foreach ($dall as $value) {
1884
+						$icao = $value['airport_arrival_icao'];
1885
+						if (isset($alldata[$icao])) {
1886
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1887
+						} else $alldata[$icao] = $value;
1888
+					}
1889
+					$count = array();
1890
+					foreach ($alldata as $key => $row) {
1891
+						$count[$key] = $row['airport_arrival_icao_count'];
1892
+					}
1893
+					array_multisort($count,SORT_DESC,$alldata);
1894 1894
 				foreach ($alldata as $number) {
1895 1895
 					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset);
1896 1896
 				}
@@ -1923,45 +1923,45 @@  discard block
 block discarded – undo
1923 1923
 				}
1924 1924
 				echo '...Departure'."\n";
1925 1925
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1926
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1926
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1927 1927
 				foreach ($dall as $value) {
1928
-    					$icao = $value['departure_airport_icao'];
1929
-    					$ddate = $value['date'];
1930
-    					$find = false;
1931
-    					foreach ($pall as $pvalue) {
1932
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1933
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1934
-	    						$find = true;
1935
-    							break;
1936
-    						}
1937
-    					}
1938
-    					if ($find === false) {
1939
-    						$pall[] = $value;
1940
-	    				}
1941
-    				}
1942
-	    			$alldata = $pall;
1928
+						$icao = $value['departure_airport_icao'];
1929
+						$ddate = $value['date'];
1930
+						$find = false;
1931
+						foreach ($pall as $pvalue) {
1932
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1933
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1934
+								$find = true;
1935
+								break;
1936
+							}
1937
+						}
1938
+						if ($find === false) {
1939
+							$pall[] = $value;
1940
+						}
1941
+					}
1942
+					$alldata = $pall;
1943 1943
 				foreach ($alldata as $number) {
1944 1944
 					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1945 1945
 				}
1946 1946
 				echo '...Arrival'."\n";
1947 1947
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1948
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1948
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1949 1949
 				foreach ($dall as $value) {
1950 1950
 					$icao = $value['arrival_airport_icao'];
1951 1951
 					$ddate = $value['date'];
1952
-    					$find = false;
1952
+						$find = false;
1953 1953
 					foreach ($pall as $pvalue) {
1954
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1955
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1956
-    							$find = true;
1957
-    							break;
1958
-	    					}
1959
-    					}
1960
-    					if ($find === false) {
1961
-    						$pall[] = $value;
1962
-	    				}
1963
-    				}
1964
-    				$alldata = $pall;
1954
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1955
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1956
+								$find = true;
1957
+								break;
1958
+							}
1959
+						}
1960
+						if ($find === false) {
1961
+							$pall[] = $value;
1962
+						}
1963
+					}
1964
+					$alldata = $pall;
1965 1965
 				foreach ($alldata as $number) {
1966 1966
 					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1967 1967
 				}
Please login to merge, or discard this patch.
Spacing   +342 added lines, -342 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		$this->db = $Connection->db();
18 18
         }
19 19
               
20
-	public function addLastStatsUpdate($type,$stats_date) {
20
+	public function addLastStatsUpdate($type, $stats_date) {
21 21
                 $query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
23
+                $query_values = array('type' => $type, ':stats_date' => $stats_date);
24 24
                  try {
25 25
                         $sth = $this->db->prepare($query);
26 26
                         $sth->execute($query_values);
27
-                } catch(PDOException $e) {
27
+                } catch (PDOException $e) {
28 28
                         return "error : ".$e->getMessage();
29 29
                 }
30 30
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                  try {
35 35
                         $sth = $this->db->prepare($query);
36 36
                         $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
37
+                } catch (PDOException $e) {
38 38
                         echo "error : ".$e->getMessage();
39 39
                 }
40 40
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                  try {
55 55
                         $sth = $this->db->prepare($query);
56 56
                         $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                  try {
65 65
                         $sth = $this->db->prepare($query);
66 66
                         $sth->execute();
67
-                } catch(PDOException $e) {
67
+                } catch (PDOException $e) {
68 68
                         return "error : ".$e->getMessage();
69 69
                 }
70 70
                 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                  try {
73 73
                         $sth = $this->db->prepare($query);
74 74
                         $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
75
+                } catch (PDOException $e) {
76 76
                         return "error : ".$e->getMessage();
77 77
                 }
78 78
         }
@@ -82,69 +82,69 @@  discard block
 block discarded – undo
82 82
                  try {
83 83
                         $sth = $this->db->prepare($query);
84 84
                         $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
85
+                } catch (PDOException $e) {
86 86
                         echo "error : ".$e->getMessage();
87 87
                 }
88 88
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89 89
                 return $all;
90 90
         }
91
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
91
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93 93
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 94
                  try {
95 95
                         $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
96
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
97
+                } catch (PDOException $e) {
98 98
                         echo "error : ".$e->getMessage();
99 99
                 }
100 100
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101 101
                 return $all;
102 102
         }
103
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
103
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
105 105
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 106
                  try {
107 107
                         $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
108
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
109
+                } catch (PDOException $e) {
110 110
                         echo "error : ".$e->getMessage();
111 111
                 }
112 112
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113 113
                 return $all;
114 114
         }
115
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
115
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
117 117
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 118
                  try {
119 119
                         $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
120
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
121
+                } catch (PDOException $e) {
122 122
                         echo "error : ".$e->getMessage();
123 123
                 }
124 124
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
125 125
                 return $all;
126 126
         }
127 127
 
128
-	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
128
+	public function getAllOwnerNames($stats_airline = '', $filter_name = '') {
129 129
 		if ($filter_name == '') $filter_name = $this->filter_name;
130 130
                 $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
131 131
                  try {
132 132
                         $sth = $this->db->prepare($query);
133
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
134
-                } catch(PDOException $e) {
133
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
134
+                } catch (PDOException $e) {
135 135
                         echo "error : ".$e->getMessage();
136 136
                 }
137 137
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
138 138
                 return $all;
139 139
         }
140 140
 
141
-	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
141
+	public function getAllPilotNames($stats_airline = '', $filter_name = '') {
142 142
 		if ($filter_name == '') $filter_name = $this->filter_name;
143 143
                 $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
144 144
                  try {
145 145
                         $sth = $this->db->prepare($query);
146
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
147
-                } catch(PDOException $e) {
146
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
147
+                } catch (PDOException $e) {
148 148
                         echo "error : ".$e->getMessage();
149 149
                 }
150 150
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
 
155
-	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
155
+	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
156 156
 		global $globalStatsFilters;
157 157
 		if ($filter_name == '') $filter_name = $this->filter_name;
158 158
 		if ($year == '' && $month == '') {
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 			else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
161 161
 			try {
162 162
 				$sth = $this->db->prepare($query);
163
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
164
-			} catch(PDOException $e) {
163
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
164
+			} catch (PDOException $e) {
165 165
 				echo "error : ".$e->getMessage();
166 166
 			}
167 167
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
                 if (empty($all)) {
170 170
             	    $filters = array('airlines' => array($stats_airline));
171 171
             	    if ($filter_name != '') {
172
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
172
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
173 173
             	    }
174 174
             	    $Spotter = new Spotter($this->db);
175
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
175
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters, $year, $month);
176 176
                 }
177 177
                 return $all;
178 178
 	}
179
-	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
179
+	public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') {
180 180
 		global $globalStatsFilters;
181 181
 		if ($filter_name == '') $filter_name = $this->filter_name;
182 182
 		if ($year == '' && $month == '') {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			try {
186 186
 				$sth = $this->db->prepare($query);
187 187
 				$sth->execute(array(':filter_name' => $filter_name));
188
-			} catch(PDOException $e) {
188
+			} catch (PDOException $e) {
189 189
 				echo "error : ".$e->getMessage();
190 190
 			}
191 191
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
             		$Spotter = new Spotter($this->db);
195 195
             		$filters = array();
196 196
             		if ($filter_name != '') {
197
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
197
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
198 198
 			}
199
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
199
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters, $year, $month);
200 200
                 }
201 201
                 return $all;
202 202
 	}
203
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
203
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
204 204
 		global $globalStatsFilters;
205 205
 		if ($filter_name == '') $filter_name = $this->filter_name;
206 206
 		if ($year == '' && $month == '') {
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 			else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
209 209
 			try {
210 210
 				$sth = $this->db->prepare($query);
211
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
212
-			} catch(PDOException $e) {
211
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
212
+			} catch (PDOException $e) {
213 213
 				echo "error : ".$e->getMessage();
214 214
 			}
215 215
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 		if (empty($all)) {
218 218
 			$filters = array('airlines' => array($stats_airline));
219 219
 			if ($filter_name != '') {
220
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
220
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
221 221
 			}
222 222
 			$Spotter = new Spotter($this->db);
223
-			$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month);
223
+			$all = $Spotter->countAllAircraftManufacturers($filters, $year, $month);
224 224
 		}
225 225
 		return $all;
226 226
 	}
227 227
 
228
-	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
228
+	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
229 229
 		global $globalStatsFilters;
230 230
 		if ($filter_name == '') $filter_name = $this->filter_name;
231 231
 		if ($year == '' && $month == '') {
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 			else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
234 234
 			try {
235 235
 				$sth = $this->db->prepare($query);
236
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
237
-			} catch(PDOException $e) {
236
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
237
+			} catch (PDOException $e) {
238 238
 				echo "error : ".$e->getMessage();
239 239
 			}
240 240
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
                 if (empty($all)) {
243 243
 			$filters = array('airlines' => array($stats_airline));
244 244
 			if ($filter_name != '') {
245
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
245
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
246 246
 			}
247 247
 			$Spotter = new Spotter($this->db);
248
-			$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month);
248
+			$all = $Spotter->countAllArrivalCountries($limit, $filters, $year, $month);
249 249
                 }
250 250
                 return $all;
251 251
 	}
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
257 257
                  try {
258 258
                         $sth = $this->db->prepare($query);
259
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
260
-                } catch(PDOException $e) {
259
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
260
+                } catch (PDOException $e) {
261 261
                         echo "error : ".$e->getMessage();
262 262
                 }
263 263
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
264 264
                 if (empty($all)) {
265 265
 			$filters = array('airlines' => array($stats_airline));
266 266
 			if ($filter_name != '') {
267
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
267
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
268 268
 			}
269 269
 			$Spotter = new Spotter($this->db);
270
-			$all = $Spotter->countAllDepartureCountries($filters,$year,$month);
270
+			$all = $Spotter->countAllDepartureCountries($filters, $year, $month);
271 271
                 }
272 272
                 return $all;
273 273
 	}
274 274
 
275
-	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
275
+	public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') {
276 276
 		global $globalStatsFilters;
277 277
 		if ($filter_name == '') $filter_name = $this->filter_name;
278 278
 		if ($year == '' && $month == '') {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 			try {
282 282
 				$sth = $this->db->prepare($query);
283 283
 				$sth->execute(array(':filter_name' => $filter_name));
284
-			} catch(PDOException $e) {
284
+			} catch (PDOException $e) {
285 285
 				echo "error : ".$e->getMessage();
286 286
 			}
287 287
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	                $Spotter = new Spotter($this->db);
291 291
             		$filters = array();
292 292
             		if ($filter_name != '') {
293
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
293
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
294 294
 			}
295 295
 
296
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
296
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters, $year, $month);
297 297
                 }
298 298
                 return $all;
299 299
 	}
300
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
300
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
301 301
 		global $globalStatsFilters;
302 302
 		if ($filter_name == '') $filter_name = $this->filter_name;
303 303
 		if ($year == '' && $month == '') {
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 			else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
306 306
 			try {
307 307
 				$sth = $this->db->prepare($query);
308
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
309
-			} catch(PDOException $e) {
308
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
309
+			} catch (PDOException $e) {
310 310
 				echo "error : ".$e->getMessage();
311 311
 			}
312 312
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
                 if (empty($all)) {
315 315
 			$filters = array('airlines' => array($stats_airline));
316 316
 			if ($filter_name != '') {
317
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
317
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
318 318
 			}
319 319
 	                $Spotter = new Spotter($this->db);
320
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
320
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters, $year, $month);
321 321
                 }
322 322
                 return $all;
323 323
 	}
324
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
324
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
325 325
 		global $globalStatsFilters;
326 326
 		if ($filter_name == '') $filter_name = $this->filter_name;
327 327
 		if ($year == '' && $month == '') {
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 			else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
330 330
 			 try {
331 331
 				$sth = $this->db->prepare($query);
332
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
333
-			} catch(PDOException $e) {
332
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
333
+			} catch (PDOException $e) {
334 334
 				echo "error : ".$e->getMessage();
335 335
 			}
336 336
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 		if (empty($all)) {
339 339
 			$filters = array('airlines' => array($stats_airline));
340 340
 			if ($filter_name != '') {
341
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
341
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
342 342
 			}
343 343
 			$Spotter = new Spotter($this->db);
344
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month);
344
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters, $year, $month);
345 345
 		}
346 346
 		return $all;
347 347
 	}
348
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
348
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
349 349
 		$Connection = new Connection();
350 350
 		if ($filter_name == '') $filter_name = $this->filter_name;
351 351
 		if ($Connection->tableExists('countries')) {
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 				else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
355 355
 				 try {
356 356
 					$sth = $this->db->prepare($query);
357
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
358
-				} catch(PDOException $e) {
357
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
358
+				} catch (PDOException $e) {
359 359
 					echo "error : ".$e->getMessage();
360 360
 				}
361 361
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			return array();
372 372
 		}
373 373
 	}
374
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
374
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
375 375
 		global $globalStatsFilters;
376 376
 		if ($filter_name == '') $filter_name = $this->filter_name;
377 377
 		if ($year == '' && $month == '') {
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
380 380
 			try {
381 381
 				$sth = $this->db->prepare($query);
382
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
383
-			} catch(PDOException $e) {
382
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
383
+			} catch (PDOException $e) {
384 384
 				echo "error : ".$e->getMessage();
385 385
 			}
386 386
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 		if (empty($all)) {
389 389
 			$filters = array('airlines' => array($stats_airline));
390 390
 			if ($filter_name != '') {
391
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
391
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
392 392
 			}
393 393
 			$Spotter = new Spotter($this->db);
394
-			$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month);
394
+			$all = $Spotter->countAllPilots($limit, 0, '', $filters, $year, $month);
395 395
 		}
396 396
 		return $all;
397 397
 	}
398 398
 
399
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
399
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
400 400
 		global $globalStatsFilters;
401 401
 		if ($filter_name == '') $filter_name = $this->filter_name;
402 402
 		if ($year == '' && $month == '') {
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 			else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
405 405
 			try {
406 406
 				$sth = $this->db->prepare($query);
407
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
408
-			} catch(PDOException $e) {
407
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
408
+			} catch (PDOException $e) {
409 409
 				echo "error : ".$e->getMessage();
410 410
 			}
411 411
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
                 if (empty($all)) {
414 414
 			$filters = array('airlines' => array($stats_airline));
415 415
 			if ($filter_name != '') {
416
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
416
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
417 417
 			}
418 418
             		$Spotter = new Spotter($this->db);
419
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
419
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters, $year, $month);
420 420
                 }
421 421
                 return $all;
422 422
 	}
423
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
423
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
424 424
 		global $globalStatsFilters;
425 425
 		if ($filter_name == '') $filter_name = $this->filter_name;
426 426
 		if ($year == '' && $month == '') {
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 			else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
429 429
 			try {
430 430
 				$sth = $this->db->prepare($query);
431
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
432
-			} catch(PDOException $e) {
431
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
432
+			} catch (PDOException $e) {
433 433
 				echo "error : ".$e->getMessage();
434 434
 			}
435 435
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
                 if (empty($all)) {
438 438
 			$filters = array('airlines' => array($stats_airline));
439 439
             		if ($filter_name != '') {
440
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
440
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
441 441
 			}
442 442
             		$Spotter = new Spotter($this->db);
443
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
444
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
443
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters, $year, $month);
444
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters, $year, $month);
445 445
         		$all = array();
446 446
         		foreach ($pall as $value) {
447 447
         			$icao = $value['airport_departure_icao'];
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
         		foreach ($all as $key => $row) {
459 459
         			$count[$key] = $row['airport_departure_icao_count'];
460 460
         		}
461
-        		array_multisort($count,SORT_DESC,$all);
461
+        		array_multisort($count, SORT_DESC, $all);
462 462
                 }
463 463
                 return $all;
464 464
 	}
465
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
465
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
466 466
 		global $globalStatsFilters;
467 467
 		if ($filter_name == '') $filter_name = $this->filter_name;
468 468
 		if ($year == '' && $month == '') {
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
 			else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
471 471
 			try {
472 472
 				$sth = $this->db->prepare($query);
473
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
474
-			} catch(PDOException $e) {
473
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
474
+			} catch (PDOException $e) {
475 475
 				echo "error : ".$e->getMessage();
476 476
 			}
477 477
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
 		if (empty($all)) {
480 480
 			$filters = array('airlines' => array($stats_airline));
481 481
 			if ($filter_name != '') {
482
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
482
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
483 483
 			}
484 484
 			$Spotter = new Spotter($this->db);
485
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month);
486
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month);
485
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters, $year, $month);
486
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters, $year, $month);
487 487
         		$all = array();
488 488
         		foreach ($pall as $value) {
489 489
         			$icao = $value['airport_arrival_icao'];
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
         		foreach ($all as $key => $row) {
501 501
         			$count[$key] = $row['airport_arrival_icao_count'];
502 502
         		}
503
-        		array_multisort($count,SORT_DESC,$all);
503
+        		array_multisort($count, SORT_DESC, $all);
504 504
                 }
505 505
  
506 506
                 return $all;
507 507
 	}
508
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
508
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
509 509
 		global $globalDBdriver, $globalStatsFilters;
510 510
 		if ($filter_name == '') $filter_name = $this->filter_name;
511 511
 		if ($globalDBdriver == 'mysql') {
@@ -515,18 +515,18 @@  discard block
 block discarded – undo
515 515
 			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
516 516
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
517 517
 		}
518
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
518
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
519 519
                  try {
520 520
                         $sth = $this->db->prepare($query);
521 521
                         $sth->execute($query_data);
522
-                } catch(PDOException $e) {
522
+                } catch (PDOException $e) {
523 523
                         echo "error : ".$e->getMessage();
524 524
                 }
525 525
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
526 526
                 if (empty($all)) {
527 527
 			$filters = array('airlines' => array($stats_airline));
528 528
 			if ($filter_name != '') {
529
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
529
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
530 530
 			}
531 531
             		$Spotter = new Spotter($this->db);
532 532
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -535,29 +535,29 @@  discard block
 block discarded – undo
535 535
                 return $all;
536 536
 	}
537 537
 	
538
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
538
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
539 539
 		global $globalStatsFilters;
540 540
 		if ($filter_name == '') $filter_name = $this->filter_name;
541 541
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
542
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
542
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
543 543
                  try {
544 544
                         $sth = $this->db->prepare($query);
545 545
                         $sth->execute($query_data);
546
-                } catch(PDOException $e) {
546
+                } catch (PDOException $e) {
547 547
                         echo "error : ".$e->getMessage();
548 548
                 }
549 549
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
550 550
                 if (empty($all)) {
551 551
 			$filters = array('airlines' => array($stats_airline));
552 552
 			if ($filter_name != '') {
553
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
553
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
554 554
 			}
555 555
             		$Spotter = new Spotter($this->db);
556 556
             		$all = $Spotter->countAllDatesLastMonth($filters);
557 557
                 }
558 558
                 return $all;
559 559
 	}
560
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
560
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
561 561
 		global $globalDBdriver, $globalStatsFilters;
562 562
 		if ($filter_name == '') $filter_name = $this->filter_name;
563 563
 		if ($globalDBdriver == 'mysql') {
@@ -565,40 +565,40 @@  discard block
 block discarded – undo
565 565
 		} else {
566 566
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
567 567
 		}
568
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
568
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
569 569
                  try {
570 570
                         $sth = $this->db->prepare($query);
571 571
                         $sth->execute($query_data);
572
-                } catch(PDOException $e) {
572
+                } catch (PDOException $e) {
573 573
                         echo "error : ".$e->getMessage();
574 574
                 }
575 575
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
576 576
                 if (empty($all)) {
577 577
 			$filters = array('airlines' => array($stats_airline));
578 578
 			if ($filter_name != '') {
579
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
579
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
580 580
 			}
581 581
             		$Spotter = new Spotter($this->db);
582 582
             		$all = $Spotter->countAllDatesLast7Days($filters);
583 583
                 }
584 584
                 return $all;
585 585
 	}
586
-	public function countAllDates($stats_airline = '',$filter_name = '') {
586
+	public function countAllDates($stats_airline = '', $filter_name = '') {
587 587
 		global $globalStatsFilters;
588 588
 		if ($filter_name == '') $filter_name = $this->filter_name;
589 589
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
590
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
590
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
591 591
                  try {
592 592
                         $sth = $this->db->prepare($query);
593 593
                         $sth->execute($query_data);
594
-                } catch(PDOException $e) {
594
+                } catch (PDOException $e) {
595 595
                         echo "error : ".$e->getMessage();
596 596
                 }
597 597
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
598 598
                 if (empty($all)) {
599 599
 			$filters = array('airlines' => array($stats_airline));
600 600
 			if ($filter_name != '') {
601
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
601
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
602 602
 			}
603 603
             		$Spotter = new Spotter($this->db);
604 604
             		$all = $Spotter->countAllDates($filters);
@@ -613,35 +613,35 @@  discard block
 block discarded – undo
613 613
                  try {
614 614
                         $sth = $this->db->prepare($query);
615 615
                         $sth->execute($query_data);
616
-                } catch(PDOException $e) {
616
+                } catch (PDOException $e) {
617 617
                         echo "error : ".$e->getMessage();
618 618
                 }
619 619
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
620 620
                 if (empty($all)) {
621 621
             		$filters = array();
622 622
             		if ($filter_name != '') {
623
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
623
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
624 624
 			}
625 625
             		$Spotter = new Spotter($this->db);
626 626
             		$all = $Spotter->countAllDatesByAirlines($filters);
627 627
                 }
628 628
                 return $all;
629 629
 	}
630
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
630
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
631 631
 		global $globalStatsFilters;
632 632
 		if ($filter_name == '') $filter_name = $this->filter_name;
633 633
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
634 634
                  try {
635 635
                         $sth = $this->db->prepare($query);
636 636
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
637
-                } catch(PDOException $e) {
637
+                } catch (PDOException $e) {
638 638
                         echo "error : ".$e->getMessage();
639 639
                 }
640 640
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
641 641
                 if (empty($all)) {
642 642
 			$filters = array('airlines' => array($stats_airline));
643 643
 			if ($filter_name != '') {
644
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
644
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
645 645
 			}
646 646
             		$Spotter = new Spotter($this->db);
647 647
             		$all = $Spotter->countAllMonths($filters);
@@ -655,21 +655,21 @@  discard block
 block discarded – undo
655 655
                  try {
656 656
                         $sth = $this->db->prepare($query);
657 657
                         $sth->execute(array(':filter_name' => $filter_name));
658
-                } catch(PDOException $e) {
658
+                } catch (PDOException $e) {
659 659
                         echo "error : ".$e->getMessage();
660 660
                 }
661 661
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
662 662
                 if (empty($all)) {
663 663
             		$filters = array();
664 664
             		if ($filter_name != '') {
665
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
665
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
666 666
 			}
667 667
             		$Spotter = new Spotter($this->db);
668 668
             		$all = $Spotter->countAllMilitaryMonths($filters);
669 669
                 }
670 670
                 return $all;
671 671
 	}
672
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
672
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
673 673
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
674 674
 		if ($filter_name == '') $filter_name = $this->filter_name;
675 675
 		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -686,82 +686,82 @@  discard block
 block discarded – undo
686 686
                  try {
687 687
                         $sth = $this->db->prepare($query);
688 688
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
689
-                } catch(PDOException $e) {
689
+                } catch (PDOException $e) {
690 690
                         echo "error : ".$e->getMessage();
691 691
                 }
692 692
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
693 693
                 if (empty($all)) {
694 694
 			$filters = array('airlines' => array($stats_airline));
695 695
 			if ($filter_name != '') {
696
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
696
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
697 697
 			}
698 698
             		$Spotter = new Spotter($this->db);
699
-            		$all = $Spotter->countAllHours($orderby,$filters);
699
+            		$all = $Spotter->countAllHours($orderby, $filters);
700 700
                 }
701 701
                 return $all;
702 702
 	}
703 703
 	
704
-	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
704
+	public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') {
705 705
 		global $globalStatsFilters;
706 706
 		if ($filter_name == '') $filter_name = $this->filter_name;
707 707
 		if ($year == '') $year = date('Y');
708
-		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
708
+		$all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month);
709 709
 		if (empty($all)) {
710 710
 			$filters = array('airlines' => array($stats_airline));
711 711
 			if ($filter_name != '') {
712
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
712
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
713 713
 			}
714 714
 			$Spotter = new Spotter($this->db);
715
-			$all = $Spotter->countOverallFlights($filters,$year,$month);
715
+			$all = $Spotter->countOverallFlights($filters, $year, $month);
716 716
 		}
717 717
 		return $all;
718 718
 	}
719
-	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
719
+	public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') {
720 720
 		global $globalStatsFilters;
721 721
 		if ($filter_name == '') $filter_name = $this->filter_name;
722 722
 		if ($year == '') $year = date('Y');
723
-		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
723
+		$all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month);
724 724
 		if (empty($all)) {
725 725
 		        $filters = array();
726 726
             		if ($filter_name != '') {
727
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
727
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
728 728
 			}
729 729
 			$Spotter = new Spotter($this->db);
730
-			$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month);
730
+			$all = $Spotter->countOverallMilitaryFlights($filters, $year, $month);
731 731
 		}
732 732
 		return $all;
733 733
 	}
734
-	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
734
+	public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') {
735 735
 		global $globalStatsFilters;
736 736
 		if ($filter_name == '') $filter_name = $this->filter_name;
737 737
 		if ($year == '') $year = date('Y');
738
-		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
738
+		$all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month);
739 739
 		if (empty($all)) {
740 740
 			$filters = array('airlines' => array($stats_airline));
741 741
 			if ($filter_name != '') {
742
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
742
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
743 743
 			}
744 744
 			$Spotter = new Spotter($this->db);
745
-			$all = $Spotter->countOverallArrival($filters,$year,$month);
745
+			$all = $Spotter->countOverallArrival($filters, $year, $month);
746 746
 		}
747 747
 		return $all;
748 748
 	}
749
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
749
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') {
750 750
 		global $globalStatsFilters;
751 751
 		if ($filter_name == '') $filter_name = $this->filter_name;
752 752
 		if ($year == '') $year = date('Y');
753
-		$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
753
+		$all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month);
754 754
 		if (empty($all)) {
755 755
 			$filters = array('airlines' => array($stats_airline));
756 756
 			if ($filter_name != '') {
757
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
757
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
758 758
 			}
759 759
 			$Spotter = new Spotter($this->db);
760
-			$all = $Spotter->countOverallAircrafts($filters,$year,$month);
760
+			$all = $Spotter->countOverallAircrafts($filters, $year, $month);
761 761
 		}
762 762
 		return $all;
763 763
 	}
764
-	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
764
+	public function countOverallAirlines($filter_name = '', $year = '', $month = '') {
765 765
 		global $globalStatsFilters;
766 766
 		if ($filter_name == '') $filter_name = $this->filter_name;
767 767
 		if ($year == '' && $month == '') {
@@ -769,23 +769,23 @@  discard block
 block discarded – undo
769 769
 			try {
770 770
 				$sth = $this->db->prepare($query);
771 771
 				$sth->execute(array(':filter_name' => $filter_name));
772
-			} catch(PDOException $e) {
772
+			} catch (PDOException $e) {
773 773
 				echo "error : ".$e->getMessage();
774 774
 			}
775 775
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
776 776
 			$all = $result[0]['nb_airline'];
777
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
777
+		} else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month);
778 778
 		if (empty($all)) {
779 779
             		$filters = array();
780 780
             		if ($filter_name != '') {
781
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
781
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
782 782
 			}
783 783
 			$Spotter = new Spotter($this->db);
784
-			$all = $Spotter->countOverallAirlines($filters,$year,$month);
784
+			$all = $Spotter->countOverallAirlines($filters, $year, $month);
785 785
 		}
786 786
 		return $all;
787 787
 	}
788
-	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
788
+	public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') {
789 789
 		global $globalStatsFilters;
790 790
 		if ($filter_name == '') $filter_name = $this->filter_name;
791 791
 		if ($year == '') $year = date('Y');
@@ -800,83 +800,83 @@  discard block
 block discarded – undo
800 800
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
801 801
                 $all = $result[0]['nb_owner'];
802 802
                 */
803
-		$all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month);
803
+		$all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month);
804 804
 		if (empty($all)) {
805 805
 			$filters = array('airlines' => array($stats_airline));
806 806
 			if ($filter_name != '') {
807
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
807
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
808 808
 			}
809 809
 			$Spotter = new Spotter($this->db);
810
-			$all = $Spotter->countOverallOwners($filters,$year,$month);
810
+			$all = $Spotter->countOverallOwners($filters, $year, $month);
811 811
 		}
812 812
 		return $all;
813 813
 	}
814
-	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
814
+	public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') {
815 815
 		global $globalStatsFilters;
816 816
 		if ($filter_name == '') $filter_name = $this->filter_name;
817 817
 		if ($year == '') $year = date('Y');
818
-		$all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month);
818
+		$all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month);
819 819
 		if (empty($all)) {
820 820
 			$filters = array('airlines' => array($stats_airline));
821 821
 			if ($filter_name != '') {
822
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
822
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
823 823
 			}
824 824
 			$Spotter = new Spotter($this->db);
825
-			$all = $Spotter->countOverallPilots($filters,$year,$month);
825
+			$all = $Spotter->countOverallPilots($filters, $year, $month);
826 826
 		}
827 827
 		return $all;
828 828
 	}
829 829
 
830
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
830
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
831 831
 		if ($filter_name == '') $filter_name = $this->filter_name;
832 832
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
833
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
833
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
834 834
                  try {
835 835
                         $sth = $this->db->prepare($query);
836 836
                         $sth->execute($query_values);
837
-                } catch(PDOException $e) {
837
+                } catch (PDOException $e) {
838 838
                         echo "error : ".$e->getMessage();
839 839
                 }
840 840
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
841 841
                 return $all;
842 842
 	}
843
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
843
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
844 844
 		if ($filter_name == '') $filter_name = $this->filter_name;
845 845
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
846
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
846
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
847 847
                  try {
848 848
                         $sth = $this->db->prepare($query);
849 849
                         $sth->execute($query_values);
850
-                } catch(PDOException $e) {
850
+                } catch (PDOException $e) {
851 851
                         echo "error : ".$e->getMessage();
852 852
                 }
853 853
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
854 854
                 return $all;
855 855
         }
856
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
856
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') {
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858 858
     		global $globalArchiveMonths, $globalDBdriver;
859 859
     		if ($globalDBdriver == 'mysql') {
860 860
     			if ($month == '') {
861 861
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
862
-				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
862
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
863 863
 			} else {
864 864
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
865
-				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
865
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
866 866
 			}
867 867
 		} else {
868 868
 			if ($month == '') {
869 869
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
870
-				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
870
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
871 871
 			} else {
872 872
 				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
873
-				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
873
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
874 874
 			}
875 875
                 }
876 876
                  try {
877 877
                         $sth = $this->db->prepare($query);
878 878
                         $sth->execute($query_values);
879
-                } catch(PDOException $e) {
879
+                } catch (PDOException $e) {
880 880
                         echo "error : ".$e->getMessage();
881 881
                 }
882 882
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                  try {
895 895
                         $sth = $this->db->prepare($query);
896 896
                         $sth->execute($query_values);
897
-                } catch(PDOException $e) {
897
+                } catch (PDOException $e) {
898 898
                         echo "error : ".$e->getMessage();
899 899
                 }
900 900
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
                  try {
912 912
                         $sth = $this->db->prepare($query);
913 913
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
914
-                } catch(PDOException $e) {
914
+                } catch (PDOException $e) {
915 915
                         echo "error : ".$e->getMessage();
916 916
                 }
917 917
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                  try {
929 929
                         $sth = $this->db->prepare($query);
930 930
                         $sth->execute(array(':filter_name' => $filter_name));
931
-                } catch(PDOException $e) {
931
+                } catch (PDOException $e) {
932 932
                         echo "error : ".$e->getMessage();
933 933
                 }
934 934
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
                  try {
946 946
                         $sth = $this->db->prepare($query);
947 947
                         $sth->execute(array(':filter_name' => $filter_name));
948
-                } catch(PDOException $e) {
948
+                } catch (PDOException $e) {
949 949
                         echo "error : ".$e->getMessage();
950 950
                 }
951 951
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -962,14 +962,14 @@  discard block
 block discarded – undo
962 962
                  try {
963 963
                         $sth = $this->db->prepare($query);
964 964
                         $sth->execute(array(':filter_name' => $filter_name));
965
-                } catch(PDOException $e) {
965
+                } catch (PDOException $e) {
966 966
                         echo "error : ".$e->getMessage();
967 967
                 }
968 968
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
969 969
                 return $all[0]['total'];
970 970
         }
971 971
 
972
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
972
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
973 973
 		global $globalDBdriver;
974 974
 		if ($filter_name == '') $filter_name = $this->filter_name;
975 975
 		if ($globalDBdriver == 'mysql') {
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
                 } else {
978 978
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
979 979
 		}
980
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
980
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
981 981
                  try {
982 982
                         $sth = $this->db->prepare($query);
983 983
                         $sth->execute($query_values);
984
-                } catch(PDOException $e) {
984
+                } catch (PDOException $e) {
985 985
                         return "error : ".$e->getMessage();
986 986
                 }
987 987
         }
988
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
988
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
989 989
 		global $globalDBdriver;
990 990
 		if ($filter_name == '') $filter_name = $this->filter_name;
991 991
 		if ($globalDBdriver == 'mysql') {
@@ -994,11 +994,11 @@  discard block
 block discarded – undo
994 994
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
995 995
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
996 996
                 }
997
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
997
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
998 998
                  try {
999 999
                         $sth = $this->db->prepare($query);
1000 1000
                         $sth->execute($query_values);
1001
-                } catch(PDOException $e) {
1001
+                } catch (PDOException $e) {
1002 1002
                         return "error : ".$e->getMessage();
1003 1003
                 }
1004 1004
         }
@@ -1022,75 +1022,75 @@  discard block
 block discarded – undo
1022 1022
         }
1023 1023
         */
1024 1024
 
1025
-	public function getStatsSource($stats_type,$year = '',$month = '',$day = '') {
1025
+	public function getStatsSource($stats_type, $year = '', $month = '', $day = '') {
1026 1026
 		global $globalDBdriver;
1027 1027
 		$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type";
1028 1028
 		$query_values = array();
1029 1029
 		if ($globalDBdriver == 'mysql') {
1030 1030
 			if ($year != '') {
1031 1031
 				$query .= ' AND YEAR(stats_date) = :year';
1032
-				$query_values = array_merge($query_values,array(':year' => $year));
1032
+				$query_values = array_merge($query_values, array(':year' => $year));
1033 1033
 			}
1034 1034
 			if ($month != '') {
1035 1035
 				$query .= ' AND MONTH(stats_date) = :month';
1036
-				$query_values = array_merge($query_values,array(':month' => $month));
1036
+				$query_values = array_merge($query_values, array(':month' => $month));
1037 1037
 			}
1038 1038
 			if ($day != '') {
1039 1039
 				$query .= ' AND DAY(stats_date) = :day';
1040
-				$query_values = array_merge($query_values,array(':day' => $day));
1040
+				$query_values = array_merge($query_values, array(':day' => $day));
1041 1041
 			}
1042 1042
 		} else {
1043 1043
 			if ($year != '') {
1044 1044
 				$query .= ' AND EXTRACT(YEAR FROM stats_date) = :year';
1045
-				$query_values = array_merge($query_values,array(':year' => $year));
1045
+				$query_values = array_merge($query_values, array(':year' => $year));
1046 1046
 			}
1047 1047
 			if ($month != '') {
1048 1048
 				$query .= ' AND EXTRACT(MONTH FROM stats_date) = :month';
1049
-				$query_values = array_merge($query_values,array(':month' => $month));
1049
+				$query_values = array_merge($query_values, array(':month' => $month));
1050 1050
 			}
1051 1051
 			if ($day != '') {
1052 1052
 				$query .= ' AND EXTRACT(DAY FROM stats_date) = :day';
1053
-				$query_values = array_merge($query_values,array(':day' => $day));
1053
+				$query_values = array_merge($query_values, array(':day' => $day));
1054 1054
 			}
1055 1055
 		}
1056 1056
 		$query .= " ORDER BY source_name";
1057
-		$query_values = array_merge($query_values,array(':stats_type' => $stats_type));
1057
+		$query_values = array_merge($query_values, array(':stats_type' => $stats_type));
1058 1058
 		try {
1059 1059
 			$sth = $this->db->prepare($query);
1060 1060
 			$sth->execute($query_values);
1061
-		} catch(PDOException $e) {
1061
+		} catch (PDOException $e) {
1062 1062
 			echo "error : ".$e->getMessage();
1063 1063
 		}
1064 1064
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1065 1065
 		return $all;
1066 1066
 	}
1067 1067
 
1068
-	public function addStatSource($data,$source_name,$stats_type,$date) {
1068
+	public function addStatSource($data, $source_name, $stats_type, $date) {
1069 1069
 		global $globalDBdriver;
1070 1070
 		if ($globalDBdriver == 'mysql') {
1071 1071
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
1072 1072
 		} else {
1073 1073
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
1074 1074
                 }
1075
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1075
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
1076 1076
                  try {
1077 1077
                         $sth = $this->db->prepare($query);
1078 1078
                         $sth->execute($query_values);
1079
-                } catch(PDOException $e) {
1079
+                } catch (PDOException $e) {
1080 1080
                         return "error : ".$e->getMessage();
1081 1081
                 }
1082 1082
         }
1083
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1083
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
1084 1084
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1085
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1085
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1086 1086
                  try {
1087 1087
                         $sth = $this->db->prepare($query);
1088 1088
                         $sth->execute($query_values);
1089
-                } catch(PDOException $e) {
1089
+                } catch (PDOException $e) {
1090 1090
                         return "error : ".$e->getMessage();
1091 1091
                 }
1092 1092
         }
1093
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
1093
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) {
1094 1094
 		global $globalDBdriver;
1095 1095
 		if ($globalDBdriver == 'mysql') {
1096 1096
 			if ($reset) {
@@ -1105,15 +1105,15 @@  discard block
 block discarded – undo
1105 1105
 				$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1106 1106
 			}
1107 1107
 		}
1108
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1108
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1109 1109
                  try {
1110 1110
                         $sth = $this->db->prepare($query);
1111 1111
                         $sth->execute($query_values);
1112
-                } catch(PDOException $e) {
1112
+                } catch (PDOException $e) {
1113 1113
                         return "error : ".$e->getMessage();
1114 1114
                 }
1115 1115
         }
1116
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1116
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1117 1117
 		global $globalDBdriver;
1118 1118
 		if ($globalDBdriver == 'mysql') {
1119 1119
 			if ($reset) {
@@ -1128,15 +1128,15 @@  discard block
 block discarded – undo
1128 1128
 				$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1129 1129
 			}
1130 1130
 		}
1131
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1131
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1132 1132
                  try {
1133 1133
                         $sth = $this->db->prepare($query);
1134 1134
                         $sth->execute($query_values);
1135
-                } catch(PDOException $e) {
1135
+                } catch (PDOException $e) {
1136 1136
                         return "error : ".$e->getMessage();
1137 1137
                 }
1138 1138
         }
1139
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1139
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) {
1140 1140
 		global $globalDBdriver;
1141 1141
 		if ($globalDBdriver == 'mysql') {
1142 1142
 			if ($reset) {
@@ -1151,15 +1151,15 @@  discard block
 block discarded – undo
1151 1151
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1152 1152
 			}
1153 1153
 		}
1154
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1154
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1155 1155
                  try {
1156 1156
                         $sth = $this->db->prepare($query);
1157 1157
                         $sth->execute($query_values);
1158
-                } catch(PDOException $e) {
1158
+                } catch (PDOException $e) {
1159 1159
                         return "error : ".$e->getMessage();
1160 1160
                 }
1161 1161
         }
1162
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1162
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1163 1163
 		global $globalDBdriver;
1164 1164
 		if ($globalDBdriver == 'mysql') {
1165 1165
 			if ($reset) {
@@ -1174,15 +1174,15 @@  discard block
 block discarded – undo
1174 1174
 				$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1175 1175
 			}
1176 1176
 		}
1177
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1177
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1178 1178
                  try {
1179 1179
                         $sth = $this->db->prepare($query);
1180 1180
                         $sth->execute($query_values);
1181
-                } catch(PDOException $e) {
1181
+                } catch (PDOException $e) {
1182 1182
                         return "error : ".$e->getMessage();
1183 1183
                 }
1184 1184
         }
1185
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
1185
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) {
1186 1186
 		global $globalDBdriver;
1187 1187
 		if ($globalDBdriver == 'mysql') {
1188 1188
 			if ($reset) {
@@ -1197,15 +1197,15 @@  discard block
 block discarded – undo
1197 1197
 				$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
1198 1198
 			}
1199 1199
 		}
1200
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1200
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1201 1201
                  try {
1202 1202
                         $sth = $this->db->prepare($query);
1203 1203
                         $sth->execute($query_values);
1204
-                } catch(PDOException $e) {
1204
+                } catch (PDOException $e) {
1205 1205
                         return "error : ".$e->getMessage();
1206 1206
                 }
1207 1207
         }
1208
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
1208
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) {
1209 1209
 		global $globalDBdriver;
1210 1210
 		if ($globalDBdriver == 'mysql') {
1211 1211
 			if ($reset) {
@@ -1220,15 +1220,15 @@  discard block
 block discarded – undo
1220 1220
 				$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1221 1221
 			}
1222 1222
 		}
1223
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1223
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1224 1224
                  try {
1225 1225
                         $sth = $this->db->prepare($query);
1226 1226
                         $sth->execute($query_values);
1227
-                } catch(PDOException $e) {
1227
+                } catch (PDOException $e) {
1228 1228
                         return "error : ".$e->getMessage();
1229 1229
                 }
1230 1230
         }
1231
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
1231
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) {
1232 1232
 		global $globalDBdriver;
1233 1233
 		if ($globalDBdriver == 'mysql') {
1234 1234
 			if ($reset) {
@@ -1243,15 +1243,15 @@  discard block
 block discarded – undo
1243 1243
 				$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1244 1244
 			}
1245 1245
 		}
1246
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1246
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
1247 1247
                  try {
1248 1248
                         $sth = $this->db->prepare($query);
1249 1249
                         $sth->execute($query_values);
1250
-                } catch(PDOException $e) {
1250
+                } catch (PDOException $e) {
1251 1251
                         return "error : ".$e->getMessage();
1252 1252
                 }
1253 1253
         }
1254
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
1254
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) {
1255 1255
 		global $globalDBdriver;
1256 1256
 		if ($airport_icao != '') {
1257 1257
 			if ($globalDBdriver == 'mysql') {
@@ -1267,16 +1267,16 @@  discard block
 block discarded – undo
1267 1267
 					$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1268 1268
 				}
1269 1269
 			}
1270
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1270
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1271 1271
 			try {
1272 1272
 				$sth = $this->db->prepare($query);
1273 1273
 				$sth->execute($query_values);
1274
-			} catch(PDOException $e) {
1274
+			} catch (PDOException $e) {
1275 1275
 				return "error : ".$e->getMessage();
1276 1276
 			}
1277 1277
                 }
1278 1278
         }
1279
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1279
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1280 1280
 		global $globalDBdriver;
1281 1281
 		if ($airport_icao != '') {
1282 1282
 			if ($globalDBdriver == 'mysql') {
@@ -1284,16 +1284,16 @@  discard block
 block discarded – undo
1284 1284
 			} else {
1285 1285
 				$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1286 1286
 			}
1287
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1287
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1288 1288
 			 try {
1289 1289
 				$sth = $this->db->prepare($query);
1290 1290
 				$sth->execute($query_values);
1291
-			} catch(PDOException $e) {
1291
+			} catch (PDOException $e) {
1292 1292
 				return "error : ".$e->getMessage();
1293 1293
 			}
1294 1294
                 }
1295 1295
         }
1296
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
1296
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) {
1297 1297
 		global $globalDBdriver;
1298 1298
 		if ($airport_icao != '') {
1299 1299
 			if ($globalDBdriver == 'mysql') {
@@ -1309,16 +1309,16 @@  discard block
 block discarded – undo
1309 1309
 					$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1310 1310
 				}
1311 1311
 			}
1312
-	                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1312
+	                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1313 1313
 			 try {
1314 1314
                     		$sth = $this->db->prepare($query);
1315 1315
 	                        $sth->execute($query_values);
1316
-    		        } catch(PDOException $e) {
1316
+    		        } catch (PDOException $e) {
1317 1317
             		        return "error : ".$e->getMessage();
1318 1318
 	                }
1319 1319
 	        }
1320 1320
         }
1321
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1321
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1322 1322
 		global $globalDBdriver;
1323 1323
 		if ($airport_icao != '') {
1324 1324
 			if ($globalDBdriver == 'mysql') {
@@ -1326,11 +1326,11 @@  discard block
 block discarded – undo
1326 1326
 			} else {
1327 1327
 				$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1328 1328
 			}
1329
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1329
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1330 1330
 			try {
1331 1331
 				$sth = $this->db->prepare($query);
1332 1332
 				$sth->execute($query_values);
1333
-			} catch(PDOException $e) {
1333
+			} catch (PDOException $e) {
1334 1334
 				return "error : ".$e->getMessage();
1335 1335
 			}
1336 1336
                 }
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
                  try {
1343 1343
                         $sth = $this->db->prepare($query);
1344 1344
                         $sth->execute($query_values);
1345
-                } catch(PDOException $e) {
1345
+                } catch (PDOException $e) {
1346 1346
                         return "error : ".$e->getMessage();
1347 1347
                 }
1348 1348
         }
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
                  try {
1353 1353
                         $sth = $this->db->prepare($query);
1354 1354
                         $sth->execute($query_values);
1355
-                } catch(PDOException $e) {
1355
+                } catch (PDOException $e) {
1356 1356
                         return "error : ".$e->getMessage();
1357 1357
                 }
1358 1358
         }
@@ -1362,13 +1362,13 @@  discard block
 block discarded – undo
1362 1362
                  try {
1363 1363
                         $sth = $this->db->prepare($query);
1364 1364
                         $sth->execute($query_values);
1365
-                } catch(PDOException $e) {
1365
+                } catch (PDOException $e) {
1366 1366
                         return "error : ".$e->getMessage();
1367 1367
                 }
1368 1368
         }
1369 1369
         
1370 1370
         public function addOldStats() {
1371
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1371
+    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear;
1372 1372
     		$Common = new Common();
1373 1373
     		$Connection = new Connection();
1374 1374
     		date_default_timezone_set('UTC');
@@ -1385,40 +1385,40 @@  discard block
 block discarded – undo
1385 1385
 			$Spotter = new Spotter($this->db);
1386 1386
 
1387 1387
 			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1388
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1388
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1389 1389
 			foreach ($alldata as $number) {
1390
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
1390
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset);
1391 1391
 			}
1392 1392
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1393
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1393
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1394 1394
 			foreach ($alldata as $number) {
1395
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
1395
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset);
1396 1396
 			}
1397 1397
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1398
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1398
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1399 1399
 			foreach ($alldata as $number) {
1400
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
1400
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset);
1401 1401
 			}
1402 1402
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1403
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1403
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1404 1404
 			foreach ($alldata as $number) {
1405
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1405
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
1406 1406
 			}
1407 1407
 			if ($globalDebug) echo 'Count all owners...'."\n";
1408
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1408
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1409 1409
 			foreach ($alldata as $number) {
1410
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
1410
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset);
1411 1411
 			}
1412 1412
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1413
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1413
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1414 1414
 			foreach ($alldata as $number) {
1415
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
1415
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset);
1416 1416
 			}
1417 1417
 			
1418 1418
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1419
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1419
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1420 1420
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1421
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1421
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1422 1422
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1423 1423
 	        	$alldata = array();
1424 1424
 	        	
@@ -1436,14 +1436,14 @@  discard block
 block discarded – undo
1436 1436
     			foreach ($alldata as $key => $row) {
1437 1437
     				$count[$key] = $row['airport_departure_icao_count'];
1438 1438
         		}
1439
-			array_multisort($count,SORT_DESC,$alldata);
1439
+			array_multisort($count, SORT_DESC, $alldata);
1440 1440
 			foreach ($alldata as $number) {
1441
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
1441
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset);
1442 1442
 			}
1443 1443
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1444
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1444
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1445 1445
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1446
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1446
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1447 1447
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1448 1448
 	        	$alldata = array();
1449 1449
     			foreach ($pall as $value) {
@@ -1460,16 +1460,16 @@  discard block
 block discarded – undo
1460 1460
         		foreach ($alldata as $key => $row) {
1461 1461
         			$count[$key] = $row['airport_arrival_icao_count'];
1462 1462
 	        	}
1463
-    			array_multisort($count,SORT_DESC,$alldata);
1463
+    			array_multisort($count, SORT_DESC, $alldata);
1464 1464
                         foreach ($alldata as $number) {
1465
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
1465
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset);
1466 1466
 			}
1467 1467
 			if ($Connection->tableExists('countries')) {
1468 1468
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1469 1469
 				$SpotterArchive = new SpotterArchive();
1470
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1470
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1471 1471
 				foreach ($alldata as $number) {
1472
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'',$reset);
1472
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', $reset);
1473 1473
 				}
1474 1474
 			}
1475 1475
 			
@@ -1483,37 +1483,37 @@  discard block
 block discarded – undo
1483 1483
 			$lastyear = false;
1484 1484
 			foreach ($alldata as $number) {
1485 1485
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1486
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1486
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1487 1487
 			}
1488 1488
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1489 1489
 			$alldata = $Spotter->countAllMilitaryMonths();
1490 1490
 			foreach ($alldata as $number) {
1491
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1491
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1492 1492
 			}
1493 1493
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1494 1494
 			$alldata = $Spotter->countAllMonthsOwners();
1495 1495
 			foreach ($alldata as $number) {
1496
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1496
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1497 1497
 			}
1498 1498
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1499 1499
 			$alldata = $Spotter->countAllMonthsPilots();
1500 1500
 			foreach ($alldata as $number) {
1501
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1501
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1502 1502
 			}
1503 1503
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1504 1504
 			$alldata = $Spotter->countAllMonthsAirlines();
1505 1505
 			foreach ($alldata as $number) {
1506
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1506
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1507 1507
 			}
1508 1508
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1509 1509
 			$alldata = $Spotter->countAllMonthsAircrafts();
1510 1510
 			foreach ($alldata as $number) {
1511
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1511
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1512 1512
 			}
1513 1513
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1514 1514
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1515 1515
 			foreach ($alldata as $number) {
1516
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1516
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1517 1517
 			}
1518 1518
 			if ($globalDebug) echo 'Airports data...'."\n";
1519 1519
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
     			}
1559 1559
     			$alldata = $pall;
1560 1560
 			foreach ($alldata as $number) {
1561
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1561
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1562 1562
 			}
1563 1563
 			echo '...Arrival'."\n";
1564 1564
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
     			}
1601 1601
     			$alldata = $pall;
1602 1602
 			foreach ($alldata as $number) {
1603
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1603
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1604 1604
 			}
1605 1605
 
1606 1606
 			echo 'Flights data...'."\n";
@@ -1608,28 +1608,28 @@  discard block
 block discarded – undo
1608 1608
 			echo '-> countAllDatesLastMonth...'."\n";
1609 1609
 			$alldata = $Spotter->countAllDatesLastMonth();
1610 1610
 			foreach ($alldata as $number) {
1611
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1611
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1612 1612
 			}
1613 1613
 			echo '-> countAllDates...'."\n";
1614 1614
 			$previousdata = $this->countAllDates();
1615 1615
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1616 1616
 			$this->deleteStatFlight('date');
1617
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1617
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1618 1618
 			$values = array();
1619 1619
 			foreach ($alldata as $cnt) {
1620 1620
 				$values[] = $cnt['date_count'];
1621 1621
 			}
1622
-			array_multisort($values,SORT_DESC,$alldata);
1623
-			array_splice($alldata,11);
1622
+			array_multisort($values, SORT_DESC, $alldata);
1623
+			array_splice($alldata, 11);
1624 1624
 			foreach ($alldata as $number) {
1625
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1625
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1626 1626
 			}
1627 1627
 			
1628 1628
 			$this->deleteStatFlight('hour');
1629 1629
 			echo '-> countAllHours...'."\n";
1630 1630
 			$alldata = $Spotter->countAllHours('hour');
1631 1631
 			foreach ($alldata as $number) {
1632
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1632
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1633 1633
 			}
1634 1634
 
1635 1635
 
@@ -1638,34 +1638,34 @@  discard block
 block discarded – undo
1638 1638
 			echo '--- Stats by airlines ---'."\n";
1639 1639
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1640 1640
 			$Spotter = new Spotter($this->db);
1641
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1641
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1642 1642
 			foreach ($alldata as $number) {
1643
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
1643
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset);
1644 1644
 			}
1645 1645
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1646
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1646
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1647 1647
 			foreach ($alldata as $number) {
1648
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
1648
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset);
1649 1649
 			}
1650 1650
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1651
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1651
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1652 1652
 			foreach ($alldata as $number) {
1653
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1653
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
1654 1654
 			}
1655 1655
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1656
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1656
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1657 1657
 			foreach ($alldata as $number) {
1658
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
1658
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset);
1659 1659
 			}
1660 1660
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1661
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1661
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1662 1662
 			foreach ($alldata as $number) {
1663
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
1663
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset);
1664 1664
 			}
1665 1665
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1666
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1666
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1667 1667
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1668
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1668
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1669 1669
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1670 1670
 	        	//$alldata = array();
1671 1671
     			foreach ($dall as $value) {
@@ -1685,12 +1685,12 @@  discard block
 block discarded – undo
1685 1685
     			}
1686 1686
     			$alldata = $pall;
1687 1687
 			foreach ($alldata as $number) {
1688
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
1688
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset);
1689 1689
 			}
1690 1690
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1691
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1691
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1692 1692
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1693
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1693
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1694 1694
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1695 1695
 	        	//$alldata = array();
1696 1696
     			foreach ($dall as $value) {
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
     			}
1711 1711
     			$alldata = $pall;
1712 1712
                         foreach ($alldata as $number) {
1713
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
1713
+				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset);
1714 1714
 			}
1715 1715
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1716 1716
 			$Spotter = new Spotter($this->db);
@@ -1718,27 +1718,27 @@  discard block
 block discarded – undo
1718 1718
 			$lastyear = false;
1719 1719
 			foreach ($alldata as $number) {
1720 1720
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1721
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1721
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1722 1722
 			}
1723 1723
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1724 1724
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1725 1725
 			foreach ($alldata as $number) {
1726
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1726
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1727 1727
 			}
1728 1728
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1729 1729
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1730 1730
 			foreach ($alldata as $number) {
1731
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1731
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1732 1732
 			}
1733 1733
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1734 1734
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1735 1735
 			foreach ($alldata as $number) {
1736
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1736
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1737 1737
 			}
1738 1738
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1739 1739
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1740 1740
 			foreach ($alldata as $number) {
1741
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1741
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1742 1742
 			}
1743 1743
 			if ($globalDebug) echo '...Departure'."\n";
1744 1744
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
     			}
1762 1762
     			$alldata = $pall;
1763 1763
 			foreach ($alldata as $number) {
1764
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1764
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
1765 1765
 			}
1766 1766
 			if ($globalDebug) echo '...Arrival'."\n";
1767 1767
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1784,32 +1784,32 @@  discard block
 block discarded – undo
1784 1784
     			}
1785 1785
     			$alldata = $pall;
1786 1786
 			foreach ($alldata as $number) {
1787
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1787
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
1788 1788
 			}
1789 1789
 
1790 1790
 			if ($globalDebug) echo 'Flights data...'."\n";
1791 1791
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1792 1792
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1793 1793
 			foreach ($alldata as $number) {
1794
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1794
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1795 1795
 			}
1796 1796
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1797 1797
 			//$previousdata = $this->countAllDatesByAirlines();
1798
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1798
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1799 1799
 			$values = array();
1800 1800
 			foreach ($alldata as $cnt) {
1801 1801
 				$values[] = $cnt['date_count'];
1802 1802
 			}
1803
-			array_multisort($values,SORT_DESC,$alldata);
1804
-			array_splice($alldata,11);
1803
+			array_multisort($values, SORT_DESC, $alldata);
1804
+			array_splice($alldata, 11);
1805 1805
 			foreach ($alldata as $number) {
1806
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1806
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1807 1807
 			}
1808 1808
 			
1809 1809
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1810 1810
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1811 1811
 			foreach ($alldata as $number) {
1812
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1812
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1813 1813
 			}
1814 1814
 			
1815 1815
 
@@ -1828,32 +1828,32 @@  discard block
 block discarded – undo
1828 1828
 				// Count by filter
1829 1829
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1830 1830
 				$Spotter = new Spotter($this->db);
1831
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1831
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1832 1832
 				foreach ($alldata as $number) {
1833
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset);
1833
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset);
1834 1834
 				}
1835
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1835
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1836 1836
 				foreach ($alldata as $number) {
1837
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset);
1837
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset);
1838 1838
 				}
1839
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1839
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1840 1840
 				foreach ($alldata as $number) {
1841
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset);
1841
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset);
1842 1842
 				}
1843
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1843
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1844 1844
 				foreach ($alldata as $number) {
1845
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset);
1845
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset);
1846 1846
 				}
1847
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1847
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1848 1848
 				foreach ($alldata as $number) {
1849
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset);
1849
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset);
1850 1850
 				}
1851
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1851
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1852 1852
 				foreach ($alldata as $number) {
1853
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
1853
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset);
1854 1854
 				}
1855
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1856
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1855
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1856
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1857 1857
 		        	$alldata = array();
1858 1858
 	    			foreach ($pall as $value) {
1859 1859
 		        		$icao = $value['airport_departure_icao'];
@@ -1869,12 +1869,12 @@  discard block
 block discarded – undo
1869 1869
     				foreach ($alldata as $key => $row) {
1870 1870
     					$count[$key] = $row['airport_departure_icao_count'];
1871 1871
     				}
1872
-				array_multisort($count,SORT_DESC,$alldata);
1872
+				array_multisort($count, SORT_DESC, $alldata);
1873 1873
 				foreach ($alldata as $number) {
1874
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
1874
+    					echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset);
1875 1875
 				}
1876
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1877
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1876
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
1877
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
1878 1878
 				$alldata = array();
1879 1879
     				foreach ($pall as $value) {
1880 1880
 		        		$icao = $value['airport_arrival_icao'];
@@ -1890,40 +1890,40 @@  discard block
 block discarded – undo
1890 1890
         			foreach ($alldata as $key => $row) {
1891 1891
     					$count[$key] = $row['airport_arrival_icao_count'];
1892 1892
 		        	}
1893
-        			array_multisort($count,SORT_DESC,$alldata);
1893
+        			array_multisort($count, SORT_DESC, $alldata);
1894 1894
 				foreach ($alldata as $number) {
1895
-					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset);
1895
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset);
1896 1896
 				}
1897 1897
 				$Spotter = new Spotter($this->db);
1898 1898
 				$alldata = $Spotter->countAllMonths($filter);
1899 1899
 				$lastyear = false;
1900 1900
 				foreach ($alldata as $number) {
1901 1901
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1902
-					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1902
+					$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1903 1903
 				}
1904 1904
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1905 1905
 				foreach ($alldata as $number) {
1906
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1906
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1907 1907
 				}
1908 1908
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1909 1909
 				foreach ($alldata as $number) {
1910
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1910
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1911 1911
 				}
1912 1912
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
1913 1913
 				foreach ($alldata as $number) {
1914
-					$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1914
+					$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1915 1915
 				}
1916 1916
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1917 1917
 				foreach ($alldata as $number) {
1918
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1918
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1919 1919
 				}
1920 1920
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1921 1921
 				foreach ($alldata as $number) {
1922
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1922
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1923 1923
 				}
1924 1924
 				echo '...Departure'."\n";
1925
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1926
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1925
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1926
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1927 1927
 				foreach ($dall as $value) {
1928 1928
     					$icao = $value['departure_airport_icao'];
1929 1929
     					$ddate = $value['date'];
@@ -1941,11 +1941,11 @@  discard block
 block discarded – undo
1941 1941
     				}
1942 1942
 	    			$alldata = $pall;
1943 1943
 				foreach ($alldata as $number) {
1944
-					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1944
+					$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
1945 1945
 				}
1946 1946
 				echo '...Arrival'."\n";
1947
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1948
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1947
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1948
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1949 1949
 				foreach ($dall as $value) {
1950 1950
 					$icao = $value['arrival_airport_icao'];
1951 1951
 					$ddate = $value['date'];
@@ -1963,40 +1963,40 @@  discard block
 block discarded – undo
1963 1963
     				}
1964 1964
     				$alldata = $pall;
1965 1965
 				foreach ($alldata as $number) {
1966
-					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1966
+					$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
1967 1967
 				}
1968 1968
     
1969 1969
 				echo 'Flights data...'."\n";
1970 1970
 				echo '-> countAllDatesLastMonth...'."\n";
1971 1971
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1972 1972
 				foreach ($alldata as $number) {
1973
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1973
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1974 1974
 				}
1975 1975
 				echo '-> countAllDates...'."\n";
1976
-				$previousdata = $this->countAllDates('',$filter_name);
1977
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1976
+				$previousdata = $this->countAllDates('', $filter_name);
1977
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1978 1978
 				$values = array();
1979 1979
 				foreach ($alldata as $cnt) {
1980 1980
 					$values[] = $cnt['date_count'];
1981 1981
 				}
1982
-				array_multisort($values,SORT_DESC,$alldata);
1983
-				array_splice($alldata,11);
1982
+				array_multisort($values, SORT_DESC, $alldata);
1983
+				array_splice($alldata, 11);
1984 1984
 				foreach ($alldata as $number) {
1985
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
1985
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
1986 1986
 				}
1987 1987
 				
1988 1988
 				echo '-> countAllHours...'."\n";
1989
-				$alldata = $Spotter->countAllHours('hour',$filter);
1989
+				$alldata = $Spotter->countAllHours('hour', $filter);
1990 1990
 				foreach ($alldata as $number) {
1991
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
1991
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
1992 1992
 				}
1993 1993
 				echo 'Insert last stats update date...'."\n";
1994 1994
 				date_default_timezone_set('UTC');
1995
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
1995
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
1996 1996
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
1997
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
1997
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
1998 1998
 						$this->deleteOldStats($filter_name);
1999
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
1999
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
2000 2000
 					}
2001 2001
 				}
2002 2002
 
@@ -2009,16 +2009,16 @@  discard block
 block discarded – undo
2009 2009
 				// SUM all previous month to put as year
2010 2010
 				$previous_year = date('Y');
2011 2011
 				$previous_year--;
2012
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2013
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2014
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2015
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2012
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2013
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2014
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2015
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2016 2016
 				$allairlines = $this->getAllAirlineNames();
2017 2017
 				foreach ($allairlines as $data) {
2018
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2019
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2020
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2021
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2018
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2019
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2020
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2021
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2022 2022
 				}
2023 2023
 				
2024 2024
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 						try {
2028 2028
 							$sth = $this->db->prepare($query);
2029 2029
 							$sth->execute();
2030
-						} catch(PDOException $e) {
2030
+						} catch (PDOException $e) {
2031 2031
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
2032 2032
 						}
2033 2033
 					}
@@ -2036,15 +2036,15 @@  discard block
 block discarded – undo
2036 2036
 					try {
2037 2037
 						$sth = $this->db->prepare($query);
2038 2038
 						$sth->execute();
2039
-					} catch(PDOException $e) {
2039
+					} catch (PDOException $e) {
2040 2040
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2041 2041
 					}
2042 2042
 				}
2043 2043
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
2044 2044
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
2045
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
2045
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
2046 2046
 						$this->deleteOldStats();
2047
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
2047
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
2048 2048
 						$lastyearupdate = true;
2049 2049
 					}
2050 2050
 				}
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 					try {
2067 2067
 						$sth = $this->db->prepare($query);
2068 2068
 						$sth->execute();
2069
-					} catch(PDOException $e) {
2069
+					} catch (PDOException $e) {
2070 2070
 						return "error : ".$e->getMessage();
2071 2071
 					}
2072 2072
 				}
@@ -2080,14 +2080,14 @@  discard block
 block discarded – undo
2080 2080
 				try {
2081 2081
 					$sth = $this->db->prepare($query);
2082 2082
 					$sth->execute();
2083
-				} catch(PDOException $e) {
2083
+				} catch (PDOException $e) {
2084 2084
 					return "error : ".$e->getMessage();
2085 2085
 				}
2086 2086
 			}
2087 2087
 			if (!isset($lastyearupdate)) {
2088 2088
 				echo 'Insert last stats update date...'."\n";
2089 2089
 				date_default_timezone_set('UTC');
2090
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2090
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2091 2091
 			}
2092 2092
 			if ($globalStatsResetYear) {
2093 2093
 				require_once(dirname(__FILE__).'/../install/class.settings.php');
Please login to merge, or discard this patch.
Braces   +452 added lines, -156 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
                 }
78 80
         }
79 81
 	public function getAllAirlineNames($filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
82
+		if ($filter_name == '') {
83
+			$filter_name = $this->filter_name;
84
+		}
81 85
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82 86
                  try {
83 87
                         $sth = $this->db->prepare($query);
@@ -89,7 +93,9 @@  discard block
 block discarded – undo
89 93
                 return $all;
90 94
         }
91 95
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
+		if ($filter_name == '') {
97
+			$filter_name = $this->filter_name;
98
+		}
93 99
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 100
                  try {
95 101
                         $sth = $this->db->prepare($query);
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
                 return $all;
102 108
         }
103 109
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
105 113
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 114
                  try {
107 115
                         $sth = $this->db->prepare($query);
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
                 return $all;
114 122
         }
115 123
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
117 127
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 128
                  try {
119 129
                         $sth = $this->db->prepare($query);
@@ -126,7 +136,9 @@  discard block
 block discarded – undo
126 136
         }
127 137
 
128 138
 	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
129
-		if ($filter_name == '') $filter_name = $this->filter_name;
139
+		if ($filter_name == '') {
140
+			$filter_name = $this->filter_name;
141
+		}
130 142
                 $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
131 143
                  try {
132 144
                         $sth = $this->db->prepare($query);
@@ -139,7 +151,9 @@  discard block
 block discarded – undo
139 151
         }
140 152
 
141 153
 	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
142
-		if ($filter_name == '') $filter_name = $this->filter_name;
154
+		if ($filter_name == '') {
155
+			$filter_name = $this->filter_name;
156
+		}
143 157
                 $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
144 158
                  try {
145 159
                         $sth = $this->db->prepare($query);
@@ -154,10 +168,15 @@  discard block
 block discarded – undo
154 168
 
155 169
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
156 170
 		global $globalStatsFilters;
157
-		if ($filter_name == '') $filter_name = $this->filter_name;
171
+		if ($filter_name == '') {
172
+			$filter_name = $this->filter_name;
173
+		}
158 174
 		if ($year == '' && $month == '') {
159
-			if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
160
-			else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
175
+			if ($limit) {
176
+				$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
177
+			} else {
178
+				$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
179
+			}
161 180
 			try {
162 181
 				$sth = $this->db->prepare($query);
163 182
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -165,7 +184,9 @@  discard block
 block discarded – undo
165 184
 				echo "error : ".$e->getMessage();
166 185
 			}
167 186
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
168
-		} else $all = array();
187
+		} else {
188
+			$all = array();
189
+		}
169 190
                 if (empty($all)) {
170 191
             	    $filters = array('airlines' => array($stats_airline));
171 192
             	    if ($filter_name != '') {
@@ -178,10 +199,15 @@  discard block
 block discarded – undo
178 199
 	}
179 200
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
180 201
 		global $globalStatsFilters;
181
-		if ($filter_name == '') $filter_name = $this->filter_name;
202
+		if ($filter_name == '') {
203
+			$filter_name = $this->filter_name;
204
+		}
182 205
 		if ($year == '' && $month == '') {
183
-			if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
184
-			else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
206
+			if ($limit) {
207
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
208
+			} else {
209
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
210
+			}
185 211
 			try {
186 212
 				$sth = $this->db->prepare($query);
187 213
 				$sth->execute(array(':filter_name' => $filter_name));
@@ -189,7 +215,9 @@  discard block
 block discarded – undo
189 215
 				echo "error : ".$e->getMessage();
190 216
 			}
191 217
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
192
-		} else $all = array();
218
+		} else {
219
+			$all = array();
220
+		}
193 221
                 if (empty($all)) {
194 222
             		$Spotter = new Spotter($this->db);
195 223
             		$filters = array();
@@ -202,10 +230,15 @@  discard block
 block discarded – undo
202 230
 	}
203 231
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
204 232
 		global $globalStatsFilters;
205
-		if ($filter_name == '') $filter_name = $this->filter_name;
233
+		if ($filter_name == '') {
234
+			$filter_name = $this->filter_name;
235
+		}
206 236
 		if ($year == '' && $month == '') {
207
-			if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
208
-			else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
237
+			if ($limit) {
238
+				$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
239
+			} else {
240
+				$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
241
+			}
209 242
 			try {
210 243
 				$sth = $this->db->prepare($query);
211 244
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -213,7 +246,9 @@  discard block
 block discarded – undo
213 246
 				echo "error : ".$e->getMessage();
214 247
 			}
215 248
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
216
-		} else $all = array();
249
+		} else {
250
+			$all = array();
251
+		}
217 252
 		if (empty($all)) {
218 253
 			$filters = array('airlines' => array($stats_airline));
219 254
 			if ($filter_name != '') {
@@ -227,10 +262,15 @@  discard block
 block discarded – undo
227 262
 
228 263
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
229 264
 		global $globalStatsFilters;
230
-		if ($filter_name == '') $filter_name = $this->filter_name;
265
+		if ($filter_name == '') {
266
+			$filter_name = $this->filter_name;
267
+		}
231 268
 		if ($year == '' && $month == '') {
232
-			if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
233
-			else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
269
+			if ($limit) {
270
+				$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
271
+			} else {
272
+				$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
273
+			}
234 274
 			try {
235 275
 				$sth = $this->db->prepare($query);
236 276
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -238,7 +278,9 @@  discard block
 block discarded – undo
238 278
 				echo "error : ".$e->getMessage();
239 279
 			}
240 280
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
241
-		} else $all = array();
281
+		} else {
282
+			$all = array();
283
+		}
242 284
                 if (empty($all)) {
243 285
 			$filters = array('airlines' => array($stats_airline));
244 286
 			if ($filter_name != '') {
@@ -251,9 +293,14 @@  discard block
 block discarded – undo
251 293
 	}
252 294
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
253 295
 		global $globalStatsFilters;
254
-		if ($filter_name == '') $filter_name = $this->filter_name;
255
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
256
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
296
+		if ($filter_name == '') {
297
+			$filter_name = $this->filter_name;
298
+		}
299
+		if ($limit) {
300
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
301
+		} else {
302
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
303
+		}
257 304
                  try {
258 305
                         $sth = $this->db->prepare($query);
259 306
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -274,10 +321,15 @@  discard block
 block discarded – undo
274 321
 
275 322
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
276 323
 		global $globalStatsFilters;
277
-		if ($filter_name == '') $filter_name = $this->filter_name;
324
+		if ($filter_name == '') {
325
+			$filter_name = $this->filter_name;
326
+		}
278 327
 		if ($year == '' && $month == '') {
279
-			if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
280
-			else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
328
+			if ($limit) {
329
+				$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
330
+			} else {
331
+				$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
332
+			}
281 333
 			try {
282 334
 				$sth = $this->db->prepare($query);
283 335
 				$sth->execute(array(':filter_name' => $filter_name));
@@ -285,7 +337,9 @@  discard block
 block discarded – undo
285 337
 				echo "error : ".$e->getMessage();
286 338
 			}
287 339
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
288
-		} else $all = array();
340
+		} else {
341
+			$all = array();
342
+		}
289 343
                 if (empty($all)) {
290 344
 	                $Spotter = new Spotter($this->db);
291 345
             		$filters = array();
@@ -299,10 +353,15 @@  discard block
 block discarded – undo
299 353
 	}
300 354
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
301 355
 		global $globalStatsFilters;
302
-		if ($filter_name == '') $filter_name = $this->filter_name;
356
+		if ($filter_name == '') {
357
+			$filter_name = $this->filter_name;
358
+		}
303 359
 		if ($year == '' && $month == '') {
304
-			if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
305
-			else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
360
+			if ($limit) {
361
+				$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
362
+			} else {
363
+				$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
364
+			}
306 365
 			try {
307 366
 				$sth = $this->db->prepare($query);
308 367
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -310,7 +369,9 @@  discard block
 block discarded – undo
310 369
 				echo "error : ".$e->getMessage();
311 370
 			}
312 371
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
313
-		} else $all = array();
372
+		} else {
373
+			$all = array();
374
+		}
314 375
                 if (empty($all)) {
315 376
 			$filters = array('airlines' => array($stats_airline));
316 377
 			if ($filter_name != '') {
@@ -323,10 +384,15 @@  discard block
 block discarded – undo
323 384
 	}
324 385
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
325 386
 		global $globalStatsFilters;
326
-		if ($filter_name == '') $filter_name = $this->filter_name;
387
+		if ($filter_name == '') {
388
+			$filter_name = $this->filter_name;
389
+		}
327 390
 		if ($year == '' && $month == '') {
328
-			if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
329
-			else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
391
+			if ($limit) {
392
+				$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
393
+			} else {
394
+				$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
395
+			}
330 396
 			 try {
331 397
 				$sth = $this->db->prepare($query);
332 398
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -334,7 +400,9 @@  discard block
 block discarded – undo
334 400
 				echo "error : ".$e->getMessage();
335 401
 			}
336 402
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
337
-		} else $all = array();
403
+		} else {
404
+			$all = array();
405
+		}
338 406
 		if (empty($all)) {
339 407
 			$filters = array('airlines' => array($stats_airline));
340 408
 			if ($filter_name != '') {
@@ -347,11 +415,16 @@  discard block
 block discarded – undo
347 415
 	}
348 416
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
349 417
 		$Connection = new Connection();
350
-		if ($filter_name == '') $filter_name = $this->filter_name;
418
+		if ($filter_name == '') {
419
+			$filter_name = $this->filter_name;
420
+		}
351 421
 		if ($Connection->tableExists('countries')) {
352 422
 			if ($year == '' && $month == '') {
353
-				if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
354
-				else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
423
+				if ($limit) {
424
+					$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
425
+				} else {
426
+					$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
427
+				}
355 428
 				 try {
356 429
 					$sth = $this->db->prepare($query);
357 430
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -366,17 +439,24 @@  discard block
 block discarded – undo
366 439
                 }
367 440
                 */
368 441
 				return $all;
369
-			} else return array();
442
+			} else {
443
+				return array();
444
+			}
370 445
 		} else {
371 446
 			return array();
372 447
 		}
373 448
 	}
374 449
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
375 450
 		global $globalStatsFilters;
376
-		if ($filter_name == '') $filter_name = $this->filter_name;
451
+		if ($filter_name == '') {
452
+			$filter_name = $this->filter_name;
453
+		}
377 454
 		if ($year == '' && $month == '') {
378
-			if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
379
-			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
455
+			if ($limit) {
456
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
457
+			} else {
458
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
459
+			}
380 460
 			try {
381 461
 				$sth = $this->db->prepare($query);
382 462
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -384,7 +464,9 @@  discard block
 block discarded – undo
384 464
 				echo "error : ".$e->getMessage();
385 465
 			}
386 466
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
387
-		} else $all = array();
467
+		} else {
468
+			$all = array();
469
+		}
388 470
 		if (empty($all)) {
389 471
 			$filters = array('airlines' => array($stats_airline));
390 472
 			if ($filter_name != '') {
@@ -398,10 +480,15 @@  discard block
 block discarded – undo
398 480
 
399 481
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
400 482
 		global $globalStatsFilters;
401
-		if ($filter_name == '') $filter_name = $this->filter_name;
483
+		if ($filter_name == '') {
484
+			$filter_name = $this->filter_name;
485
+		}
402 486
 		if ($year == '' && $month == '') {
403
-			if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
404
-			else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
487
+			if ($limit) {
488
+				$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
489
+			} else {
490
+				$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
491
+			}
405 492
 			try {
406 493
 				$sth = $this->db->prepare($query);
407 494
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -409,7 +496,9 @@  discard block
 block discarded – undo
409 496
 				echo "error : ".$e->getMessage();
410 497
 			}
411 498
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
412
-		} else $all = array();
499
+		} else {
500
+			$all = array();
501
+		}
413 502
                 if (empty($all)) {
414 503
 			$filters = array('airlines' => array($stats_airline));
415 504
 			if ($filter_name != '') {
@@ -422,10 +511,15 @@  discard block
 block discarded – undo
422 511
 	}
423 512
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
424 513
 		global $globalStatsFilters;
425
-		if ($filter_name == '') $filter_name = $this->filter_name;
514
+		if ($filter_name == '') {
515
+			$filter_name = $this->filter_name;
516
+		}
426 517
 		if ($year == '' && $month == '') {
427
-			if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
428
-			else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
518
+			if ($limit) {
519
+				$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
520
+			} else {
521
+				$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
522
+			}
429 523
 			try {
430 524
 				$sth = $this->db->prepare($query);
431 525
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -433,7 +527,9 @@  discard block
 block discarded – undo
433 527
 				echo "error : ".$e->getMessage();
434 528
 			}
435 529
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
436
-		} else $all = array();
530
+		} else {
531
+			$all = array();
532
+		}
437 533
                 if (empty($all)) {
438 534
 			$filters = array('airlines' => array($stats_airline));
439 535
             		if ($filter_name != '') {
@@ -452,7 +548,9 @@  discard block
 block discarded – undo
452 548
         			$icao = $value['airport_departure_icao'];
453 549
         			if (isset($all[$icao])) {
454 550
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
455
-        			} else $all[$icao] = $value;
551
+        			} else {
552
+        				$all[$icao] = $value;
553
+        			}
456 554
         		}
457 555
         		$count = array();
458 556
         		foreach ($all as $key => $row) {
@@ -464,10 +562,15 @@  discard block
 block discarded – undo
464 562
 	}
465 563
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
466 564
 		global $globalStatsFilters;
467
-		if ($filter_name == '') $filter_name = $this->filter_name;
565
+		if ($filter_name == '') {
566
+			$filter_name = $this->filter_name;
567
+		}
468 568
 		if ($year == '' && $month == '') {
469
-			if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
470
-			else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
569
+			if ($limit) {
570
+				$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
571
+			} else {
572
+				$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
573
+			}
471 574
 			try {
472 575
 				$sth = $this->db->prepare($query);
473 576
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -475,7 +578,9 @@  discard block
 block discarded – undo
475 578
 				echo "error : ".$e->getMessage();
476 579
 			}
477 580
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
478
-		} else $all = array();
581
+		} else {
582
+			$all = array();
583
+		}
479 584
 		if (empty($all)) {
480 585
 			$filters = array('airlines' => array($stats_airline));
481 586
 			if ($filter_name != '') {
@@ -494,7 +599,9 @@  discard block
 block discarded – undo
494 599
         			$icao = $value['airport_arrival_icao'];
495 600
         			if (isset($all[$icao])) {
496 601
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
497
-        			} else $all[$icao] = $value;
602
+        			} else {
603
+        				$all[$icao] = $value;
604
+        			}
498 605
         		}
499 606
         		$count = array();
500 607
         		foreach ($all as $key => $row) {
@@ -507,13 +614,21 @@  discard block
 block discarded – undo
507 614
 	}
508 615
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
509 616
 		global $globalDBdriver, $globalStatsFilters;
510
-		if ($filter_name == '') $filter_name = $this->filter_name;
617
+		if ($filter_name == '') {
618
+			$filter_name = $this->filter_name;
619
+		}
511 620
 		if ($globalDBdriver == 'mysql') {
512
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
513
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
621
+			if ($limit) {
622
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
623
+			} else {
624
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
625
+			}
514 626
 		} else {
515
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
516
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
627
+			if ($limit) {
628
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
629
+			} else {
630
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
631
+			}
517 632
 		}
518 633
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
519 634
                  try {
@@ -537,7 +652,9 @@  discard block
 block discarded – undo
537 652
 	
538 653
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
539 654
 		global $globalStatsFilters;
540
-		if ($filter_name == '') $filter_name = $this->filter_name;
655
+		if ($filter_name == '') {
656
+			$filter_name = $this->filter_name;
657
+		}
541 658
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
542 659
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
543 660
                  try {
@@ -559,7 +676,9 @@  discard block
 block discarded – undo
559 676
 	}
560 677
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
561 678
 		global $globalDBdriver, $globalStatsFilters;
562
-		if ($filter_name == '') $filter_name = $this->filter_name;
679
+		if ($filter_name == '') {
680
+			$filter_name = $this->filter_name;
681
+		}
563 682
 		if ($globalDBdriver == 'mysql') {
564 683
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
565 684
 		} else {
@@ -585,7 +704,9 @@  discard block
 block discarded – undo
585 704
 	}
586 705
 	public function countAllDates($stats_airline = '',$filter_name = '') {
587 706
 		global $globalStatsFilters;
588
-		if ($filter_name == '') $filter_name = $this->filter_name;
707
+		if ($filter_name == '') {
708
+			$filter_name = $this->filter_name;
709
+		}
589 710
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
590 711
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
591 712
                  try {
@@ -607,7 +728,9 @@  discard block
 block discarded – undo
607 728
 	}
608 729
 	public function countAllDatesByAirlines($filter_name = '') {
609 730
 		global $globalStatsFilters;
610
-		if ($filter_name == '') $filter_name = $this->filter_name;
731
+		if ($filter_name == '') {
732
+			$filter_name = $this->filter_name;
733
+		}
611 734
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
612 735
 		$query_data = array('filter_name' => $filter_name);
613 736
                  try {
@@ -629,7 +752,9 @@  discard block
 block discarded – undo
629 752
 	}
630 753
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
631 754
 		global $globalStatsFilters;
632
-		if ($filter_name == '') $filter_name = $this->filter_name;
755
+		if ($filter_name == '') {
756
+			$filter_name = $this->filter_name;
757
+		}
633 758
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
634 759
                  try {
635 760
                         $sth = $this->db->prepare($query);
@@ -650,7 +775,9 @@  discard block
 block discarded – undo
650 775
 	}
651 776
 	public function countAllMilitaryMonths($filter_name = '') {
652 777
 		global $globalStatsFilters;
653
-		if ($filter_name == '') $filter_name = $this->filter_name;
778
+		if ($filter_name == '') {
779
+			$filter_name = $this->filter_name;
780
+		}
654 781
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
655 782
                  try {
656 783
                         $sth = $this->db->prepare($query);
@@ -671,9 +798,14 @@  discard block
 block discarded – undo
671 798
 	}
672 799
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
673 800
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
674
-		if ($filter_name == '') $filter_name = $this->filter_name;
675
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
676
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
801
+		if ($filter_name == '') {
802
+			$filter_name = $this->filter_name;
803
+		}
804
+		if ($limit) {
805
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
806
+		} else {
807
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
808
+		}
677 809
 		if ($orderby == 'hour') {
678 810
 			/*
679 811
 			if ($globalDBdriver == 'mysql') {
@@ -682,7 +814,9 @@  discard block
 block discarded – undo
682 814
 			*/
683 815
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
684 816
 		}
685
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
817
+		if ($orderby == 'count') {
818
+			$query .= " ORDER BY hour_count DESC";
819
+		}
686 820
                  try {
687 821
                         $sth = $this->db->prepare($query);
688 822
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -703,8 +837,12 @@  discard block
 block discarded – undo
703 837
 	
704 838
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
705 839
 		global $globalStatsFilters;
706
-		if ($filter_name == '') $filter_name = $this->filter_name;
707
-		if ($year == '') $year = date('Y');
840
+		if ($filter_name == '') {
841
+			$filter_name = $this->filter_name;
842
+		}
843
+		if ($year == '') {
844
+			$year = date('Y');
845
+		}
708 846
 		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
709 847
 		if (empty($all)) {
710 848
 			$filters = array('airlines' => array($stats_airline));
@@ -718,8 +856,12 @@  discard block
 block discarded – undo
718 856
 	}
719 857
 	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
720 858
 		global $globalStatsFilters;
721
-		if ($filter_name == '') $filter_name = $this->filter_name;
722
-		if ($year == '') $year = date('Y');
859
+		if ($filter_name == '') {
860
+			$filter_name = $this->filter_name;
861
+		}
862
+		if ($year == '') {
863
+			$year = date('Y');
864
+		}
723 865
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
724 866
 		if (empty($all)) {
725 867
 		        $filters = array();
@@ -733,8 +875,12 @@  discard block
 block discarded – undo
733 875
 	}
734 876
 	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
735 877
 		global $globalStatsFilters;
736
-		if ($filter_name == '') $filter_name = $this->filter_name;
737
-		if ($year == '') $year = date('Y');
878
+		if ($filter_name == '') {
879
+			$filter_name = $this->filter_name;
880
+		}
881
+		if ($year == '') {
882
+			$year = date('Y');
883
+		}
738 884
 		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
739 885
 		if (empty($all)) {
740 886
 			$filters = array('airlines' => array($stats_airline));
@@ -748,8 +894,12 @@  discard block
 block discarded – undo
748 894
 	}
749 895
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
750 896
 		global $globalStatsFilters;
751
-		if ($filter_name == '') $filter_name = $this->filter_name;
752
-		if ($year == '') $year = date('Y');
897
+		if ($filter_name == '') {
898
+			$filter_name = $this->filter_name;
899
+		}
900
+		if ($year == '') {
901
+			$year = date('Y');
902
+		}
753 903
 		$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
754 904
 		if (empty($all)) {
755 905
 			$filters = array('airlines' => array($stats_airline));
@@ -763,7 +913,9 @@  discard block
 block discarded – undo
763 913
 	}
764 914
 	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
765 915
 		global $globalStatsFilters;
766
-		if ($filter_name == '') $filter_name = $this->filter_name;
916
+		if ($filter_name == '') {
917
+			$filter_name = $this->filter_name;
918
+		}
767 919
 		if ($year == '' && $month == '') {
768 920
 			$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
769 921
 			try {
@@ -774,7 +926,9 @@  discard block
 block discarded – undo
774 926
 			}
775 927
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
776 928
 			$all = $result[0]['nb_airline'];
777
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
929
+		} else {
930
+			$all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
931
+		}
778 932
 		if (empty($all)) {
779 933
             		$filters = array();
780 934
             		if ($filter_name != '') {
@@ -787,8 +941,12 @@  discard block
 block discarded – undo
787 941
 	}
788 942
 	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
789 943
 		global $globalStatsFilters;
790
-		if ($filter_name == '') $filter_name = $this->filter_name;
791
-		if ($year == '') $year = date('Y');
944
+		if ($filter_name == '') {
945
+			$filter_name = $this->filter_name;
946
+		}
947
+		if ($year == '') {
948
+			$year = date('Y');
949
+		}
792 950
 		/*
793 951
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
794 952
                  try {
@@ -813,8 +971,12 @@  discard block
 block discarded – undo
813 971
 	}
814 972
 	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
815 973
 		global $globalStatsFilters;
816
-		if ($filter_name == '') $filter_name = $this->filter_name;
817
-		if ($year == '') $year = date('Y');
974
+		if ($filter_name == '') {
975
+			$filter_name = $this->filter_name;
976
+		}
977
+		if ($year == '') {
978
+			$year = date('Y');
979
+		}
818 980
 		$all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month);
819 981
 		if (empty($all)) {
820 982
 			$filters = array('airlines' => array($stats_airline));
@@ -828,7 +990,9 @@  discard block
 block discarded – undo
828 990
 	}
829 991
 
830 992
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
831
-		if ($filter_name == '') $filter_name = $this->filter_name;
993
+		if ($filter_name == '') {
994
+			$filter_name = $this->filter_name;
995
+		}
832 996
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
833 997
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
834 998
                  try {
@@ -841,7 +1005,9 @@  discard block
 block discarded – undo
841 1005
                 return $all;
842 1006
 	}
843 1007
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
844
-		if ($filter_name == '') $filter_name = $this->filter_name;
1008
+		if ($filter_name == '') {
1009
+			$filter_name = $this->filter_name;
1010
+		}
845 1011
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
846 1012
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
847 1013
                  try {
@@ -854,7 +1020,9 @@  discard block
 block discarded – undo
854 1020
                 return $all;
855 1021
         }
856 1022
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
857
-		if ($filter_name == '') $filter_name = $this->filter_name;
1023
+		if ($filter_name == '') {
1024
+			$filter_name = $this->filter_name;
1025
+		}
858 1026
     		global $globalArchiveMonths, $globalDBdriver;
859 1027
     		if ($globalDBdriver == 'mysql') {
860 1028
     			if ($month == '') {
@@ -884,7 +1052,9 @@  discard block
 block discarded – undo
884 1052
         }
885 1053
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
886 1054
     		global $globalArchiveMonths, $globalDBdriver;
887
-		if ($filter_name == '') $filter_name = $this->filter_name;
1055
+		if ($filter_name == '') {
1056
+			$filter_name = $this->filter_name;
1057
+		}
888 1058
     		if ($globalDBdriver == 'mysql') {
889 1059
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
890 1060
 		} else {
@@ -902,7 +1072,9 @@  discard block
 block discarded – undo
902 1072
         }
903 1073
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
904 1074
     		global $globalArchiveMonths, $globalDBdriver;
905
-		if ($filter_name == '') $filter_name = $this->filter_name;
1075
+		if ($filter_name == '') {
1076
+			$filter_name = $this->filter_name;
1077
+		}
906 1078
     		if ($globalDBdriver == 'mysql') {
907 1079
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
908 1080
                 } else {
@@ -919,7 +1091,9 @@  discard block
 block discarded – undo
919 1091
         }
920 1092
 	public function getStatsAirlineTotal($filter_name = '') {
921 1093
     		global $globalArchiveMonths, $globalDBdriver;
922
-		if ($filter_name == '') $filter_name = $this->filter_name;
1094
+		if ($filter_name == '') {
1095
+			$filter_name = $this->filter_name;
1096
+		}
923 1097
     		if ($globalDBdriver == 'mysql') {
924 1098
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
925 1099
                 } else {
@@ -936,7 +1110,9 @@  discard block
 block discarded – undo
936 1110
         }
937 1111
 	public function getStatsOwnerTotal($filter_name = '') {
938 1112
     		global $globalArchiveMonths, $globalDBdriver;
939
-		if ($filter_name == '') $filter_name = $this->filter_name;
1113
+		if ($filter_name == '') {
1114
+			$filter_name = $this->filter_name;
1115
+		}
940 1116
     		if ($globalDBdriver == 'mysql') {
941 1117
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
942 1118
 		} else {
@@ -953,7 +1129,9 @@  discard block
 block discarded – undo
953 1129
         }
954 1130
 	public function getStatsPilotTotal($filter_name = '') {
955 1131
     		global $globalArchiveMonths, $globalDBdriver;
956
-		if ($filter_name == '') $filter_name = $this->filter_name;
1132
+		if ($filter_name == '') {
1133
+			$filter_name = $this->filter_name;
1134
+		}
957 1135
     		if ($globalDBdriver == 'mysql') {
958 1136
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
959 1137
             	} else {
@@ -971,7 +1149,9 @@  discard block
 block discarded – undo
971 1149
 
972 1150
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
973 1151
 		global $globalDBdriver;
974
-		if ($filter_name == '') $filter_name = $this->filter_name;
1152
+		if ($filter_name == '') {
1153
+			$filter_name = $this->filter_name;
1154
+		}
975 1155
 		if ($globalDBdriver == 'mysql') {
976 1156
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
977 1157
                 } else {
@@ -987,7 +1167,9 @@  discard block
 block discarded – undo
987 1167
         }
988 1168
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
989 1169
 		global $globalDBdriver;
990
-		if ($filter_name == '') $filter_name = $this->filter_name;
1170
+		if ($filter_name == '') {
1171
+			$filter_name = $this->filter_name;
1172
+		}
991 1173
 		if ($globalDBdriver == 'mysql') {
992 1174
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
993 1175
 		} else {
@@ -1373,10 +1555,14 @@  discard block
 block discarded – undo
1373 1555
     		$Connection = new Connection();
1374 1556
     		date_default_timezone_set('UTC');
1375 1557
     		$last_update = $this->getLastStatsUpdate('last_update_stats');
1376
-			if ($globalDebug) echo 'Update stats !'."\n";
1558
+			if ($globalDebug) {
1559
+				echo 'Update stats !'."\n";
1560
+			}
1377 1561
 			if (isset($last_update[0]['value'])) {
1378 1562
 				$last_update_day = $last_update[0]['value'];
1379
-			} else $last_update_day = '2012-12-12 12:12:12';
1563
+			} else {
1564
+				$last_update_day = '2012-12-12 12:12:12';
1565
+			}
1380 1566
 			$reset = false;
1381 1567
 			if ($globalStatsResetYear) {
1382 1568
 				$reset = true;
@@ -1384,42 +1570,60 @@  discard block
 block discarded – undo
1384 1570
 			}
1385 1571
 			$Spotter = new Spotter($this->db);
1386 1572
 
1387
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1573
+			if ($globalDebug) {
1574
+				echo 'Count all aircraft types...'."\n";
1575
+			}
1388 1576
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1389 1577
 			foreach ($alldata as $number) {
1390 1578
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
1391 1579
 			}
1392
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1580
+			if ($globalDebug) {
1581
+				echo 'Count all airlines...'."\n";
1582
+			}
1393 1583
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1394 1584
 			foreach ($alldata as $number) {
1395 1585
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
1396 1586
 			}
1397
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1587
+			if ($globalDebug) {
1588
+				echo 'Count all registrations...'."\n";
1589
+			}
1398 1590
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1399 1591
 			foreach ($alldata as $number) {
1400 1592
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
1401 1593
 			}
1402
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1594
+			if ($globalDebug) {
1595
+				echo 'Count all callsigns...'."\n";
1596
+			}
1403 1597
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1404 1598
 			foreach ($alldata as $number) {
1405 1599
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1406 1600
 			}
1407
-			if ($globalDebug) echo 'Count all owners...'."\n";
1601
+			if ($globalDebug) {
1602
+				echo 'Count all owners...'."\n";
1603
+			}
1408 1604
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1409 1605
 			foreach ($alldata as $number) {
1410 1606
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
1411 1607
 			}
1412
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1608
+			if ($globalDebug) {
1609
+				echo 'Count all pilots...'."\n";
1610
+			}
1413 1611
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1414 1612
 			foreach ($alldata as $number) {
1415 1613
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
1416 1614
 			}
1417 1615
 			
1418
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1616
+			if ($globalDebug) {
1617
+				echo 'Count all departure airports...'."\n";
1618
+			}
1419 1619
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1420
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1620
+			if ($globalDebug) {
1621
+				echo 'Count all detected departure airports...'."\n";
1622
+			}
1421 1623
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1422
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1624
+			if ($globalDebug) {
1625
+				echo 'Order departure airports...'."\n";
1626
+			}
1423 1627
 	        	$alldata = array();
1424 1628
 	        	
1425 1629
     			foreach ($pall as $value) {
@@ -1430,7 +1634,9 @@  discard block
 block discarded – undo
1430 1634
     				$icao = $value['airport_departure_icao'];
1431 1635
         			if (isset($alldata[$icao])) {
1432 1636
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1433
-        			} else $alldata[$icao] = $value;
1637
+        			} else {
1638
+        				$alldata[$icao] = $value;
1639
+        			}
1434 1640
 			}
1435 1641
     			$count = array();
1436 1642
     			foreach ($alldata as $key => $row) {
@@ -1440,11 +1646,17 @@  discard block
 block discarded – undo
1440 1646
 			foreach ($alldata as $number) {
1441 1647
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
1442 1648
 			}
1443
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1649
+			if ($globalDebug) {
1650
+				echo 'Count all arrival airports...'."\n";
1651
+			}
1444 1652
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1445
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1653
+			if ($globalDebug) {
1654
+				echo 'Count all detected arrival airports...'."\n";
1655
+			}
1446 1656
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1447
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1657
+			if ($globalDebug) {
1658
+				echo 'Order arrival airports...'."\n";
1659
+			}
1448 1660
 	        	$alldata = array();
1449 1661
     			foreach ($pall as $value) {
1450 1662
 	        		$icao = $value['airport_arrival_icao'];
@@ -1454,7 +1666,9 @@  discard block
 block discarded – undo
1454 1666
     				$icao = $value['airport_arrival_icao'];
1455 1667
         			if (isset($alldata[$icao])) {
1456 1668
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1457
-	        		} else $alldata[$icao] = $value;
1669
+	        		} else {
1670
+	        			$alldata[$icao] = $value;
1671
+	        		}
1458 1672
     			}
1459 1673
         		$count = array();
1460 1674
         		foreach ($alldata as $key => $row) {
@@ -1465,7 +1679,9 @@  discard block
 block discarded – undo
1465 1679
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
1466 1680
 			}
1467 1681
 			if ($Connection->tableExists('countries')) {
1468
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1682
+				if ($globalDebug) {
1683
+					echo 'Count all flights by countries...'."\n";
1684
+				}
1469 1685
 				$SpotterArchive = new SpotterArchive();
1470 1686
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1471 1687
 				foreach ($alldata as $number) {
@@ -1477,46 +1693,66 @@  discard block
 block discarded – undo
1477 1693
 			// Add by month using getstat if month finish...
1478 1694
 
1479 1695
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1480
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1696
+			if ($globalDebug) {
1697
+				echo 'Count all flights by months...'."\n";
1698
+			}
1481 1699
 			$Spotter = new Spotter($this->db);
1482 1700
 			$alldata = $Spotter->countAllMonths();
1483 1701
 			$lastyear = false;
1484 1702
 			foreach ($alldata as $number) {
1485
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1703
+				if ($number['year_name'] != date('Y')) {
1704
+					$lastyear = true;
1705
+				}
1486 1706
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1487 1707
 			}
1488
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1708
+			if ($globalDebug) {
1709
+				echo 'Count all military flights by months...'."\n";
1710
+			}
1489 1711
 			$alldata = $Spotter->countAllMilitaryMonths();
1490 1712
 			foreach ($alldata as $number) {
1491 1713
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1492 1714
 			}
1493
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1715
+			if ($globalDebug) {
1716
+				echo 'Count all owners by months...'."\n";
1717
+			}
1494 1718
 			$alldata = $Spotter->countAllMonthsOwners();
1495 1719
 			foreach ($alldata as $number) {
1496 1720
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1497 1721
 			}
1498
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1722
+			if ($globalDebug) {
1723
+				echo 'Count all pilots by months...'."\n";
1724
+			}
1499 1725
 			$alldata = $Spotter->countAllMonthsPilots();
1500 1726
 			foreach ($alldata as $number) {
1501 1727
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1502 1728
 			}
1503
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1729
+			if ($globalDebug) {
1730
+				echo 'Count all airlines by months...'."\n";
1731
+			}
1504 1732
 			$alldata = $Spotter->countAllMonthsAirlines();
1505 1733
 			foreach ($alldata as $number) {
1506 1734
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1507 1735
 			}
1508
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1736
+			if ($globalDebug) {
1737
+				echo 'Count all aircrafts by months...'."\n";
1738
+			}
1509 1739
 			$alldata = $Spotter->countAllMonthsAircrafts();
1510 1740
 			foreach ($alldata as $number) {
1511 1741
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1512 1742
 			}
1513
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1743
+			if ($globalDebug) {
1744
+				echo 'Count all real arrivals by months...'."\n";
1745
+			}
1514 1746
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1515 1747
 			foreach ($alldata as $number) {
1516 1748
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1517 1749
 			}
1518
-			if ($globalDebug) echo 'Airports data...'."\n";
1519
-			if ($globalDebug) echo '...Departure'."\n";
1750
+			if ($globalDebug) {
1751
+				echo 'Airports data...'."\n";
1752
+			}
1753
+			if ($globalDebug) {
1754
+				echo '...Departure'."\n";
1755
+			}
1520 1756
 			$this->deleteStatAirport('daily');
1521 1757
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1522 1758
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1636,37 +1872,53 @@  discard block
 block discarded – undo
1636 1872
 
1637 1873
 			// Count by airlines
1638 1874
 			echo '--- Stats by airlines ---'."\n";
1639
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1875
+			if ($globalDebug) {
1876
+				echo 'Count all aircraft types by airlines...'."\n";
1877
+			}
1640 1878
 			$Spotter = new Spotter($this->db);
1641 1879
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1642 1880
 			foreach ($alldata as $number) {
1643 1881
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
1644 1882
 			}
1645
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1883
+			if ($globalDebug) {
1884
+				echo 'Count all aircraft registrations by airlines...'."\n";
1885
+			}
1646 1886
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1647 1887
 			foreach ($alldata as $number) {
1648 1888
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
1649 1889
 			}
1650
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1890
+			if ($globalDebug) {
1891
+				echo 'Count all callsigns by airlines...'."\n";
1892
+			}
1651 1893
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1652 1894
 			foreach ($alldata as $number) {
1653 1895
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1654 1896
 			}
1655
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1897
+			if ($globalDebug) {
1898
+				echo 'Count all owners by airlines...'."\n";
1899
+			}
1656 1900
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1657 1901
 			foreach ($alldata as $number) {
1658 1902
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
1659 1903
 			}
1660
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1904
+			if ($globalDebug) {
1905
+				echo 'Count all pilots by airlines...'."\n";
1906
+			}
1661 1907
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1662 1908
 			foreach ($alldata as $number) {
1663 1909
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
1664 1910
 			}
1665
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1911
+			if ($globalDebug) {
1912
+				echo 'Count all departure airports by airlines...'."\n";
1913
+			}
1666 1914
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1667
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1915
+			if ($globalDebug) {
1916
+				echo 'Count all detected departure airports by airlines...'."\n";
1917
+			}
1668 1918
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1669
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1919
+			if ($globalDebug) {
1920
+				echo 'Order detected departure airports by airlines...'."\n";
1921
+			}
1670 1922
 	        	//$alldata = array();
1671 1923
     			foreach ($dall as $value) {
1672 1924
     				$icao = $value['airport_departure_icao'];
@@ -1687,11 +1939,17 @@  discard block
 block discarded – undo
1687 1939
 			foreach ($alldata as $number) {
1688 1940
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
1689 1941
 			}
1690
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1942
+			if ($globalDebug) {
1943
+				echo 'Count all arrival airports by airlines...'."\n";
1944
+			}
1691 1945
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1692
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1946
+			if ($globalDebug) {
1947
+				echo 'Count all detected arrival airports by airlines...'."\n";
1948
+			}
1693 1949
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1694
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1950
+			if ($globalDebug) {
1951
+				echo 'Order arrival airports by airlines...'."\n";
1952
+			}
1695 1953
 	        	//$alldata = array();
1696 1954
     			foreach ($dall as $value) {
1697 1955
     				$icao = $value['airport_arrival_icao'];
@@ -1710,37 +1968,53 @@  discard block
 block discarded – undo
1710 1968
     			}
1711 1969
     			$alldata = $pall;
1712 1970
                         foreach ($alldata as $number) {
1713
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
1971
+				if ($number['airline_icao'] != '') {
1972
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
1973
+				}
1974
+			}
1975
+			if ($globalDebug) {
1976
+				echo 'Count all flights by months by airlines...'."\n";
1714 1977
 			}
1715
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1716 1978
 			$Spotter = new Spotter($this->db);
1717 1979
 			$alldata = $Spotter->countAllMonthsByAirlines();
1718 1980
 			$lastyear = false;
1719 1981
 			foreach ($alldata as $number) {
1720
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1982
+				if ($number['year_name'] != date('Y')) {
1983
+					$lastyear = true;
1984
+				}
1721 1985
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1722 1986
 			}
1723
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1987
+			if ($globalDebug) {
1988
+				echo 'Count all owners by months by airlines...'."\n";
1989
+			}
1724 1990
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1725 1991
 			foreach ($alldata as $number) {
1726 1992
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1727 1993
 			}
1728
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1994
+			if ($globalDebug) {
1995
+				echo 'Count all pilots by months by airlines...'."\n";
1996
+			}
1729 1997
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1730 1998
 			foreach ($alldata as $number) {
1731 1999
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1732 2000
 			}
1733
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2001
+			if ($globalDebug) {
2002
+				echo 'Count all aircrafts by months by airlines...'."\n";
2003
+			}
1734 2004
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1735 2005
 			foreach ($alldata as $number) {
1736 2006
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1737 2007
 			}
1738
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2008
+			if ($globalDebug) {
2009
+				echo 'Count all real arrivals by months by airlines...'."\n";
2010
+			}
1739 2011
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1740 2012
 			foreach ($alldata as $number) {
1741 2013
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1742 2014
 			}
1743
-			if ($globalDebug) echo '...Departure'."\n";
2015
+			if ($globalDebug) {
2016
+				echo '...Departure'."\n";
2017
+			}
1744 2018
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1745 2019
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1746 2020
     			foreach ($dall as $value) {
@@ -1763,7 +2037,9 @@  discard block
 block discarded – undo
1763 2037
 			foreach ($alldata as $number) {
1764 2038
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1765 2039
 			}
1766
-			if ($globalDebug) echo '...Arrival'."\n";
2040
+			if ($globalDebug) {
2041
+				echo '...Arrival'."\n";
2042
+			}
1767 2043
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1768 2044
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1769 2045
     			foreach ($dall as $value) {
@@ -1787,13 +2063,19 @@  discard block
 block discarded – undo
1787 2063
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1788 2064
 			}
1789 2065
 
1790
-			if ($globalDebug) echo 'Flights data...'."\n";
1791
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2066
+			if ($globalDebug) {
2067
+				echo 'Flights data...'."\n";
2068
+			}
2069
+			if ($globalDebug) {
2070
+				echo '-> countAllDatesLastMonth...'."\n";
2071
+			}
1792 2072
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1793 2073
 			foreach ($alldata as $number) {
1794 2074
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1795 2075
 			}
1796
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2076
+			if ($globalDebug) {
2077
+				echo '-> countAllDates...'."\n";
2078
+			}
1797 2079
 			//$previousdata = $this->countAllDatesByAirlines();
1798 2080
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1799 2081
 			$values = array();
@@ -1806,7 +2088,9 @@  discard block
 block discarded – undo
1806 2088
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1807 2089
 			}
1808 2090
 			
1809
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2091
+			if ($globalDebug) {
2092
+				echo '-> countAllHours...'."\n";
2093
+			}
1810 2094
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1811 2095
 			foreach ($alldata as $number) {
1812 2096
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
@@ -1814,7 +2098,9 @@  discard block
 block discarded – undo
1814 2098
 			
1815 2099
 
1816 2100
 			// Stats by filters
1817
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2101
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2102
+				$globalStatsFilters = array();
2103
+			}
1818 2104
 			foreach ($globalStatsFilters as $name => $filter) {
1819 2105
 				//$filter_name = $filter['name'];
1820 2106
 				$filter_name = $name;
@@ -1822,11 +2108,15 @@  discard block
 block discarded – undo
1822 2108
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
1823 2109
 				if (isset($last_update[0]['value'])) {
1824 2110
 					$last_update_day = $last_update[0]['value'];
1825
-				} else $last_update_day = '2012-12-12 12:12:12';
2111
+				} else {
2112
+					$last_update_day = '2012-12-12 12:12:12';
2113
+				}
1826 2114
 				$reset = false;
1827 2115
 
1828 2116
 				// Count by filter
1829
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2117
+				if ($globalDebug) {
2118
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2119
+				}
1830 2120
 				$Spotter = new Spotter($this->db);
1831 2121
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1832 2122
 				foreach ($alldata as $number) {
@@ -1863,7 +2153,9 @@  discard block
 block discarded – undo
1863 2153
 	    				$icao = $value['airport_departure_icao'];
1864 2154
         				if (isset($alldata[$icao])) {
1865 2155
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1866
-        				} else $alldata[$icao] = $value;
2156
+        				} else {
2157
+        					$alldata[$icao] = $value;
2158
+        				}
1867 2159
 				}
1868 2160
 	    			$count = array();
1869 2161
     				foreach ($alldata as $key => $row) {
@@ -1884,7 +2176,9 @@  discard block
 block discarded – undo
1884 2176
 	    				$icao = $value['airport_arrival_icao'];
1885 2177
         				if (isset($alldata[$icao])) {
1886 2178
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1887
-		        		} else $alldata[$icao] = $value;
2179
+		        		} else {
2180
+		        			$alldata[$icao] = $value;
2181
+		        		}
1888 2182
 	    			}
1889 2183
         			$count = array();
1890 2184
         			foreach ($alldata as $key => $row) {
@@ -1898,7 +2192,9 @@  discard block
 block discarded – undo
1898 2192
 				$alldata = $Spotter->countAllMonths($filter);
1899 2193
 				$lastyear = false;
1900 2194
 				foreach ($alldata as $number) {
1901
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2195
+					if ($number['year_name'] != date('Y')) {
2196
+						$lastyear = true;
2197
+					}
1902 2198
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1903 2199
 				}
1904 2200
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
require/class.Spotter.php 2 patches
Indentation   +1437 added lines, -1437 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;
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	
1379 1379
 	
1380 1380
 	/**
1381
-	* Gets all the spotter information based on the aircraft type
1382
-	*
1383
-	* @return Array the spotter information
1384
-	*
1385
-	*/
1381
+	 * Gets all the spotter information based on the aircraft type
1382
+	 *
1383
+	 * @return Array the spotter information
1384
+	 *
1385
+	 */
1386 1386
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1387 1387
 	{
1388 1388
 		global $global_query;
@@ -1436,11 +1436,11 @@  discard block
 block discarded – undo
1436 1436
 	
1437 1437
 	
1438 1438
 	/**
1439
-	* Gets all the spotter information based on the aircraft registration
1440
-	*
1441
-	* @return Array the spotter information
1442
-	*
1443
-	*/
1439
+	 * Gets all the spotter information based on the aircraft registration
1440
+	 *
1441
+	 * @return Array the spotter information
1442
+	 *
1443
+	 */
1444 1444
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1445 1445
 	{
1446 1446
 		global $global_query;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	
1498 1498
 	
1499 1499
 	/**
1500
-	* Gets all the spotter information based on the airline
1501
-	*
1502
-	* @return Array the spotter information
1503
-	*
1504
-	*/
1500
+	 * Gets all the spotter information based on the airline
1501
+	 *
1502
+	 * @return Array the spotter information
1503
+	 *
1504
+	 */
1505 1505
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
@@ -1554,11 +1554,11 @@  discard block
 block discarded – undo
1554 1554
 	
1555 1555
 	
1556 1556
 	/**
1557
-	* Gets all the spotter information based on the airport
1558
-	*
1559
-	* @return Array the spotter information
1560
-	*
1561
-	*/
1557
+	 * Gets all the spotter information based on the airport
1558
+	 *
1559
+	 * @return Array the spotter information
1560
+	 *
1561
+	 */
1562 1562
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
@@ -1612,11 +1612,11 @@  discard block
 block discarded – undo
1612 1612
 
1613 1613
 
1614 1614
 	/**
1615
-	* Gets all the spotter information based on the date
1616
-	*
1617
-	* @return Array the spotter information
1618
-	*
1619
-	*/
1615
+	 * Gets all the spotter information based on the date
1616
+	 *
1617
+	 * @return Array the spotter information
1618
+	 *
1619
+	 */
1620 1620
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
 
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the country name
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the country name
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1738,11 +1738,11 @@  discard block
 block discarded – undo
1738 1738
 	
1739 1739
 	
1740 1740
 	/**
1741
-	* Gets all the spotter information based on the manufacturer name
1742
-	*
1743
-	* @return Array the spotter information
1744
-	*
1745
-	*/
1741
+	 * Gets all the spotter information based on the manufacturer name
1742
+	 *
1743
+	 * @return Array the spotter information
1744
+	 *
1745
+	 */
1746 1746
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1747 1747
 	{
1748 1748
 		global $global_query;
@@ -1798,13 +1798,13 @@  discard block
 block discarded – undo
1798 1798
   
1799 1799
   
1800 1800
 	/**
1801
-	* Gets a list of all aircraft that take a route
1802
-	*
1803
-	* @param String $departure_airport_icao ICAO code of departure airport
1804
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1805
-	* @return Array the spotter information
1806
-	*
1807
-	*/
1801
+	 * Gets a list of all aircraft that take a route
1802
+	 *
1803
+	 * @param String $departure_airport_icao ICAO code of departure airport
1804
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1805
+	 * @return Array the spotter information
1806
+	 *
1807
+	 */
1808 1808
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1809 1809
 	{
1810 1810
 		global $global_query;
@@ -1873,11 +1873,11 @@  discard block
 block discarded – undo
1873 1873
 	
1874 1874
 	
1875 1875
 	/**
1876
-	* Gets all the spotter information based on the special column in the table
1877
-	*
1878
-	* @return Array the spotter information
1879
-	*
1880
-	*/
1876
+	 * Gets all the spotter information based on the special column in the table
1877
+	 *
1878
+	 * @return Array the spotter information
1879
+	 *
1880
+	 */
1881 1881
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1882 1882
 	{
1883 1883
 		global $global_query;
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Gets all the highlight based on a aircraft registration
1920
-	*
1921
-	* @return String the highlight text
1922
-	*
1923
-	*/
1919
+	 * Gets all the highlight based on a aircraft registration
1920
+	 *
1921
+	 * @return String the highlight text
1922
+	 *
1923
+	 */
1924 1924
 	public function getHighlightByRegistration($registration,$filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
@@ -1942,13 +1942,13 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	
1944 1944
 	/**
1945
-	* Gets the squawk usage from squawk code
1946
-	*
1947
-	* @param String $squawk squawk code
1948
-	* @param String $country country
1949
-	* @return String usage
1950
-	*
1951
-	*/
1945
+	 * Gets the squawk usage from squawk code
1946
+	 *
1947
+	 * @param String $squawk squawk code
1948
+	 * @param String $country country
1949
+	 * @return String usage
1950
+	 *
1951
+	 */
1952 1952
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1953 1953
 	{
1954 1954
 		
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 
1971 1971
 	/**
1972
-	* Gets the airport icao from the iata
1973
-	*
1974
-	* @param String $airport_iata the iata code of the airport
1975
-	* @return String airport iata
1976
-	*
1977
-	*/
1972
+	 * Gets the airport icao from the iata
1973
+	 *
1974
+	 * @param String $airport_iata the iata code of the airport
1975
+	 * @return String airport iata
1976
+	 *
1977
+	 */
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
 	}
1995 1995
 
1996 1996
 	/**
1997
-	* Gets the airport distance
1998
-	*
1999
-	* @param String $airport_icao the icao code of the airport
2000
-	* @param Float $latitude the latitude
2001
-	* @param Float $longitude the longitude
2002
-	* @return Float distance to the airport
2003
-	*
2004
-	*/
1997
+	 * Gets the airport distance
1998
+	 *
1999
+	 * @param String $airport_icao the icao code of the airport
2000
+	 * @param Float $latitude the latitude
2001
+	 * @param Float $longitude the longitude
2002
+	 * @return Float distance to the airport
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2006 2006
 	{
2007 2007
 		
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 	}
2023 2023
 	
2024 2024
 	/**
2025
-	* Gets the airport info based on the icao
2026
-	*
2027
-	* @param String $airport the icao code of the airport
2028
-	* @return Array airport information
2029
-	*
2030
-	*/
2025
+	 * Gets the airport info based on the icao
2026
+	 *
2027
+	 * @param String $airport the icao code of the airport
2028
+	 * @return Array airport information
2029
+	 *
2030
+	 */
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
@@ -2073,12 +2073,12 @@  discard block
 block discarded – undo
2073 2073
 	}
2074 2074
 	
2075 2075
 	/**
2076
-	* Gets the airport info based on the country
2077
-	*
2078
-	* @param Array $countries Airports countries
2079
-	* @return Array airport information
2080
-	*
2081
-	*/
2076
+	 * Gets the airport info based on the country
2077
+	 *
2078
+	 * @param Array $countries Airports countries
2079
+	 * @return Array airport information
2080
+	 *
2081
+	 */
2082 2082
 	public function getAllAirportInfobyCountry($countries)
2083 2083
 	{
2084 2084
 		$lst_countries = '';
@@ -2116,12 +2116,12 @@  discard block
 block discarded – undo
2116 2116
 	}
2117 2117
 	
2118 2118
 	/**
2119
-	* Gets airports info based on the coord
2120
-	*
2121
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
-	* @return Array airport information
2123
-	*
2124
-	*/
2119
+	 * Gets airports info based on the coord
2120
+	 *
2121
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
+	 * @return Array airport information
2123
+	 *
2124
+	 */
2125 2125
 	public function getAllAirportInfobyCoord($coord)
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets waypoints info based on the coord
2156
-	*
2157
-	* @param Array $coord waypoints coord
2158
-	* @return Array airport information
2159
-	*
2160
-	*/
2155
+	 * Gets waypoints info based on the coord
2156
+	 *
2157
+	 * @param Array $coord waypoints coord
2158
+	 * @return Array airport information
2159
+	 *
2160
+	 */
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
@@ -2191,12 +2191,12 @@  discard block
 block discarded – undo
2191 2191
 	
2192 2192
 	
2193 2193
 	/**
2194
-	* Gets the airline info based on the icao code or iata code
2195
-	*
2196
-	* @param String $airline_icao the iata code of the airport
2197
-	* @return Array airport information
2198
-	*
2199
-	*/
2194
+	 * Gets the airline info based on the icao code or iata code
2195
+	 *
2196
+	 * @param String $airline_icao the iata code of the airport
2197
+	 * @return Array airport information
2198
+	 *
2199
+	 */
2200 2200
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 			} else {
2228 2228
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2229 2229
 			}
2230
-                        /*
2230
+						/*
2231 2231
 			$airline_array = array();
2232 2232
 			$temp_array = array();
2233 2233
 		
@@ -2260,12 +2260,12 @@  discard block
 block discarded – undo
2260 2260
 	}
2261 2261
 	
2262 2262
 	/**
2263
-	* Gets the airline info based on the airline name
2264
-	*
2265
-	* @param String $airline_name the name of the airline
2266
-	* @return Array airline information
2267
-	*
2268
-	*/
2263
+	 * Gets the airline info based on the airline name
2264
+	 *
2265
+	 * @param String $airline_name the name of the airline
2266
+	 * @return Array airline information
2267
+	 *
2268
+	 */
2269 2269
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
@@ -2293,12 +2293,12 @@  discard block
 block discarded – undo
2293 2293
 	
2294 2294
 	
2295 2295
 	/**
2296
-	* Gets the aircraft info based on the aircraft type
2297
-	*
2298
-	* @param String $aircraft_type the aircraft type
2299
-	* @return Array aircraft information
2300
-	*
2301
-	*/
2296
+	 * Gets the aircraft info based on the aircraft type
2297
+	 *
2298
+	 * @param String $aircraft_type the aircraft type
2299
+	 * @return Array aircraft information
2300
+	 *
2301
+	 */
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304 2304
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 
2332 2332
 	/**
2333
-	* Gets the aircraft icao based on the aircraft name/type
2334
-	*
2335
-	* @param String $aircraft_type the aircraft type
2336
-	* @return String aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft icao based on the aircraft name/type
2334
+	 *
2335
+	 * @param String $aircraft_type the aircraft type
2336
+	 * @return String aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341 2341
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2360,12 +2360,12 @@  discard block
 block discarded – undo
2360 2360
 	}
2361 2361
 	
2362 2362
 	/**
2363
-	* Gets the aircraft info based on the aircraft modes
2364
-	*
2365
-	* @param String $aircraft_modes the aircraft ident (hex)
2366
-	* @return String aircraft type
2367
-	*
2368
-	*/
2363
+	 * Gets the aircraft info based on the aircraft modes
2364
+	 *
2365
+	 * @param String $aircraft_modes the aircraft ident (hex)
2366
+	 * @return String aircraft type
2367
+	 *
2368
+	 */
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371 2371
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2385,12 +2385,12 @@  discard block
 block discarded – undo
2385 2385
 	}
2386 2386
 
2387 2387
 	/**
2388
-	* Gets the aircraft info based on the aircraft registration
2389
-	*
2390
-	* @param String $registration the aircraft registration
2391
-	* @return String aircraft type
2392
-	*
2393
-	*/
2388
+	 * Gets the aircraft info based on the aircraft registration
2389
+	 *
2390
+	 * @param String $registration the aircraft registration
2391
+	 * @return String aircraft type
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396 2396
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2408,12 +2408,12 @@  discard block
 block discarded – undo
2408 2408
 	}
2409 2409
 
2410 2410
 	/**
2411
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2412
-	*
2413
-	* @param String $registration the aircraft registration
2414
-	* @return Array spotter_id and flightaware_id
2415
-	*
2416
-	*/
2411
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2412
+	 *
2413
+	 * @param String $registration the aircraft registration
2414
+	 * @return Array spotter_id and flightaware_id
2415
+	 *
2416
+	 */
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419 2419
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2432,12 +2432,12 @@  discard block
 block discarded – undo
2432 2432
 	}
2433 2433
 
2434 2434
 	/**
2435
-	* Gets correct aircraft operator code
2436
-	*
2437
-	* @param String $operator the aircraft operator code (callsign)
2438
-	* @return String aircraft operator code
2439
-	*
2440
-	*/
2435
+	 * Gets correct aircraft operator code
2436
+	 *
2437
+	 * @param String $operator the aircraft operator code (callsign)
2438
+	 * @return String aircraft operator code
2439
+	 *
2440
+	 */
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443 2443
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2454,16 +2454,16 @@  discard block
 block discarded – undo
2454 2454
 	}
2455 2455
 
2456 2456
 	/**
2457
-	* Gets the aircraft route based on the aircraft callsign
2458
-	*
2459
-	* @param String $callsign the aircraft callsign
2460
-	* @return Array aircraft type
2461
-	*
2462
-	*/
2457
+	 * Gets the aircraft route based on the aircraft callsign
2458
+	 *
2459
+	 * @param String $callsign the aircraft callsign
2460
+	 * @return Array aircraft type
2461
+	 *
2462
+	 */
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465 2465
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2466
+				if ($callsign == '') return array();
2467 2467
 		$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";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
@@ -2477,12 +2477,12 @@  discard block
 block discarded – undo
2477 2477
 	}
2478 2478
 	
2479 2479
 	/**
2480
-	* Gets the aircraft info based on the aircraft registration
2481
-	*
2482
-	* @param String $registration the aircraft registration
2483
-	* @return Array aircraft information
2484
-	*
2485
-	*/
2480
+	 * Gets the aircraft info based on the aircraft registration
2481
+	 *
2482
+	 * @param String $registration the aircraft registration
2483
+	 * @return Array aircraft information
2484
+	 *
2485
+	 */
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488 2488
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2509,12 +2509,12 @@  discard block
 block discarded – undo
2509 2509
 	}
2510 2510
 	
2511 2511
 	/**
2512
-	* Gets the aircraft owner & base based on the aircraft registration
2513
-	*
2514
-	* @param String $registration the aircraft registration
2515
-	* @return Array aircraft information
2516
-	*
2517
-	*/
2512
+	 * Gets the aircraft owner & base based on the aircraft registration
2513
+	 *
2514
+	 * @param String $registration the aircraft registration
2515
+	 * @return Array aircraft information
2516
+	 *
2517
+	 */
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520 2520
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
 	
2532 2532
   
2533 2533
   /**
2534
-	* Gets all flights (but with only little info)
2535
-	*
2536
-	* @return Array basic flight information
2537
-	*
2538
-	*/
2534
+   * Gets all flights (but with only little info)
2535
+   *
2536
+   * @return Array basic flight information
2537
+   *
2538
+   */
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$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 ";
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
2546
-                  /*
2546
+				  /*
2547 2547
 		$flight_array = array();
2548 2548
 		$temp_array = array();
2549 2549
 		
@@ -2565,11 +2565,11 @@  discard block
 block discarded – undo
2565 2565
 	}
2566 2566
   
2567 2567
 	/**
2568
-	* Gets a list of all aircraft manufacturers
2569
-	*
2570
-	* @return Array list of aircraft types
2571
-	*
2572
-	*/
2568
+	 * Gets a list of all aircraft manufacturers
2569
+	 *
2570
+	 * @return Array list of aircraft types
2571
+	 *
2572
+	 */
2573 2573
 	public function getAllManufacturers()
2574 2574
 	{
2575 2575
 		/*
@@ -2598,11 +2598,11 @@  discard block
 block discarded – undo
2598 2598
   
2599 2599
   
2600 2600
   /**
2601
-	* Gets a list of all aircraft types
2602
-	*
2603
-	* @return Array list of aircraft types
2604
-	*
2605
-	*/
2601
+   * Gets a list of all aircraft types
2602
+   *
2603
+   * @return Array list of aircraft types
2604
+   *
2605
+   */
2606 2606
 	public function getAllAircraftTypes($filters = array())
2607 2607
 	{
2608 2608
 		/*
@@ -2637,11 +2637,11 @@  discard block
 block discarded – undo
2637 2637
 	
2638 2638
 	
2639 2639
 	/**
2640
-	* Gets a list of all aircraft registrations
2641
-	*
2642
-	* @return Array list of aircraft registrations
2643
-	*
2644
-	*/
2640
+	 * Gets a list of all aircraft registrations
2641
+	 *
2642
+	 * @return Array list of aircraft registrations
2643
+	 *
2644
+	 */
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647 2647
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2666,12 +2666,12 @@  discard block
 block discarded – undo
2666 2666
 	}
2667 2667
 
2668 2668
 	/**
2669
-	* Gets all source name
2670
-	*
2671
-	* @param String type format of source
2672
-	* @return Array list of source name
2673
-	*
2674
-	*/
2669
+	 * Gets all source name
2670
+	 *
2671
+	 * @param String type format of source
2672
+	 * @return Array list of source name
2673
+	 *
2674
+	 */
2675 2675
 	public function getAllSourceName($type = '',$filters = array())
2676 2676
 	{
2677 2677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 
2703 2703
 
2704 2704
 	/**
2705
-	* Gets a list of all airline names
2706
-	*
2707
-	* @return Array list of airline names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all airline names
2706
+	 *
2707
+	 * @return Array list of airline names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2711 2711
 	{
2712 2712
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 	}
2756 2756
 	
2757 2757
 	/**
2758
-	* Gets a list of all alliance names
2759
-	*
2760
-	* @return Array list of alliance names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all alliance names
2759
+	 *
2760
+	 * @return Array list of alliance names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2784,11 +2784,11 @@  discard block
 block discarded – undo
2784 2784
 	}
2785 2785
 	
2786 2786
 	/**
2787
-	* Gets a list of all airline countries
2788
-	*
2789
-	* @return Array list of airline countries
2790
-	*
2791
-	*/
2787
+	 * Gets a list of all airline countries
2788
+	 *
2789
+	 * @return Array list of airline countries
2790
+	 *
2791
+	 */
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794 2794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2816,11 +2816,11 @@  discard block
 block discarded – undo
2816 2816
 	
2817 2817
 	
2818 2818
 	/**
2819
-	* Gets a list of all departure & arrival names
2820
-	*
2821
-	* @return Array list of airport names
2822
-	*
2823
-	*/
2819
+	 * Gets a list of all departure & arrival names
2820
+	 *
2821
+	 * @return Array list of airport names
2822
+	 *
2823
+	 */
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826 2826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2868,11 +2868,11 @@  discard block
 block discarded – undo
2868 2868
 	} 
2869 2869
 
2870 2870
 	/**
2871
-	* Gets a list of all owner names
2872
-	*
2873
-	* @return Array list of owner names
2874
-	*
2875
-	*/
2871
+	 * Gets a list of all owner names
2872
+	 *
2873
+	 * @return Array list of owner names
2874
+	 *
2875
+	 */
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878 2878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2887,11 +2887,11 @@  discard block
 block discarded – undo
2887 2887
 	} 
2888 2888
 
2889 2889
 	/**
2890
-	* Gets a list of all pilot names and pilot ids
2891
-	*
2892
-	* @return Array list of pilot names and pilot ids
2893
-	*
2894
-	*/
2890
+	 * Gets a list of all pilot names and pilot ids
2891
+	 *
2892
+	 * @return Array list of pilot names and pilot ids
2893
+	 *
2894
+	 */
2895 2895
 	public function getAllPilotNames($filters = array())
2896 2896
 	{
2897 2897
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2907,11 +2907,11 @@  discard block
 block discarded – undo
2907 2907
 	
2908 2908
 	
2909 2909
 	/**
2910
-	* Gets a list of all departure & arrival airport countries
2911
-	*
2912
-	* @return Array list of airport countries
2913
-	*
2914
-	*/
2910
+	 * Gets a list of all departure & arrival airport countries
2911
+	 *
2912
+	 * @return Array list of airport countries
2913
+	 *
2914
+	 */
2915 2915
 	public function getAllAirportCountries($filters = array())
2916 2916
 	{
2917 2917
 		$airport_array = array();
@@ -2959,11 +2959,11 @@  discard block
 block discarded – undo
2959 2959
 	
2960 2960
 	
2961 2961
 	/**
2962
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2963
-	*
2964
-	* @return Array list of countries
2965
-	*
2966
-	*/
2962
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2963
+	 *
2964
+	 * @return Array list of countries
2965
+	 *
2966
+	 */
2967 2967
 	public function getAllCountries($filters = array())
2968 2968
 	{
2969 2969
 		$Connection= new Connection($this->db);
@@ -3040,11 +3040,11 @@  discard block
 block discarded – undo
3040 3040
 	
3041 3041
 	
3042 3042
 	/**
3043
-	* Gets a list of all idents/callsigns
3044
-	*
3045
-	* @return Array list of ident/callsign names
3046
-	*
3047
-	*/
3043
+	 * Gets a list of all idents/callsigns
3044
+	 *
3045
+	 * @return Array list of ident/callsign names
3046
+	 *
3047
+	 */
3048 3048
 	public function getAllIdents($filters = array())
3049 3049
 	{
3050 3050
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3068,9 +3068,9 @@  discard block
 block discarded – undo
3068 3068
 	}
3069 3069
 
3070 3070
 	/**
3071
-	* Get a list of flights from airport since 7 days
3072
-	* @return Array number, icao, name and city of airports
3073
-	*/
3071
+	 * Get a list of flights from airport since 7 days
3072
+	 * @return Array number, icao, name and city of airports
3073
+	 */
3074 3074
 
3075 3075
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3076 3076
 		global $globalTimezone, $globalDBdriver;
@@ -3101,9 +3101,9 @@  discard block
 block discarded – undo
3101 3101
 	}
3102 3102
 
3103 3103
 	/**
3104
-	* Get a list of flights from airport since 7 days
3105
-	* @return Array number, icao, name and city of airports
3106
-	*/
3104
+	 * Get a list of flights from airport since 7 days
3105
+	 * @return Array number, icao, name and city of airports
3106
+	 */
3107 3107
 
3108 3108
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3109 3109
 		global $globalTimezone, $globalDBdriver;
@@ -3133,9 +3133,9 @@  discard block
 block discarded – undo
3133 3133
 	}
3134 3134
 
3135 3135
 	/**
3136
-	* Get a list of flights from detected airport since 7 days
3137
-	* @return Array number, icao, name and city of airports
3138
-	*/
3136
+	 * Get a list of flights from detected airport since 7 days
3137
+	 * @return Array number, icao, name and city of airports
3138
+	 */
3139 3139
 
3140 3140
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3141 3141
 		global $globalTimezone, $globalDBdriver;
@@ -3173,9 +3173,9 @@  discard block
 block discarded – undo
3173 3173
 	}
3174 3174
 
3175 3175
 	/**
3176
-	* Get a list of flights from detected airport since 7 days
3177
-	* @return Array number, icao, name and city of airports
3178
-	*/
3176
+	 * Get a list of flights from detected airport since 7 days
3177
+	 * @return Array number, icao, name and city of airports
3178
+	 */
3179 3179
 
3180 3180
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3181 3181
 		global $globalTimezone, $globalDBdriver;
@@ -3217,9 +3217,9 @@  discard block
 block discarded – undo
3217 3217
 
3218 3218
 
3219 3219
 	/**
3220
-	* Get a list of flights to airport since 7 days
3221
-	* @return Array number, icao, name and city of airports
3222
-	*/
3220
+	 * Get a list of flights to airport since 7 days
3221
+	 * @return Array number, icao, name and city of airports
3222
+	 */
3223 3223
 
3224 3224
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3225 3225
 		global $globalTimezone, $globalDBdriver;
@@ -3252,9 +3252,9 @@  discard block
 block discarded – undo
3252 3252
 
3253 3253
 
3254 3254
 	/**
3255
-	* Get a list of flights detected to airport since 7 days
3256
-	* @return Array number, icao, name and city of airports
3257
-	*/
3255
+	 * Get a list of flights detected to airport since 7 days
3256
+	 * @return Array number, icao, name and city of airports
3257
+	 */
3258 3258
 
3259 3259
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3260 3260
 		global $globalTimezone, $globalDBdriver;
@@ -3295,9 +3295,9 @@  discard block
 block discarded – undo
3295 3295
 
3296 3296
 
3297 3297
 	/**
3298
-	* Get a list of flights to airport since 7 days
3299
-	* @return Array number, icao, name and city of airports
3300
-	*/
3298
+	 * Get a list of flights to airport since 7 days
3299
+	 * @return Array number, icao, name and city of airports
3300
+	 */
3301 3301
 
3302 3302
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3303 3303
 		global $globalTimezone, $globalDBdriver;
@@ -3329,9 +3329,9 @@  discard block
 block discarded – undo
3329 3329
 
3330 3330
 
3331 3331
 	/**
3332
-	* Get a list of flights detected to airport since 7 days
3333
-	* @return Array number, icao, name and city of airports
3334
-	*/
3332
+	 * Get a list of flights detected to airport since 7 days
3333
+	 * @return Array number, icao, name and city of airports
3334
+	 */
3335 3335
 
3336 3336
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3337 3337
 		global $globalTimezone, $globalDBdriver;
@@ -3375,11 +3375,11 @@  discard block
 block discarded – undo
3375 3375
 
3376 3376
 
3377 3377
 	/**
3378
-	* Gets a list of all dates
3379
-	*
3380
-	* @return Array list of date names
3381
-	*
3382
-	*/
3378
+	 * Gets a list of all dates
3379
+	 *
3380
+	 * @return Array list of date names
3381
+	 *
3382
+	 */
3383 3383
 	public function getAllDates()
3384 3384
 	{
3385 3385
 		global $globalTimezone, $globalDBdriver;
@@ -3420,11 +3420,11 @@  discard block
 block discarded – undo
3420 3420
 	
3421 3421
 	
3422 3422
 	/**
3423
-	* Gets all route combinations
3424
-	*
3425
-	* @return Array the route list
3426
-	*
3427
-	*/
3423
+	 * Gets all route combinations
3424
+	 *
3425
+	 * @return Array the route list
3426
+	 *
3427
+	 */
3428 3428
 	public function getAllRoutes()
3429 3429
 	{
3430 3430
 		$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 
@@ -3450,13 +3450,13 @@  discard block
 block discarded – undo
3450 3450
 	}
3451 3451
 
3452 3452
 	/**
3453
-	* Update ident spotter data
3454
-	*
3455
-	* @param String $flightaware_id the ID from flightaware
3456
-	* @param String $ident the flight ident
3457
-	* @return String success or false
3458
-	*
3459
-	*/	
3453
+	 * Update ident spotter data
3454
+	 *
3455
+	 * @param String $flightaware_id the ID from flightaware
3456
+	 * @param String $ident the flight ident
3457
+	 * @return String success or false
3458
+	 *
3459
+	 */	
3460 3460
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3461 3461
 	{
3462 3462
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3477,14 +3477,14 @@  discard block
 block discarded – undo
3477 3477
 		} else {
3478 3478
 			$airline_array = $this->getAllAirlineInfo("NA");
3479 3479
 		}
3480
-                $airline_name = $airline_array[0]['name'];
3481
-                $airline_icao = $airline_array[0]['icao'];
3482
-                $airline_country = $airline_array[0]['country'];
3483
-                $airline_type = $airline_array[0]['type'];
3480
+				$airline_name = $airline_array[0]['name'];
3481
+				$airline_icao = $airline_array[0]['icao'];
3482
+				$airline_country = $airline_array[0]['country'];
3483
+				$airline_type = $airline_array[0]['type'];
3484 3484
 
3485 3485
 
3486 3486
 		$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';
3487
-                $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);
3487
+				$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);
3488 3488
 
3489 3489
 		try {
3490 3490
 			$sth = $this->db->prepare($query);
@@ -3497,19 +3497,19 @@  discard block
 block discarded – undo
3497 3497
 
3498 3498
 	}
3499 3499
 	/**
3500
-	* Update latest spotter data
3501
-	*
3502
-	* @param String $flightaware_id the ID from flightaware
3503
-	* @param String $ident the flight ident
3504
-	* @param String $arrival_airport_icao the arrival airport
3505
-	* @return String success or false
3506
-	*
3507
-	*/	
3500
+	 * Update latest spotter data
3501
+	 *
3502
+	 * @param String $flightaware_id the ID from flightaware
3503
+	 * @param String $ident the flight ident
3504
+	 * @param String $arrival_airport_icao the arrival airport
3505
+	 * @return String success or false
3506
+	 *
3507
+	 */	
3508 3508
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3509 3509
 	{
3510 3510
 		if ($groundspeed == '') $groundspeed = NULL;
3511 3511
 		$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';
3512
-                $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);
3512
+				$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);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3523,32 +3523,32 @@  discard block
 block discarded – undo
3523 3523
 	}
3524 3524
 
3525 3525
 	/**
3526
-	* Adds a new spotter data
3527
-	*
3528
-	* @param String $flightaware_id the ID from flightaware
3529
-	* @param String $ident the flight ident
3530
-	* @param String $aircraft_icao the aircraft type
3531
-	* @param String $departure_airport_icao the departure airport
3532
-	* @param String $arrival_airport_icao the arrival airport
3533
-	* @param String $latitude latitude of flight
3534
-	* @param String $longitude latitude of flight
3535
-	* @param String $waypoints waypoints of flight
3536
-	* @param String $altitude altitude of flight
3537
-	* @param String $heading heading of flight
3538
-	* @param String $groundspeed speed of flight
3539
-	* @param String $date date of flight
3540
-	* @param String $departure_airport_time departure time of flight
3541
-	* @param String $arrival_airport_time arrival time of flight
3542
-	* @param String $squawk squawk code of flight
3543
-	* @param String $route_stop route stop of flight
3544
-	* @param String $highlight highlight or not
3545
-	* @param String $ModeS ModesS code of flight
3546
-	* @param String $registration registration code of flight
3547
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3548
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3549
-	* @param String $verticalrate vertival rate of flight
3550
-	* @return String success or false
3551
-	*/
3526
+	 * Adds a new spotter data
3527
+	 *
3528
+	 * @param String $flightaware_id the ID from flightaware
3529
+	 * @param String $ident the flight ident
3530
+	 * @param String $aircraft_icao the aircraft type
3531
+	 * @param String $departure_airport_icao the departure airport
3532
+	 * @param String $arrival_airport_icao the arrival airport
3533
+	 * @param String $latitude latitude of flight
3534
+	 * @param String $longitude latitude of flight
3535
+	 * @param String $waypoints waypoints of flight
3536
+	 * @param String $altitude altitude of flight
3537
+	 * @param String $heading heading of flight
3538
+	 * @param String $groundspeed speed of flight
3539
+	 * @param String $date date of flight
3540
+	 * @param String $departure_airport_time departure time of flight
3541
+	 * @param String $arrival_airport_time arrival time of flight
3542
+	 * @param String $squawk squawk code of flight
3543
+	 * @param String $route_stop route stop of flight
3544
+	 * @param String $highlight highlight or not
3545
+	 * @param String $ModeS ModesS code of flight
3546
+	 * @param String $registration registration code of flight
3547
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3548
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3549
+	 * @param String $verticalrate vertival rate of flight
3550
+	 * @return String success or false
3551
+	 */
3552 3552
 	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 = '')
3553 3553
 	{
3554 3554
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3763,8 +3763,8 @@  discard block
 block discarded – undo
3763 3763
     
3764 3764
 		if ($globalIVAO && $aircraft_icao != '')
3765 3765
 		{
3766
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3767
-            		else $airline_icao = '';
3766
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3767
+					else $airline_icao = '';
3768 3768
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3769 3769
 			if (!isset($image_array[0]['registration']))
3770 3770
 			{
@@ -3795,53 +3795,53 @@  discard block
 block discarded – undo
3795 3795
 	
3796 3796
 		if (count($airline_array) == 0) 
3797 3797
 		{
3798
-                        $airline_array = $this->getAllAirlineInfo('NA');
3799
-                }
3800
-                if (count($aircraft_array) == 0) 
3801
-                {
3802
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3803
-                }
3804
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3805
-                {
3806
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3807
-                }
3808
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3809
-                {
3810
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3811
-                }
3812
-                if ($registration == '') $registration = 'NA';
3813
-                if ($latitude == '' && $longitude == '') {
3814
-            		$latitude = 0;
3815
-            		$longitude = 0;
3816
-            	}
3817
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3818
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3819
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3820
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3821
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3822
-                $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) 
3798
+						$airline_array = $this->getAllAirlineInfo('NA');
3799
+				}
3800
+				if (count($aircraft_array) == 0) 
3801
+				{
3802
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3803
+				}
3804
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3805
+				{
3806
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3807
+				}
3808
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3809
+				{
3810
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3811
+				}
3812
+				if ($registration == '') $registration = 'NA';
3813
+				if ($latitude == '' && $longitude == '') {
3814
+					$latitude = 0;
3815
+					$longitude = 0;
3816
+				}
3817
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3818
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3819
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3820
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3821
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3822
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3823 3823
                 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)";
3824 3824
 
3825
-                $airline_name = $airline_array[0]['name'];
3826
-                $airline_icao = $airline_array[0]['icao'];
3827
-                $airline_country = $airline_array[0]['country'];
3828
-                $airline_type = $airline_array[0]['type'];
3825
+				$airline_name = $airline_array[0]['name'];
3826
+				$airline_icao = $airline_array[0]['icao'];
3827
+				$airline_country = $airline_array[0]['country'];
3828
+				$airline_type = $airline_array[0]['type'];
3829 3829
 		if ($airline_type == '') {
3830 3830
 			$timeelapsed = microtime(true);
3831 3831
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3832 3832
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3833 3833
 		}
3834 3834
 		if ($airline_type == null) $airline_type = '';
3835
-                $aircraft_type = $aircraft_array[0]['type'];
3836
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3837
-                $departure_airport_name = $departure_airport_array[0]['name'];
3838
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3839
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3835
+				$aircraft_type = $aircraft_array[0]['type'];
3836
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3837
+				$departure_airport_name = $departure_airport_array[0]['name'];
3838
+			$departure_airport_city = $departure_airport_array[0]['city'];
3839
+				$departure_airport_country = $departure_airport_array[0]['country'];
3840 3840
                 
3841
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3842
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3843
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3844
-                $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);
3841
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3842
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3843
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3844
+				$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);
3845 3845
 
3846 3846
 		try {
3847 3847
 		        
@@ -3849,7 +3849,7 @@  discard block
 block discarded – undo
3849 3849
 			$sth->execute($query_values);
3850 3850
 			$this->db = null;
3851 3851
 		} catch (PDOException $e) {
3852
-		    return "error : ".$e->getMessage();
3852
+			return "error : ".$e->getMessage();
3853 3853
 		}
3854 3854
 		
3855 3855
 		return "success";
@@ -3858,11 +3858,11 @@  discard block
 block discarded – undo
3858 3858
 	
3859 3859
   
3860 3860
 	/**
3861
-	* Gets the aircraft ident within the last hour
3862
-	*
3863
-	* @return String the ident
3864
-	*
3865
-	*/
3861
+	 * Gets the aircraft ident within the last hour
3862
+	 *
3863
+	 * @return String the ident
3864
+	 *
3865
+	 */
3866 3866
 	public function getIdentFromLastHour($ident)
3867 3867
 	{
3868 3868
 		global $globalDBdriver, $globalTimezone;
@@ -3878,11 +3878,11 @@  discard block
 block discarded – undo
3878 3878
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3879 3879
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3880 3880
 			$query_data = array(':ident' => $ident);
3881
-    		}
3881
+			}
3882 3882
 		
3883 3883
 		$sth = $this->db->prepare($query);
3884 3884
 		$sth->execute($query_data);
3885
-    		$ident_result='';
3885
+			$ident_result='';
3886 3886
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3887 3887
 		{
3888 3888
 			$ident_result = $row['ident'];
@@ -3893,11 +3893,11 @@  discard block
 block discarded – undo
3893 3893
 	
3894 3894
 	
3895 3895
 	/**
3896
-	* Gets the aircraft data from the last 20 seconds
3897
-	*
3898
-	* @return Array the spotter data
3899
-	*
3900
-	*/
3896
+	 * Gets the aircraft data from the last 20 seconds
3897
+	 *
3898
+	 * @return Array the spotter data
3899
+	 *
3900
+	 */
3901 3901
 	public function getRealTimeData($q = '')
3902 3902
 	{
3903 3903
 		global $globalDBdriver;
@@ -3941,11 +3941,11 @@  discard block
 block discarded – undo
3941 3941
 	
3942 3942
 	
3943 3943
 	 /**
3944
-	* Gets all airlines that have flown over
3945
-	*
3946
-	* @return Array the airline list
3947
-	*
3948
-	*/
3944
+	  * Gets all airlines that have flown over
3945
+	  *
3946
+	  * @return Array the airline list
3947
+	  *
3948
+	  */
3949 3949
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3950 3950
 	{
3951 3951
 		global $globalDBdriver;
@@ -3959,7 +3959,7 @@  discard block
 block discarded – undo
3959 3959
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3960 3960
 			}
3961 3961
 		}
3962
-                if ($sincedate != '') {
3962
+				if ($sincedate != '') {
3963 3963
 			if ($globalDBdriver == 'mysql') {
3964 3964
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3965 3965
 			} else {
@@ -4013,26 +4013,26 @@  discard block
 block discarded – undo
4013 4013
 	}
4014 4014
 
4015 4015
 	 /**
4016
-	* Gets all pilots that have flown over
4017
-	*
4018
-	* @return Array the pilots list
4019
-	*
4020
-	*/
4016
+	  * Gets all pilots that have flown over
4017
+	  *
4018
+	  * @return Array the pilots list
4019
+	  *
4020
+	  */
4021 4021
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4022 4022
 	{
4023 4023
 		global $globalDBdriver;
4024 4024
 		$filter_query = $this->getFilter($filters,true,true);
4025 4025
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4026 4026
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
4027
-                if ($olderthanmonths > 0) {
4028
-            		if ($globalDBdriver == 'mysql') {
4027
+				if ($olderthanmonths > 0) {
4028
+					if ($globalDBdriver == 'mysql') {
4029 4029
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4030 4030
 			} else {
4031 4031
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4032 4032
 			}
4033 4033
 		}
4034
-                if ($sincedate != '') {
4035
-            		if ($globalDBdriver == 'mysql') {
4034
+				if ($sincedate != '') {
4035
+					if ($globalDBdriver == 'mysql') {
4036 4036
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4037 4037
 			} else {
4038 4038
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4087,25 +4087,25 @@  discard block
 block discarded – undo
4087 4087
 	}
4088 4088
 	
4089 4089
 	/**
4090
-	* Gets all pilots that have flown over
4091
-	*
4092
-	* @return Array the pilots list
4093
-	*
4094
-	*/
4090
+	 * Gets all pilots that have flown over
4091
+	 *
4092
+	 * @return Array the pilots list
4093
+	 *
4094
+	 */
4095 4095
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4096 4096
 	{
4097 4097
 		global $globalDBdriver;
4098 4098
 		$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
4099 4099
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4100
-                if ($olderthanmonths > 0) {
4101
-            		if ($globalDBdriver == 'mysql') {
4100
+				if ($olderthanmonths > 0) {
4101
+					if ($globalDBdriver == 'mysql') {
4102 4102
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4103 4103
 			} else {
4104 4104
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4105 4105
 			}
4106 4106
 		}
4107
-                if ($sincedate != '') {
4108
-            		if ($globalDBdriver == 'mysql') {
4107
+				if ($sincedate != '') {
4108
+					if ($globalDBdriver == 'mysql') {
4109 4109
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4110 4110
 			} else {
4111 4111
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4134,26 +4134,26 @@  discard block
 block discarded – undo
4134 4134
 	}
4135 4135
 	
4136 4136
 	 /**
4137
-	* Gets all owner that have flown over
4138
-	*
4139
-	* @return Array the pilots list
4140
-	*
4141
-	*/
4137
+	  * Gets all owner that have flown over
4138
+	  *
4139
+	  * @return Array the pilots list
4140
+	  *
4141
+	  */
4142 4142
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4143 4143
 	{
4144 4144
 		global $globalDBdriver;
4145 4145
 		$filter_query = $this->getFilter($filters,true,true);
4146 4146
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4147 4147
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4148
-                if ($olderthanmonths > 0) {
4149
-            		if ($globalDBdriver == 'mysql') {
4148
+				if ($olderthanmonths > 0) {
4149
+					if ($globalDBdriver == 'mysql') {
4150 4150
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4151 4151
 			} else {
4152 4152
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4153 4153
 			}
4154 4154
 		}
4155
-                if ($sincedate != '') {
4156
-            		if ($globalDBdriver == 'mysql') {
4155
+				if ($sincedate != '') {
4156
+					if ($globalDBdriver == 'mysql') {
4157 4157
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4158 4158
 			} else {
4159 4159
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4204,26 +4204,26 @@  discard block
 block discarded – undo
4204 4204
 	}
4205 4205
 	
4206 4206
 	 /**
4207
-	* Gets all owner that have flown over
4208
-	*
4209
-	* @return Array the pilots list
4210
-	*
4211
-	*/
4207
+	  * Gets all owner that have flown over
4208
+	  *
4209
+	  * @return Array the pilots list
4210
+	  *
4211
+	  */
4212 4212
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4213 4213
 	{
4214 4214
 		global $globalDBdriver;
4215 4215
 		$filter_query = $this->getFilter($filters,true,true);
4216 4216
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4217 4217
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4218
-                if ($olderthanmonths > 0) {
4219
-            		if ($globalDBdriver == 'mysql') {
4218
+				if ($olderthanmonths > 0) {
4219
+					if ($globalDBdriver == 'mysql') {
4220 4220
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4221 4221
 			} else {
4222 4222
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4223 4223
 			}
4224 4224
 		}
4225
-                if ($sincedate != '') {
4226
-            		if ($globalDBdriver == 'mysql') {
4225
+				if ($sincedate != '') {
4226
+					if ($globalDBdriver == 'mysql') {
4227 4227
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4228 4228
 			} else {
4229 4229
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4250,11 +4250,11 @@  discard block
 block discarded – undo
4250 4250
 	}
4251 4251
 
4252 4252
 	/**
4253
-	* Gets all airlines that have flown over by aircraft
4254
-	*
4255
-	* @return Array the airline list
4256
-	*
4257
-	*/
4253
+	 * Gets all airlines that have flown over by aircraft
4254
+	 *
4255
+	 * @return Array the airline list
4256
+	 *
4257
+	 */
4258 4258
 	public function countAllAirlinesByAircraft($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 airline countries that have flown over by aircraft
4290
-	*
4291
-	* @return Array the airline country list
4292
-	*
4293
-	*/
4289
+	 * Gets all airline countries that have flown over by aircraft
4290
+	 *
4291
+	 * @return Array the airline country list
4292
+	 *
4293
+	 */
4294 4294
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4295 4295
 	{
4296 4296
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4322,11 +4322,11 @@  discard block
 block discarded – undo
4322 4322
 	
4323 4323
 	
4324 4324
 	/**
4325
-	* Gets all airlines that have flown over by airport
4326
-	*
4327
-	* @return Array the airline list
4328
-	*
4329
-	*/
4325
+	 * Gets all airlines that have flown over by airport
4326
+	 *
4327
+	 * @return Array the airline list
4328
+	 *
4329
+	 */
4330 4330
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4331 4331
 	{
4332 4332
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4357,11 +4357,11 @@  discard block
 block discarded – undo
4357 4357
 
4358 4358
 
4359 4359
 	/**
4360
-	* Gets all airline countries that have flown over by airport icao
4361
-	*
4362
-	* @return Array the airline country list
4363
-	*
4364
-	*/
4360
+	 * Gets all airline countries that have flown over by airport icao
4361
+	 *
4362
+	 * @return Array the airline country list
4363
+	 *
4364
+	 */
4365 4365
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4366 4366
 	{
4367 4367
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4391,11 +4391,11 @@  discard block
 block discarded – undo
4391 4391
 
4392 4392
 
4393 4393
 	/**
4394
-	* Gets all airlines that have flown over by aircraft manufacturer
4395
-	*
4396
-	* @return Array the airline list
4397
-	*
4398
-	*/
4394
+	 * Gets all airlines that have flown over by aircraft manufacturer
4395
+	 *
4396
+	 * @return Array the airline list
4397
+	 *
4398
+	 */
4399 4399
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4400 4400
 	{
4401 4401
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4426,11 +4426,11 @@  discard block
 block discarded – undo
4426 4426
 
4427 4427
 
4428 4428
 	/**
4429
-	* Gets all airline countries that have flown over by aircraft manufacturer
4430
-	*
4431
-	* @return Array the airline country list
4432
-	*
4433
-	*/
4429
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4430
+	 *
4431
+	 * @return Array the airline country list
4432
+	 *
4433
+	 */
4434 4434
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4435 4435
 	{
4436 4436
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4459,11 +4459,11 @@  discard block
 block discarded – undo
4459 4459
 
4460 4460
 
4461 4461
 	/**
4462
-	* Gets all airlines that have flown over by date
4463
-	*
4464
-	* @return Array the airline list
4465
-	*
4466
-	*/
4462
+	 * Gets all airlines that have flown over by date
4463
+	 *
4464
+	 * @return Array the airline list
4465
+	 *
4466
+	 */
4467 4467
 	public function countAllAirlinesByDate($date,$filters = array())
4468 4468
 	{
4469 4469
 		global $globalTimezone, $globalDBdriver;
@@ -4507,11 +4507,11 @@  discard block
 block discarded – undo
4507 4507
 	
4508 4508
 	
4509 4509
 	/**
4510
-	* Gets all airline countries that have flown over by date
4511
-	*
4512
-	* @return Array the airline country list
4513
-	*
4514
-	*/
4510
+	 * Gets all airline countries that have flown over by date
4511
+	 *
4512
+	 * @return Array the airline country list
4513
+	 *
4514
+	 */
4515 4515
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4516 4516
 	{
4517 4517
 		global $globalTimezone, $globalDBdriver;
@@ -4554,11 +4554,11 @@  discard block
 block discarded – undo
4554 4554
 
4555 4555
 
4556 4556
 	/**
4557
-	* Gets all airlines that have flown over by ident/callsign
4558
-	*
4559
-	* @return Array the airline list
4560
-	*
4561
-	*/
4557
+	 * Gets all airlines that have flown over by ident/callsign
4558
+	 *
4559
+	 * @return Array the airline list
4560
+	 *
4561
+	 */
4562 4562
 	public function countAllAirlinesByIdent($ident,$filters = array())
4563 4563
 	{
4564 4564
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4575,11 +4575,11 @@  discard block
 block discarded – undo
4575 4575
 	}
4576 4576
 
4577 4577
 	/**
4578
-	* Gets all airlines by owner
4579
-	*
4580
-	* @return Array the airline list
4581
-	*
4582
-	*/
4578
+	 * Gets all airlines by owner
4579
+	 *
4580
+	 * @return Array the airline list
4581
+	 *
4582
+	 */
4583 4583
 	public function countAllAirlinesByOwner($owner,$filters = array())
4584 4584
 	{
4585 4585
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 	}
4597 4597
 
4598 4598
 	/**
4599
-	* Gets all airlines used by pilot
4600
-	*
4601
-	* @return Array the airline list
4602
-	*
4603
-	*/
4599
+	 * Gets all airlines used by pilot
4600
+	 *
4601
+	 * @return Array the airline list
4602
+	 *
4603
+	 */
4604 4604
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4605 4605
 	{
4606 4606
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4617,11 +4617,11 @@  discard block
 block discarded – undo
4617 4617
 	}
4618 4618
 
4619 4619
 	/**
4620
-	* Gets all airlines that have flown over by route
4621
-	*
4622
-	* @return Array the airline list
4623
-	*
4624
-	*/
4620
+	 * Gets all airlines that have flown over by route
4621
+	 *
4622
+	 * @return Array the airline list
4623
+	 *
4624
+	 */
4625 4625
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4626 4626
 	{
4627 4627
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4653,11 +4653,11 @@  discard block
 block discarded – undo
4653 4653
 	}
4654 4654
 
4655 4655
 	/**
4656
-	* Gets all airline countries that have flown over by route
4657
-	*
4658
-	* @return Array the airline country list
4659
-	*
4660
-	*/
4656
+	 * Gets all airline countries that have flown over by route
4657
+	 *
4658
+	 * @return Array the airline country list
4659
+	 *
4660
+	 */
4661 4661
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4662 4662
 	{
4663 4663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4689,11 +4689,11 @@  discard block
 block discarded – undo
4689 4689
 
4690 4690
 
4691 4691
 	/**
4692
-	* Gets all airlines that have flown over by country
4693
-	*
4694
-	* @return Array the airline list
4695
-	*
4696
-	*/
4692
+	 * Gets all airlines that have flown over by country
4693
+	 *
4694
+	 * @return Array the airline list
4695
+	 *
4696
+	 */
4697 4697
 	public function countAllAirlinesByCountry($country,$filters = array())
4698 4698
 	{
4699 4699
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4723,11 +4723,11 @@  discard block
 block discarded – undo
4723 4723
 
4724 4724
 
4725 4725
 	/**
4726
-	* Gets all airline countries that have flown over by country
4727
-	*
4728
-	* @return Array the airline country list
4729
-	*
4730
-	*/
4726
+	 * Gets all airline countries that have flown over by country
4727
+	 *
4728
+	 * @return Array the airline country list
4729
+	 *
4730
+	 */
4731 4731
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4732 4732
 	{
4733 4733
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4756,11 +4756,11 @@  discard block
 block discarded – undo
4756 4756
 
4757 4757
 
4758 4758
 	/**
4759
-	* Gets all airlines countries
4760
-	*
4761
-	* @return Array the airline country list
4762
-	*
4763
-	*/
4759
+	 * Gets all airlines countries
4760
+	 *
4761
+	 * @return Array the airline country list
4762
+	 *
4763
+	 */
4764 4764
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4765 4765
 	{
4766 4766
 		global $globalDBdriver;
@@ -4815,11 +4815,11 @@  discard block
 block discarded – undo
4815 4815
 	}
4816 4816
 
4817 4817
 	/**
4818
-	* Gets all number of flight over countries
4819
-	*
4820
-	* @return Array the airline country list
4821
-	*
4822
-	*/
4818
+	 * Gets all number of flight over countries
4819
+	 *
4820
+	 * @return Array the airline country list
4821
+	 *
4822
+	 */
4823 4823
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4824 4824
 	{
4825 4825
 		global $globalDBdriver;
@@ -4841,15 +4841,15 @@  discard block
 block discarded – undo
4841 4841
 		$SpotterLive = new SpotterLive();
4842 4842
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4843 4843
 		$filter_query .= ' over_country IS NOT NULL';
4844
-                if ($olderthanmonths > 0) {
4844
+				if ($olderthanmonths > 0) {
4845 4845
 			if ($globalDBdriver == 'mysql') {
4846 4846
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4847 4847
 			} else {
4848 4848
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4849 4849
 			}
4850 4850
 		}
4851
-                if ($sincedate != '') {
4852
-            		if ($globalDBdriver == 'mysql') {
4851
+				if ($sincedate != '') {
4852
+					if ($globalDBdriver == 'mysql') {
4853 4853
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4854 4854
 			} else {
4855 4855
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4879,11 +4879,11 @@  discard block
 block discarded – undo
4879 4879
 	
4880 4880
 	
4881 4881
 	/**
4882
-	* Gets all aircraft types that have flown over
4883
-	*
4884
-	* @return Array the aircraft list
4885
-	*
4886
-	*/
4882
+	 * Gets all aircraft types that have flown over
4883
+	 *
4884
+	 * @return Array the aircraft list
4885
+	 *
4886
+	 */
4887 4887
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4888 4888
 	{
4889 4889
 		global $globalDBdriver;
@@ -4953,11 +4953,11 @@  discard block
 block discarded – undo
4953 4953
 	}
4954 4954
 
4955 4955
 	/**
4956
-	* Gets all aircraft types that have flown over by airline
4957
-	*
4958
-	* @return Array the aircraft list
4959
-	*
4960
-	*/
4956
+	 * Gets all aircraft types that have flown over by airline
4957
+	 *
4958
+	 * @return Array the aircraft list
4959
+	 *
4960
+	 */
4961 4961
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4962 4962
 	{
4963 4963
 		global $globalDBdriver;
@@ -5028,11 +5028,11 @@  discard block
 block discarded – undo
5028 5028
 	}
5029 5029
 
5030 5030
 	/**
5031
-	* Gets all aircraft types that have flown over by months
5032
-	*
5033
-	* @return Array the aircraft list
5034
-	*
5035
-	*/
5031
+	 * Gets all aircraft types that have flown over by months
5032
+	 *
5033
+	 * @return Array the aircraft list
5034
+	 *
5035
+	 */
5036 5036
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5037 5037
 	{
5038 5038
 		global $globalDBdriver;
@@ -5076,11 +5076,11 @@  discard block
 block discarded – undo
5076 5076
 
5077 5077
 
5078 5078
 	/**
5079
-	* Gets all aircraft registration that have flown over by aircaft icao
5080
-	*
5081
-	* @return Array the aircraft list
5082
-	*
5083
-	*/
5079
+	 * Gets all aircraft registration that have flown over by aircaft icao
5080
+	 *
5081
+	 * @return Array the aircraft list
5082
+	 *
5083
+	 */
5084 5084
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5085 5085
 	{
5086 5086
 		$Image = new Image($this->db);
@@ -5119,11 +5119,11 @@  discard block
 block discarded – undo
5119 5119
 
5120 5120
 
5121 5121
 	/**
5122
-	* Gets all aircraft types that have flown over by airline icao
5123
-	*
5124
-	* @return Array the aircraft list
5125
-	*
5126
-	*/
5122
+	 * Gets all aircraft types that have flown over by airline icao
5123
+	 *
5124
+	 * @return Array the aircraft list
5125
+	 *
5126
+	 */
5127 5127
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5128 5128
 	{
5129 5129
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5152,11 +5152,11 @@  discard block
 block discarded – undo
5152 5152
 
5153 5153
 
5154 5154
 	/**
5155
-	* Gets all aircraft registration that have flown over by airline icao
5156
-	*
5157
-	* @return Array the aircraft list
5158
-	*
5159
-	*/
5155
+	 * Gets all aircraft registration that have flown over by airline icao
5156
+	 *
5157
+	 * @return Array the aircraft list
5158
+	 *
5159
+	 */
5160 5160
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5161 5161
 	{
5162 5162
 		$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 manufacturer that have flown over by airline icao
5198
-	*
5199
-	* @return Array the aircraft list
5200
-	*
5201
-	*/
5197
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5198
+	 *
5199
+	 * @return Array the aircraft list
5200
+	 *
5201
+	 */
5202 5202
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5203 5203
 	{
5204 5204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5226,11 +5226,11 @@  discard block
 block discarded – undo
5226 5226
 
5227 5227
 
5228 5228
 	/**
5229
-	* Gets all aircraft types that have flown over by airline icao
5230
-	*
5231
-	* @return Array the aircraft list
5232
-	*
5233
-	*/
5229
+	 * Gets all aircraft types that have flown over by airline icao
5230
+	 *
5231
+	 * @return Array the aircraft list
5232
+	 *
5233
+	 */
5234 5234
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5235 5235
 	{
5236 5236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5259,11 +5259,11 @@  discard block
 block discarded – undo
5259 5259
 
5260 5260
 
5261 5261
 	/**
5262
-	* Gets all aircraft registration that have flown over by airport icao
5263
-	*
5264
-	* @return Array the aircraft list
5265
-	*
5266
-	*/
5262
+	 * Gets all aircraft registration that have flown over by airport icao
5263
+	 *
5264
+	 * @return Array the aircraft list
5265
+	 *
5266
+	 */
5267 5267
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5268 5268
 	{
5269 5269
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5300,11 +5300,11 @@  discard block
 block discarded – undo
5300 5300
 	
5301 5301
 	
5302 5302
 	/**
5303
-	* Gets all aircraft manufacturer that have flown over by airport icao
5304
-	*
5305
-	* @return Array the aircraft list
5306
-	*
5307
-	*/
5303
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5304
+	 *
5305
+	 * @return Array the aircraft list
5306
+	 *
5307
+	 */
5308 5308
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5309 5309
 	{
5310 5310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5330,11 +5330,11 @@  discard block
 block discarded – undo
5330 5330
 	}
5331 5331
 
5332 5332
 	/**
5333
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5334
-	*
5335
-	* @return Array the aircraft list
5336
-	*
5337
-	*/
5333
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5334
+	 *
5335
+	 * @return Array the aircraft list
5336
+	 *
5337
+	 */
5338 5338
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5339 5339
 	{
5340 5340
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5361,11 +5361,11 @@  discard block
 block discarded – undo
5361 5361
 
5362 5362
 
5363 5363
 	/**
5364
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5365
-	*
5366
-	* @return Array the aircraft list
5367
-	*
5368
-	*/
5364
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5365
+	 *
5366
+	 * @return Array the aircraft list
5367
+	 *
5368
+	 */
5369 5369
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5370 5370
 	{
5371 5371
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5401,11 +5401,11 @@  discard block
 block discarded – undo
5401 5401
 	}
5402 5402
 
5403 5403
 	/**
5404
-	* Gets all aircraft types that have flown over by date
5405
-	*
5406
-	* @return Array the aircraft list
5407
-	*
5408
-	*/
5404
+	 * Gets all aircraft types that have flown over by date
5405
+	 *
5406
+	 * @return Array the aircraft list
5407
+	 *
5408
+	 */
5409 5409
 	public function countAllAircraftTypesByDate($date,$filters = array())
5410 5410
 	{
5411 5411
 		global $globalTimezone, $globalDBdriver;
@@ -5447,11 +5447,11 @@  discard block
 block discarded – undo
5447 5447
 
5448 5448
 
5449 5449
 	/**
5450
-	* Gets all aircraft registration that have flown over by date
5451
-	*
5452
-	* @return Array the aircraft list
5453
-	*
5454
-	*/
5450
+	 * Gets all aircraft registration that have flown over by date
5451
+	 *
5452
+	 * @return Array the aircraft list
5453
+	 *
5454
+	 */
5455 5455
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5456 5456
 	{
5457 5457
 		global $globalTimezone, $globalDBdriver;
@@ -5502,11 +5502,11 @@  discard block
 block discarded – undo
5502 5502
 
5503 5503
 
5504 5504
 	/**
5505
-	* Gets all aircraft manufacturer that have flown over by date
5506
-	*
5507
-	* @return Array the aircraft manufacturer list
5508
-	*
5509
-	*/
5505
+	 * Gets all aircraft manufacturer that have flown over by date
5506
+	 *
5507
+	 * @return Array the aircraft manufacturer list
5508
+	 *
5509
+	 */
5510 5510
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5511 5511
 	{
5512 5512
 		global $globalTimezone, $globalDBdriver;
@@ -5548,11 +5548,11 @@  discard block
 block discarded – undo
5548 5548
 
5549 5549
 
5550 5550
 	/**
5551
-	* Gets all aircraft types that have flown over by ident/callsign
5552
-	*
5553
-	* @return Array the aircraft list
5554
-	*
5555
-	*/
5551
+	 * Gets all aircraft types that have flown over by ident/callsign
5552
+	 *
5553
+	 * @return Array the aircraft list
5554
+	 *
5555
+	 */
5556 5556
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5557 5557
 	{
5558 5558
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5580,11 +5580,11 @@  discard block
 block discarded – undo
5580 5580
 	}
5581 5581
 
5582 5582
 	/**
5583
-	* Gets all aircraft types that have flown over by pilot
5584
-	*
5585
-	* @return Array the aircraft list
5586
-	*
5587
-	*/
5583
+	 * Gets all aircraft types that have flown over by pilot
5584
+	 *
5585
+	 * @return Array the aircraft list
5586
+	 *
5587
+	 */
5588 5588
 	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5589 5589
 	{
5590 5590
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5600,11 +5600,11 @@  discard block
 block discarded – undo
5600 5600
 	}
5601 5601
 
5602 5602
 	/**
5603
-	* Gets all aircraft types that have flown over by owner
5604
-	*
5605
-	* @return Array the aircraft list
5606
-	*
5607
-	*/
5603
+	 * Gets all aircraft types that have flown over by owner
5604
+	 *
5605
+	 * @return Array the aircraft list
5606
+	 *
5607
+	 */
5608 5608
 	public function countAllAircraftTypesByOwner($owner,$filters = array())
5609 5609
 	{
5610 5610
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5621,11 +5621,11 @@  discard block
 block discarded – undo
5621 5621
 
5622 5622
 
5623 5623
 	/**
5624
-	* Gets all aircraft registration that have flown over by ident/callsign
5625
-	*
5626
-	* @return Array the aircraft list
5627
-	*
5628
-	*/
5624
+	 * Gets all aircraft registration that have flown over by ident/callsign
5625
+	 *
5626
+	 * @return Array the aircraft list
5627
+	 *
5628
+	 */
5629 5629
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5630 5630
 	{
5631 5631
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5664,11 +5664,11 @@  discard block
 block discarded – undo
5664 5664
 	}
5665 5665
 
5666 5666
 	/**
5667
-	* Gets all aircraft registration that have flown over by owner
5668
-	*
5669
-	* @return Array the aircraft list
5670
-	*
5671
-	*/
5667
+	 * Gets all aircraft registration that have flown over by owner
5668
+	 *
5669
+	 * @return Array the aircraft list
5670
+	 *
5671
+	 */
5672 5672
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5673 5673
 	{
5674 5674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5708,11 +5708,11 @@  discard block
 block discarded – undo
5708 5708
 	}
5709 5709
 
5710 5710
 	/**
5711
-	* Gets all aircraft registration that have flown over by pilot
5712
-	*
5713
-	* @return Array the aircraft list
5714
-	*
5715
-	*/
5711
+	 * Gets all aircraft registration that have flown over by pilot
5712
+	 *
5713
+	 * @return Array the aircraft list
5714
+	 *
5715
+	 */
5716 5716
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5717 5717
 	{
5718 5718
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5753,11 +5753,11 @@  discard block
 block discarded – undo
5753 5753
 
5754 5754
 
5755 5755
 	/**
5756
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5757
-	*
5758
-	* @return Array the aircraft manufacturer list
5759
-	*
5760
-	*/
5756
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5757
+	 *
5758
+	 * @return Array the aircraft manufacturer list
5759
+	 *
5760
+	 */
5761 5761
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5762 5762
 	{
5763 5763
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5782,11 +5782,11 @@  discard block
 block discarded – undo
5782 5782
 	}
5783 5783
 
5784 5784
 	/**
5785
-	* Gets all aircraft manufacturer that have flown over by owner
5786
-	*
5787
-	* @return Array the aircraft manufacturer list
5788
-	*
5789
-	*/
5785
+	 * Gets all aircraft manufacturer that have flown over by owner
5786
+	 *
5787
+	 * @return Array the aircraft manufacturer list
5788
+	 *
5789
+	 */
5790 5790
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5791 5791
 	{
5792 5792
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5803,11 +5803,11 @@  discard block
 block discarded – undo
5803 5803
 	}
5804 5804
 
5805 5805
 	/**
5806
-	* Gets all aircraft manufacturer that have flown over by pilot
5807
-	*
5808
-	* @return Array the aircraft manufacturer list
5809
-	*
5810
-	*/
5806
+	 * Gets all aircraft manufacturer that have flown over by pilot
5807
+	 *
5808
+	 * @return Array the aircraft manufacturer list
5809
+	 *
5810
+	 */
5811 5811
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5812 5812
 	{
5813 5813
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5825,11 +5825,11 @@  discard block
 block discarded – undo
5825 5825
 
5826 5826
 
5827 5827
 	/**
5828
-	* Gets all aircraft types that have flown over by route
5829
-	*
5830
-	* @return Array the aircraft list
5831
-	*
5832
-	*/
5828
+	 * Gets all aircraft types that have flown over by route
5829
+	 *
5830
+	 * @return Array the aircraft list
5831
+	 *
5832
+	 */
5833 5833
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5834 5834
 	{
5835 5835
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5858,11 +5858,11 @@  discard block
 block discarded – undo
5858 5858
 	}
5859 5859
 
5860 5860
 	/**
5861
-	* Gets all aircraft registration that have flown over by route
5862
-	*
5863
-	* @return Array the aircraft list
5864
-	*
5865
-	*/
5861
+	 * Gets all aircraft registration that have flown over by route
5862
+	 *
5863
+	 * @return Array the aircraft list
5864
+	 *
5865
+	 */
5866 5866
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5867 5867
 	{
5868 5868
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5904,11 +5904,11 @@  discard block
 block discarded – undo
5904 5904
 	
5905 5905
 	
5906 5906
 	/**
5907
-	* Gets all aircraft manufacturer that have flown over by route
5908
-	*
5909
-	* @return Array the aircraft manufacturer list
5910
-	*
5911
-	*/
5907
+	 * Gets all aircraft manufacturer that have flown over by route
5908
+	 *
5909
+	 * @return Array the aircraft manufacturer list
5910
+	 *
5911
+	 */
5912 5912
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5913 5913
 	{
5914 5914
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5942,11 +5942,11 @@  discard block
 block discarded – undo
5942 5942
 	
5943 5943
 	
5944 5944
 	/**
5945
-	* Gets all aircraft types that have flown over by country
5946
-	*
5947
-	* @return Array the aircraft list
5948
-	*
5949
-	*/
5945
+	 * Gets all aircraft types that have flown over by country
5946
+	 *
5947
+	 * @return Array the aircraft list
5948
+	 *
5949
+	 */
5950 5950
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5951 5951
 	{
5952 5952
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5977,11 +5977,11 @@  discard block
 block discarded – undo
5977 5977
 
5978 5978
 
5979 5979
 	/**
5980
-	* Gets all aircraft registration that have flown over by country
5981
-	*
5982
-	* @return Array the aircraft list
5983
-	*
5984
-	*/
5980
+	 * Gets all aircraft registration that have flown over by country
5981
+	 *
5982
+	 * @return Array the aircraft list
5983
+	 *
5984
+	 */
5985 5985
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5986 5986
 	{
5987 5987
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6021,11 +6021,11 @@  discard block
 block discarded – undo
6021 6021
 	
6022 6022
 	
6023 6023
 	/**
6024
-	* Gets all aircraft manufacturer that have flown over by country
6025
-	*
6026
-	* @return Array the aircraft manufacturer list
6027
-	*
6028
-	*/
6024
+	 * Gets all aircraft manufacturer that have flown over by country
6025
+	 *
6026
+	 * @return Array the aircraft manufacturer list
6027
+	 *
6028
+	 */
6029 6029
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6030 6030
 	{
6031 6031
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6056,18 +6056,18 @@  discard block
 block discarded – undo
6056 6056
 	
6057 6057
 	
6058 6058
 	/**
6059
-	* Gets all aircraft manufacturers that have flown over
6060
-	*
6061
-	* @return Array the aircraft list
6062
-	*
6063
-	*/
6059
+	 * Gets all aircraft manufacturers that have flown over
6060
+	 *
6061
+	 * @return Array the aircraft list
6062
+	 *
6063
+	 */
6064 6064
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6065 6065
 	{
6066 6066
 		global $globalDBdriver;
6067 6067
 		$filter_query = $this->getFilter($filters,true,true);
6068 6068
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6069 6069
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6070
-                $query_values = array();
6070
+				$query_values = array();
6071 6071
 		if ($year != '') {
6072 6072
 			if ($globalDBdriver == 'mysql') {
6073 6073
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6120,11 +6120,11 @@  discard block
 block discarded – undo
6120 6120
 	
6121 6121
 	
6122 6122
 	/**
6123
-	* Gets all aircraft registrations that have flown over
6124
-	*
6125
-	* @return Array the aircraft list
6126
-	*
6127
-	*/
6123
+	 * Gets all aircraft registrations that have flown over
6124
+	 *
6125
+	 * @return Array the aircraft list
6126
+	 *
6127
+	 */
6128 6128
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6129 6129
 	{
6130 6130
 		global $globalDBdriver;
@@ -6132,15 +6132,15 @@  discard block
 block discarded – undo
6132 6132
 		$filter_query = $this->getFilter($filters,true,true);
6133 6133
 		$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    
6134 6134
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6135
-                if ($olderthanmonths > 0) {
6136
-            		if ($globalDBdriver == 'mysql') {
6135
+				if ($olderthanmonths > 0) {
6136
+					if ($globalDBdriver == 'mysql') {
6137 6137
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6138 6138
 			} else {
6139 6139
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6140 6140
 			}
6141 6141
 		}
6142
-                if ($sincedate != '') {
6143
-            		if ($globalDBdriver == 'mysql') {
6142
+				if ($sincedate != '') {
6143
+					if ($globalDBdriver == 'mysql') {
6144 6144
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6145 6145
 			} else {
6146 6146
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6205,11 +6205,11 @@  discard block
 block discarded – undo
6205 6205
 
6206 6206
 
6207 6207
 	/**
6208
-	* Gets all aircraft registrations that have flown over
6209
-	*
6210
-	* @return Array the aircraft list
6211
-	*
6212
-	*/
6208
+	 * Gets all aircraft registrations that have flown over
6209
+	 *
6210
+	 * @return Array the aircraft list
6211
+	 *
6212
+	 */
6213 6213
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6214 6214
 	{
6215 6215
 		global $globalDBdriver;
@@ -6217,15 +6217,15 @@  discard block
 block discarded – undo
6217 6217
 		$Image = new Image($this->db);
6218 6218
 		$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    
6219 6219
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6220
-                if ($olderthanmonths > 0) {
6221
-            		if ($globalDBdriver == 'mysql') {
6220
+				if ($olderthanmonths > 0) {
6221
+					if ($globalDBdriver == 'mysql') {
6222 6222
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6223 6223
 			} else {
6224 6224
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6225 6225
 			}
6226 6226
 		}
6227
-                if ($sincedate != '') {
6228
-            		if ($globalDBdriver == 'mysql') {
6227
+				if ($sincedate != '') {
6228
+					if ($globalDBdriver == 'mysql') {
6229 6229
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6230 6230
 			} else {
6231 6231
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6234,7 +6234,7 @@  discard block
 block discarded – undo
6234 6234
 
6235 6235
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6236 6236
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6237
-                $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";
6237
+				$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";
6238 6238
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6239 6239
 		
6240 6240
 		$sth = $this->db->prepare($query);
@@ -6266,26 +6266,26 @@  discard block
 block discarded – undo
6266 6266
 	
6267 6267
 	
6268 6268
 	/**
6269
-	* Gets all departure airports of the airplanes that have flown over
6270
-	*
6271
-	* @return Array the airport list
6272
-	*
6273
-	*/
6269
+	 * Gets all departure airports of the airplanes that have flown over
6270
+	 *
6271
+	 * @return Array the airport list
6272
+	 *
6273
+	 */
6274 6274
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6275 6275
 	{
6276 6276
 		global $globalDBdriver;
6277 6277
 		$filter_query = $this->getFilter($filters,true,true);
6278 6278
 		$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 
6279 6279
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6280
-                if ($olderthanmonths > 0) {
6281
-            		if ($globalDBdriver == 'mysql') {
6280
+				if ($olderthanmonths > 0) {
6281
+					if ($globalDBdriver == 'mysql') {
6282 6282
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6283 6283
 			} else {
6284 6284
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6285 6285
 			}
6286
-                }
6287
-                if ($sincedate != '') {
6288
-            		if ($globalDBdriver == 'mysql') {
6286
+				}
6287
+				if ($sincedate != '') {
6288
+					if ($globalDBdriver == 'mysql') {
6289 6289
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6290 6290
 			} else {
6291 6291
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6319,7 +6319,7 @@  discard block
 block discarded – undo
6319 6319
 				$query_values = array_merge($query_values,array(':day' => $day));
6320 6320
 			}
6321 6321
 		}
6322
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6322
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6323 6323
 				ORDER BY airport_departure_icao_count DESC";
6324 6324
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6325 6325
 
@@ -6342,35 +6342,35 @@  discard block
 block discarded – undo
6342 6342
 	}
6343 6343
 
6344 6344
 	/**
6345
-	* Gets all departure airports of the airplanes that have flown over
6346
-	*
6347
-	* @return Array the airport list
6348
-	*
6349
-	*/
6345
+	 * Gets all departure airports of the airplanes that have flown over
6346
+	 *
6347
+	 * @return Array the airport list
6348
+	 *
6349
+	 */
6350 6350
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6351 6351
 	{
6352 6352
 		global $globalDBdriver;
6353 6353
 		$filter_query = $this->getFilter($filters,true,true);
6354 6354
 		$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 
6355 6355
 			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 <> '' ";
6356
-                if ($olderthanmonths > 0) {
6357
-            		if ($globalDBdriver == 'mysql') {
6356
+				if ($olderthanmonths > 0) {
6357
+					if ($globalDBdriver == 'mysql') {
6358 6358
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6359 6359
 			} else {
6360 6360
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6361 6361
 			}
6362
-                }
6363
-                if ($sincedate != '') {
6364
-            		if ($globalDBdriver == 'mysql') {
6362
+				}
6363
+				if ($sincedate != '') {
6364
+					if ($globalDBdriver == 'mysql') {
6365 6365
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6366 6366
 			} else {
6367 6367
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6368 6368
 			}
6369 6369
 		}
6370 6370
 
6371
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6372
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6373
-                $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
6371
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6372
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6373
+				$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
6374 6374
 				ORDER BY airport_departure_icao_count DESC";
6375 6375
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6376 6376
       
@@ -6395,26 +6395,26 @@  discard block
 block discarded – undo
6395 6395
 	}
6396 6396
 
6397 6397
 	/**
6398
-	* Gets all detected departure airports of the airplanes that have flown over
6399
-	*
6400
-	* @return Array the airport list
6401
-	*
6402
-	*/
6398
+	 * Gets all detected departure airports of the airplanes that have flown over
6399
+	 *
6400
+	 * @return Array the airport list
6401
+	 *
6402
+	 */
6403 6403
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6404 6404
 	{
6405 6405
 		global $globalDBdriver;
6406 6406
 		$filter_query = $this->getFilter($filters,true,true);
6407 6407
 		$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
6408 6408
 				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";
6409
-                if ($olderthanmonths > 0) {
6410
-            		if ($globalDBdriver == 'mysql') {
6409
+				if ($olderthanmonths > 0) {
6410
+					if ($globalDBdriver == 'mysql') {
6411 6411
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6412 6412
 			} else {
6413 6413
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6414 6414
 			}
6415
-                }
6416
-                if ($sincedate != '') {
6417
-            		if ($globalDBdriver == 'mysql') {
6415
+				}
6416
+				if ($sincedate != '') {
6417
+					if ($globalDBdriver == 'mysql') {
6418 6418
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6419 6419
 			} else {
6420 6420
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6448,10 +6448,10 @@  discard block
 block discarded – undo
6448 6448
 				$query_values = array_merge($query_values,array(':day' => $day));
6449 6449
 			}
6450 6450
 		}
6451
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6451
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6452 6452
 				ORDER BY airport_departure_icao_count DESC";
6453 6453
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6454
-    		//echo $query;
6454
+			//echo $query;
6455 6455
 		$sth = $this->db->prepare($query);
6456 6456
 		$sth->execute($query_values);
6457 6457
       
@@ -6472,35 +6472,35 @@  discard block
 block discarded – undo
6472 6472
 	}
6473 6473
 	
6474 6474
 	/**
6475
-	* Gets all detected departure airports of the airplanes that have flown over
6476
-	*
6477
-	* @return Array the airport list
6478
-	*
6479
-	*/
6475
+	 * Gets all detected departure airports of the airplanes that have flown over
6476
+	 *
6477
+	 * @return Array the airport list
6478
+	 *
6479
+	 */
6480 6480
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6481 6481
 	{
6482 6482
 		global $globalDBdriver;
6483 6483
 		$filter_query = $this->getFilter($filters,true,true);
6484 6484
 		$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
6485 6485
 				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 ";
6486
-                if ($olderthanmonths > 0) {
6487
-            		if ($globalDBdriver == 'mysql') {
6486
+				if ($olderthanmonths > 0) {
6487
+					if ($globalDBdriver == 'mysql') {
6488 6488
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6489 6489
 			} else {
6490 6490
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6491 6491
 			}
6492
-                }
6493
-                if ($sincedate != '') {
6494
-            		if ($globalDBdriver == 'mysql') {
6492
+				}
6493
+				if ($sincedate != '') {
6494
+					if ($globalDBdriver == 'mysql') {
6495 6495
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6496 6496
 			} else {
6497 6497
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6498 6498
 			}
6499 6499
 		}
6500 6500
 
6501
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6502
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6503
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6501
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6502
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6503
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6504 6504
 				ORDER BY airport_departure_icao_count DESC";
6505 6505
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6506 6506
       
@@ -6525,11 +6525,11 @@  discard block
 block discarded – undo
6525 6525
 	}	
6526 6526
 	
6527 6527
 	/**
6528
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6529
-	*
6530
-	* @return Array the airport list
6531
-	*
6532
-	*/
6528
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6529
+	 *
6530
+	 * @return Array the airport list
6531
+	 *
6532
+	 */
6533 6533
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6534 6534
 	{
6535 6535
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6563,11 +6563,11 @@  discard block
 block discarded – undo
6563 6563
 	
6564 6564
 	
6565 6565
 	/**
6566
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6567
-	*
6568
-	* @return Array the airport list
6569
-	*
6570
-	*/
6566
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6567
+	 *
6568
+	 * @return Array the airport list
6569
+	 *
6570
+	 */
6571 6571
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6572 6572
 	{
6573 6573
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6598,11 +6598,11 @@  discard block
 block discarded – undo
6598 6598
 	
6599 6599
 	
6600 6600
 	/**
6601
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6602
-	*
6603
-	* @return Array the airport list
6604
-	*
6605
-	*/
6601
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6602
+	 *
6603
+	 * @return Array the airport list
6604
+	 *
6605
+	 */
6606 6606
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6607 6607
 	{
6608 6608
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6635,11 +6635,11 @@  discard block
 block discarded – undo
6635 6635
 	
6636 6636
 	
6637 6637
 	/**
6638
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6639
-	*
6640
-	* @return Array the airport list
6641
-	*
6642
-	*/
6638
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6639
+	 *
6640
+	 * @return Array the airport list
6641
+	 *
6642
+	 */
6643 6643
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6644 6644
 	{
6645 6645
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6669,11 +6669,11 @@  discard block
 block discarded – undo
6669 6669
 	
6670 6670
 	
6671 6671
 	/**
6672
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6673
-	*
6674
-	* @return Array the airport list
6675
-	*
6676
-	*/
6672
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6673
+	 *
6674
+	 * @return Array the airport list
6675
+	 *
6676
+	 */
6677 6677
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6678 6678
 	{
6679 6679
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6706,11 +6706,11 @@  discard block
 block discarded – undo
6706 6706
 	
6707 6707
 	
6708 6708
 	/**
6709
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6710
-	*
6711
-	* @return Array the airport list
6712
-	*
6713
-	*/
6709
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6710
+	 *
6711
+	 * @return Array the airport list
6712
+	 *
6713
+	 */
6714 6714
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6715 6715
 	{
6716 6716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6740,11 +6740,11 @@  discard block
 block discarded – undo
6740 6740
 	
6741 6741
 	
6742 6742
 	/**
6743
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6744
-	*
6745
-	* @return Array the airport list
6746
-	*
6747
-	*/
6743
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6744
+	 *
6745
+	 * @return Array the airport list
6746
+	 *
6747
+	 */
6748 6748
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6749 6749
 	{
6750 6750
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6777,11 +6777,11 @@  discard block
 block discarded – undo
6777 6777
 	
6778 6778
 	
6779 6779
 	/**
6780
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6781
-	*
6782
-	* @return Array the airport list
6783
-	*
6784
-	*/
6780
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6781
+	 *
6782
+	 * @return Array the airport list
6783
+	 *
6784
+	 */
6785 6785
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6786 6786
 	{
6787 6787
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6812,11 +6812,11 @@  discard block
 block discarded – undo
6812 6812
 	
6813 6813
 	
6814 6814
 	/**
6815
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6816
-	*
6817
-	* @return Array the airport list
6818
-	*
6819
-	*/
6815
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6816
+	 *
6817
+	 * @return Array the airport list
6818
+	 *
6819
+	 */
6820 6820
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6821 6821
 	{
6822 6822
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6849,11 +6849,11 @@  discard block
 block discarded – undo
6849 6849
 	
6850 6850
 	
6851 6851
 	/**
6852
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6853
-	*
6854
-	* @return Array the airport list
6855
-	*
6856
-	*/
6852
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6853
+	 *
6854
+	 * @return Array the airport list
6855
+	 *
6856
+	 */
6857 6857
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6858 6858
 	{
6859 6859
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6883,11 +6883,11 @@  discard block
 block discarded – undo
6883 6883
 	
6884 6884
 	
6885 6885
 	/**
6886
-	* Gets all departure airports of the airplanes that have flown over based on a date
6887
-	*
6888
-	* @return Array the airport list
6889
-	*
6890
-	*/
6886
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6887
+	 *
6888
+	 * @return Array the airport list
6889
+	 *
6890
+	 */
6891 6891
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6892 6892
 	{
6893 6893
 		global $globalTimezone, $globalDBdriver;
@@ -6933,11 +6933,11 @@  discard block
 block discarded – undo
6933 6933
 	
6934 6934
 	
6935 6935
 	/**
6936
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6937
-	*
6938
-	* @return Array the airport list
6939
-	*
6940
-	*/
6936
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6937
+	 *
6938
+	 * @return Array the airport list
6939
+	 *
6940
+	 */
6941 6941
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6942 6942
 	{
6943 6943
 		global $globalTimezone, $globalDBdriver;
@@ -6980,11 +6980,11 @@  discard block
 block discarded – undo
6980 6980
 	
6981 6981
 	
6982 6982
 	/**
6983
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6984
-	*
6985
-	* @return Array the airport list
6986
-	*
6987
-	*/
6983
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6984
+	 *
6985
+	 * @return Array the airport list
6986
+	 *
6987
+	 */
6988 6988
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6989 6989
 	{
6990 6990
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7016,11 +7016,11 @@  discard block
 block discarded – undo
7016 7016
 	}
7017 7017
 	
7018 7018
 	/**
7019
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7020
-	*
7021
-	* @return Array the airport list
7022
-	*
7023
-	*/
7019
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7020
+	 *
7021
+	 * @return Array the airport list
7022
+	 *
7023
+	 */
7024 7024
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7025 7025
 	{
7026 7026
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7052,11 +7052,11 @@  discard block
 block discarded – undo
7052 7052
 	}
7053 7053
 	
7054 7054
 	/**
7055
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7056
-	*
7057
-	* @return Array the airport list
7058
-	*
7059
-	*/
7055
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7056
+	 *
7057
+	 * @return Array the airport list
7058
+	 *
7059
+	 */
7060 7060
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7061 7061
 	{
7062 7062
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7089,11 +7089,11 @@  discard block
 block discarded – undo
7089 7089
 	
7090 7090
 	
7091 7091
 	/**
7092
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7093
-	*
7094
-	* @return Array the airport list
7095
-	*
7096
-	*/
7092
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7093
+	 *
7094
+	 * @return Array the airport list
7095
+	 *
7096
+	 */
7097 7097
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7098 7098
 	{
7099 7099
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	}
7123 7123
 	
7124 7124
 	/**
7125
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7126
-	*
7127
-	* @return Array the airport list
7128
-	*
7129
-	*/
7125
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7126
+	 *
7127
+	 * @return Array the airport list
7128
+	 *
7129
+	 */
7130 7130
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7131 7131
 	{
7132 7132
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7142,11 +7142,11 @@  discard block
 block discarded – undo
7142 7142
 	}
7143 7143
 	
7144 7144
 	/**
7145
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7146
-	*
7147
-	* @return Array the airport list
7148
-	*
7149
-	*/
7145
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7146
+	 *
7147
+	 * @return Array the airport list
7148
+	 *
7149
+	 */
7150 7150
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7151 7151
 	{
7152 7152
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7164,11 +7164,11 @@  discard block
 block discarded – undo
7164 7164
 	
7165 7165
 	
7166 7166
 	/**
7167
-	* Gets all departure airports of the airplanes that have flown over based on a country
7168
-	*
7169
-	* @return Array the airport list
7170
-	*
7171
-	*/
7167
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7168
+	 *
7169
+	 * @return Array the airport list
7170
+	 *
7171
+	 */
7172 7172
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7173 7173
 	{
7174 7174
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7202,11 +7202,11 @@  discard block
 block discarded – undo
7202 7202
 
7203 7203
 
7204 7204
 	/**
7205
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7206
-	*
7207
-	* @return Array the airport list
7208
-	*
7209
-	*/
7205
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7206
+	 *
7207
+	 * @return Array the airport list
7208
+	 *
7209
+	 */
7210 7210
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7211 7211
 	{
7212 7212
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7236,31 +7236,31 @@  discard block
 block discarded – undo
7236 7236
 	
7237 7237
 
7238 7238
 	/**
7239
-	* Gets all arrival airports of the airplanes that have flown over
7240
-	*
7241
-	* @param Boolean $limit Limit result to 10 or not
7242
-	* @param Integer $olderthanmonths Only show result older than x months
7243
-	* @param String $sincedate Only show result since x date
7244
-	* @param Boolean $icaoaskey Show result by ICAO
7245
-	* @param Array $filters Filter used here
7246
-	* @return Array the airport list
7247
-	*
7248
-	*/
7239
+	 * Gets all arrival airports of the airplanes that have flown over
7240
+	 *
7241
+	 * @param Boolean $limit Limit result to 10 or not
7242
+	 * @param Integer $olderthanmonths Only show result older than x months
7243
+	 * @param String $sincedate Only show result since x date
7244
+	 * @param Boolean $icaoaskey Show result by ICAO
7245
+	 * @param Array $filters Filter used here
7246
+	 * @return Array the airport list
7247
+	 *
7248
+	 */
7249 7249
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7250 7250
 	{
7251 7251
 		global $globalDBdriver;
7252 7252
 		$filter_query = $this->getFilter($filters,true,true);
7253 7253
 		$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 
7254 7254
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7255
-                if ($olderthanmonths > 0) {
7256
-            		if ($globalDBdriver == 'mysql') {
7255
+				if ($olderthanmonths > 0) {
7256
+					if ($globalDBdriver == 'mysql') {
7257 7257
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7258 7258
 			} else {
7259 7259
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7260 7260
 			}
7261 7261
 		}
7262
-                if ($sincedate != '') {
7263
-            		if ($globalDBdriver == 'mysql') {
7262
+				if ($sincedate != '') {
7263
+					if ($globalDBdriver == 'mysql') {
7264 7264
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7265 7265
 			} else {
7266 7266
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7294,7 +7294,7 @@  discard block
 block discarded – undo
7294 7294
 				$query_values = array_merge($query_values,array(':day' => $day));
7295 7295
 			}
7296 7296
 		}
7297
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7297
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7298 7298
 					ORDER BY airport_arrival_icao_count DESC";
7299 7299
 		if ($limit) $query .= " LIMIT 10";
7300 7300
       
@@ -7323,35 +7323,35 @@  discard block
 block discarded – undo
7323 7323
 	}
7324 7324
 
7325 7325
 	/**
7326
-	* Gets all arrival airports of the airplanes that have flown over
7327
-	*
7328
-	* @return Array the airport list
7329
-	*
7330
-	*/
7326
+	 * Gets all arrival airports of the airplanes that have flown over
7327
+	 *
7328
+	 * @return Array the airport list
7329
+	 *
7330
+	 */
7331 7331
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7332 7332
 	{
7333 7333
 		global $globalDBdriver;
7334 7334
 		$filter_query = $this->getFilter($filters,true,true);
7335 7335
 		$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 
7336 7336
 			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 <> '' ";
7337
-                if ($olderthanmonths > 0) {
7338
-            		if ($globalDBdriver == 'mysql') {
7337
+				if ($olderthanmonths > 0) {
7338
+					if ($globalDBdriver == 'mysql') {
7339 7339
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7340 7340
 			} else {
7341 7341
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7342 7342
 			}
7343 7343
 		}
7344
-                if ($sincedate != '') {
7345
-            		if ($globalDBdriver == 'mysql') {
7344
+				if ($sincedate != '') {
7345
+					if ($globalDBdriver == 'mysql') {
7346 7346
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7347 7347
 			} else {
7348 7348
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7349 7349
 			}
7350 7350
 		}
7351 7351
 
7352
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7353
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7354
-                $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
7352
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7353
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7354
+				$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
7355 7355
 					ORDER BY airport_arrival_icao_count DESC";
7356 7356
 		if ($limit) $query .= " LIMIT 10";
7357 7357
       
@@ -7382,26 +7382,26 @@  discard block
 block discarded – undo
7382 7382
 
7383 7383
 
7384 7384
 	/**
7385
-	* Gets all detected arrival airports of the airplanes that have flown over
7386
-	*
7387
-	* @return Array the airport list
7388
-	*
7389
-	*/
7385
+	 * Gets all detected arrival airports of the airplanes that have flown over
7386
+	 *
7387
+	 * @return Array the airport list
7388
+	 *
7389
+	 */
7390 7390
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7391 7391
 	{
7392 7392
 		global $globalDBdriver;
7393 7393
 		$filter_query = $this->getFilter($filters,true,true);
7394 7394
 		$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 
7395 7395
 			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";
7396
-                if ($olderthanmonths > 0) {
7397
-            		if ($globalDBdriver == 'mysql') {
7396
+				if ($olderthanmonths > 0) {
7397
+					if ($globalDBdriver == 'mysql') {
7398 7398
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7399 7399
 			} else {
7400 7400
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7401 7401
 			}
7402 7402
 		}
7403
-                if ($sincedate != '') {
7404
-            		if ($globalDBdriver == 'mysql') {
7403
+				if ($sincedate != '') {
7404
+					if ($globalDBdriver == 'mysql') {
7405 7405
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7406 7406
 			} else {
7407 7407
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7435,7 +7435,7 @@  discard block
 block discarded – undo
7435 7435
 				$query_values = array_merge($query_values,array(':day' => $day));
7436 7436
 			}
7437 7437
 		}
7438
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7438
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7439 7439
 					ORDER BY airport_arrival_icao_count DESC";
7440 7440
 		if ($limit) $query .= " LIMIT 10";
7441 7441
       
@@ -7463,35 +7463,35 @@  discard block
 block discarded – undo
7463 7463
 	}
7464 7464
 	
7465 7465
 	/**
7466
-	* Gets all detected arrival airports of the airplanes that have flown over
7467
-	*
7468
-	* @return Array the airport list
7469
-	*
7470
-	*/
7466
+	 * Gets all detected arrival airports of the airplanes that have flown over
7467
+	 *
7468
+	 * @return Array the airport list
7469
+	 *
7470
+	 */
7471 7471
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7472 7472
 	{
7473 7473
 		global $globalDBdriver;
7474 7474
 		$filter_query = $this->getFilter($filters,true,true);
7475 7475
 		$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 
7476 7476
 			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 ";
7477
-                if ($olderthanmonths > 0) {
7478
-            		if ($globalDBdriver == 'mysql') {
7477
+				if ($olderthanmonths > 0) {
7478
+					if ($globalDBdriver == 'mysql') {
7479 7479
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7480 7480
 			} else {
7481 7481
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7482 7482
 			}
7483 7483
 		}
7484
-                if ($sincedate != '') {
7485
-            		if ($globalDBdriver == 'mysql') {
7484
+				if ($sincedate != '') {
7485
+					if ($globalDBdriver == 'mysql') {
7486 7486
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7487 7487
 			} else {
7488 7488
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7489 7489
 			}
7490 7490
 		}
7491 7491
 
7492
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7493
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7494
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7492
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7493
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7494
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7495 7495
 					ORDER BY airport_arrival_icao_count DESC";
7496 7496
 		if ($limit) $query .= " LIMIT 10";
7497 7497
       
@@ -7521,11 +7521,11 @@  discard block
 block discarded – undo
7521 7521
 	}	
7522 7522
 	
7523 7523
 	/**
7524
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7525
-	*
7526
-	* @return Array the airport list
7527
-	*
7528
-	*/
7524
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7525
+	 *
7526
+	 * @return Array the airport list
7527
+	 *
7528
+	 */
7529 7529
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7530 7530
 	{
7531 7531
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7557,11 +7557,11 @@  discard block
 block discarded – undo
7557 7557
 	
7558 7558
 	
7559 7559
 	/**
7560
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7561
-	*
7562
-	* @return Array the airport list
7563
-	*
7564
-	*/
7560
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7561
+	 *
7562
+	 * @return Array the airport list
7563
+	 *
7564
+	 */
7565 7565
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7566 7566
 	{
7567 7567
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7592,11 +7592,11 @@  discard block
 block discarded – undo
7592 7592
 	
7593 7593
 	
7594 7594
 	/**
7595
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7596
-	*
7597
-	* @return Array the airport list
7598
-	*
7599
-	*/
7595
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7596
+	 *
7597
+	 * @return Array the airport list
7598
+	 *
7599
+	 */
7600 7600
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7601 7601
 	{
7602 7602
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7630,11 +7630,11 @@  discard block
 block discarded – undo
7630 7630
 	
7631 7631
 	
7632 7632
 	/**
7633
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7634
-	*
7635
-	* @return Array the airport list
7636
-	*
7637
-	*/
7633
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7634
+	 *
7635
+	 * @return Array the airport list
7636
+	 *
7637
+	 */
7638 7638
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7639 7639
 	{
7640 7640
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7664,11 +7664,11 @@  discard block
 block discarded – undo
7664 7664
 	
7665 7665
 	
7666 7666
 	/**
7667
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7668
-	*
7669
-	* @return Array the airport list
7670
-	*
7671
-	*/
7667
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7668
+	 *
7669
+	 * @return Array the airport list
7670
+	 *
7671
+	 */
7672 7672
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7673 7673
 	{
7674 7674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7702,11 +7702,11 @@  discard block
 block discarded – undo
7702 7702
 	
7703 7703
 	
7704 7704
 	/**
7705
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7706
-	*
7707
-	* @return Array the airport list
7708
-	*
7709
-	*/
7705
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7706
+	 *
7707
+	 * @return Array the airport list
7708
+	 *
7709
+	 */
7710 7710
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7711 7711
 	{
7712 7712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	
7738 7738
 	
7739 7739
 	/**
7740
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
7741
-	*
7742
-	* @return Array the airport list
7743
-	*
7744
-	*/
7740
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
7741
+	 *
7742
+	 * @return Array the airport list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7746 7746
 	{
7747 7747
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7774,11 +7774,11 @@  discard block
 block discarded – undo
7774 7774
 	
7775 7775
 	
7776 7776
 	/**
7777
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7778
-	*
7779
-	* @return Array the airport list
7780
-	*
7781
-	*/
7777
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7778
+	 *
7779
+	 * @return Array the airport list
7780
+	 *
7781
+	 */
7782 7782
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7783 7783
 	{
7784 7784
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7808,11 +7808,11 @@  discard block
 block discarded – undo
7808 7808
 	
7809 7809
 	
7810 7810
 	/**
7811
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7812
-	*
7813
-	* @return Array the airport list
7814
-	*
7815
-	*/
7811
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7812
+	 *
7813
+	 * @return Array the airport list
7814
+	 *
7815
+	 */
7816 7816
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7817 7817
 	{
7818 7818
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7846,11 +7846,11 @@  discard block
 block discarded – undo
7846 7846
 	
7847 7847
 	
7848 7848
 	/**
7849
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7850
-	*
7851
-	* @return Array the airport list
7852
-	*
7853
-	*/
7849
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7850
+	 *
7851
+	 * @return Array the airport list
7852
+	 *
7853
+	 */
7854 7854
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7855 7855
 	{
7856 7856
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7881,11 +7881,11 @@  discard block
 block discarded – undo
7881 7881
 	
7882 7882
 	
7883 7883
 	/**
7884
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7885
-	*
7886
-	* @return Array the airport list
7887
-	*
7888
-	*/
7884
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7885
+	 *
7886
+	 * @return Array the airport list
7887
+	 *
7888
+	 */
7889 7889
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7890 7890
 	{
7891 7891
 		global $globalTimezone, $globalDBdriver;
@@ -7931,11 +7931,11 @@  discard block
 block discarded – undo
7931 7931
 	
7932 7932
 	
7933 7933
 	/**
7934
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7935
-	*
7936
-	* @return Array the airport list
7937
-	*
7938
-	*/
7934
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7935
+	 *
7936
+	 * @return Array the airport list
7937
+	 *
7938
+	 */
7939 7939
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7940 7940
 	{
7941 7941
 		global $globalTimezone, $globalDBdriver;
@@ -7978,11 +7978,11 @@  discard block
 block discarded – undo
7978 7978
 	
7979 7979
 	
7980 7980
 	/**
7981
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7982
-	*
7983
-	* @return Array the airport list
7984
-	*
7985
-	*/
7981
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7982
+	 *
7983
+	 * @return Array the airport list
7984
+	 *
7985
+	 */
7986 7986
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7987 7987
 	{
7988 7988
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8014,11 +8014,11 @@  discard block
 block discarded – undo
8014 8014
 	}
8015 8015
 	
8016 8016
 	/**
8017
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8018
-	*
8019
-	* @return Array the airport list
8020
-	*
8021
-	*/
8017
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8018
+	 *
8019
+	 * @return Array the airport list
8020
+	 *
8021
+	 */
8022 8022
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8023 8023
 	{
8024 8024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8049,11 +8049,11 @@  discard block
 block discarded – undo
8049 8049
 	}
8050 8050
 
8051 8051
 	/**
8052
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8053
-	*
8054
-	* @return Array the airport list
8055
-	*
8056
-	*/
8052
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8053
+	 *
8054
+	 * @return Array the airport list
8055
+	 *
8056
+	 */
8057 8057
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8058 8058
 	{
8059 8059
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8084,11 +8084,11 @@  discard block
 block discarded – undo
8084 8084
 	}
8085 8085
 	
8086 8086
 	/**
8087
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8088
-	*
8089
-	* @return Array the airport list
8090
-	*
8091
-	*/
8087
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8088
+	 *
8089
+	 * @return Array the airport list
8090
+	 *
8091
+	 */
8092 8092
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8093 8093
 	{
8094 8094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8117,11 +8117,11 @@  discard block
 block discarded – undo
8117 8117
 	}
8118 8118
 	
8119 8119
 	/**
8120
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8121
-	*
8122
-	* @return Array the airport list
8123
-	*
8124
-	*/
8120
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8121
+	 *
8122
+	 * @return Array the airport list
8123
+	 *
8124
+	 */
8125 8125
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8126 8126
 	{
8127 8127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8137,11 +8137,11 @@  discard block
 block discarded – undo
8137 8137
 	}
8138 8138
 	
8139 8139
 	/**
8140
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8141
-	*
8142
-	* @return Array the airport list
8143
-	*
8144
-	*/
8140
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8141
+	 *
8142
+	 * @return Array the airport list
8143
+	 *
8144
+	 */
8145 8145
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8146 8146
 	{
8147 8147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8159,11 +8159,11 @@  discard block
 block discarded – undo
8159 8159
 	
8160 8160
 	
8161 8161
 	/**
8162
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8163
-	*
8164
-	* @return Array the airport list
8165
-	*
8166
-	*/
8162
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8163
+	 *
8164
+	 * @return Array the airport list
8165
+	 *
8166
+	 */
8167 8167
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8168 8168
 	{
8169 8169
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8196,11 +8196,11 @@  discard block
 block discarded – undo
8196 8196
 	
8197 8197
 	
8198 8198
 	/**
8199
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8200
-	*
8201
-	* @return Array the airport list
8202
-	*
8203
-	*/
8199
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8200
+	 *
8201
+	 * @return Array the airport list
8202
+	 *
8203
+	 */
8204 8204
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8205 8205
 	{
8206 8206
 		global $globalDBdriver;
@@ -8232,11 +8232,11 @@  discard block
 block discarded – undo
8232 8232
 
8233 8233
 
8234 8234
 	/**
8235
-	* Counts all airport departure countries
8236
-	*
8237
-	* @return Array the airport departure list
8238
-	*
8239
-	*/
8235
+	 * Counts all airport departure countries
8236
+	 *
8237
+	 * @return Array the airport departure list
8238
+	 *
8239
+	 */
8240 8240
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8241 8241
 	{
8242 8242
 		global $globalDBdriver;
@@ -8295,11 +8295,11 @@  discard block
 block discarded – undo
8295 8295
 	
8296 8296
 	
8297 8297
 	/**
8298
-	* Counts all airport arrival countries
8299
-	*
8300
-	* @return Array the airport arrival list
8301
-	*
8302
-	*/
8298
+	 * Counts all airport arrival countries
8299
+	 *
8300
+	 * @return Array the airport arrival list
8301
+	 *
8302
+	 */
8303 8303
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8304 8304
 	{
8305 8305
 		global $globalDBdriver;
@@ -8361,11 +8361,11 @@  discard block
 block discarded – undo
8361 8361
 
8362 8362
 
8363 8363
 	/**
8364
-	* Gets all route combinations
8365
-	*
8366
-	* @return Array the route list
8367
-	*
8368
-	*/
8364
+	 * Gets all route combinations
8365
+	 *
8366
+	 * @return Array the route list
8367
+	 *
8368
+	 */
8369 8369
 	public function countAllRoutes($filters = array())
8370 8370
 	{
8371 8371
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8404,11 +8404,11 @@  discard block
 block discarded – undo
8404 8404
 	
8405 8405
 	
8406 8406
 	/**
8407
-	* Gets all route combinations based on an aircraft
8408
-	*
8409
-	* @return Array the route list
8410
-	*
8411
-	*/
8407
+	 * Gets all route combinations based on an aircraft
8408
+	 *
8409
+	 * @return Array the route list
8410
+	 *
8411
+	 */
8412 8412
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8413 8413
 	{
8414 8414
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8444,11 +8444,11 @@  discard block
 block discarded – undo
8444 8444
 	
8445 8445
 	
8446 8446
 	/**
8447
-	* Gets all route combinations based on an aircraft registration
8448
-	*
8449
-	* @return Array the route list
8450
-	*
8451
-	*/
8447
+	 * Gets all route combinations based on an aircraft registration
8448
+	 *
8449
+	 * @return Array the route list
8450
+	 *
8451
+	 */
8452 8452
 	public function countAllRoutesByRegistration($registration, $filters = array())
8453 8453
 	{
8454 8454
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8486,11 +8486,11 @@  discard block
 block discarded – undo
8486 8486
 	
8487 8487
 	
8488 8488
 	/**
8489
-	* Gets all route combinations based on an airline
8490
-	*
8491
-	* @return Array the route list
8492
-	*
8493
-	*/
8489
+	 * Gets all route combinations based on an airline
8490
+	 *
8491
+	 * @return Array the route list
8492
+	 *
8493
+	 */
8494 8494
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8495 8495
 	{
8496 8496
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8528,11 +8528,11 @@  discard block
 block discarded – undo
8528 8528
 	
8529 8529
 	
8530 8530
 	/**
8531
-	* Gets all route combinations based on an airport
8532
-	*
8533
-	* @return Array the route list
8534
-	*
8535
-	*/
8531
+	 * Gets all route combinations based on an airport
8532
+	 *
8533
+	 * @return Array the route list
8534
+	 *
8535
+	 */
8536 8536
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8537 8537
 	{
8538 8538
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8569,11 +8569,11 @@  discard block
 block discarded – undo
8569 8569
 	
8570 8570
 	
8571 8571
 	/**
8572
-	* Gets all route combinations based on an country
8573
-	*
8574
-	* @return Array the route list
8575
-	*
8576
-	*/
8572
+	 * Gets all route combinations based on an country
8573
+	 *
8574
+	 * @return Array the route list
8575
+	 *
8576
+	 */
8577 8577
 	public function countAllRoutesByCountry($country, $filters = array())
8578 8578
 	{
8579 8579
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8609,11 +8609,11 @@  discard block
 block discarded – undo
8609 8609
 
8610 8610
 
8611 8611
 	/**
8612
-	* Gets all route combinations based on an date
8613
-	*
8614
-	* @return Array the route list
8615
-	*
8616
-	*/
8612
+	 * Gets all route combinations based on an date
8613
+	 *
8614
+	 * @return Array the route list
8615
+	 *
8616
+	 */
8617 8617
 	public function countAllRoutesByDate($date, $filters = array())
8618 8618
 	{
8619 8619
 		global $globalTimezone, $globalDBdriver;
@@ -8663,11 +8663,11 @@  discard block
 block discarded – undo
8663 8663
 	
8664 8664
 	
8665 8665
 	/**
8666
-	* Gets all route combinations based on an ident/callsign
8667
-	*
8668
-	* @return Array the route list
8669
-	*
8670
-	*/
8666
+	 * Gets all route combinations based on an ident/callsign
8667
+	 *
8668
+	 * @return Array the route list
8669
+	 *
8670
+	 */
8671 8671
 	public function countAllRoutesByIdent($ident, $filters = array())
8672 8672
 	{
8673 8673
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8703,11 +8703,11 @@  discard block
 block discarded – undo
8703 8703
 	}
8704 8704
 	
8705 8705
 	/**
8706
-	* Gets all route combinations based on an owner
8707
-	*
8708
-	* @return Array the route list
8709
-	*
8710
-	*/
8706
+	 * Gets all route combinations based on an owner
8707
+	 *
8708
+	 * @return Array the route list
8709
+	 *
8710
+	 */
8711 8711
 	public function countAllRoutesByOwner($owner,$filters = array())
8712 8712
 	{
8713 8713
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8743,11 +8743,11 @@  discard block
 block discarded – undo
8743 8743
 	}
8744 8744
 	
8745 8745
 	/**
8746
-	* Gets all route combinations based on a pilot
8747
-	*
8748
-	* @return Array the route list
8749
-	*
8750
-	*/
8746
+	 * Gets all route combinations based on a pilot
8747
+	 *
8748
+	 * @return Array the route list
8749
+	 *
8750
+	 */
8751 8751
 	public function countAllRoutesByPilot($pilot,$filters = array())
8752 8752
 	{
8753 8753
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8784,11 +8784,11 @@  discard block
 block discarded – undo
8784 8784
 	
8785 8785
 	
8786 8786
 	/**
8787
-	* Gets all route combinations based on an manufacturer
8788
-	*
8789
-	* @return Array the route list
8790
-	*
8791
-	*/
8787
+	 * Gets all route combinations based on an manufacturer
8788
+	 *
8789
+	 * @return Array the route list
8790
+	 *
8791
+	 */
8792 8792
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8793 8793
 	{
8794 8794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8826,11 +8826,11 @@  discard block
 block discarded – undo
8826 8826
 	
8827 8827
 	
8828 8828
 	/**
8829
-	* Gets all route combinations with waypoints
8830
-	*
8831
-	* @return Array the route list
8832
-	*
8833
-	*/
8829
+	 * Gets all route combinations with waypoints
8830
+	 *
8831
+	 * @return Array the route list
8832
+	 *
8833
+	 */
8834 8834
 	public function countAllRoutesWithWaypoints($filters = array())
8835 8835
 	{
8836 8836
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8867,11 +8867,11 @@  discard block
 block discarded – undo
8867 8867
 	}
8868 8868
 	
8869 8869
 	/**
8870
-	* Gets all callsigns that have flown over
8871
-	*
8872
-	* @return Array the callsign list
8873
-	*
8874
-	*/
8870
+	 * Gets all callsigns that have flown over
8871
+	 *
8872
+	 * @return Array the callsign list
8873
+	 *
8874
+	 */
8875 8875
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8876 8876
 	{
8877 8877
 		global $globalDBdriver;
@@ -8937,11 +8937,11 @@  discard block
 block discarded – undo
8937 8937
 	}
8938 8938
 
8939 8939
 	/**
8940
-	* Gets all callsigns that have flown over
8941
-	*
8942
-	* @return Array the callsign list
8943
-	*
8944
-	*/
8940
+	 * Gets all callsigns that have flown over
8941
+	 *
8942
+	 * @return Array the callsign list
8943
+	 *
8944
+	 */
8945 8945
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8946 8946
 	{
8947 8947
 		global $globalDBdriver;
@@ -8982,11 +8982,11 @@  discard block
 block discarded – undo
8982 8982
 
8983 8983
 
8984 8984
 	/**
8985
-	* Counts all dates
8986
-	*
8987
-	* @return Array the date list
8988
-	*
8989
-	*/
8985
+	 * Counts all dates
8986
+	 *
8987
+	 * @return Array the date list
8988
+	 *
8989
+	 */
8990 8990
 	public function countAllDates($filters = array())
8991 8991
 	{
8992 8992
 		global $globalTimezone, $globalDBdriver;
@@ -9031,11 +9031,11 @@  discard block
 block discarded – undo
9031 9031
 	}
9032 9032
 	
9033 9033
 	/**
9034
-	* Counts all dates
9035
-	*
9036
-	* @return Array the date list
9037
-	*
9038
-	*/
9034
+	 * Counts all dates
9035
+	 *
9036
+	 * @return Array the date list
9037
+	 *
9038
+	 */
9039 9039
 	public function countAllDatesByAirlines($filters = array())
9040 9040
 	{
9041 9041
 		global $globalTimezone, $globalDBdriver;
@@ -9080,11 +9080,11 @@  discard block
 block discarded – undo
9080 9080
 	}	
9081 9081
 	
9082 9082
 	/**
9083
-	* Counts all dates during the last 7 days
9084
-	*
9085
-	* @return Array the date list
9086
-	*
9087
-	*/
9083
+	 * Counts all dates during the last 7 days
9084
+	 *
9085
+	 * @return Array the date list
9086
+	 *
9087
+	 */
9088 9088
 	public function countAllDatesLast7Days($filters = array())
9089 9089
 	{
9090 9090
 		global $globalTimezone, $globalDBdriver;
@@ -9106,7 +9106,7 @@  discard block
 block discarded – undo
9106 9106
 			$query .= " GROUP BY date_name 
9107 9107
 								ORDER BY date_name ASC";
9108 9108
 			$query_data = array(':offset' => $offset);
9109
-    		}
9109
+			}
9110 9110
 		
9111 9111
 		$sth = $this->db->prepare($query);
9112 9112
 		$sth->execute($query_data);
@@ -9126,11 +9126,11 @@  discard block
 block discarded – undo
9126 9126
 	}
9127 9127
 
9128 9128
 	/**
9129
-	* Counts all dates during the last month
9130
-	*
9131
-	* @return Array the date list
9132
-	*
9133
-	*/
9129
+	 * Counts all dates during the last month
9130
+	 *
9131
+	 * @return Array the date list
9132
+	 *
9133
+	 */
9134 9134
 	public function countAllDatesLastMonth($filters = array())
9135 9135
 	{
9136 9136
 		global $globalTimezone, $globalDBdriver;
@@ -9152,7 +9152,7 @@  discard block
 block discarded – undo
9152 9152
 			$query .= " GROUP BY date_name 
9153 9153
 								ORDER BY date_name ASC";
9154 9154
 			$query_data = array(':offset' => $offset);
9155
-    		}
9155
+			}
9156 9156
 		
9157 9157
 		$sth = $this->db->prepare($query);
9158 9158
 		$sth->execute($query_data);
@@ -9173,11 +9173,11 @@  discard block
 block discarded – undo
9173 9173
 
9174 9174
 
9175 9175
 	/**
9176
-	* Counts all dates during the last month
9177
-	*
9178
-	* @return Array the date list
9179
-	*
9180
-	*/
9176
+	 * Counts all dates during the last month
9177
+	 *
9178
+	 * @return Array the date list
9179
+	 *
9180
+	 */
9181 9181
 	public function countAllDatesLastMonthByAirlines($filters = array())
9182 9182
 	{
9183 9183
 		global $globalTimezone, $globalDBdriver;
@@ -9200,7 +9200,7 @@  discard block
 block discarded – undo
9200 9200
 								GROUP BY spotter_output.airline_icao, date_name 
9201 9201
 								ORDER BY date_name ASC";
9202 9202
 			$query_data = array(':offset' => $offset);
9203
-    		}
9203
+			}
9204 9204
 		
9205 9205
 		$sth = $this->db->prepare($query);
9206 9206
 		$sth->execute($query_data);
@@ -9222,11 +9222,11 @@  discard block
 block discarded – undo
9222 9222
 	
9223 9223
 
9224 9224
 	/**
9225
-	* Counts all month
9226
-	*
9227
-	* @return Array the month list
9228
-	*
9229
-	*/
9225
+	 * Counts all month
9226
+	 *
9227
+	 * @return Array the month list
9228
+	 *
9229
+	 */
9230 9230
 	public function countAllMonths($filters = array())
9231 9231
 	{
9232 9232
 		global $globalTimezone, $globalDBdriver;
@@ -9268,11 +9268,11 @@  discard block
 block discarded – undo
9268 9268
 	}
9269 9269
 
9270 9270
 	/**
9271
-	* Counts all month
9272
-	*
9273
-	* @return Array the month list
9274
-	*
9275
-	*/
9271
+	 * Counts all month
9272
+	 *
9273
+	 * @return Array the month list
9274
+	 *
9275
+	 */
9276 9276
 	public function countAllMonthsByAirlines($filters = array())
9277 9277
 	{
9278 9278
 		global $globalTimezone, $globalDBdriver;
@@ -9317,11 +9317,11 @@  discard block
 block discarded – undo
9317 9317
 	}
9318 9318
 
9319 9319
 	/**
9320
-	* Counts all military month
9321
-	*
9322
-	* @return Array the month list
9323
-	*
9324
-	*/
9320
+	 * Counts all military month
9321
+	 *
9322
+	 * @return Array the month list
9323
+	 *
9324
+	 */
9325 9325
 	public function countAllMilitaryMonths($filters = array())
9326 9326
 	{
9327 9327
 		global $globalTimezone, $globalDBdriver;
@@ -9362,11 +9362,11 @@  discard block
 block discarded – undo
9362 9362
 	}
9363 9363
 	
9364 9364
 	/**
9365
-	* Counts all month owners
9366
-	*
9367
-	* @return Array the month list
9368
-	*
9369
-	*/
9365
+	 * Counts all month owners
9366
+	 *
9367
+	 * @return Array the month list
9368
+	 *
9369
+	 */
9370 9370
 	public function countAllMonthsOwners($filters = array())
9371 9371
 	{
9372 9372
 		global $globalTimezone, $globalDBdriver;
@@ -9408,11 +9408,11 @@  discard block
 block discarded – undo
9408 9408
 	}
9409 9409
 	
9410 9410
 	/**
9411
-	* Counts all month owners
9412
-	*
9413
-	* @return Array the month list
9414
-	*
9415
-	*/
9411
+	 * Counts all month owners
9412
+	 *
9413
+	 * @return Array the month list
9414
+	 *
9415
+	 */
9416 9416
 	public function countAllMonthsOwnersByAirlines($filters = array())
9417 9417
 	{
9418 9418
 		global $globalTimezone, $globalDBdriver;
@@ -9455,11 +9455,11 @@  discard block
 block discarded – undo
9455 9455
 	}
9456 9456
 
9457 9457
 	/**
9458
-	* Counts all month pilot
9459
-	*
9460
-	* @return Array the month list
9461
-	*
9462
-	*/
9458
+	 * Counts all month pilot
9459
+	 *
9460
+	 * @return Array the month list
9461
+	 *
9462
+	 */
9463 9463
 	public function countAllMonthsPilots($filters = array())
9464 9464
 	{
9465 9465
 		global $globalTimezone, $globalDBdriver;
@@ -9501,11 +9501,11 @@  discard block
 block discarded – undo
9501 9501
 	}
9502 9502
 	
9503 9503
 	/**
9504
-	* Counts all month pilot
9505
-	*
9506
-	* @return Array the month list
9507
-	*
9508
-	*/
9504
+	 * Counts all month pilot
9505
+	 *
9506
+	 * @return Array the month list
9507
+	 *
9508
+	 */
9509 9509
 	public function countAllMonthsPilotsByAirlines($filters = array())
9510 9510
 	{
9511 9511
 		global $globalTimezone, $globalDBdriver;
@@ -9548,11 +9548,11 @@  discard block
 block discarded – undo
9548 9548
 	}
9549 9549
 
9550 9550
 	/**
9551
-	* Counts all month airline
9552
-	*
9553
-	* @return Array the month list
9554
-	*
9555
-	*/
9551
+	 * Counts all month airline
9552
+	 *
9553
+	 * @return Array the month list
9554
+	 *
9555
+	 */
9556 9556
 	public function countAllMonthsAirlines($filters = array())
9557 9557
 	{
9558 9558
 		global $globalTimezone, $globalDBdriver;
@@ -9594,11 +9594,11 @@  discard block
 block discarded – undo
9594 9594
 	}
9595 9595
 	
9596 9596
 	/**
9597
-	* Counts all month aircraft
9598
-	*
9599
-	* @return Array the month list
9600
-	*
9601
-	*/
9597
+	 * Counts all month aircraft
9598
+	 *
9599
+	 * @return Array the month list
9600
+	 *
9601
+	 */
9602 9602
 	public function countAllMonthsAircrafts($filters = array())
9603 9603
 	{
9604 9604
 		global $globalTimezone, $globalDBdriver;
@@ -9641,11 +9641,11 @@  discard block
 block discarded – undo
9641 9641
 	
9642 9642
 
9643 9643
 	/**
9644
-	* Counts all month aircraft
9645
-	*
9646
-	* @return Array the month list
9647
-	*
9648
-	*/
9644
+	 * Counts all month aircraft
9645
+	 *
9646
+	 * @return Array the month list
9647
+	 *
9648
+	 */
9649 9649
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9650 9650
 	{
9651 9651
 		global $globalTimezone, $globalDBdriver;
@@ -9688,11 +9688,11 @@  discard block
 block discarded – undo
9688 9688
 	}
9689 9689
 
9690 9690
 	/**
9691
-	* Counts all month real arrival
9692
-	*
9693
-	* @return Array the month list
9694
-	*
9695
-	*/
9691
+	 * Counts all month real arrival
9692
+	 *
9693
+	 * @return Array the month list
9694
+	 *
9695
+	 */
9696 9696
 	public function countAllMonthsRealArrivals($filters = array())
9697 9697
 	{
9698 9698
 		global $globalTimezone, $globalDBdriver;
@@ -9735,11 +9735,11 @@  discard block
 block discarded – undo
9735 9735
 	
9736 9736
 
9737 9737
 	/**
9738
-	* Counts all month real arrival
9739
-	*
9740
-	* @return Array the month list
9741
-	*
9742
-	*/
9738
+	 * Counts all month real arrival
9739
+	 *
9740
+	 * @return Array the month list
9741
+	 *
9742
+	 */
9743 9743
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9744 9744
 	{
9745 9745
 		global $globalTimezone, $globalDBdriver;
@@ -9783,11 +9783,11 @@  discard block
 block discarded – undo
9783 9783
 	
9784 9784
 
9785 9785
 	/**
9786
-	* Counts all dates during the last year
9787
-	*
9788
-	* @return Array the date list
9789
-	*
9790
-	*/
9786
+	 * Counts all dates during the last year
9787
+	 *
9788
+	 * @return Array the date list
9789
+	 *
9790
+	 */
9791 9791
 	public function countAllMonthsLastYear($filters)
9792 9792
 	{
9793 9793
 		global $globalTimezone, $globalDBdriver;
@@ -9809,7 +9809,7 @@  discard block
 block discarded – undo
9809 9809
 			$query .= " GROUP BY year_name, month_name
9810 9810
 								ORDER BY year_name, month_name ASC";
9811 9811
 			$query_data = array(':offset' => $offset);
9812
-    		}
9812
+			}
9813 9813
 		
9814 9814
 		$sth = $this->db->prepare($query);
9815 9815
 		$sth->execute($query_data);
@@ -9832,11 +9832,11 @@  discard block
 block discarded – undo
9832 9832
 	
9833 9833
 	
9834 9834
 	/**
9835
-	* Counts all hours
9836
-	*
9837
-	* @return Array the hour list
9838
-	*
9839
-	*/
9835
+	 * Counts all hours
9836
+	 *
9837
+	 * @return Array the hour list
9838
+	 *
9839
+	 */
9840 9840
 	public function countAllHours($orderby,$filters = array())
9841 9841
 	{
9842 9842
 		global $globalTimezone, $globalDBdriver;
@@ -9897,11 +9897,11 @@  discard block
 block discarded – undo
9897 9897
 	}
9898 9898
 	
9899 9899
 	/**
9900
-	* Counts all hours
9901
-	*
9902
-	* @return Array the hour list
9903
-	*
9904
-	*/
9900
+	 * Counts all hours
9901
+	 *
9902
+	 * @return Array the hour list
9903
+	 *
9904
+	 */
9905 9905
 	public function countAllHoursByAirlines($orderby, $filters = array())
9906 9906
 	{
9907 9907
 		global $globalTimezone, $globalDBdriver;
@@ -9964,11 +9964,11 @@  discard block
 block discarded – undo
9964 9964
 
9965 9965
 
9966 9966
 	/**
9967
-	* Counts all hours by airline
9968
-	*
9969
-	* @return Array the hour list
9970
-	*
9971
-	*/
9967
+	 * Counts all hours by airline
9968
+	 *
9969
+	 * @return Array the hour list
9970
+	 *
9971
+	 */
9972 9972
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9973 9973
 	{
9974 9974
 		global $globalTimezone, $globalDBdriver;
@@ -10014,11 +10014,11 @@  discard block
 block discarded – undo
10014 10014
 	
10015 10015
 	
10016 10016
 	/**
10017
-	* Counts all hours by aircraft
10018
-	*
10019
-	* @return Array the hour list
10020
-	*
10021
-	*/
10017
+	 * Counts all hours by aircraft
10018
+	 *
10019
+	 * @return Array the hour list
10020
+	 *
10021
+	 */
10022 10022
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10023 10023
 	{
10024 10024
 		global $globalTimezone, $globalDBdriver;
@@ -10061,11 +10061,11 @@  discard block
 block discarded – undo
10061 10061
 	
10062 10062
 	
10063 10063
 	/**
10064
-	* Counts all hours by aircraft registration
10065
-	*
10066
-	* @return Array the hour list
10067
-	*
10068
-	*/
10064
+	 * Counts all hours by aircraft registration
10065
+	 *
10066
+	 * @return Array the hour list
10067
+	 *
10068
+	 */
10069 10069
 	public function countAllHoursByRegistration($registration, $filters = array())
10070 10070
 	{
10071 10071
 		global $globalTimezone, $globalDBdriver;
@@ -10108,11 +10108,11 @@  discard block
 block discarded – undo
10108 10108
 	
10109 10109
 	
10110 10110
 	/**
10111
-	* Counts all hours by airport
10112
-	*
10113
-	* @return Array the hour list
10114
-	*
10115
-	*/
10111
+	 * Counts all hours by airport
10112
+	 *
10113
+	 * @return Array the hour list
10114
+	 *
10115
+	 */
10116 10116
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10117 10117
 	{
10118 10118
 		global $globalTimezone, $globalDBdriver;
@@ -10156,11 +10156,11 @@  discard block
 block discarded – undo
10156 10156
 	
10157 10157
 	
10158 10158
 	/**
10159
-	* Counts all hours by manufacturer
10160
-	*
10161
-	* @return Array the hour list
10162
-	*
10163
-	*/
10159
+	 * Counts all hours by manufacturer
10160
+	 *
10161
+	 * @return Array the hour list
10162
+	 *
10163
+	 */
10164 10164
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10165 10165
 	{
10166 10166
 		global $globalTimezone, $globalDBdriver;
@@ -10204,11 +10204,11 @@  discard block
 block discarded – undo
10204 10204
 	
10205 10205
 	
10206 10206
 	/**
10207
-	* Counts all hours by date
10208
-	*
10209
-	* @return Array the hour list
10210
-	*
10211
-	*/
10207
+	 * Counts all hours by date
10208
+	 *
10209
+	 * @return Array the hour list
10210
+	 *
10211
+	 */
10212 10212
 	public function countAllHoursByDate($date, $filters = array())
10213 10213
 	{
10214 10214
 		global $globalTimezone, $globalDBdriver;
@@ -10252,11 +10252,11 @@  discard block
 block discarded – undo
10252 10252
 	
10253 10253
 	
10254 10254
 	/**
10255
-	* Counts all hours by a ident/callsign
10256
-	*
10257
-	* @return Array the hour list
10258
-	*
10259
-	*/
10255
+	 * Counts all hours by a ident/callsign
10256
+	 *
10257
+	 * @return Array the hour list
10258
+	 *
10259
+	 */
10260 10260
 	public function countAllHoursByIdent($ident, $filters = array())
10261 10261
 	{
10262 10262
 		global $globalTimezone, $globalDBdriver;
@@ -10299,11 +10299,11 @@  discard block
 block discarded – undo
10299 10299
 	}
10300 10300
 	
10301 10301
 	/**
10302
-	* Counts all hours by a owner
10303
-	*
10304
-	* @return Array the hour list
10305
-	*
10306
-	*/
10302
+	 * Counts all hours by a owner
10303
+	 *
10304
+	 * @return Array the hour list
10305
+	 *
10306
+	 */
10307 10307
 	public function countAllHoursByOwner($owner, $filters = array())
10308 10308
 	{
10309 10309
 		global $globalTimezone, $globalDBdriver;
@@ -10346,11 +10346,11 @@  discard block
 block discarded – undo
10346 10346
 	}
10347 10347
 	
10348 10348
 	/**
10349
-	* Counts all hours by a pilot
10350
-	*
10351
-	* @return Array the hour list
10352
-	*
10353
-	*/
10349
+	 * Counts all hours by a pilot
10350
+	 *
10351
+	 * @return Array the hour list
10352
+	 *
10353
+	 */
10354 10354
 	public function countAllHoursByPilot($pilot, $filters = array())
10355 10355
 	{
10356 10356
 		global $globalTimezone, $globalDBdriver;
@@ -10395,11 +10395,11 @@  discard block
 block discarded – undo
10395 10395
 	
10396 10396
 	
10397 10397
 	/**
10398
-	* Counts all hours by route
10399
-	*
10400
-	* @return Array the hour list
10401
-	*
10402
-	*/
10398
+	 * Counts all hours by route
10399
+	 *
10400
+	 * @return Array the hour list
10401
+	 *
10402
+	 */
10403 10403
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10404 10404
 	{
10405 10405
 		global $globalTimezone, $globalDBdriver;
@@ -10443,11 +10443,11 @@  discard block
 block discarded – undo
10443 10443
 	
10444 10444
 	
10445 10445
 	/**
10446
-	* Counts all hours by country
10447
-	*
10448
-	* @return Array the hour list
10449
-	*
10450
-	*/
10446
+	 * Counts all hours by country
10447
+	 *
10448
+	 * @return Array the hour list
10449
+	 *
10450
+	 */
10451 10451
 	public function countAllHoursByCountry($country, $filters = array())
10452 10452
 	{
10453 10453
 		global $globalTimezone, $globalDBdriver;
@@ -10492,11 +10492,11 @@  discard block
 block discarded – undo
10492 10492
 
10493 10493
 
10494 10494
 	/**
10495
-	* Counts all aircraft that have flown over
10496
-	*
10497
-	* @return Integer the number of aircrafts
10498
-	*
10499
-	*/
10495
+	 * Counts all aircraft that have flown over
10496
+	 *
10497
+	 * @return Integer the number of aircrafts
10498
+	 *
10499
+	 */
10500 10500
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10501 10501
 	{
10502 10502
 		global $globalDBdriver;
@@ -10529,11 +10529,11 @@  discard block
 block discarded – undo
10529 10529
 	}
10530 10530
 
10531 10531
 	/**
10532
-	* Counts all flight that really arrival
10533
-	*
10534
-	* @return Integer the number of aircrafts
10535
-	*
10536
-	*/
10532
+	 * Counts all flight that really arrival
10533
+	 *
10534
+	 * @return Integer the number of aircrafts
10535
+	 *
10536
+	 */
10537 10537
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10538 10538
 	{
10539 10539
 		global $globalDBdriver;
@@ -10566,11 +10566,11 @@  discard block
 block discarded – undo
10566 10566
 	}
10567 10567
 
10568 10568
 	/**
10569
-	* Counts all pilots that have flown over
10570
-	*
10571
-	* @return Integer the number of pilots
10572
-	*
10573
-	*/
10569
+	 * Counts all pilots that have flown over
10570
+	 *
10571
+	 * @return Integer the number of pilots
10572
+	 *
10573
+	 */
10574 10574
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10575 10575
 	{
10576 10576
 		global $globalDBdriver;
@@ -10602,11 +10602,11 @@  discard block
 block discarded – undo
10602 10602
 	}
10603 10603
 
10604 10604
 	/**
10605
-	* Counts all owners that have flown over
10606
-	*
10607
-	* @return Integer the number of owners
10608
-	*
10609
-	*/
10605
+	 * Counts all owners that have flown over
10606
+	 *
10607
+	 * @return Integer the number of owners
10608
+	 *
10609
+	 */
10610 10610
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10611 10611
 	{
10612 10612
 		global $globalDBdriver;
@@ -10639,11 +10639,11 @@  discard block
 block discarded – undo
10639 10639
 	
10640 10640
 	
10641 10641
 	/**
10642
-	* Counts all flights that have flown over
10643
-	*
10644
-	* @return Integer the number of flights
10645
-	*
10646
-	*/
10642
+	 * Counts all flights that have flown over
10643
+	 *
10644
+	 * @return Integer the number of flights
10645
+	 *
10646
+	 */
10647 10647
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10648 10648
 	{
10649 10649
 		global $globalDBdriver;
@@ -10678,11 +10678,11 @@  discard block
 block discarded – undo
10678 10678
 	}
10679 10679
 	
10680 10680
 	/**
10681
-	* Counts all military flights that have flown over
10682
-	*
10683
-	* @return Integer the number of flights
10684
-	*
10685
-	*/
10681
+	 * Counts all military flights that have flown over
10682
+	 *
10683
+	 * @return Integer the number of flights
10684
+	 *
10685
+	 */
10686 10686
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10687 10687
 	{
10688 10688
 		global $globalDBdriver;
@@ -10717,11 +10717,11 @@  discard block
 block discarded – undo
10717 10717
 	
10718 10718
 	
10719 10719
 	/**
10720
-	* Counts all airlines that have flown over
10721
-	*
10722
-	* @return Integer the number of airlines
10723
-	*
10724
-	*/
10720
+	 * Counts all airlines that have flown over
10721
+	 *
10722
+	 * @return Integer the number of airlines
10723
+	 *
10724
+	 */
10725 10725
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10726 10726
 	{
10727 10727
 		global $globalDBdriver;
@@ -10748,8 +10748,8 @@  discard block
 block discarded – undo
10748 10748
 				$query_values = array_merge($query_values,array(':month' => $month));
10749 10749
 			}
10750 10750
 		}
10751
-                if ($query == '') $queryi .= $this->getFilter($filters);
10752
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10751
+				if ($query == '') $queryi .= $this->getFilter($filters);
10752
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10753 10753
 
10754 10754
 
10755 10755
 		$sth = $this->db->prepare($queryi);
@@ -10759,11 +10759,11 @@  discard block
 block discarded – undo
10759 10759
 
10760 10760
   
10761 10761
 	/**
10762
-	* Counts all hours of today
10763
-	*
10764
-	* @return Array the hour list
10765
-	*
10766
-	*/
10762
+	 * Counts all hours of today
10763
+	 *
10764
+	 * @return Array the hour list
10765
+	 *
10766
+	 */
10767 10767
 	public function countAllHoursFromToday($filters = array())
10768 10768
 	{
10769 10769
 		global $globalTimezone, $globalDBdriver;
@@ -10803,11 +10803,11 @@  discard block
 block discarded – undo
10803 10803
 	}
10804 10804
     
10805 10805
 	/**
10806
-	* Gets all the spotter information based on calculated upcoming flights
10807
-	*
10808
-	* @return Array the spotter information
10809
-	*
10810
-	*/
10806
+	 * Gets all the spotter information based on calculated upcoming flights
10807
+	 *
10808
+	 * @return Array the spotter information
10809
+	 *
10810
+	 */
10811 10811
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10812 10812
 	{
10813 10813
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -10882,12 +10882,12 @@  discard block
 block discarded – undo
10882 10882
 	}
10883 10883
     
10884 10884
     
10885
-     /**
10886
-	* Gets the Barrie Spotter ID based on the FlightAware ID
10887
-	*
10888
-	* @return Integer the Barrie Spotter ID
10885
+	 /**
10886
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
10887
+	  *
10888
+	  * @return Integer the Barrie Spotter ID
10889 10889
 q	*
10890
-	*/
10890
+	  */
10891 10891
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10892 10892
 	{
10893 10893
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -10908,13 +10908,13 @@  discard block
 block discarded – undo
10908 10908
   
10909 10909
  
10910 10910
 	/**
10911
-	* Parses a date string
10912
-	*
10913
-	* @param String $dateString the date string
10914
-	* @param String $timezone the timezone of a user
10915
-	* @return Array the time information
10916
-	*
10917
-	*/
10911
+	 * Parses a date string
10912
+	 *
10913
+	 * @param String $dateString the date string
10914
+	 * @param String $timezone the timezone of a user
10915
+	 * @return Array the time information
10916
+	 *
10917
+	 */
10918 10918
 	public function parseDateString($dateString, $timezone = '')
10919 10919
 	{
10920 10920
 		$time_array = array();
@@ -10950,12 +10950,12 @@  discard block
 block discarded – undo
10950 10950
 	
10951 10951
 	
10952 10952
 	/**
10953
-	* Parses the direction degrees to working
10954
-	*
10955
-	* @param Float $direction the direction in degrees
10956
-	* @return Array the direction information
10957
-	*
10958
-	*/
10953
+	 * Parses the direction degrees to working
10954
+	 *
10955
+	 * @param Float $direction the direction in degrees
10956
+	 * @return Array the direction information
10957
+	 *
10958
+	 */
10959 10959
 	public function parseDirection($direction = 0)
10960 10960
 	{
10961 10961
 		if ($direction == '') $direction = 0;
@@ -11034,12 +11034,12 @@  discard block
 block discarded – undo
11034 11034
 	
11035 11035
 	
11036 11036
 	/**
11037
-	* Gets the aircraft registration
11038
-	*
11039
-	* @param String $flightaware_id the flight aware id
11040
-	* @return String the aircraft registration
11041
-	*
11042
-	*/
11037
+	 * Gets the aircraft registration
11038
+	 *
11039
+	 * @param String $flightaware_id the flight aware id
11040
+	 * @return String the aircraft registration
11041
+	 *
11042
+	 */
11043 11043
 	
11044 11044
 	public function getAircraftRegistration($flightaware_id)
11045 11045
 	{
@@ -11068,12 +11068,12 @@  discard block
 block discarded – undo
11068 11068
 
11069 11069
 
11070 11070
 	/**
11071
-	* Gets the aircraft registration from ModeS
11072
-	*
11073
-	* @param String $aircraft_modes the flight ModeS in hex
11074
-	* @return String the aircraft registration
11075
-	*
11076
-	*/
11071
+	 * Gets the aircraft registration from ModeS
11072
+	 *
11073
+	 * @param String $aircraft_modes the flight ModeS in hex
11074
+	 * @return String the aircraft registration
11075
+	 *
11076
+	 */
11077 11077
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11078 11078
 	{
11079 11079
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11086,19 +11086,19 @@  discard block
 block discarded – undo
11086 11086
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11087 11087
 		$sth->closeCursor();
11088 11088
 		if (count($row) > 0) {
11089
-		    //return $row['Registration'];
11090
-		    return $row['registration'];
11089
+			//return $row['Registration'];
11090
+			return $row['registration'];
11091 11091
 		} else return '';
11092 11092
 	
11093 11093
 	}
11094 11094
 
11095 11095
 	/**
11096
-	* Gets the aircraft type from ModeS
11097
-	*
11098
-	* @param String $aircraft_modes the flight ModeS in hex
11099
-	* @return String the aircraft type
11100
-	*
11101
-	*/
11096
+	 * Gets the aircraft type from ModeS
11097
+	 *
11098
+	 * @param String $aircraft_modes the flight ModeS in hex
11099
+	 * @return String the aircraft type
11100
+	 *
11101
+	 */
11102 11102
 	public function getAircraftTypeBymodeS($aircraft_modes)
11103 11103
 	{
11104 11104
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11111,19 +11111,19 @@  discard block
 block discarded – undo
11111 11111
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11112 11112
 		$sth->closeCursor();
11113 11113
 		if (count($row) > 0) {
11114
-		    if ($row['type_flight'] == null) return '';
11115
-		    else return $row['type_flight'];
11114
+			if ($row['type_flight'] == null) return '';
11115
+			else return $row['type_flight'];
11116 11116
 		} else return '';
11117 11117
 	
11118 11118
 	}
11119 11119
 
11120 11120
 	/**
11121
-	* Gets Country from latitude/longitude
11122
-	*
11123
-	* @param Float $latitude latitute of the flight
11124
-	* @param Float $longitude longitute of the flight
11125
-	* @return String the countrie
11126
-	*/
11121
+	 * Gets Country from latitude/longitude
11122
+	 *
11123
+	 * @param Float $latitude latitute of the flight
11124
+	 * @param Float $longitude longitute of the flight
11125
+	 * @return String the countrie
11126
+	 */
11127 11127
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11128 11128
 	{
11129 11129
 		global $globalDBdriver, $globalDebug;
@@ -11160,11 +11160,11 @@  discard block
 block discarded – undo
11160 11160
 	}
11161 11161
 
11162 11162
 	/**
11163
-	* Gets Country from iso2
11164
-	*
11165
-	* @param String $iso2 ISO2 country code
11166
-	* @return String the countrie
11167
-	*/
11163
+	 * Gets Country from iso2
11164
+	 *
11165
+	 * @param String $iso2 ISO2 country code
11166
+	 * @return String the countrie
11167
+	 */
11168 11168
 	public function getCountryFromISO2($iso2)
11169 11169
 	{
11170 11170
 		global $globalDBdriver, $globalDebug;
@@ -11192,12 +11192,12 @@  discard block
 block discarded – undo
11192 11192
 	}
11193 11193
 
11194 11194
 	/**
11195
-	* converts the registration code using the country prefix
11196
-	*
11197
-	* @param String $registration the aircraft registration
11198
-	* @return String the aircraft registration
11199
-	*
11200
-	*/
11195
+	 * converts the registration code using the country prefix
11196
+	 *
11197
+	 * @param String $registration the aircraft registration
11198
+	 * @return String the aircraft registration
11199
+	 *
11200
+	 */
11201 11201
 	public function convertAircraftRegistration($registration)
11202 11202
 	{
11203 11203
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11249,12 +11249,12 @@  discard block
 block discarded – undo
11249 11249
 	}
11250 11250
 
11251 11251
 	/**
11252
-	* Country from the registration code
11253
-	*
11254
-	* @param String $registration the aircraft registration
11255
-	* @return String the country
11256
-	*
11257
-	*/
11252
+	 * Country from the registration code
11253
+	 *
11254
+	 * @param String $registration the aircraft registration
11255
+	 * @return String the country
11256
+	 *
11257
+	 */
11258 11258
 	public function countryFromAircraftRegistration($registration)
11259 11259
 	{
11260 11260
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11273,8 +11273,8 @@  discard block
 block discarded – undo
11273 11273
 				$country = $row['country'];
11274 11274
 			}
11275 11275
 		} else {
11276
-    			$registration_1 = substr($registration, 0, 1);
11277
-		        $registration_2 = substr($registration, 0, 2);
11276
+				$registration_1 = substr($registration, 0, 1);
11277
+				$registration_2 = substr($registration, 0, 2);
11278 11278
 
11279 11279
 			$country = '';
11280 11280
 			//first get the prefix based on two characters
@@ -11310,12 +11310,12 @@  discard block
 block discarded – undo
11310 11310
 	}
11311 11311
 
11312 11312
 	/**
11313
-	* Registration prefix from the registration code
11314
-	*
11315
-	* @param String $registration the aircraft registration
11316
-	* @return String the registration prefix
11317
-	*
11318
-	*/
11313
+	 * Registration prefix from the registration code
11314
+	 *
11315
+	 * @param String $registration the aircraft registration
11316
+	 * @return String the registration prefix
11317
+	 *
11318
+	 */
11319 11319
 	public function registrationPrefixFromAircraftRegistration($registration)
11320 11320
 	{
11321 11321
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11334,8 +11334,8 @@  discard block
 block discarded – undo
11334 11334
 				//$country = $row['country'];
11335 11335
 			}
11336 11336
 		} else {
11337
-    			$registration_1 = substr($registration, 0, 1);
11338
-		        $registration_2 = substr($registration, 0, 2);
11337
+				$registration_1 = substr($registration, 0, 1);
11338
+				$registration_2 = substr($registration, 0, 2);
11339 11339
 
11340 11340
 			//first get the prefix based on two characters
11341 11341
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11371,12 +11371,12 @@  discard block
 block discarded – undo
11371 11371
 
11372 11372
 
11373 11373
 	/**
11374
-	* Country from the registration code
11375
-	*
11376
-	* @param String $registration the aircraft registration
11377
-	* @return String the country
11378
-	*
11379
-	*/
11374
+	 * Country from the registration code
11375
+	 *
11376
+	 * @param String $registration the aircraft registration
11377
+	 * @return String the country
11378
+	 *
11379
+	 */
11380 11380
 	public function countryFromAircraftRegistrationCode($registration)
11381 11381
 	{
11382 11382
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11393,11 +11393,11 @@  discard block
 block discarded – undo
11393 11393
 	}
11394 11394
 	
11395 11395
 	/**
11396
-	* Set a new highlight value for a flight
11397
-	*
11398
-	* @param String $flightaware_id flightaware_id from spotter_output table
11399
-	* @param String $highlight New highlight value
11400
-	*/
11396
+	 * Set a new highlight value for a flight
11397
+	 *
11398
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11399
+	 * @param String $highlight New highlight value
11400
+	 */
11401 11401
 	public function setHighlightFlight($flightaware_id,$highlight) {
11402 11402
 		
11403 11403
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11406,12 +11406,12 @@  discard block
 block discarded – undo
11406 11406
 	}
11407 11407
 
11408 11408
 	/**
11409
-	* Set a new highlight value for a flight by Registration
11410
-	*
11411
-	* @param String $registration Registration of the aircraft
11412
-	* @param String $date Date of spotted aircraft
11413
-	* @param String $highlight New highlight value
11414
-	*/
11409
+	 * Set a new highlight value for a flight by Registration
11410
+	 *
11411
+	 * @param String $registration Registration of the aircraft
11412
+	 * @param String $date Date of spotted aircraft
11413
+	 * @param String $highlight New highlight value
11414
+	 */
11415 11415
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11416 11416
 		if ($date == '') {
11417 11417
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11425,12 +11425,12 @@  discard block
 block discarded – undo
11425 11425
 	}
11426 11426
 	
11427 11427
 	/**
11428
-	* Gets the short url from bit.ly
11429
-	*
11430
-	* @param String $url the full url
11431
-	* @return String the bit.ly url
11432
-	*
11433
-	*/
11428
+	 * Gets the short url from bit.ly
11429
+	 *
11430
+	 * @param String $url the full url
11431
+	 * @return String the bit.ly url
11432
+	 *
11433
+	 */
11434 11434
 	public function getBitlyURL($url)
11435 11435
 	{
11436 11436
 		global $globalBitlyAccessToken;
@@ -11719,11 +11719,11 @@  discard block
 block discarded – undo
11719 11719
 			$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 
11720 11720
 	                      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)) 
11721 11721
 	                      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;";
11722
-                } else {
11722
+				} else {
11723 11723
 			$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 
11724 11724
 	                      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)) 
11725 11725
 	                      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;";
11726
-    		}
11726
+			}
11727 11727
 		$sth = $this->db->prepare($query);
11728 11728
 		$sth->execute();
11729 11729
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1261 added lines, -1261 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
 			{
@@ -1350,8 +1350,8 @@  discard block
 block discarded – undo
1350 1350
 		{
1351 1351
 			$limit_array = explode(",", $limit);
1352 1352
 			
1353
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1354
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1353
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1354
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1355 1355
 			
1356 1356
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1357 1357
 			{
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 		$query_values = array();
1393 1393
 		$limit_query = '';
1394 1394
 		$additional_query = '';
1395
-		$filter_query = $this->getFilter($filter,true,true);
1395
+		$filter_query = $this->getFilter($filter, true, true);
1396 1396
 		
1397 1397
 		if ($aircraft_type != "")
1398 1398
 		{
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
 		{
1410 1410
 			$limit_array = explode(",", $limit);
1411 1411
 			
1412
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1413
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1412
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1413
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1414 1414
 			
1415 1415
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1416 1416
 			{
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
 		{
1467 1467
 			$limit_array = explode(",", $limit);
1468 1468
 			
1469
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1470
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1469
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1470
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1471 1471
 			
1472 1472
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1473 1473
 			{
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 		} else {
1484 1484
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1485 1485
 		}
1486
-		$filter_query = $this->getFilter($filter,true,true);
1486
+		$filter_query = $this->getFilter($filter, true, true);
1487 1487
 
1488 1488
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1489 1489
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	* @return Array the spotter information
1503 1503
 	*
1504 1504
 	*/
1505
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1505
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
1508 1508
 		
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 		$query_values = array();
1512 1512
 		$limit_query = '';
1513 1513
 		$additional_query = '';
1514
-		$filter_query = $this->getFilter($filters,true,true);
1514
+		$filter_query = $this->getFilter($filters, true, true);
1515 1515
 		
1516 1516
 		if ($airline != "")
1517 1517
 		{
@@ -1528,8 +1528,8 @@  discard block
 block discarded – undo
1528 1528
 		{
1529 1529
 			$limit_array = explode(",", $limit);
1530 1530
 			
1531
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1532
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1531
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1532
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1533 1533
 			
1534 1534
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1535 1535
 			{
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 	* @return Array the spotter information
1560 1560
 	*
1561 1561
 	*/
1562
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1562
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
1565 1565
 		
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		$query_values = array();
1568 1568
 		$limit_query = '';
1569 1569
 		$additional_query = '';
1570
-		$filter_query = $this->getFilter($filters,true,true);
1570
+		$filter_query = $this->getFilter($filters, true, true);
1571 1571
 		
1572 1572
 		if ($airport != "")
1573 1573
 		{
@@ -1584,8 +1584,8 @@  discard block
 block discarded – undo
1584 1584
 		{
1585 1585
 			$limit_array = explode(",", $limit);
1586 1586
 			
1587
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1588
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1587
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1588
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1589 1589
 			
1590 1590
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1591 1591
 			{
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	* @return Array the spotter information
1618 1618
 	*
1619 1619
 	*/
1620
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1620
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
1623 1623
 		
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		$limit_query = '';
1626 1626
 		$additional_query = '';
1627 1627
 
1628
-		$filter_query = $this->getFilter($filter,true,true);
1628
+		$filter_query = $this->getFilter($filter, true, true);
1629 1629
 		
1630 1630
 		if ($date != "")
1631 1631
 		{
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
 		{
1655 1655
 			$limit_array = explode(",", $limit);
1656 1656
 			
1657
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1658
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1657
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1658
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1659 1659
 			
1660 1660
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1661 1661
 			{
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 	* @return Array the spotter information
1686 1686
 	*
1687 1687
 	*/
1688
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1688
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
1691 1691
 		
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 		$query_values = array();
1695 1695
 		$limit_query = '';
1696 1696
 		$additional_query = '';
1697
-		$filter_query = $this->getFilter($filters,true,true);
1697
+		$filter_query = $this->getFilter($filters, true, true);
1698 1698
 		if ($country != "")
1699 1699
 		{
1700 1700
 			if (!is_string($country))
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 		{
1712 1712
 			$limit_array = explode(",", $limit);
1713 1713
 			
1714
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1715
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1714
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1715
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1716 1716
 			
1717 1717
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1718 1718
 			{
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 		$query_values = array();
1753 1753
 		$additional_query = '';
1754 1754
 		$limit_query = '';
1755
-		$filter_query = $this->getFilter($filters,true,true);
1755
+		$filter_query = $this->getFilter($filters, true, true);
1756 1756
 		
1757 1757
 		if ($aircraft_manufacturer != "")
1758 1758
 		{
@@ -1769,8 +1769,8 @@  discard block
 block discarded – undo
1769 1769
 		{
1770 1770
 			$limit_array = explode(",", $limit);
1771 1771
 			
1772
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1773
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1772
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1773
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1774 1774
 			
1775 1775
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1776 1776
 			{
@@ -1812,14 +1812,14 @@  discard block
 block discarded – undo
1812 1812
 		$query_values = array();
1813 1813
 		$additional_query = '';
1814 1814
 		$limit_query = '';
1815
-		$filter_query = $this->getFilter($filters,true,true);
1815
+		$filter_query = $this->getFilter($filters, true, true);
1816 1816
 		if ($departure_airport_icao != "")
1817 1817
 		{
1818 1818
 			if (!is_string($departure_airport_icao))
1819 1819
 			{
1820 1820
 				return false;
1821 1821
 			} else {
1822
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1822
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1823 1823
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1824 1824
 				//$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";
1825 1825
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 			{
1833 1833
 				return false;
1834 1834
 			} else {
1835
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1835
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1836 1836
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1837 1837
 				//$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)";
1838
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1838
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1839 1839
 			}
1840 1840
 		}
1841 1841
 		
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 		{
1844 1844
 			$limit_array = explode(",", $limit);
1845 1845
 			
1846
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1847
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1846
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1847
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1848 1848
 			
1849 1849
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1850 1850
 			{
@@ -1883,15 +1883,15 @@  discard block
 block discarded – undo
1883 1883
 		global $global_query;
1884 1884
 		
1885 1885
 		date_default_timezone_set('UTC');
1886
-		$filter_query = $this->getFilter($filter,true,true);
1886
+		$filter_query = $this->getFilter($filter, true, true);
1887 1887
 		$limit_query = '';
1888 1888
 		
1889 1889
 		if ($limit != "")
1890 1890
 		{
1891 1891
 			$limit_array = explode(",", $limit);
1892 1892
 			
1893
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1894
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1894
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1895 1895
 			
1896 1896
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1897 1897
 			{
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1909 1909
 		}
1910 1910
 
1911
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1911
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1912 1912
 
1913 1913
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1914 1914
 
@@ -1921,19 +1921,19 @@  discard block
 block discarded – undo
1921 1921
 	* @return String the highlight text
1922 1922
 	*
1923 1923
 	*/
1924
-	public function getHighlightByRegistration($registration,$filter = array())
1924
+	public function getHighlightByRegistration($registration, $filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
1927 1927
 		
1928 1928
 		date_default_timezone_set('UTC');
1929
-		$filter_query = $this->getFilter($filter,true,true);
1930
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1929
+		$filter_query = $this->getFilter($filter, true, true);
1930
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1931 1931
 		
1932
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1932
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1933 1933
 		$sth = $this->db->prepare($query);
1934 1934
 		$sth->execute(array(':registration' => $registration));
1935 1935
 
1936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1937 1937
 		{
1938 1938
 			$highlight = $row['highlight'];
1939 1939
 		}
@@ -1949,14 +1949,14 @@  discard block
 block discarded – undo
1949 1949
 	* @return String usage
1950 1950
 	*
1951 1951
 	*/
1952
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1952
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1953 1953
 	{
1954 1954
 		
1955
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1956
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1955
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1956
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1957 1957
 
1958 1958
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1959
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1959
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1960 1960
 		
1961 1961
 		$sth = $this->db->prepare($query);
1962 1962
 		$sth->execute($query_values);
@@ -1978,9 +1978,9 @@  discard block
 block discarded – undo
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
1981
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1981
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1982 1982
 
1983
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1983
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1984 1984
 		$query_values = array(':airport' => $airport_iata);
1985 1985
 		
1986 1986
 		$sth = $this->db->prepare($query);
@@ -2002,12 +2002,12 @@  discard block
 block discarded – undo
2002 2002
 	* @return Float distance to the airport
2003 2003
 	*
2004 2004
 	*/
2005
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2005
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2006 2006
 	{
2007 2007
 		
2008
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2008
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2009 2009
 
2010
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2010
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2011 2011
 		$query_values = array(':airport' => $airport_icao);
2012 2012
 		$sth = $this->db->prepare($query);
2013 2013
 		$sth->execute($query_values);
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 			$airport_latitude = $row['latitude'];
2018 2018
 			$airport_longitude = $row['longitude'];
2019 2019
 			$Common = new Common();
2020
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2020
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2021 2021
 		} else return '';
2022 2022
 	}
2023 2023
 	
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
2034
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2034
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2035 2035
 
2036 2036
 		$query_values = array();
2037 2037
 		if ($airport == 'NA') {
2038
-			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' => ''));
2038
+			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' => ''));
2039 2039
 		} elseif ($airport == '') {
2040 2040
 			$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";
2041 2041
 		} else {
@@ -2083,14 +2083,14 @@  discard block
 block discarded – undo
2083 2083
 	{
2084 2084
 		$lst_countries = '';
2085 2085
 		foreach ($countries as $country) {
2086
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2086
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2087 2087
 			if ($lst_countries == '') {
2088 2088
 				$lst_countries = "'".$country."'";
2089 2089
 			} else {
2090 2090
 				$lst_countries .= ",'".$country."'";
2091 2091
 			}
2092 2092
 		}
2093
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2093
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2094 2094
 		
2095 2095
 		$sth = $this->db->prepare($query);
2096 2096
 		$sth->execute();
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 		$airport_array = array();
2099 2099
 		$temp_array = array();
2100 2100
 		
2101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2102 2102
 		{
2103 2103
 			$temp_array['name'] = $row['name'];
2104 2104
 			$temp_array['city'] = $row['city'];
@@ -2126,10 +2126,10 @@  discard block
 block discarded – undo
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
2128 2128
 		if (is_array($coord)) {
2129
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2130
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2129
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2130
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2131
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2132
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2133 2133
 		} else return array();
2134 2134
 		if ($globalDBdriver == 'mysql') {
2135 2135
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
     
2142 2142
 		$airport_array = array();
2143 2143
 		
2144
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2144
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2145 2145
 		{
2146 2146
 			$temp_array = $row;
2147 2147
 
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
2164
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2165
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2164
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2165
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2166
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2167
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2168 2168
 		} else return array();
2169 2169
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170
-		$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.")";
2170
+		$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.")";
2171 2171
 		//$query  = "SELECT waypoints.* FROM waypoints";
2172 2172
 		//$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";
2173 2173
 		//$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;
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
     
2180 2180
 		$waypoints_array = array();
2181 2181
 		
2182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2183 2183
 		{
2184 2184
 			$temp_array = $row;
2185 2185
 
@@ -2201,10 +2201,10 @@  discard block
 block discarded – undo
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
2203 2203
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2204
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2204
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2205 2205
 		if ($airline_icao == 'NA') {
2206 2206
 			$airline_array = array();
2207
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2207
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2208 2208
 			return $airline_array;
2209 2209
 		} else {
2210 2210
 			if (strlen($airline_icao) == 2) {
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 			if ($fromsource === NULL) {
2226 2226
 				$sth->execute(array(':airline_icao' => $airline_icao));
2227 2227
 			} else {
2228
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2228
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2229 2229
 			}
2230 2230
                         /*
2231 2231
 			$airline_array = array();
@@ -2270,13 +2270,13 @@  discard block
 block discarded – undo
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
2272 2272
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2273
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274
-		$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";
2273
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2274
+		$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 2275
 		$sth = $this->db->prepare($query);
2276 2276
 		if ($fromsource === NULL) {
2277 2277
 			$sth->execute(array(':airline_name' => $airline_name));
2278 2278
 		} else {
2279
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2279
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2280 2280
 		}
2281 2281
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2282 2282
 		if (empty($result) && $fromsource !== NULL) {
@@ -2301,12 +2301,12 @@  discard block
 block discarded – undo
2301 2301
 	*/
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2304
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2305 2305
 
2306 2306
 		if ($aircraft_type == 'NA') {
2307
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2307
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2308 2308
 		}
2309
-		$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";
2309
+		$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";
2310 2310
 		
2311 2311
 		$sth = $this->db->prepare($query);
2312 2312
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 	*/
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2341
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2342 2342
 		$all_aircraft = array('737-300' => 'B733',
2343 2343
 				'777-200' => 'B772',
2344 2344
 				'777-200ER' => 'B772',
@@ -2350,10 +2350,10 @@  discard block
 block discarded – undo
2350 2350
 				'A380' => 'A388');
2351 2351
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2352 2352
 
2353
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2353
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2354
 		$aircraft_type = strtoupper($aircraft_type);
2355 2355
 		$sth = $this->db->prepare($query);
2356
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2356
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2357 2357
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358 2358
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359 2359
 		else return '';
@@ -2368,9 +2368,9 @@  discard block
 block discarded – undo
2368 2368
 	*/
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2371
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2372 2372
 
2373
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2373
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2374 2374
 		
2375 2375
 		$sth = $this->db->prepare($query);
2376 2376
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2393,9 +2393,9 @@  discard block
 block discarded – undo
2393 2393
 	*/
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2396
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2397 2397
 
2398
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2398
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2399 2399
 		
2400 2400
 		$sth = $this->db->prepare($query);
2401 2401
 		$sth->execute(array(':registration' => $registration));
@@ -2416,9 +2416,9 @@  discard block
 block discarded – undo
2416 2416
 	*/
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2419
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2420 2420
 
2421
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2421
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2422 2422
 		
2423 2423
 		$sth = $this->db->prepare($query);
2424 2424
 		$sth->execute(array(':registration' => $registration));
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 		$idarray = array();
2427 2427
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2428 2428
 			$date = $row['date'];
2429
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2429
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2430 2430
 		}
2431 2431
 		return $idarray;
2432 2432
 	}
@@ -2440,8 +2440,8 @@  discard block
 block discarded – undo
2440 2440
 	*/
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2444
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2443
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2444
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2445 2445
 		
2446 2446
 		$sth = $this->db->prepare($query);
2447 2447
 		$sth->execute(array(':operator' => $operator));
@@ -2462,9 +2462,9 @@  discard block
 block discarded – undo
2462 2462
 	*/
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2465
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2466 2466
                 if ($callsign == '') return array();
2467
-		$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";
2467
+		$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";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
2470 2470
 		$sth->execute(array(':callsign' => $callsign));
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
 	*/
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2488
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2489 2489
 
2490
-		$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";
2490
+		$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";
2491 2491
 		
2492 2492
 		$sth = $this->db->prepare($query);
2493 2493
 		$sth->execute(array(':registration' => $registration));
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 		$aircraft_array = array();
2496 2496
 		$temp_array = array();
2497 2497
 		
2498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2499 2499
 		{
2500 2500
 			$temp_array['airline_icao'] = $row['airline_icao'];
2501 2501
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 	*/
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2520
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2521 2521
 		$Connection = new Connection($this->db);
2522 2522
 		if ($Connection->tableExists('aircraft_owner')) {
2523 2523
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$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 ";
2542
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2542
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 		$manufacturer_array = array();
2587 2587
 		$temp_array = array();
2588 2588
 		
2589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2590 2590
 		{
2591 2591
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2592 2592
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 		$aircraft_array = array();
2624 2624
 		$temp_array = array();
2625 2625
 		
2626
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2626
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2627 2627
 		{
2628 2628
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2629 2629
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2644,8 +2644,8 @@  discard block
 block discarded – undo
2644 2644
 	*/
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647
-		$filter_query = $this->getFilter($filters,true,true);
2648
-		$query  = "SELECT DISTINCT spotter_output.registration 
2647
+		$filter_query = $this->getFilter($filters, true, true);
2648
+		$query = "SELECT DISTINCT spotter_output.registration 
2649 2649
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2650 2650
 				ORDER BY spotter_output.registration ASC";
2651 2651
 
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
 		$aircraft_array = array();
2656 2656
 		$temp_array = array();
2657 2657
 		
2658
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2658
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2659 2659
 		{
2660 2660
 			$temp_array['registration'] = $row['registration'];
2661 2661
 
@@ -2672,11 +2672,11 @@  discard block
 block discarded – undo
2672 2672
 	* @return Array list of source name
2673 2673
 	*
2674 2674
 	*/
2675
-	public function getAllSourceName($type = '',$filters = array())
2675
+	public function getAllSourceName($type = '', $filters = array())
2676 2676
 	{
2677
-		$filter_query = $this->getFilter($filters,true,true);
2677
+		$filter_query = $this->getFilter($filters, true, true);
2678 2678
 		$query_values = array();
2679
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2679
+		$query = "SELECT DISTINCT spotter_output.source_name 
2680 2680
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2681 2681
 		if ($type != '') {
2682 2682
 			$query_values = array(':type' => $type);
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 		$source_array = array();
2692 2692
 		$temp_array = array();
2693 2693
 		
2694
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2694
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2695 2695
 		{
2696 2696
 			$temp_array['source_name'] = $row['source_name'];
2697 2697
 			$source_array[] = $temp_array;
@@ -2707,11 +2707,11 @@  discard block
 block discarded – undo
2707 2707
 	* @return Array list of airline names
2708 2708
 	*
2709 2709
 	*/
2710
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2710
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2711 2711
 	{
2712
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2713
-		$filter_query = $this->getFilter($filters,true,true);
2714
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2712
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2713
+		$filter_query = $this->getFilter($filters, true, true);
2714
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2715 2715
 		if ($airline_type == '' || $airline_type == 'all') {
2716 2716
 			/*
2717 2717
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
 				$query_data = array(':forsource' => $forsource);
2731 2731
 			}
2732 2732
 		} else {
2733
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2733
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2734 2734
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2735 2735
 					AND spotter_output.airline_type = :airline_type 
2736 2736
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
 		$airline_array = array();
2744 2744
 		$temp_array = array();
2745 2745
 		
2746
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2746
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2747 2747
 		{
2748 2748
 			$temp_array['airline_icao'] = $row['airline_icao'];
2749 2749
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2760,10 +2760,10 @@  discard block
 block discarded – undo
2760 2760
 	* @return Array list of alliance names
2761 2761
 	*
2762 2762
 	*/
2763
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2763
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2764 2764
 	{
2765
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766
-		$filter_query = $this->getFilter($filters,true,true);
2765
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2766
+		$filter_query = $this->getFilter($filters, true, true);
2767 2767
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768 2768
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769 2769
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2791,8 +2791,8 @@  discard block
 block discarded – undo
2791 2791
 	*/
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794
-		$filter_query = $this->getFilter($filters,true,true);
2795
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2794
+		$filter_query = $this->getFilter($filters, true, true);
2795
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2796 2796
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2797 2797
 				ORDER BY spotter_output.airline_country ASC";
2798 2798
 		
@@ -2803,7 +2803,7 @@  discard block
 block discarded – undo
2803 2803
 		$airline_array = array();
2804 2804
 		$temp_array = array();
2805 2805
 		
2806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2807 2807
 		{
2808 2808
 			$temp_array['airline_country'] = $row['airline_country'];
2809 2809
 
@@ -2823,9 +2823,9 @@  discard block
 block discarded – undo
2823 2823
 	*/
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826
-		$filter_query = $this->getFilter($filters,true,true);
2826
+		$filter_query = $this->getFilter($filters, true, true);
2827 2827
 		$airport_array = array();
2828
-		$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
2828
+		$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
2829 2829
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2830 2830
 				ORDER BY spotter_output.departure_airport_city ASC";
2831 2831
 		
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
 		$sth->execute();
2835 2835
 
2836 2836
 		$temp_array = array();
2837
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2837
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2838 2838
 		{
2839 2839
 			$temp_array['airport_icao'] = $row['airport_icao'];
2840 2840
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2844,14 +2844,14 @@  discard block
 block discarded – undo
2844 2844
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2845 2845
 		}
2846 2846
 
2847
-		$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
2847
+		$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
2848 2848
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2849 2849
 								ORDER BY spotter_output.arrival_airport_city ASC";
2850 2850
 					
2851 2851
 		$sth = $this->db->prepare($query);
2852 2852
 		$sth->execute();
2853 2853
 
2854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2855 2855
 			{
2856 2856
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2857 2857
 		//	{
@@ -2875,9 +2875,9 @@  discard block
 block discarded – undo
2875 2875
 	*/
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878
-		$filter_query = $this->getFilter($filters,true,true);
2878
+		$filter_query = $this->getFilter($filters, true, true);
2879 2879
 		$airport_array = array();
2880
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2880
+		$query = "SELECT DISTINCT spotter_output.owner_name
2881 2881
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2882 2882
 				ORDER BY spotter_output.owner_name ASC";
2883 2883
 		
@@ -2894,9 +2894,9 @@  discard block
 block discarded – undo
2894 2894
 	*/
2895 2895
 	public function getAllPilotNames($filters = array())
2896 2896
 	{
2897
-		$filter_query = $this->getFilter($filters,true,true);
2897
+		$filter_query = $this->getFilter($filters, true, true);
2898 2898
 		$airport_array = array();
2899
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2899
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2900 2900
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2901 2901
 				ORDER BY spotter_output.pilot_name ASC";
2902 2902
 		
@@ -2929,21 +2929,21 @@  discard block
 block discarded – undo
2929 2929
    
2930 2930
 		$temp_array = array();
2931 2931
 		
2932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2933 2933
 		{
2934 2934
 			$temp_array['airport_country'] = $row['airport_country'];
2935 2935
 
2936 2936
 			$airport_array[$row['airport_country']] = $temp_array;
2937 2937
 		}
2938
-		$filter_query = $this->getFilter($filters,true,true);
2939
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2938
+		$filter_query = $this->getFilter($filters, true, true);
2939
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2940 2940
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2941 2941
 								ORDER BY spotter_output.arrival_airport_country ASC";
2942 2942
 					
2943 2943
 		$sth = $this->db->prepare($query);
2944 2944
 		$sth->execute();
2945 2945
 		
2946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2947 2947
 		{
2948 2948
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2949 2949
 			{
@@ -2966,9 +2966,9 @@  discard block
 block discarded – undo
2966 2966
 	*/
2967 2967
 	public function getAllCountries($filters = array())
2968 2968
 	{
2969
-		$Connection= new Connection($this->db);
2969
+		$Connection = new Connection($this->db);
2970 2970
 		if ($Connection->tableExists('countries')) {
2971
-			$query  = "SELECT countries.name AS airport_country
2971
+			$query = "SELECT countries.name AS airport_country
2972 2972
 				FROM countries
2973 2973
 				ORDER BY countries.name ASC";
2974 2974
 			$sth = $this->db->prepare($query);
@@ -2977,14 +2977,14 @@  discard block
 block discarded – undo
2977 2977
 			$temp_array = array();
2978 2978
 			$country_array = array();
2979 2979
 		
2980
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2980
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2981 2981
 			{
2982 2982
 				$temp_array['country'] = $row['airport_country'];
2983 2983
 				$country_array[$row['airport_country']] = $temp_array;
2984 2984
 			}
2985 2985
 		} else {
2986
-			$filter_query = $this->getFilter($filters,true,true);
2987
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2986
+			$filter_query = $this->getFilter($filters, true, true);
2987
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2988 2988
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2989 2989
 								ORDER BY spotter_output.departure_airport_country ASC";
2990 2990
 
@@ -2993,20 +2993,20 @@  discard block
 block discarded – undo
2993 2993
    
2994 2994
 			$temp_array = array();
2995 2995
 			$country_array = array();
2996
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2996
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2997 2997
 			{
2998 2998
 				$temp_array['country'] = $row['airport_country'];
2999 2999
 				$country_array[$row['airport_country']] = $temp_array;
3000 3000
 			}
3001 3001
 
3002
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3002
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3003 3003
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3004 3004
 								ORDER BY spotter_output.arrival_airport_country ASC";
3005 3005
 					
3006 3006
 		$sth = $this->db->prepare($query);
3007 3007
 		$sth->execute();
3008 3008
 		
3009
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3009
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3010 3010
 		{
3011 3011
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3012 3012
 			{
@@ -3016,14 +3016,14 @@  discard block
 block discarded – undo
3016 3016
 			}
3017 3017
 		}
3018 3018
 		
3019
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3019
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3020 3020
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3021 3021
 								ORDER BY spotter_output.airline_country ASC";
3022 3022
 					
3023 3023
 		$sth = $this->db->prepare($query);
3024 3024
 		$sth->execute();
3025 3025
 		
3026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3027 3027
 		{
3028 3028
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3029 3029
 			{
@@ -3047,8 +3047,8 @@  discard block
 block discarded – undo
3047 3047
 	*/
3048 3048
 	public function getAllIdents($filters = array())
3049 3049
 	{
3050
-		$filter_query = $this->getFilter($filters,true,true);
3051
-		$query  = "SELECT DISTINCT spotter_output.ident
3050
+		$filter_query = $this->getFilter($filters, true, true);
3051
+		$query = "SELECT DISTINCT spotter_output.ident
3052 3052
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3053 3053
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3054 3054
 
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
 		$ident_array = array();
3059 3059
 		$temp_array = array();
3060 3060
 		
3061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3062 3062
 		{
3063 3063
 			$temp_array['ident'] = $row['ident'];
3064 3064
 			$ident_array[] = $temp_array;
@@ -3072,9 +3072,9 @@  discard block
 block discarded – undo
3072 3072
 	* @return Array number, icao, name and city of airports
3073 3073
 	*/
3074 3074
 
3075
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3075
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3076 3076
 		global $globalTimezone, $globalDBdriver;
3077
-		$filter_query = $this->getFilter($filters,true,true);
3077
+		$filter_query = $this->getFilter($filters, true, true);
3078 3078
 		if ($globalTimezone != '') {
3079 3079
 			date_default_timezone_set($globalTimezone);
3080 3080
 			$datetime = new DateTime();
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
 
3140 3140
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3141 3141
 		global $globalTimezone, $globalDBdriver;
3142
-		$filter_query = $this->getFilter($filters,true,true);
3142
+		$filter_query = $this->getFilter($filters, true, true);
3143 3143
 		if ($globalTimezone != '') {
3144 3144
 			date_default_timezone_set($globalTimezone);
3145 3145
 			$datetime = new DateTime();
@@ -3223,7 +3223,7 @@  discard block
 block discarded – undo
3223 3223
 
3224 3224
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3225 3225
 		global $globalTimezone, $globalDBdriver;
3226
-		$filter_query = $this->getFilter($filters,true,true);
3226
+		$filter_query = $this->getFilter($filters, true, true);
3227 3227
 		if ($globalTimezone != '') {
3228 3228
 			date_default_timezone_set($globalTimezone);
3229 3229
 			$datetime = new DateTime();
@@ -3256,9 +3256,9 @@  discard block
 block discarded – undo
3256 3256
 	* @return Array number, icao, name and city of airports
3257 3257
 	*/
3258 3258
 
3259
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3259
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3260 3260
 		global $globalTimezone, $globalDBdriver;
3261
-		$filter_query = $this->getFilter($filters,true,true);
3261
+		$filter_query = $this->getFilter($filters, true, true);
3262 3262
 		if ($globalTimezone != '') {
3263 3263
 			date_default_timezone_set($globalTimezone);
3264 3264
 			$datetime = new DateTime();
@@ -3390,12 +3390,12 @@  discard block
 block discarded – undo
3390 3390
 		} else $offset = '+00:00';
3391 3391
 
3392 3392
 		if ($globalDBdriver == 'mysql') {
3393
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3393
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3394 3394
 								FROM spotter_output
3395 3395
 								WHERE spotter_output.date <> '' 
3396 3396
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3397 3397
 		} else {
3398
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3398
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3399 3399
 								FROM spotter_output
3400 3400
 								WHERE spotter_output.date <> '' 
3401 3401
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3407,7 +3407,7 @@  discard block
 block discarded – undo
3407 3407
 		$date_array = array();
3408 3408
 		$temp_array = array();
3409 3409
 		
3410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3411 3411
 		{
3412 3412
 			$temp_array['date'] = $row['date'];
3413 3413
 
@@ -3427,7 +3427,7 @@  discard block
 block discarded – undo
3427 3427
 	*/
3428 3428
 	public function getAllRoutes()
3429 3429
 	{
3430
-		$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 
3430
+		$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 
3431 3431
 				FROM spotter_output
3432 3432
 				WHERE spotter_output.ident <> '' 
3433 3433
 				GROUP BY route
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
 
3439 3439
 		$routes_array = array();
3440 3440
 		$temp_array = array();
3441
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3441
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3442 3442
 		{
3443 3443
 			$temp_array['route'] = $row['route'];
3444 3444
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3457,21 +3457,21 @@  discard block
 block discarded – undo
3457 3457
 	* @return String success or false
3458 3458
 	*
3459 3459
 	*/	
3460
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3460
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3461 3461
 	{
3462 3462
 		if (!is_numeric(substr($ident, 0, 3)))
3463 3463
 		{
3464 3464
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3465
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3465
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3466 3466
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3467
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3467
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3468 3468
 			} else {
3469 3469
 				$airline_array = $this->getAllAirlineInfo("NA");
3470 3470
 			}
3471 3471
 			if (count($airline_array) == 0) {
3472 3472
 				$airline_array = $this->getAllAirlineInfo("NA");
3473 3473
 			}
3474
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3474
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3475 3475
 				$airline_array = $this->getAllAirlineInfo("NA");
3476 3476
 			}
3477 3477
 		} else {
@@ -3484,7 +3484,7 @@  discard block
 block discarded – undo
3484 3484
 
3485 3485
 
3486 3486
 		$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';
3487
-                $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);
3487
+                $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);
3488 3488
 
3489 3489
 		try {
3490 3490
 			$sth = $this->db->prepare($query);
@@ -3505,11 +3505,11 @@  discard block
 block discarded – undo
3505 3505
 	* @return String success or false
3506 3506
 	*
3507 3507
 	*/	
3508
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3508
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3509 3509
 	{
3510 3510
 		if ($groundspeed == '') $groundspeed = NULL;
3511 3511
 		$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';
3512
-                $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);
3512
+                $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);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3549,7 +3549,7 @@  discard block
 block discarded – undo
3549 3549
 	* @param String $verticalrate vertival rate of flight
3550 3550
 	* @return String success or false
3551 3551
 	*/
3552
-	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 = '')
3552
+	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 = '')
3553 3553
 	{
3554 3554
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3555 3555
 		
@@ -3573,13 +3573,13 @@  discard block
 block discarded – undo
3573 3573
 				if ($ModeS != '') {
3574 3574
 					$timeelapsed = microtime(true);
3575 3575
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3576
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3576
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3577 3577
 				} else {
3578
-					$myhex = explode('-',$flightaware_id);
3578
+					$myhex = explode('-', $flightaware_id);
3579 3579
 					if (count($myhex) > 0) {
3580 3580
 						$timeelapsed = microtime(true);
3581 3581
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3582
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3582
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3583 3583
 					}
3584 3584
 				}
3585 3585
 			}
@@ -3601,24 +3601,24 @@  discard block
 block discarded – undo
3601 3601
 				{
3602 3602
 					$timeelapsed = microtime(true);
3603 3603
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3604
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3604
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3605 3605
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3606
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3606
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3607 3607
 					} else {
3608 3608
 						$airline_array = $this->getAllAirlineInfo("NA");
3609 3609
 					}
3610 3610
 					if (count($airline_array) == 0) {
3611 3611
 						$airline_array = $this->getAllAirlineInfo("NA");
3612 3612
 					}
3613
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3613
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3614 3614
 						$airline_array = $this->getAllAirlineInfo("NA");
3615 3615
 					}
3616
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3616
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3617 3617
 
3618 3618
 				} else {
3619 3619
 					$timeelapsed = microtime(true);
3620 3620
 					$airline_array = $this->getAllAirlineInfo("NA");
3621
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3621
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3622 3622
 				}
3623 3623
 			}
3624 3624
 		} else $airline_array = array();
@@ -3635,27 +3635,27 @@  discard block
 block discarded – undo
3635 3635
 				{
3636 3636
 					$timeelapsed = microtime(true);
3637 3637
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3638
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3638
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3639 3639
 				} else {
3640 3640
 					$timeelapsed = microtime(true);
3641 3641
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3642
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3642
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3643 3643
 				}
3644 3644
 			}
3645 3645
 		} else {
3646 3646
 			if ($ModeS != '') {
3647 3647
 				$timeelapsed = microtime(true);
3648 3648
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3649
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3649
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3650 3650
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3651 3651
 				{
3652 3652
 					$timeelapsed = microtime(true);
3653 3653
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3654
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3654
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3655 3655
 				} else {
3656 3656
 					$timeelapsed = microtime(true);
3657 3657
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3658
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3658
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3659 3659
 				}
3660 3660
 			}
3661 3661
 		}
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
 			} else {
3672 3672
 				$timeelapsed = microtime(true);
3673 3673
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3674
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3674
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3675 3675
 			}
3676 3676
 		}
3677 3677
 		
@@ -3686,7 +3686,7 @@  discard block
 block discarded – undo
3686 3686
 			} else {
3687 3687
 				$timeelapsed = microtime(true);
3688 3688
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3689
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3689
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3690 3690
 			}
3691 3691
 		}
3692 3692
 
@@ -3749,7 +3749,7 @@  discard block
 block discarded – undo
3749 3749
 		{
3750 3750
 			$timeelapsed = microtime(true);
3751 3751
 			$image_array = $Image->getSpotterImage($registration);
3752
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3752
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3753 3753
 			if (!isset($image_array[0]['registration']))
3754 3754
 			{
3755 3755
 				//echo "Add image !!!! \n";
@@ -3757,7 +3757,7 @@  discard block
 block discarded – undo
3757 3757
 			}
3758 3758
 			$timeelapsed = microtime(true);
3759 3759
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3760
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3760
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3761 3761
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3762 3762
 		}
3763 3763
     
@@ -3765,33 +3765,33 @@  discard block
 block discarded – undo
3765 3765
 		{
3766 3766
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3767 3767
             		else $airline_icao = '';
3768
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3768
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3769 3769
 			if (!isset($image_array[0]['registration']))
3770 3770
 			{
3771 3771
 				//echo "Add image !!!! \n";
3772
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3772
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3773 3773
 			}
3774 3774
 		}
3775 3775
     
3776
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3777
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3778
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3779
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3780
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3781
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3782
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3783
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3784
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3785
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3786
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3787
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3788
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3789
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3790
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3791
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3792
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3793
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3794
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3776
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3777
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3778
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3779
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3780
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3781
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3782
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3783
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3784
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3785
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3786
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3787
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3788
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3789
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3790
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3791
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3792
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3793
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3794
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3795 3795
 	
3796 3796
 		if (count($airline_array) == 0) 
3797 3797
 		{
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3820 3820
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3821 3821
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3822
-                $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) 
3822
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3823 3823
                 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)";
3824 3824
 
3825 3825
                 $airline_name = $airline_array[0]['name'];
@@ -3829,7 +3829,7 @@  discard block
 block discarded – undo
3829 3829
 		if ($airline_type == '') {
3830 3830
 			$timeelapsed = microtime(true);
3831 3831
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3832
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3832
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3833 3833
 		}
3834 3834
 		if ($airline_type == null) $airline_type = '';
3835 3835
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3841,7 +3841,7 @@  discard block
 block discarded – undo
3841 3841
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3842 3842
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3843 3843
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3844
-                $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);
3844
+                $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);
3845 3845
 
3846 3846
 		try {
3847 3847
 		        
@@ -3867,13 +3867,13 @@  discard block
 block discarded – undo
3867 3867
 	{
3868 3868
 		global $globalDBdriver, $globalTimezone;
3869 3869
 		if ($globalDBdriver == 'mysql') {
3870
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3870
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3871 3871
 								WHERE spotter_output.ident = :ident 
3872 3872
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3873 3873
 								AND spotter_output.date < UTC_TIMESTAMP()";
3874 3874
 			$query_data = array(':ident' => $ident);
3875 3875
 		} else {
3876
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3876
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3877 3877
 								WHERE spotter_output.ident = :ident 
3878 3878
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3879 3879
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3882,8 +3882,8 @@  discard block
 block discarded – undo
3882 3882
 		
3883 3883
 		$sth = $this->db->prepare($query);
3884 3884
 		$sth->execute($query_data);
3885
-    		$ident_result='';
3886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3885
+    		$ident_result = '';
3886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3887 3887
 		{
3888 3888
 			$ident_result = $row['ident'];
3889 3889
 		}
@@ -3909,8 +3909,8 @@  discard block
 block discarded – undo
3909 3909
 				return false;
3910 3910
 			} else {
3911 3911
 				$q_array = explode(" ", $q);
3912
-				foreach ($q_array as $q_item){
3913
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3912
+				foreach ($q_array as $q_item) {
3913
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3914 3914
 					$additional_query .= " AND (";
3915 3915
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3916 3916
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3925,11 +3925,11 @@  discard block
 block discarded – undo
3925 3925
 			}
3926 3926
 		}
3927 3927
 		if ($globalDBdriver == 'mysql') {
3928
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3928
+			$query = "SELECT spotter_output.* FROM spotter_output 
3929 3929
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3930 3930
 				AND spotter_output.date < UTC_TIMESTAMP()";
3931 3931
 		} else {
3932
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3932
+			$query = "SELECT spotter_output.* FROM spotter_output 
3933 3933
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3934 3934
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3935 3935
 		}
@@ -3946,11 +3946,11 @@  discard block
 block discarded – undo
3946 3946
 	* @return Array the airline list
3947 3947
 	*
3948 3948
 	*/
3949
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3949
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3950 3950
 	{
3951 3951
 		global $globalDBdriver;
3952
-		$filter_query = $this->getFilter($filters,true,true);
3953
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3952
+		$filter_query = $this->getFilter($filters, true, true);
3953
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3954 3954
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3955 3955
 		if ($olderthanmonths > 0) {
3956 3956
 			if ($globalDBdriver == 'mysql') {
@@ -3970,28 +3970,28 @@  discard block
 block discarded – undo
3970 3970
 		if ($year != '') {
3971 3971
 			if ($globalDBdriver == 'mysql') {
3972 3972
 				$query .= " AND YEAR(spotter_output.date) = :year";
3973
-				$query_values = array_merge($query_values,array(':year' => $year));
3973
+				$query_values = array_merge($query_values, array(':year' => $year));
3974 3974
 			} else {
3975 3975
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
3976
-				$query_values = array_merge($query_values,array(':year' => $year));
3976
+				$query_values = array_merge($query_values, array(':year' => $year));
3977 3977
 			}
3978 3978
 		}
3979 3979
 		if ($month != '') {
3980 3980
 			if ($globalDBdriver == 'mysql') {
3981 3981
 				$query .= " AND MONTH(spotter_output.date) = :month";
3982
-				$query_values = array_merge($query_values,array(':month' => $month));
3982
+				$query_values = array_merge($query_values, array(':month' => $month));
3983 3983
 			} else {
3984 3984
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
3985
-				$query_values = array_merge($query_values,array(':month' => $month));
3985
+				$query_values = array_merge($query_values, array(':month' => $month));
3986 3986
 			}
3987 3987
 		}
3988 3988
 		if ($day != '') {
3989 3989
 			if ($globalDBdriver == 'mysql') {
3990 3990
 				$query .= " AND DAY(spotter_output.date) = :day";
3991
-				$query_values = array_merge($query_values,array(':day' => $day));
3991
+				$query_values = array_merge($query_values, array(':day' => $day));
3992 3992
 			} else {
3993 3993
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
3994
-				$query_values = array_merge($query_values,array(':day' => $day));
3994
+				$query_values = array_merge($query_values, array(':day' => $day));
3995 3995
 			}
3996 3996
 		}
3997 3997
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4001,7 +4001,7 @@  discard block
 block discarded – undo
4001 4001
 		$sth->execute($query_values);
4002 4002
 		$airline_array = array();
4003 4003
 		$temp_array = array();
4004
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4004
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4005 4005
 		{
4006 4006
 			$temp_array['airline_name'] = $row['airline_name'];
4007 4007
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4018,11 +4018,11 @@  discard block
 block discarded – undo
4018 4018
 	* @return Array the pilots list
4019 4019
 	*
4020 4020
 	*/
4021
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4021
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4022 4022
 	{
4023 4023
 		global $globalDBdriver;
4024
-		$filter_query = $this->getFilter($filters,true,true);
4025
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4024
+		$filter_query = $this->getFilter($filters, true, true);
4025
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4026 4026
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
4027 4027
                 if ($olderthanmonths > 0) {
4028 4028
             		if ($globalDBdriver == 'mysql') {
@@ -4042,28 +4042,28 @@  discard block
 block discarded – undo
4042 4042
 		if ($year != '') {
4043 4043
 			if ($globalDBdriver == 'mysql') {
4044 4044
 				$query .= " AND YEAR(spotter_output.date) = :year";
4045
-				$query_values = array_merge($query_values,array(':year' => $year));
4045
+				$query_values = array_merge($query_values, array(':year' => $year));
4046 4046
 			} else {
4047 4047
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4048
-				$query_values = array_merge($query_values,array(':year' => $year));
4048
+				$query_values = array_merge($query_values, array(':year' => $year));
4049 4049
 			}
4050 4050
 		}
4051 4051
 		if ($month != '') {
4052 4052
 			if ($globalDBdriver == 'mysql') {
4053 4053
 				$query .= " AND MONTH(spotter_output.date) = :month";
4054
-				$query_values = array_merge($query_values,array(':month' => $month));
4054
+				$query_values = array_merge($query_values, array(':month' => $month));
4055 4055
 			} else {
4056 4056
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4057
-				$query_values = array_merge($query_values,array(':month' => $month));
4057
+				$query_values = array_merge($query_values, array(':month' => $month));
4058 4058
 			}
4059 4059
 		}
4060 4060
 		if ($day != '') {
4061 4061
 			if ($globalDBdriver == 'mysql') {
4062 4062
 				$query .= " AND DAY(spotter_output.date) = :day";
4063
-				$query_values = array_merge($query_values,array(':day' => $day));
4063
+				$query_values = array_merge($query_values, array(':day' => $day));
4064 4064
 			} else {
4065 4065
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4066
-				$query_values = array_merge($query_values,array(':day' => $day));
4066
+				$query_values = array_merge($query_values, array(':day' => $day));
4067 4067
 			}
4068 4068
 		}
4069 4069
 		
@@ -4075,7 +4075,7 @@  discard block
 block discarded – undo
4075 4075
 		$sth->execute($query_values);
4076 4076
 		$airline_array = array();
4077 4077
 		$temp_array = array();
4078
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4078
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4079 4079
 		{
4080 4080
 			$temp_array['pilot_name'] = $row['pilot_name'];
4081 4081
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4095,7 +4095,7 @@  discard block
 block discarded – undo
4095 4095
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4096 4096
 	{
4097 4097
 		global $globalDBdriver;
4098
-		$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
4098
+		$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
4099 4099
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4100 4100
                 if ($olderthanmonths > 0) {
4101 4101
             		if ($globalDBdriver == 'mysql') {
@@ -4121,7 +4121,7 @@  discard block
 block discarded – undo
4121 4121
 		$airline_array = array();
4122 4122
 		$temp_array = array();
4123 4123
         
4124
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4124
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4125 4125
 		{
4126 4126
 			$temp_array['pilot_name'] = $row['pilot_name'];
4127 4127
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4139,11 +4139,11 @@  discard block
 block discarded – undo
4139 4139
 	* @return Array the pilots list
4140 4140
 	*
4141 4141
 	*/
4142
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4142
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4143 4143
 	{
4144 4144
 		global $globalDBdriver;
4145
-		$filter_query = $this->getFilter($filters,true,true);
4146
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4145
+		$filter_query = $this->getFilter($filters, true, true);
4146
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4147 4147
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4148 4148
                 if ($olderthanmonths > 0) {
4149 4149
             		if ($globalDBdriver == 'mysql') {
@@ -4163,28 +4163,28 @@  discard block
 block discarded – undo
4163 4163
 		if ($year != '') {
4164 4164
 			if ($globalDBdriver == 'mysql') {
4165 4165
 				$query .= " AND YEAR(spotter_output.date) = :year";
4166
-				$query_values = array_merge($query_values,array(':year' => $year));
4166
+				$query_values = array_merge($query_values, array(':year' => $year));
4167 4167
 			} else {
4168 4168
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4169
-				$query_values = array_merge($query_values,array(':year' => $year));
4169
+				$query_values = array_merge($query_values, array(':year' => $year));
4170 4170
 			}
4171 4171
 		}
4172 4172
 		if ($month != '') {
4173 4173
 			if ($globalDBdriver == 'mysql') {
4174 4174
 				$query .= " AND MONTH(spotter_output.date) = :month";
4175
-				$query_values = array_merge($query_values,array(':month' => $month));
4175
+				$query_values = array_merge($query_values, array(':month' => $month));
4176 4176
 			} else {
4177 4177
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4178
-				$query_values = array_merge($query_values,array(':month' => $month));
4178
+				$query_values = array_merge($query_values, array(':month' => $month));
4179 4179
 			}
4180 4180
 		}
4181 4181
 		if ($day != '') {
4182 4182
 			if ($globalDBdriver == 'mysql') {
4183 4183
 				$query .= " AND DAY(spotter_output.date) = :day";
4184
-				$query_values = array_merge($query_values,array(':day' => $day));
4184
+				$query_values = array_merge($query_values, array(':day' => $day));
4185 4185
 			} else {
4186 4186
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4187
-				$query_values = array_merge($query_values,array(':day' => $day));
4187
+				$query_values = array_merge($query_values, array(':day' => $day));
4188 4188
 			}
4189 4189
 		}
4190 4190
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4194,7 +4194,7 @@  discard block
 block discarded – undo
4194 4194
 		$sth->execute($query_values);
4195 4195
 		$airline_array = array();
4196 4196
 		$temp_array = array();
4197
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4197
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4198 4198
 		{
4199 4199
 			$temp_array['owner_name'] = $row['owner_name'];
4200 4200
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4209,11 +4209,11 @@  discard block
 block discarded – undo
4209 4209
 	* @return Array the pilots list
4210 4210
 	*
4211 4211
 	*/
4212
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4212
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4213 4213
 	{
4214 4214
 		global $globalDBdriver;
4215
-		$filter_query = $this->getFilter($filters,true,true);
4216
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4215
+		$filter_query = $this->getFilter($filters, true, true);
4216
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4217 4217
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4218 4218
                 if ($olderthanmonths > 0) {
4219 4219
             		if ($globalDBdriver == 'mysql') {
@@ -4239,7 +4239,7 @@  discard block
 block discarded – undo
4239 4239
 		$airline_array = array();
4240 4240
 		$temp_array = array();
4241 4241
         
4242
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4242
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4243 4243
 		{
4244 4244
 			$temp_array['owner_name'] = $row['owner_name'];
4245 4245
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
 	* @return Array the airline list
4256 4256
 	*
4257 4257
 	*/
4258
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4258
+	public function countAllAirlinesByAircraft($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_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_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_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4263 4263
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4264 4264
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4265 4265
 			    ORDER BY airline_count DESC";
@@ -4271,7 +4271,7 @@  discard block
 block discarded – undo
4271 4271
 		$airline_array = array();
4272 4272
 		$temp_array = array();
4273 4273
         
4274
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4274
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4275 4275
 		{
4276 4276
 			$temp_array['airline_name'] = $row['airline_name'];
4277 4277
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4291,11 +4291,11 @@  discard block
 block discarded – undo
4291 4291
 	* @return Array the airline country list
4292 4292
 	*
4293 4293
 	*/
4294
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4294
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4295 4295
 	{
4296
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4297
-		$filter_query = $this->getFilter($filters,true,true);
4298
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4296
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4297
+		$filter_query = $this->getFilter($filters, true, true);
4298
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4299 4299
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4300 4300
                     GROUP BY spotter_output.airline_country
4301 4301
 					ORDER BY airline_country_count DESC
@@ -4308,7 +4308,7 @@  discard block
 block discarded – undo
4308 4308
 		$airline_country_array = array();
4309 4309
 		$temp_array = array();
4310 4310
         
4311
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4311
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4312 4312
 		{
4313 4313
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4314 4314
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4327,11 +4327,11 @@  discard block
 block discarded – undo
4327 4327
 	* @return Array the airline list
4328 4328
 	*
4329 4329
 	*/
4330
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4330
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4331 4331
 	{
4332
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4333
-		$filter_query = $this->getFilter($filters,true,true);
4334
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4332
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4333
+		$filter_query = $this->getFilter($filters, true, true);
4334
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4335 4335
 		    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 ) 
4336 4336
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4337 4337
 		    ORDER BY airline_count DESC";
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
 		$airline_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_name'] = $row['airline_name'];
4349 4349
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4362,11 +4362,11 @@  discard block
 block discarded – undo
4362 4362
 	* @return Array the airline country list
4363 4363
 	*
4364 4364
 	*/
4365
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4365
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4366 4366
 	{
4367
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4368
-		$filter_query = $this->getFilter($filters,true,true);
4369
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4367
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4368
+		$filter_query = $this->getFilter($filters, true, true);
4369
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4370 4370
 		 			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 )
4371 4371
 					GROUP BY spotter_output.airline_country
4372 4372
 					ORDER BY airline_country_count DESC
@@ -4379,7 +4379,7 @@  discard block
 block discarded – undo
4379 4379
 		$airline_country_array = array();
4380 4380
 		$temp_array = array();
4381 4381
         
4382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4383 4383
 		{
4384 4384
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4385 4385
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4396,11 +4396,11 @@  discard block
 block discarded – undo
4396 4396
 	* @return Array the airline list
4397 4397
 	*
4398 4398
 	*/
4399
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4399
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4400 4400
 	{
4401
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4402
-		$filter_query = $this->getFilter($filters,true,true);
4403
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4401
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4402
+		$filter_query = $this->getFilter($filters, true, true);
4403
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4404 4404
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4405 4405
 					GROUP BY spotter_output.airline_name
4406 4406
 					ORDER BY airline_count DESC";
@@ -4411,7 +4411,7 @@  discard block
 block discarded – undo
4411 4411
 		$airline_array = array();
4412 4412
 		$temp_array = array();
4413 4413
         
4414
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4414
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4415 4415
 		{
4416 4416
 			$temp_array['airline_name'] = $row['airline_name'];
4417 4417
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4431,11 +4431,11 @@  discard block
 block discarded – undo
4431 4431
 	* @return Array the airline country list
4432 4432
 	*
4433 4433
 	*/
4434
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4434
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4435 4435
 	{
4436
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4437
-		$filter_query = $this->getFilter($filters,true,true);
4438
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4436
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4437
+		$filter_query = $this->getFilter($filters, true, true);
4438
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4439 4439
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4440 4440
 					GROUP BY spotter_output.airline_country
4441 4441
 					ORDER BY airline_country_count DESC
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
 		$airline_country_array = array();
4449 4449
 		$temp_array = array();
4450 4450
         
4451
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4451
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4452 4452
 		{
4453 4453
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4454 4454
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4464,11 +4464,11 @@  discard block
 block discarded – undo
4464 4464
 	* @return Array the airline list
4465 4465
 	*
4466 4466
 	*/
4467
-	public function countAllAirlinesByDate($date,$filters = array())
4467
+	public function countAllAirlinesByDate($date, $filters = array())
4468 4468
 	{
4469 4469
 		global $globalTimezone, $globalDBdriver;
4470
-		$filter_query = $this->getFilter($filters,true,true);
4471
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4470
+		$filter_query = $this->getFilter($filters, true, true);
4471
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4472 4472
 		if ($globalTimezone != '') {
4473 4473
 			date_default_timezone_set($globalTimezone);
4474 4474
 			$datetime = new DateTime($date);
@@ -4476,12 +4476,12 @@  discard block
 block discarded – undo
4476 4476
 		} else $offset = '+00:00';
4477 4477
 
4478 4478
 		if ($globalDBdriver == 'mysql') {
4479
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4479
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4480 4480
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4481 4481
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4482 4482
 					ORDER BY airline_count DESC";
4483 4483
 		} else {
4484
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4484
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4485 4485
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4486 4486
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4487 4487
 					ORDER BY airline_count DESC";
@@ -4492,7 +4492,7 @@  discard block
 block discarded – undo
4492 4492
 
4493 4493
 		$airline_array = array();
4494 4494
 		$temp_array = array();
4495
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4495
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4496 4496
 		{
4497 4497
 			$temp_array['airline_name'] = $row['airline_name'];
4498 4498
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4512,11 +4512,11 @@  discard block
 block discarded – undo
4512 4512
 	* @return Array the airline country list
4513 4513
 	*
4514 4514
 	*/
4515
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4515
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4516 4516
 	{
4517 4517
 		global $globalTimezone, $globalDBdriver;
4518
-		$filter_query = $this->getFilter($filters,true,true);
4519
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4518
+		$filter_query = $this->getFilter($filters, true, true);
4519
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4520 4520
 		if ($globalTimezone != '') {
4521 4521
 			date_default_timezone_set($globalTimezone);
4522 4522
 			$datetime = new DateTime($date);
@@ -4524,13 +4524,13 @@  discard block
 block discarded – undo
4524 4524
 		} else $offset = '+00:00';
4525 4525
 		
4526 4526
 		if ($globalDBdriver == 'mysql') {
4527
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4527
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4528 4528
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4529 4529
 					GROUP BY spotter_output.airline_country
4530 4530
 					ORDER BY airline_country_count DESC
4531 4531
 					LIMIT 10 OFFSET 0";
4532 4532
 		} else {
4533
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4533
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4534 4534
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4535 4535
 					GROUP BY spotter_output.airline_country
4536 4536
 					ORDER BY airline_country_count DESC
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
  
4543 4543
 		$airline_country_array = array();
4544 4544
 		$temp_array = array();
4545
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4545
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4546 4546
 		{
4547 4547
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4548 4548
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4559,11 +4559,11 @@  discard block
 block discarded – undo
4559 4559
 	* @return Array the airline list
4560 4560
 	*
4561 4561
 	*/
4562
-	public function countAllAirlinesByIdent($ident,$filters = array())
4562
+	public function countAllAirlinesByIdent($ident, $filters = array())
4563 4563
 	{
4564
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4565
-		$filter_query = $this->getFilter($filters,true,true);
4566
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4564
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4565
+		$filter_query = $this->getFilter($filters, true, true);
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.ident = :ident  
4568 4568
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4569 4569
 				ORDER BY airline_count DESC";
@@ -4580,11 +4580,11 @@  discard block
 block discarded – undo
4580 4580
 	* @return Array the airline list
4581 4581
 	*
4582 4582
 	*/
4583
-	public function countAllAirlinesByOwner($owner,$filters = array())
4583
+	public function countAllAirlinesByOwner($owner, $filters = array())
4584 4584
 	{
4585
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4586
-		$filter_query = $this->getFilter($filters,true,true);
4587
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4585
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4586
+		$filter_query = $this->getFilter($filters, true, true);
4587
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4588 4588
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4589 4589
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4590 4590
 				ORDER BY airline_count DESC";
@@ -4601,11 +4601,11 @@  discard block
 block discarded – undo
4601 4601
 	* @return Array the airline list
4602 4602
 	*
4603 4603
 	*/
4604
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4604
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4605 4605
 	{
4606
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4607
-		$filter_query = $this->getFilter($filters,true,true);
4608
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4606
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4607
+		$filter_query = $this->getFilter($filters, true, true);
4608
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4609 4609
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4610 4610
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4611 4611
 				ORDER BY airline_count DESC";
@@ -4622,25 +4622,25 @@  discard block
 block discarded – undo
4622 4622
 	* @return Array the airline list
4623 4623
 	*
4624 4624
 	*/
4625
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4625
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4626 4626
 	{
4627
-		$filter_query = $this->getFilter($filters,true,true);
4628
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4629
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4627
+		$filter_query = $this->getFilter($filters, true, true);
4628
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4629
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4630 4630
 
4631
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4631
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4632 4632
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4633 4633
 					GROUP BY spotter_output.airline_name
4634 4634
 					ORDER BY airline_count DESC";
4635 4635
       
4636 4636
 		
4637 4637
 		$sth = $this->db->prepare($query);
4638
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4638
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4639 4639
       
4640 4640
 		$airline_array = array();
4641 4641
 		$temp_array = array();
4642 4642
         
4643
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4643
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4644 4644
 		{
4645 4645
 			$temp_array['airline_name'] = $row['airline_name'];
4646 4646
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4658,13 +4658,13 @@  discard block
 block discarded – undo
4658 4658
 	* @return Array the airline country list
4659 4659
 	*
4660 4660
 	*/
4661
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4661
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4662 4662
 	{
4663
-		$filter_query = $this->getFilter($filters,true,true);
4664
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4665
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4663
+		$filter_query = $this->getFilter($filters, true, true);
4664
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4665
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4666 4666
       
4667
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4667
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4668 4668
 		 		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) 
4669 4669
 				GROUP BY spotter_output.airline_country
4670 4670
 				ORDER BY airline_country_count DESC
@@ -4672,11 +4672,11 @@  discard block
 block discarded – undo
4672 4672
       
4673 4673
 		
4674 4674
 		$sth = $this->db->prepare($query);
4675
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4675
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4676 4676
       
4677 4677
 		$airline_country_array = array();
4678 4678
 		$temp_array = array();
4679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4680 4680
 		{
4681 4681
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4682 4682
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4694,11 +4694,11 @@  discard block
 block discarded – undo
4694 4694
 	* @return Array the airline list
4695 4695
 	*
4696 4696
 	*/
4697
-	public function countAllAirlinesByCountry($country,$filters = array())
4697
+	public function countAllAirlinesByCountry($country, $filters = array())
4698 4698
 	{
4699
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4700
-		$filter_query = $this->getFilter($filters,true,true);
4701
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4699
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4700
+		$filter_query = $this->getFilter($filters, true, true);
4701
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4702 4702
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4703 4703
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4704 4704
 			    ORDER BY airline_count DESC";
@@ -4709,7 +4709,7 @@  discard block
 block discarded – undo
4709 4709
 
4710 4710
 		$airline_array = array();
4711 4711
 		$temp_array = array();
4712
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4712
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4713 4713
 		{
4714 4714
 			$temp_array['airline_name'] = $row['airline_name'];
4715 4715
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4728,11 +4728,11 @@  discard block
 block discarded – undo
4728 4728
 	* @return Array the airline country list
4729 4729
 	*
4730 4730
 	*/
4731
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4731
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4732 4732
 	{
4733
-		$filter_query = $this->getFilter($filters,true,true);
4734
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4735
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4733
+		$filter_query = $this->getFilter($filters, true, true);
4734
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4735
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4736 4736
 		 		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 
4737 4737
 				GROUP BY spotter_output.airline_country
4738 4738
 				ORDER BY airline_country_count DESC
@@ -4744,7 +4744,7 @@  discard block
 block discarded – undo
4744 4744
 
4745 4745
 		$airline_country_array = array();
4746 4746
 		$temp_array = array();
4747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4748 4748
 		{
4749 4749
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4750 4750
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4764,35 +4764,35 @@  discard block
 block discarded – undo
4764 4764
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4765 4765
 	{
4766 4766
 		global $globalDBdriver;
4767
-		$filter_query = $this->getFilter($filters,true,true);
4768
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4767
+		$filter_query = $this->getFilter($filters, true, true);
4768
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4769 4769
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4770 4770
 		$query_values = array();
4771 4771
 		if ($year != '') {
4772 4772
 			if ($globalDBdriver == 'mysql') {
4773 4773
 				$query .= " AND YEAR(spotter_output.date) = :year";
4774
-				$query_values = array_merge($query_values,array(':year' => $year));
4774
+				$query_values = array_merge($query_values, array(':year' => $year));
4775 4775
 			} else {
4776 4776
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4777
-				$query_values = array_merge($query_values,array(':year' => $year));
4777
+				$query_values = array_merge($query_values, array(':year' => $year));
4778 4778
 			}
4779 4779
 		}
4780 4780
 		if ($month != '') {
4781 4781
 			if ($globalDBdriver == 'mysql') {
4782 4782
 				$query .= " AND MONTH(spotter_output.date) = :month";
4783
-				$query_values = array_merge($query_values,array(':month' => $month));
4783
+				$query_values = array_merge($query_values, array(':month' => $month));
4784 4784
 			} else {
4785 4785
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4786
-				$query_values = array_merge($query_values,array(':month' => $month));
4786
+				$query_values = array_merge($query_values, array(':month' => $month));
4787 4787
 			}
4788 4788
 		}
4789 4789
 		if ($day != '') {
4790 4790
 			if ($globalDBdriver == 'mysql') {
4791 4791
 				$query .= " AND DAY(spotter_output.date) = :day";
4792
-				$query_values = array_merge($query_values,array(':day' => $day));
4792
+				$query_values = array_merge($query_values, array(':day' => $day));
4793 4793
 			} else {
4794 4794
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4795
-				$query_values = array_merge($query_values,array(':day' => $day));
4795
+				$query_values = array_merge($query_values, array(':day' => $day));
4796 4796
 			}
4797 4797
 		}
4798 4798
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4804,7 +4804,7 @@  discard block
 block discarded – undo
4804 4804
 
4805 4805
 		$airline_array = array();
4806 4806
 		$temp_array = array();
4807
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4807
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4808 4808
 		{
4809 4809
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4810 4810
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4820,11 +4820,11 @@  discard block
 block discarded – undo
4820 4820
 	* @return Array the airline country list
4821 4821
 	*
4822 4822
 	*/
4823
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4823
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4824 4824
 	{
4825 4825
 		global $globalDBdriver;
4826 4826
 		//$filter_query = $this->getFilter($filters,true,true);
4827
-		$Connection= new Connection($this->db);
4827
+		$Connection = new Connection($this->db);
4828 4828
 		if (!$Connection->tableExists('countries')) return array();
4829 4829
 		/*
4830 4830
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4839,7 +4839,7 @@  discard block
 block discarded – undo
4839 4839
 */
4840 4840
 		require_once('class.SpotterLive.php');
4841 4841
 		$SpotterLive = new SpotterLive();
4842
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4842
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4843 4843
 		$filter_query .= ' over_country IS NOT NULL';
4844 4844
                 if ($olderthanmonths > 0) {
4845 4845
 			if ($globalDBdriver == 'mysql') {
@@ -4866,7 +4866,7 @@  discard block
 block discarded – undo
4866 4866
 		$flight_array = array();
4867 4867
 		$temp_array = array();
4868 4868
         
4869
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4869
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4870 4870
 		{
4871 4871
 			$temp_array['flight_count'] = $row['nb'];
4872 4872
 			$temp_array['flight_country'] = $row['name'];
@@ -4884,11 +4884,11 @@  discard block
 block discarded – undo
4884 4884
 	* @return Array the aircraft list
4885 4885
 	*
4886 4886
 	*/
4887
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4887
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4888 4888
 	{
4889 4889
 		global $globalDBdriver;
4890
-		$filter_query = $this->getFilter($filters,true,true);
4891
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4890
+		$filter_query = $this->getFilter($filters, true, true);
4891
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4892 4892
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4893 4893
 		if ($olderthanmonths > 0) {
4894 4894
 			if ($globalDBdriver == 'mysql') {
@@ -4908,28 +4908,28 @@  discard block
 block discarded – undo
4908 4908
 		if ($year != '') {
4909 4909
 			if ($globalDBdriver == 'mysql') {
4910 4910
 				$query .= " AND YEAR(spotter_output.date) = :year";
4911
-				$query_values = array_merge($query_values,array(':year' => $year));
4911
+				$query_values = array_merge($query_values, array(':year' => $year));
4912 4912
 			} else {
4913 4913
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4914
-				$query_values = array_merge($query_values,array(':year' => $year));
4914
+				$query_values = array_merge($query_values, array(':year' => $year));
4915 4915
 			}
4916 4916
 		}
4917 4917
 		if ($month != '') {
4918 4918
 			if ($globalDBdriver == 'mysql') {
4919 4919
 				$query .= " AND MONTH(spotter_output.date) = :month";
4920
-				$query_values = array_merge($query_values,array(':month' => $month));
4920
+				$query_values = array_merge($query_values, array(':month' => $month));
4921 4921
 			} else {
4922 4922
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4923
-				$query_values = array_merge($query_values,array(':month' => $month));
4923
+				$query_values = array_merge($query_values, array(':month' => $month));
4924 4924
 			}
4925 4925
 		}
4926 4926
 		if ($day != '') {
4927 4927
 			if ($globalDBdriver == 'mysql') {
4928 4928
 				$query .= " AND DAY(spotter_output.date) = :day";
4929
-				$query_values = array_merge($query_values,array(':day' => $day));
4929
+				$query_values = array_merge($query_values, array(':day' => $day));
4930 4930
 			} else {
4931 4931
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4932
-				$query_values = array_merge($query_values,array(':day' => $day));
4932
+				$query_values = array_merge($query_values, array(':day' => $day));
4933 4933
 			}
4934 4934
 		}
4935 4935
 
@@ -4941,7 +4941,7 @@  discard block
 block discarded – undo
4941 4941
 
4942 4942
 		$aircraft_array = array();
4943 4943
 		$temp_array = array();
4944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4945 4945
 		{
4946 4946
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4947 4947
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4958,11 +4958,11 @@  discard block
 block discarded – undo
4958 4958
 	* @return Array the aircraft list
4959 4959
 	*
4960 4960
 	*/
4961
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4961
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4962 4962
 	{
4963 4963
 		global $globalDBdriver;
4964
-		$filter_query = $this->getFilter($filters,true,true);
4965
-		$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 
4964
+		$filter_query = $this->getFilter($filters, true, true);
4965
+		$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 
4966 4966
 		    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' ";
4967 4967
 		if ($olderthanmonths > 0) {
4968 4968
 			if ($globalDBdriver == 'mysql') {
@@ -4982,28 +4982,28 @@  discard block
 block discarded – undo
4982 4982
 		if ($year != '') {
4983 4983
 			if ($globalDBdriver == 'mysql') {
4984 4984
 				$query .= " AND YEAR(spotter_output.date) = :year";
4985
-				$query_values = array_merge($query_values,array(':year' => $year));
4985
+				$query_values = array_merge($query_values, array(':year' => $year));
4986 4986
 			} else {
4987 4987
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4988
-				$query_values = array_merge($query_values,array(':year' => $year));
4988
+				$query_values = array_merge($query_values, array(':year' => $year));
4989 4989
 			}
4990 4990
 		}
4991 4991
 		if ($month != '') {
4992 4992
 			if ($globalDBdriver == 'mysql') {
4993 4993
 				$query .= " AND MONTH(spotter_output.date) = :month";
4994
-				$query_values = array_merge($query_values,array(':month' => $month));
4994
+				$query_values = array_merge($query_values, array(':month' => $month));
4995 4995
 			} else {
4996 4996
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4997
-				$query_values = array_merge($query_values,array(':month' => $month));
4997
+				$query_values = array_merge($query_values, array(':month' => $month));
4998 4998
 			}
4999 4999
 		}
5000 5000
 		if ($day != '') {
5001 5001
 			if ($globalDBdriver == 'mysql') {
5002 5002
 				$query .= " AND DAY(spotter_output.date) = :day";
5003
-				$query_values = array_merge($query_values,array(':day' => $day));
5003
+				$query_values = array_merge($query_values, array(':day' => $day));
5004 5004
 			} else {
5005 5005
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5006
-				$query_values = array_merge($query_values,array(':day' => $day));
5006
+				$query_values = array_merge($query_values, array(':day' => $day));
5007 5007
 			}
5008 5008
 		}
5009 5009
 
@@ -5015,7 +5015,7 @@  discard block
 block discarded – undo
5015 5015
 
5016 5016
 		$aircraft_array = array();
5017 5017
 		$temp_array = array();
5018
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5018
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5019 5019
 		{
5020 5020
 			$temp_array['airline_icao'] = $row['airline_icao'];
5021 5021
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5033,11 +5033,11 @@  discard block
 block discarded – undo
5033 5033
 	* @return Array the aircraft list
5034 5034
 	*
5035 5035
 	*/
5036
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5036
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5037 5037
 	{
5038 5038
 		global $globalDBdriver;
5039
-		$filter_query = $this->getFilter($filters,true,true);
5040
-		$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 
5039
+		$filter_query = $this->getFilter($filters, true, true);
5040
+		$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 
5041 5041
 		    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' ";
5042 5042
 		if ($olderthanmonths > 0) {
5043 5043
 			if ($globalDBdriver == 'mysql') {
@@ -5062,7 +5062,7 @@  discard block
 block discarded – undo
5062 5062
 
5063 5063
 		$aircraft_array = array();
5064 5064
 		$temp_array = array();
5065
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5065
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5066 5066
 		{
5067 5067
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5068 5068
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5081,13 +5081,13 @@  discard block
 block discarded – undo
5081 5081
 	* @return Array the aircraft list
5082 5082
 	*
5083 5083
 	*/
5084
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5084
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5085 5085
 	{
5086 5086
 		$Image = new Image($this->db);
5087
-		$filter_query = $this->getFilter($filters,true,true);
5088
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5087
+		$filter_query = $this->getFilter($filters, true, true);
5088
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5089 5089
 
5090
-		$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  
5090
+		$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  
5091 5091
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5092 5092
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5093 5093
 				ORDER BY registration_count DESC";
@@ -5098,14 +5098,14 @@  discard block
 block discarded – undo
5098 5098
 		$aircraft_array = array();
5099 5099
 		$temp_array = array();
5100 5100
         
5101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5102 5102
 		{
5103 5103
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5104 5104
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5105 5105
 			$temp_array['registration'] = $row['registration'];
5106 5106
 			$temp_array['airline_name'] = $row['airline_name'];
5107 5107
 			$temp_array['image_thumbnail'] = "";
5108
-			if($row['registration'] != "")
5108
+			if ($row['registration'] != "")
5109 5109
 			{
5110 5110
 				$image_array = $Image->getSpotterImage($row['registration']);
5111 5111
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5124,11 +5124,11 @@  discard block
 block discarded – undo
5124 5124
 	* @return Array the aircraft list
5125 5125
 	*
5126 5126
 	*/
5127
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5127
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5128 5128
 	{
5129
-		$filter_query = $this->getFilter($filters,true,true);
5130
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5131
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5129
+		$filter_query = $this->getFilter($filters, true, true);
5130
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5131
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5132 5132
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5133 5133
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5134 5134
 			    ORDER BY aircraft_icao_count DESC";
@@ -5139,7 +5139,7 @@  discard block
 block discarded – undo
5139 5139
 		$aircraft_array = array();
5140 5140
 		$temp_array = array();
5141 5141
 
5142
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5142
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5143 5143
 		{
5144 5144
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5145 5145
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5157,13 +5157,13 @@  discard block
 block discarded – undo
5157 5157
 	* @return Array the aircraft list
5158 5158
 	*
5159 5159
 	*/
5160
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5160
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5161 5161
 	{
5162
-		$filter_query = $this->getFilter($filters,true,true);
5162
+		$filter_query = $this->getFilter($filters, true, true);
5163 5163
 		$Image = new Image($this->db);
5164
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5164
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5165 5165
 
5166
-		$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 
5166
+		$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 
5167 5167
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5168 5168
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5169 5169
 			    ORDER BY registration_count DESC";
@@ -5173,14 +5173,14 @@  discard block
 block discarded – undo
5173 5173
 
5174 5174
 		$aircraft_array = array();
5175 5175
 		$temp_array = array();
5176
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5176
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5177 5177
 		{
5178 5178
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5179 5179
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5180 5180
 			$temp_array['registration'] = $row['registration'];
5181 5181
 			$temp_array['airline_name'] = $row['airline_name'];
5182 5182
 			$temp_array['image_thumbnail'] = "";
5183
-			if($row['registration'] != "")
5183
+			if ($row['registration'] != "")
5184 5184
 			{
5185 5185
 				$image_array = $Image->getSpotterImage($row['registration']);
5186 5186
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5199,11 +5199,11 @@  discard block
 block discarded – undo
5199 5199
 	* @return Array the aircraft list
5200 5200
 	*
5201 5201
 	*/
5202
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5202
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5203 5203
 	{
5204
-		$filter_query = $this->getFilter($filters,true,true);
5205
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5206
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5204
+		$filter_query = $this->getFilter($filters, true, true);
5205
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5206
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5207 5207
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5208 5208
 				GROUP BY spotter_output.aircraft_manufacturer 
5209 5209
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5214,7 +5214,7 @@  discard block
 block discarded – undo
5214 5214
 		$aircraft_array = array();
5215 5215
 		$temp_array = array();
5216 5216
 
5217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5218 5218
 		{
5219 5219
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5220 5220
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5231,12 +5231,12 @@  discard block
 block discarded – undo
5231 5231
 	* @return Array the aircraft list
5232 5232
 	*
5233 5233
 	*/
5234
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5234
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5235 5235
 	{
5236
-		$filter_query = $this->getFilter($filters,true,true);
5237
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5236
+		$filter_query = $this->getFilter($filters, true, true);
5237
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5238 5238
 
5239
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5239
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5240 5240
 				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) 
5241 5241
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5242 5242
 				ORDER BY aircraft_icao_count DESC";
@@ -5246,7 +5246,7 @@  discard block
 block discarded – undo
5246 5246
 
5247 5247
 		$aircraft_array = array();
5248 5248
 		$temp_array = array();
5249
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5249
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5250 5250
 		{
5251 5251
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5252 5252
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5264,13 +5264,13 @@  discard block
 block discarded – undo
5264 5264
 	* @return Array the aircraft list
5265 5265
 	*
5266 5266
 	*/
5267
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5267
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5268 5268
 	{
5269
-		$filter_query = $this->getFilter($filters,true,true);
5269
+		$filter_query = $this->getFilter($filters, true, true);
5270 5270
 		$Image = new Image($this->db);
5271
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5271
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5272 5272
 
5273
-		$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  
5273
+		$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  
5274 5274
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5275 5275
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5276 5276
 		    ORDER BY registration_count DESC";
@@ -5280,14 +5280,14 @@  discard block
 block discarded – undo
5280 5280
 
5281 5281
 		$aircraft_array = array();
5282 5282
 		$temp_array = array();
5283
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5283
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5284 5284
 		{
5285 5285
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5286 5286
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5287 5287
 			$temp_array['registration'] = $row['registration'];
5288 5288
 			$temp_array['airline_name'] = $row['airline_name'];
5289 5289
 			$temp_array['image_thumbnail'] = "";
5290
-			if($row['registration'] != "")
5290
+			if ($row['registration'] != "")
5291 5291
 			{
5292 5292
 				$image_array = $Image->getSpotterImage($row['registration']);
5293 5293
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5305,11 +5305,11 @@  discard block
 block discarded – undo
5305 5305
 	* @return Array the aircraft list
5306 5306
 	*
5307 5307
 	*/
5308
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5308
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5309 5309
 	{
5310
-		$filter_query = $this->getFilter($filters,true,true);
5311
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5312
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5310
+		$filter_query = $this->getFilter($filters, true, true);
5311
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5312
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5313 5313
                     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)  
5314 5314
                     GROUP BY spotter_output.aircraft_manufacturer 
5315 5315
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5320,7 +5320,7 @@  discard block
 block discarded – undo
5320 5320
 
5321 5321
 		$aircraft_array = array();
5322 5322
 		$temp_array = array();
5323
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5323
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5324 5324
 		{
5325 5325
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5326 5326
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5335,12 +5335,12 @@  discard block
 block discarded – undo
5335 5335
 	* @return Array the aircraft list
5336 5336
 	*
5337 5337
 	*/
5338
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5338
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5339 5339
 	{
5340
-		$filter_query = $this->getFilter($filters,true,true);
5341
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5340
+		$filter_query = $this->getFilter($filters, true, true);
5341
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5342 5342
 
5343
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5343
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5344 5344
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5345 5345
                     GROUP BY spotter_output.aircraft_name 
5346 5346
 					ORDER BY aircraft_icao_count DESC";
@@ -5349,7 +5349,7 @@  discard block
 block discarded – undo
5349 5349
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5350 5350
 		$aircraft_array = array();
5351 5351
 		$temp_array = array();
5352
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5352
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5353 5353
 		{
5354 5354
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5355 5355
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5368,11 +5368,11 @@  discard block
 block discarded – undo
5368 5368
 	*/
5369 5369
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5370 5370
 	{
5371
-		$filter_query = $this->getFilter($filters,true,true);
5371
+		$filter_query = $this->getFilter($filters, true, true);
5372 5372
 		$Image = new Image($this->db);
5373
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5373
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5374 5374
 
5375
-		$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   
5375
+		$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   
5376 5376
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5377 5377
                     GROUP BY spotter_output.registration 
5378 5378
 					ORDER BY registration_count DESC";
@@ -5382,14 +5382,14 @@  discard block
 block discarded – undo
5382 5382
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5383 5383
 		$aircraft_array = array();
5384 5384
 		$temp_array = array();
5385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5386 5386
 		{
5387 5387
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5388 5388
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5389 5389
 			$temp_array['registration'] = $row['registration'];
5390 5390
 			$temp_array['airline_name'] = $row['airline_name'];
5391 5391
 			$temp_array['image_thumbnail'] = "";
5392
-			if($row['registration'] != "")
5392
+			if ($row['registration'] != "")
5393 5393
 			{
5394 5394
 				$image_array = $Image->getSpotterImage($row['registration']);
5395 5395
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5406,11 +5406,11 @@  discard block
 block discarded – undo
5406 5406
 	* @return Array the aircraft list
5407 5407
 	*
5408 5408
 	*/
5409
-	public function countAllAircraftTypesByDate($date,$filters = array())
5409
+	public function countAllAircraftTypesByDate($date, $filters = array())
5410 5410
 	{
5411 5411
 		global $globalTimezone, $globalDBdriver;
5412
-		$filter_query = $this->getFilter($filters,true,true);
5413
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5412
+		$filter_query = $this->getFilter($filters, true, true);
5413
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5414 5414
 		if ($globalTimezone != '') {
5415 5415
 			date_default_timezone_set($globalTimezone);
5416 5416
 			$datetime = new DateTime($date);
@@ -5418,12 +5418,12 @@  discard block
 block discarded – undo
5418 5418
 		} else $offset = '+00:00';
5419 5419
 
5420 5420
 		if ($globalDBdriver == 'mysql') {
5421
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5421
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5422 5422
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5423 5423
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5424 5424
 					ORDER BY aircraft_icao_count DESC";
5425 5425
 		} else {
5426
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5426
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5427 5427
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5428 5428
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5429 5429
 					ORDER BY aircraft_icao_count DESC";
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
 
5435 5435
 		$aircraft_array = array();
5436 5436
 		$temp_array = array();
5437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5438 5438
 		{
5439 5439
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5440 5440
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5452,12 +5452,12 @@  discard block
 block discarded – undo
5452 5452
 	* @return Array the aircraft list
5453 5453
 	*
5454 5454
 	*/
5455
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5455
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5456 5456
 	{
5457 5457
 		global $globalTimezone, $globalDBdriver;
5458
-		$filter_query = $this->getFilter($filters,true,true);
5458
+		$filter_query = $this->getFilter($filters, true, true);
5459 5459
 		$Image = new Image($this->db);
5460
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5460
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5461 5461
 		if ($globalTimezone != '') {
5462 5462
 			date_default_timezone_set($globalTimezone);
5463 5463
 			$datetime = new DateTime($date);
@@ -5465,12 +5465,12 @@  discard block
 block discarded – undo
5465 5465
 		} else $offset = '+00:00';
5466 5466
 
5467 5467
 		if ($globalDBdriver == 'mysql') {
5468
-			$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 
5468
+			$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 
5469 5469
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5470 5470
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5471 5471
 					ORDER BY registration_count DESC";
5472 5472
 		} else {
5473
-			$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    
5473
+			$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    
5474 5474
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5475 5475
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5476 5476
 					ORDER BY registration_count DESC";
@@ -5481,14 +5481,14 @@  discard block
 block discarded – undo
5481 5481
 
5482 5482
 		$aircraft_array = array();
5483 5483
 		$temp_array = array();
5484
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5484
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5485 5485
 		{
5486 5486
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5487 5487
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5488 5488
 			$temp_array['registration'] = $row['registration'];
5489 5489
 			$temp_array['airline_name'] = $row['airline_name'];
5490 5490
 			$temp_array['image_thumbnail'] = "";
5491
-			if($row['registration'] != "")
5491
+			if ($row['registration'] != "")
5492 5492
 			{
5493 5493
 				$image_array = $Image->getSpotterImage($row['registration']);
5494 5494
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5507,11 +5507,11 @@  discard block
 block discarded – undo
5507 5507
 	* @return Array the aircraft manufacturer list
5508 5508
 	*
5509 5509
 	*/
5510
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5510
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5511 5511
 	{
5512 5512
 		global $globalTimezone, $globalDBdriver;
5513
-		$filter_query = $this->getFilter($filters,true,true);
5514
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5513
+		$filter_query = $this->getFilter($filters, true, true);
5514
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5515 5515
 		if ($globalTimezone != '') {
5516 5516
 			date_default_timezone_set($globalTimezone);
5517 5517
 			$datetime = new DateTime($date);
@@ -5519,12 +5519,12 @@  discard block
 block discarded – undo
5519 5519
 		} else $offset = '+00:00';
5520 5520
 
5521 5521
 		if ($globalDBdriver == 'mysql') {
5522
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5522
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5523 5523
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5524 5524
 				GROUP BY spotter_output.aircraft_manufacturer 
5525 5525
 				ORDER BY aircraft_manufacturer_count DESC";
5526 5526
 		} else {
5527
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5527
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5528 5528
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5529 5529
 				GROUP BY spotter_output.aircraft_manufacturer 
5530 5530
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5536,7 +5536,7 @@  discard block
 block discarded – undo
5536 5536
 		$aircraft_array = array();
5537 5537
 		$temp_array = array();
5538 5538
 
5539
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5539
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5540 5540
 		{
5541 5541
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5542 5542
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5553,11 +5553,11 @@  discard block
 block discarded – undo
5553 5553
 	* @return Array the aircraft list
5554 5554
 	*
5555 5555
 	*/
5556
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5556
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5557 5557
 	{
5558
-		$filter_query = $this->getFilter($filters,true,true);
5559
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5560
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5558
+		$filter_query = $this->getFilter($filters, true, true);
5559
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5560
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5561 5561
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5562 5562
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5563 5563
 				ORDER BY aircraft_icao_count DESC";
@@ -5568,7 +5568,7 @@  discard block
 block discarded – undo
5568 5568
 		$aircraft_array = array();
5569 5569
 		$temp_array = array();
5570 5570
 
5571
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5571
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5572 5572
 		{
5573 5573
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5574 5574
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5585,11 +5585,11 @@  discard block
 block discarded – undo
5585 5585
 	* @return Array the aircraft list
5586 5586
 	*
5587 5587
 	*/
5588
-	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5588
+	public function countAllAircraftTypesByPilot($pilot, $filters = array())
5589 5589
 	{
5590
-		$filter_query = $this->getFilter($filters,true,true);
5591
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5592
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5590
+		$filter_query = $this->getFilter($filters, true, true);
5591
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5592
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5593 5593
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot) 
5594 5594
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5595 5595
 				ORDER BY aircraft_icao_count DESC";
@@ -5605,11 +5605,11 @@  discard block
 block discarded – undo
5605 5605
 	* @return Array the aircraft list
5606 5606
 	*
5607 5607
 	*/
5608
-	public function countAllAircraftTypesByOwner($owner,$filters = array())
5608
+	public function countAllAircraftTypesByOwner($owner, $filters = array())
5609 5609
 	{
5610
-		$filter_query = $this->getFilter($filters,true,true);
5611
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5612
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5610
+		$filter_query = $this->getFilter($filters, true, true);
5611
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5612
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5613 5613
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
5614 5614
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5615 5615
 				ORDER BY aircraft_icao_count DESC";
@@ -5626,13 +5626,13 @@  discard block
 block discarded – undo
5626 5626
 	* @return Array the aircraft list
5627 5627
 	*
5628 5628
 	*/
5629
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5629
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5630 5630
 	{
5631
-		$filter_query = $this->getFilter($filters,true,true);
5631
+		$filter_query = $this->getFilter($filters, true, true);
5632 5632
 		$Image = new Image($this->db);
5633
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5633
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5634 5634
 
5635
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5635
+		$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  
5636 5636
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5637 5637
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5638 5638
 		    ORDER BY registration_count DESC";
@@ -5644,14 +5644,14 @@  discard block
 block discarded – undo
5644 5644
 		$aircraft_array = array();
5645 5645
 		$temp_array = array();
5646 5646
         
5647
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5647
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5648 5648
 		{
5649 5649
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5650 5650
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5651 5651
 			$temp_array['registration'] = $row['registration'];
5652 5652
 			$temp_array['airline_name'] = $row['airline_name'];
5653 5653
 			$temp_array['image_thumbnail'] = "";
5654
-			if($row['registration'] != "")
5654
+			if ($row['registration'] != "")
5655 5655
 			{
5656 5656
 				$image_array = $Image->getSpotterImage($row['registration']);
5657 5657
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5669,13 +5669,13 @@  discard block
 block discarded – undo
5669 5669
 	* @return Array the aircraft list
5670 5670
 	*
5671 5671
 	*/
5672
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5672
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array())
5673 5673
 	{
5674
-		$filter_query = $this->getFilter($filters,true,true);
5674
+		$filter_query = $this->getFilter($filters, true, true);
5675 5675
 		$Image = new Image($this->db);
5676
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5676
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5677 5677
 
5678
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5678
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5679 5679
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner 
5680 5680
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5681 5681
 		    ORDER BY registration_count DESC";
@@ -5687,7 +5687,7 @@  discard block
 block discarded – undo
5687 5687
 		$aircraft_array = array();
5688 5688
 		$temp_array = array();
5689 5689
         
5690
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5690
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5691 5691
 		{
5692 5692
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5693 5693
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5695,7 +5695,7 @@  discard block
 block discarded – undo
5695 5695
 			$temp_array['registration'] = $row['registration'];
5696 5696
 			$temp_array['airline_name'] = $row['airline_name'];
5697 5697
 			$temp_array['image_thumbnail'] = "";
5698
-			if($row['registration'] != "")
5698
+			if ($row['registration'] != "")
5699 5699
 			{
5700 5700
 				$image_array = $Image->getSpotterImage($row['registration']);
5701 5701
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5713,13 +5713,13 @@  discard block
 block discarded – undo
5713 5713
 	* @return Array the aircraft list
5714 5714
 	*
5715 5715
 	*/
5716
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5716
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array())
5717 5717
 	{
5718
-		$filter_query = $this->getFilter($filters,true,true);
5718
+		$filter_query = $this->getFilter($filters, true, true);
5719 5719
 		$Image = new Image($this->db);
5720
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5720
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5721 5721
 
5722
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5722
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5723 5723
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5724 5724
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5725 5725
 		    ORDER BY registration_count DESC";
@@ -5731,7 +5731,7 @@  discard block
 block discarded – undo
5731 5731
 		$aircraft_array = array();
5732 5732
 		$temp_array = array();
5733 5733
         
5734
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5734
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5735 5735
 		{
5736 5736
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5737 5737
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5739,7 +5739,7 @@  discard block
 block discarded – undo
5739 5739
 			$temp_array['registration'] = $row['registration'];
5740 5740
 			$temp_array['airline_name'] = $row['airline_name'];
5741 5741
 			$temp_array['image_thumbnail'] = "";
5742
-			if($row['registration'] != "")
5742
+			if ($row['registration'] != "")
5743 5743
 			{
5744 5744
 				$image_array = $Image->getSpotterImage($row['registration']);
5745 5745
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5758,11 +5758,11 @@  discard block
 block discarded – undo
5758 5758
 	* @return Array the aircraft manufacturer list
5759 5759
 	*
5760 5760
 	*/
5761
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5761
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5762 5762
 	{
5763
-		$filter_query = $this->getFilter($filters,true,true);
5764
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5765
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5763
+		$filter_query = $this->getFilter($filters, true, true);
5764
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5765
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5766 5766
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5767 5767
                     GROUP BY spotter_output.aircraft_manufacturer 
5768 5768
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5772,7 +5772,7 @@  discard block
 block discarded – undo
5772 5772
 		$sth->execute(array(':ident' => $ident));
5773 5773
 		$aircraft_array = array();
5774 5774
 		$temp_array = array();
5775
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5775
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5776 5776
 		{
5777 5777
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5778 5778
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5787,11 +5787,11 @@  discard block
 block discarded – undo
5787 5787
 	* @return Array the aircraft manufacturer list
5788 5788
 	*
5789 5789
 	*/
5790
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5790
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array())
5791 5791
 	{
5792
-		$filter_query = $this->getFilter($filters,true,true);
5793
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5794
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5792
+		$filter_query = $this->getFilter($filters, true, true);
5793
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5794
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5795 5795
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner 
5796 5796
 		    GROUP BY spotter_output.aircraft_manufacturer 
5797 5797
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5808,11 +5808,11 @@  discard block
 block discarded – undo
5808 5808
 	* @return Array the aircraft manufacturer list
5809 5809
 	*
5810 5810
 	*/
5811
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5811
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array())
5812 5812
 	{
5813
-		$filter_query = $this->getFilter($filters,true,true);
5814
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5815
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5813
+		$filter_query = $this->getFilter($filters, true, true);
5814
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5815
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5816 5816
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5817 5817
 		    GROUP BY spotter_output.aircraft_manufacturer 
5818 5818
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5830,24 +5830,24 @@  discard block
 block discarded – undo
5830 5830
 	* @return Array the aircraft list
5831 5831
 	*
5832 5832
 	*/
5833
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5833
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5834 5834
 	{
5835
-		$filter_query = $this->getFilter($filters,true,true);
5836
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5837
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5835
+		$filter_query = $this->getFilter($filters, true, true);
5836
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5837
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5838 5838
 		
5839 5839
 
5840
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5840
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5841 5841
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5842 5842
                     GROUP BY spotter_output.aircraft_name 
5843 5843
 					ORDER BY aircraft_icao_count DESC";
5844 5844
  
5845 5845
 		
5846 5846
 		$sth = $this->db->prepare($query);
5847
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5847
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5848 5848
 		$aircraft_array = array();
5849 5849
 		$temp_array = array();
5850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5851 5851
 		{
5852 5852
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5853 5853
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5863,33 +5863,33 @@  discard block
 block discarded – undo
5863 5863
 	* @return Array the aircraft list
5864 5864
 	*
5865 5865
 	*/
5866
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5866
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5867 5867
 	{
5868
-		$filter_query = $this->getFilter($filters,true,true);
5868
+		$filter_query = $this->getFilter($filters, true, true);
5869 5869
 		$Image = new Image($this->db);
5870
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5871
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5870
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5871
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5872 5872
 
5873
-		$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   
5873
+		$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   
5874 5874
                     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)   
5875 5875
                     GROUP BY spotter_output.registration 
5876 5876
 					ORDER BY registration_count DESC";
5877 5877
 
5878 5878
 		
5879 5879
 		$sth = $this->db->prepare($query);
5880
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5880
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5881 5881
       
5882 5882
 		$aircraft_array = array();
5883 5883
 		$temp_array = array();
5884 5884
         
5885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5886 5886
 		{
5887 5887
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5888 5888
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5889 5889
 			$temp_array['registration'] = $row['registration'];
5890 5890
 			$temp_array['airline_name'] = $row['airline_name'];
5891 5891
 			$temp_array['image_thumbnail'] = "";
5892
-			if($row['registration'] != "")
5892
+			if ($row['registration'] != "")
5893 5893
 			{
5894 5894
 				$image_array = $Image->getSpotterImage($row['registration']);
5895 5895
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5909,25 +5909,25 @@  discard block
 block discarded – undo
5909 5909
 	* @return Array the aircraft manufacturer list
5910 5910
 	*
5911 5911
 	*/
5912
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5912
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5913 5913
 	{
5914
-		$filter_query = $this->getFilter($filters,true,true);
5915
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5916
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5914
+		$filter_query = $this->getFilter($filters, true, true);
5915
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5916
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5917 5917
 
5918
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5918
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5919 5919
                     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) 
5920 5920
                     GROUP BY spotter_output.aircraft_manufacturer 
5921 5921
 					ORDER BY aircraft_manufacturer_count DESC";
5922 5922
 
5923 5923
 		
5924 5924
 		$sth = $this->db->prepare($query);
5925
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5925
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5926 5926
       
5927 5927
 		$aircraft_array = array();
5928 5928
 		$temp_array = array();
5929 5929
         
5930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5931 5931
 		{
5932 5932
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5933 5933
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5947,11 +5947,11 @@  discard block
 block discarded – undo
5947 5947
 	* @return Array the aircraft list
5948 5948
 	*
5949 5949
 	*/
5950
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5950
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5951 5951
 	{
5952
-		$filter_query = $this->getFilter($filters,true,true);
5953
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5954
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5952
+		$filter_query = $this->getFilter($filters, true, true);
5953
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5954
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5955 5955
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5956 5956
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5957 5957
 			    ORDER BY aircraft_icao_count DESC";
@@ -5963,7 +5963,7 @@  discard block
 block discarded – undo
5963 5963
 		$aircraft_array = array();
5964 5964
 		$temp_array = array();
5965 5965
         
5966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5967 5967
 		{
5968 5968
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5969 5969
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5982,12 +5982,12 @@  discard block
 block discarded – undo
5982 5982
 	* @return Array the aircraft list
5983 5983
 	*
5984 5984
 	*/
5985
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5985
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5986 5986
 	{
5987
-		$filter_query = $this->getFilter($filters,true,true);
5987
+		$filter_query = $this->getFilter($filters, true, true);
5988 5988
 		$Image = new Image($this->db);
5989
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5990
-		$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 
5989
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5990
+		$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 
5991 5991
 			    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)    
5992 5992
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5993 5993
 			    ORDER BY registration_count DESC";
@@ -5999,14 +5999,14 @@  discard block
 block discarded – undo
5999 5999
 		$aircraft_array = array();
6000 6000
 		$temp_array = array();
6001 6001
         
6002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6003 6003
 		{
6004 6004
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6005 6005
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6006 6006
 			$temp_array['registration'] = $row['registration'];
6007 6007
 			$temp_array['airline_name'] = $row['airline_name'];
6008 6008
 			$temp_array['image_thumbnail'] = "";
6009
-			if($row['registration'] != "")
6009
+			if ($row['registration'] != "")
6010 6010
 			{
6011 6011
 				$image_array = $Image->getSpotterImage($row['registration']);
6012 6012
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6026,11 +6026,11 @@  discard block
 block discarded – undo
6026 6026
 	* @return Array the aircraft manufacturer list
6027 6027
 	*
6028 6028
 	*/
6029
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6029
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6030 6030
 	{
6031
-		$filter_query = $this->getFilter($filters,true,true);
6032
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6033
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6031
+		$filter_query = $this->getFilter($filters, true, true);
6032
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6033
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6034 6034
                     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) 
6035 6035
                     GROUP BY spotter_output.aircraft_manufacturer 
6036 6036
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6042,7 +6042,7 @@  discard block
 block discarded – undo
6042 6042
 		$aircraft_array = array();
6043 6043
 		$temp_array = array();
6044 6044
         
6045
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6045
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6046 6046
 		{
6047 6047
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6048 6048
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6061,38 +6061,38 @@  discard block
 block discarded – undo
6061 6061
 	* @return Array the aircraft list
6062 6062
 	*
6063 6063
 	*/
6064
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6064
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6065 6065
 	{
6066 6066
 		global $globalDBdriver;
6067
-		$filter_query = $this->getFilter($filters,true,true);
6068
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6067
+		$filter_query = $this->getFilter($filters, true, true);
6068
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6069 6069
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6070 6070
                 $query_values = array();
6071 6071
 		if ($year != '') {
6072 6072
 			if ($globalDBdriver == 'mysql') {
6073 6073
 				$query .= " AND YEAR(spotter_output.date) = :year";
6074
-				$query_values = array_merge($query_values,array(':year' => $year));
6074
+				$query_values = array_merge($query_values, array(':year' => $year));
6075 6075
 			} else {
6076 6076
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6077
-				$query_values = array_merge($query_values,array(':year' => $year));
6077
+				$query_values = array_merge($query_values, array(':year' => $year));
6078 6078
 			}
6079 6079
 		}
6080 6080
 		if ($month != '') {
6081 6081
 			if ($globalDBdriver == 'mysql') {
6082 6082
 				$query .= " AND MONTH(spotter_output.date) = :month";
6083
-				$query_values = array_merge($query_values,array(':month' => $month));
6083
+				$query_values = array_merge($query_values, array(':month' => $month));
6084 6084
 			} else {
6085 6085
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6086
-				$query_values = array_merge($query_values,array(':month' => $month));
6086
+				$query_values = array_merge($query_values, array(':month' => $month));
6087 6087
 			}
6088 6088
 		}
6089 6089
 		if ($day != '') {
6090 6090
 			if ($globalDBdriver == 'mysql') {
6091 6091
 				$query .= " AND DAY(spotter_output.date) = :day";
6092
-				$query_values = array_merge($query_values,array(':day' => $day));
6092
+				$query_values = array_merge($query_values, array(':day' => $day));
6093 6093
 			} else {
6094 6094
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6095
-				$query_values = array_merge($query_values,array(':day' => $day));
6095
+				$query_values = array_merge($query_values, array(':day' => $day));
6096 6096
 			}
6097 6097
 		}
6098 6098
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6106,7 +6106,7 @@  discard block
 block discarded – undo
6106 6106
 		$manufacturer_array = array();
6107 6107
 		$temp_array = array();
6108 6108
         
6109
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6109
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6110 6110
 		{
6111 6111
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6112 6112
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6125,12 +6125,12 @@  discard block
 block discarded – undo
6125 6125
 	* @return Array the aircraft list
6126 6126
 	*
6127 6127
 	*/
6128
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6128
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6129 6129
 	{
6130 6130
 		global $globalDBdriver;
6131 6131
 		$Image = new Image($this->db);
6132
-		$filter_query = $this->getFilter($filters,true,true);
6133
-		$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    
6132
+		$filter_query = $this->getFilter($filters, true, true);
6133
+		$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    
6134 6134
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6135 6135
                 if ($olderthanmonths > 0) {
6136 6136
             		if ($globalDBdriver == 'mysql') {
@@ -6150,28 +6150,28 @@  discard block
 block discarded – undo
6150 6150
 		if ($year != '') {
6151 6151
 			if ($globalDBdriver == 'mysql') {
6152 6152
 				$query .= " AND YEAR(spotter_output.date) = :year";
6153
-				$query_values = array_merge($query_values,array(':year' => $year));
6153
+				$query_values = array_merge($query_values, array(':year' => $year));
6154 6154
 			} else {
6155 6155
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6156
-				$query_values = array_merge($query_values,array(':year' => $year));
6156
+				$query_values = array_merge($query_values, array(':year' => $year));
6157 6157
 			}
6158 6158
 		}
6159 6159
 		if ($month != '') {
6160 6160
 			if ($globalDBdriver == 'mysql') {
6161 6161
 				$query .= " AND MONTH(spotter_output.date) = :month";
6162
-				$query_values = array_merge($query_values,array(':month' => $month));
6162
+				$query_values = array_merge($query_values, array(':month' => $month));
6163 6163
 			} else {
6164 6164
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6165
-				$query_values = array_merge($query_values,array(':month' => $month));
6165
+				$query_values = array_merge($query_values, array(':month' => $month));
6166 6166
 			}
6167 6167
 		}
6168 6168
 		if ($day != '') {
6169 6169
 			if ($globalDBdriver == 'mysql') {
6170 6170
 				$query .= " AND DAY(spotter_output.date) = :day";
6171
-				$query_values = array_merge($query_values,array(':day' => $day));
6171
+				$query_values = array_merge($query_values, array(':day' => $day));
6172 6172
 			} else {
6173 6173
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6174
-				$query_values = array_merge($query_values,array(':day' => $day));
6174
+				$query_values = array_merge($query_values, array(':day' => $day));
6175 6175
 			}
6176 6176
 		}
6177 6177
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6183,7 +6183,7 @@  discard block
 block discarded – undo
6183 6183
 		$aircraft_array = array();
6184 6184
 		$temp_array = array();
6185 6185
         
6186
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6186
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6187 6187
 		{
6188 6188
 			$temp_array['registration'] = $row['registration'];
6189 6189
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6191,7 +6191,7 @@  discard block
 block discarded – undo
6191 6191
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6192 6192
 			$temp_array['airline_name'] = $row['airline_name'];
6193 6193
 			$temp_array['image_thumbnail'] = "";
6194
-			if($row['registration'] != "")
6194
+			if ($row['registration'] != "")
6195 6195
 			{
6196 6196
 				$image_array = $Image->getSpotterImage($row['registration']);
6197 6197
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6210,12 +6210,12 @@  discard block
 block discarded – undo
6210 6210
 	* @return Array the aircraft list
6211 6211
 	*
6212 6212
 	*/
6213
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6213
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6214 6214
 	{
6215 6215
 		global $globalDBdriver;
6216
-		$filter_query = $this->getFilter($filters,true,true);
6216
+		$filter_query = $this->getFilter($filters, true, true);
6217 6217
 		$Image = new Image($this->db);
6218
-		$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    
6218
+		$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    
6219 6219
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6220 6220
                 if ($olderthanmonths > 0) {
6221 6221
             		if ($globalDBdriver == 'mysql') {
@@ -6243,7 +6243,7 @@  discard block
 block discarded – undo
6243 6243
 		$aircraft_array = array();
6244 6244
 		$temp_array = array();
6245 6245
         
6246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6247 6247
 		{
6248 6248
 			$temp_array['registration'] = $row['registration'];
6249 6249
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6252,7 +6252,7 @@  discard block
 block discarded – undo
6252 6252
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6253 6253
 			$temp_array['airline_name'] = $row['airline_name'];
6254 6254
 			$temp_array['image_thumbnail'] = "";
6255
-			if($row['registration'] != "")
6255
+			if ($row['registration'] != "")
6256 6256
 			{
6257 6257
 				$image_array = $Image->getSpotterImage($row['registration']);
6258 6258
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 	* @return Array the airport list
6272 6272
 	*
6273 6273
 	*/
6274
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6274
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6275 6275
 	{
6276 6276
 		global $globalDBdriver;
6277
-		$filter_query = $this->getFilter($filters,true,true);
6278
-		$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 
6277
+		$filter_query = $this->getFilter($filters, true, true);
6278
+		$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 
6279 6279
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6280 6280
                 if ($olderthanmonths > 0) {
6281 6281
             		if ($globalDBdriver == 'mysql') {
@@ -6295,28 +6295,28 @@  discard block
 block discarded – undo
6295 6295
 		if ($year != '') {
6296 6296
 			if ($globalDBdriver == 'mysql') {
6297 6297
 				$query .= " AND YEAR(spotter_output.date) = :year";
6298
-				$query_values = array_merge($query_values,array(':year' => $year));
6298
+				$query_values = array_merge($query_values, array(':year' => $year));
6299 6299
 			} else {
6300 6300
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6301
-				$query_values = array_merge($query_values,array(':year' => $year));
6301
+				$query_values = array_merge($query_values, array(':year' => $year));
6302 6302
 			}
6303 6303
 		}
6304 6304
 		if ($month != '') {
6305 6305
 			if ($globalDBdriver == 'mysql') {
6306 6306
 				$query .= " AND MONTH(spotter_output.date) = :month";
6307
-				$query_values = array_merge($query_values,array(':month' => $month));
6307
+				$query_values = array_merge($query_values, array(':month' => $month));
6308 6308
 			} else {
6309 6309
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6310
-				$query_values = array_merge($query_values,array(':month' => $month));
6310
+				$query_values = array_merge($query_values, array(':month' => $month));
6311 6311
 			}
6312 6312
 		}
6313 6313
 		if ($day != '') {
6314 6314
 			if ($globalDBdriver == 'mysql') {
6315 6315
 				$query .= " AND DAY(spotter_output.date) = :day";
6316
-				$query_values = array_merge($query_values,array(':day' => $day));
6316
+				$query_values = array_merge($query_values, array(':day' => $day));
6317 6317
 			} else {
6318 6318
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6319
-				$query_values = array_merge($query_values,array(':day' => $day));
6319
+				$query_values = array_merge($query_values, array(':day' => $day));
6320 6320
 			}
6321 6321
 		}
6322 6322
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6328,7 +6328,7 @@  discard block
 block discarded – undo
6328 6328
 
6329 6329
 		$airport_array = array();
6330 6330
 		$temp_array = array();
6331
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6331
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6332 6332
 		{
6333 6333
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6334 6334
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6347,11 +6347,11 @@  discard block
 block discarded – undo
6347 6347
 	* @return Array the airport list
6348 6348
 	*
6349 6349
 	*/
6350
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6350
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6351 6351
 	{
6352 6352
 		global $globalDBdriver;
6353
-		$filter_query = $this->getFilter($filters,true,true);
6354
-		$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 
6353
+		$filter_query = $this->getFilter($filters, true, true);
6354
+		$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 
6355 6355
 			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 <> '' ";
6356 6356
                 if ($olderthanmonths > 0) {
6357 6357
             		if ($globalDBdriver == 'mysql') {
@@ -6380,7 +6380,7 @@  discard block
 block discarded – undo
6380 6380
 		$airport_array = array();
6381 6381
 		$temp_array = array();
6382 6382
         
6383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6384 6384
 		{
6385 6385
 			$temp_array['airline_icao'] = $row['airline_icao'];
6386 6386
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6400,11 +6400,11 @@  discard block
 block discarded – undo
6400 6400
 	* @return Array the airport list
6401 6401
 	*
6402 6402
 	*/
6403
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6403
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6404 6404
 	{
6405 6405
 		global $globalDBdriver;
6406
-		$filter_query = $this->getFilter($filters,true,true);
6407
-		$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
6406
+		$filter_query = $this->getFilter($filters, true, true);
6407
+		$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
6408 6408
 				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";
6409 6409
                 if ($olderthanmonths > 0) {
6410 6410
             		if ($globalDBdriver == 'mysql') {
@@ -6424,28 +6424,28 @@  discard block
 block discarded – undo
6424 6424
 		if ($year != '') {
6425 6425
 			if ($globalDBdriver == 'mysql') {
6426 6426
 				$query .= " AND YEAR(spotter_output.date) = :year";
6427
-				$query_values = array_merge($query_values,array(':year' => $year));
6427
+				$query_values = array_merge($query_values, array(':year' => $year));
6428 6428
 			} else {
6429 6429
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6430
-				$query_values = array_merge($query_values,array(':year' => $year));
6430
+				$query_values = array_merge($query_values, array(':year' => $year));
6431 6431
 			}
6432 6432
 		}
6433 6433
 		if ($month != '') {
6434 6434
 			if ($globalDBdriver == 'mysql') {
6435 6435
 				$query .= " AND MONTH(spotter_output.date) = :month";
6436
-				$query_values = array_merge($query_values,array(':month' => $month));
6436
+				$query_values = array_merge($query_values, array(':month' => $month));
6437 6437
 			} else {
6438 6438
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6439
-				$query_values = array_merge($query_values,array(':month' => $month));
6439
+				$query_values = array_merge($query_values, array(':month' => $month));
6440 6440
 			}
6441 6441
 		}
6442 6442
 		if ($day != '') {
6443 6443
 			if ($globalDBdriver == 'mysql') {
6444 6444
 				$query .= " AND DAY(spotter_output.date) = :day";
6445
-				$query_values = array_merge($query_values,array(':day' => $day));
6445
+				$query_values = array_merge($query_values, array(':day' => $day));
6446 6446
 			} else {
6447 6447
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6448
-				$query_values = array_merge($query_values,array(':day' => $day));
6448
+				$query_values = array_merge($query_values, array(':day' => $day));
6449 6449
 			}
6450 6450
 		}
6451 6451
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6458,7 +6458,7 @@  discard block
 block discarded – undo
6458 6458
 		$airport_array = array();
6459 6459
 		$temp_array = array();
6460 6460
         
6461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6462 6462
 		{
6463 6463
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6464 6464
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6477,11 +6477,11 @@  discard block
 block discarded – undo
6477 6477
 	* @return Array the airport list
6478 6478
 	*
6479 6479
 	*/
6480
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6480
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6481 6481
 	{
6482 6482
 		global $globalDBdriver;
6483
-		$filter_query = $this->getFilter($filters,true,true);
6484
-		$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
6483
+		$filter_query = $this->getFilter($filters, true, true);
6484
+		$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
6485 6485
 				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 ";
6486 6486
                 if ($olderthanmonths > 0) {
6487 6487
             		if ($globalDBdriver == 'mysql') {
@@ -6510,7 +6510,7 @@  discard block
 block discarded – undo
6510 6510
 		$airport_array = array();
6511 6511
 		$temp_array = array();
6512 6512
         
6513
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6513
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6514 6514
 		{
6515 6515
 			$temp_array['airline_icao'] = $row['airline_icao'];
6516 6516
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6530,11 +6530,11 @@  discard block
 block discarded – undo
6530 6530
 	* @return Array the airport list
6531 6531
 	*
6532 6532
 	*/
6533
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6533
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6534 6534
 	{
6535
-		$filter_query = $this->getFilter($filters,true,true);
6536
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6537
-		$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 
6535
+		$filter_query = $this->getFilter($filters, true, true);
6536
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6537
+		$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 
6538 6538
 			    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 <> '' 
6539 6539
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6540 6540
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6546,7 +6546,7 @@  discard block
 block discarded – undo
6546 6546
 		$airport_array = array();
6547 6547
 		$temp_array = array();
6548 6548
         
6549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6550 6550
 		{
6551 6551
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6552 6552
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6568,11 +6568,11 @@  discard block
 block discarded – undo
6568 6568
 	* @return Array the airport list
6569 6569
 	*
6570 6570
 	*/
6571
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6571
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6572 6572
 	{
6573
-		$filter_query = $this->getFilter($filters,true,true);
6574
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6575
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6573
+		$filter_query = $this->getFilter($filters, true, true);
6574
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6575
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6576 6576
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6577 6577
                     GROUP BY spotter_output.departure_airport_country
6578 6578
 					ORDER BY airport_departure_country_count DESC";
@@ -6584,7 +6584,7 @@  discard block
 block discarded – undo
6584 6584
 		$airport_array = array();
6585 6585
 		$temp_array = array();
6586 6586
         
6587
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6587
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6588 6588
 		{
6589 6589
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6590 6590
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6603,11 +6603,11 @@  discard block
 block discarded – undo
6603 6603
 	* @return Array the airport list
6604 6604
 	*
6605 6605
 	*/
6606
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6606
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6607 6607
 	{
6608
-		$filter_query = $this->getFilter($filters,true,true);
6609
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6610
-		$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 
6608
+		$filter_query = $this->getFilter($filters, true, true);
6609
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6610
+		$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 
6611 6611
 			    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 <> '' 
6612 6612
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6613 6613
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6619,7 +6619,7 @@  discard block
 block discarded – undo
6619 6619
 		$airport_array = array();
6620 6620
 		$temp_array = array();
6621 6621
         
6622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6623 6623
 		{
6624 6624
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6625 6625
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6640,11 +6640,11 @@  discard block
 block discarded – undo
6640 6640
 	* @return Array the airport list
6641 6641
 	*
6642 6642
 	*/
6643
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6643
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6644 6644
 	{
6645
-		$filter_query = $this->getFilter($filters,true,true);
6646
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6647
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6645
+		$filter_query = $this->getFilter($filters, true, true);
6646
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6647
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6648 6648
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6649 6649
                     GROUP BY spotter_output.departure_airport_country
6650 6650
 					ORDER BY airport_departure_country_count DESC";
@@ -6656,7 +6656,7 @@  discard block
 block discarded – undo
6656 6656
 		$airport_array = array();
6657 6657
 		$temp_array = array();
6658 6658
         
6659
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6659
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6660 6660
 		{
6661 6661
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6662 6662
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6674,11 +6674,11 @@  discard block
 block discarded – undo
6674 6674
 	* @return Array the airport list
6675 6675
 	*
6676 6676
 	*/
6677
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6677
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6678 6678
 	{
6679
-		$filter_query = $this->getFilter($filters,true,true);
6680
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6681
-		$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 
6679
+		$filter_query = $this->getFilter($filters, true, true);
6680
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6681
+		$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 
6682 6682
 			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 <> '' 
6683 6683
                     GROUP BY spotter_output.departure_airport_icao
6684 6684
 					ORDER BY airport_departure_icao_count DESC";
@@ -6690,7 +6690,7 @@  discard block
 block discarded – undo
6690 6690
 		$airport_array = array();
6691 6691
 		$temp_array = array();
6692 6692
         
6693
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6693
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6694 6694
 		{
6695 6695
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6696 6696
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6711,11 +6711,11 @@  discard block
 block discarded – undo
6711 6711
 	* @return Array the airport list
6712 6712
 	*
6713 6713
 	*/
6714
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6714
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6715 6715
 	{
6716
-		$filter_query = $this->getFilter($filters,true,true);
6717
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6718
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6716
+		$filter_query = $this->getFilter($filters, true, true);
6717
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
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 spotter_output.registration = :registration 
6720 6720
                     GROUP BY spotter_output.departure_airport_country
6721 6721
 					ORDER BY airport_departure_country_count DESC";
@@ -6727,7 +6727,7 @@  discard block
 block discarded – undo
6727 6727
 		$airport_array = array();
6728 6728
 		$temp_array = array();
6729 6729
         
6730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6731 6731
 		{
6732 6732
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6733 6733
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6745,11 +6745,11 @@  discard block
 block discarded – undo
6745 6745
 	* @return Array the airport list
6746 6746
 	*
6747 6747
 	*/
6748
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6748
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6749 6749
 	{
6750
-		$filter_query = $this->getFilter($filters,true,true);
6751
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6752
-		$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 
6750
+		$filter_query = $this->getFilter($filters, true, true);
6751
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6752
+		$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 
6753 6753
 			    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 <> '' 
6754 6754
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6755 6755
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6761,7 +6761,7 @@  discard block
 block discarded – undo
6761 6761
 		$airport_array = array();
6762 6762
 		$temp_array = array();
6763 6763
         
6764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6765 6765
 		{
6766 6766
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6767 6767
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6782,11 +6782,11 @@  discard block
 block discarded – undo
6782 6782
 	* @return Array the airport list
6783 6783
 	*
6784 6784
 	*/
6785
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6785
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6786 6786
 	{
6787
-		$filter_query = $this->getFilter($filters,true,true);
6788
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6789
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6787
+		$filter_query = $this->getFilter($filters, true, true);
6788
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6789
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6790 6790
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6791 6791
                     GROUP BY spotter_output.departure_airport_country
6792 6792
 					ORDER BY airport_departure_country_count DESC";
@@ -6798,7 +6798,7 @@  discard block
 block discarded – undo
6798 6798
 		$airport_array = array();
6799 6799
 		$temp_array = array();
6800 6800
         
6801
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6801
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6802 6802
 		{
6803 6803
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6804 6804
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6817,11 +6817,11 @@  discard block
 block discarded – undo
6817 6817
 	* @return Array the airport list
6818 6818
 	*
6819 6819
 	*/
6820
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6820
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6821 6821
 	{
6822
-		$filter_query = $this->getFilter($filters,true,true);
6823
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6824
-		$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 
6822
+		$filter_query = $this->getFilter($filters, true, true);
6823
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6824
+		$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 
6825 6825
 			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 <> '' 
6826 6826
                     GROUP BY spotter_output.departure_airport_icao
6827 6827
 					ORDER BY airport_departure_icao_count DESC";
@@ -6833,7 +6833,7 @@  discard block
 block discarded – undo
6833 6833
 		$airport_array = array();
6834 6834
 		$temp_array = array();
6835 6835
         
6836
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6836
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6837 6837
 		{
6838 6838
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6839 6839
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6854,11 +6854,11 @@  discard block
 block discarded – undo
6854 6854
 	* @return Array the airport list
6855 6855
 	*
6856 6856
 	*/
6857
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6857
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6858 6858
 	{
6859
-		$filter_query = $this->getFilter($filters,true,true);
6860
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6861
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6859
+		$filter_query = $this->getFilter($filters, true, true);
6860
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6861
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6862 6862
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6863 6863
                     GROUP BY spotter_output.departure_airport_country
6864 6864
 					ORDER BY airport_departure_country_count DESC";
@@ -6870,7 +6870,7 @@  discard block
 block discarded – undo
6870 6870
 		$airport_array = array();
6871 6871
 		$temp_array = array();
6872 6872
         
6873
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6873
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6874 6874
 		{
6875 6875
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6876 6876
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6888,11 +6888,11 @@  discard block
 block discarded – undo
6888 6888
 	* @return Array the airport list
6889 6889
 	*
6890 6890
 	*/
6891
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6891
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6892 6892
 	{
6893 6893
 		global $globalTimezone, $globalDBdriver;
6894
-		$filter_query = $this->getFilter($filters,true,true);
6895
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6894
+		$filter_query = $this->getFilter($filters, true, true);
6895
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6896 6896
 		if ($globalTimezone != '') {
6897 6897
 			date_default_timezone_set($globalTimezone);
6898 6898
 			$datetime = new DateTime($date);
@@ -6900,12 +6900,12 @@  discard block
 block discarded – undo
6900 6900
 		} else $offset = '+00:00';
6901 6901
 
6902 6902
 		if ($globalDBdriver == 'mysql') {
6903
-			$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 
6903
+			$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 
6904 6904
 					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
6905 6905
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6906 6906
 					ORDER BY airport_departure_icao_count DESC";
6907 6907
 		} else {
6908
-			$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 
6908
+			$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 
6909 6909
 					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
6910 6910
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6911 6911
 					ORDER BY airport_departure_icao_count DESC";
@@ -6917,7 +6917,7 @@  discard block
 block discarded – undo
6917 6917
 		$airport_array = array();
6918 6918
 		$temp_array = array();
6919 6919
         
6920
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6920
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6921 6921
 		{
6922 6922
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6923 6923
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6938,11 +6938,11 @@  discard block
 block discarded – undo
6938 6938
 	* @return Array the airport list
6939 6939
 	*
6940 6940
 	*/
6941
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6941
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6942 6942
 	{
6943 6943
 		global $globalTimezone, $globalDBdriver;
6944
-		$filter_query = $this->getFilter($filters,true,true);
6945
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6944
+		$filter_query = $this->getFilter($filters, true, true);
6945
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6946 6946
 		if ($globalTimezone != '') {
6947 6947
 			date_default_timezone_set($globalTimezone);
6948 6948
 			$datetime = new DateTime($date);
@@ -6950,12 +6950,12 @@  discard block
 block discarded – undo
6950 6950
 		} else $offset = '+00:00';
6951 6951
 
6952 6952
 		if ($globalDBdriver == 'mysql') {
6953
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6953
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6954 6954
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6955 6955
 					GROUP BY spotter_output.departure_airport_country
6956 6956
 					ORDER BY airport_departure_country_count DESC";
6957 6957
 		} else {
6958
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6958
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6959 6959
 					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 
6960 6960
 					GROUP BY spotter_output.departure_airport_country
6961 6961
 					ORDER BY airport_departure_country_count DESC";
@@ -6967,7 +6967,7 @@  discard block
 block discarded – undo
6967 6967
 		$airport_array = array();
6968 6968
 		$temp_array = array();
6969 6969
         
6970
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6970
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6971 6971
 		{
6972 6972
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6973 6973
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6985,11 +6985,11 @@  discard block
 block discarded – undo
6985 6985
 	* @return Array the airport list
6986 6986
 	*
6987 6987
 	*/
6988
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6988
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6989 6989
 	{
6990
-		$filter_query = $this->getFilter($filters,true,true);
6991
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6992
-		$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 
6990
+		$filter_query = $this->getFilter($filters, true, true);
6991
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6992
+		$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 
6993 6993
 		    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 
6994 6994
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6995 6995
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7001,7 +7001,7 @@  discard block
 block discarded – undo
7001 7001
 		$airport_array = array();
7002 7002
 		$temp_array = array();
7003 7003
         
7004
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7004
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7005 7005
 		{
7006 7006
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7007 7007
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7021,11 +7021,11 @@  discard block
 block discarded – undo
7021 7021
 	* @return Array the airport list
7022 7022
 	*
7023 7023
 	*/
7024
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7024
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7025 7025
 	{
7026
-		$filter_query = $this->getFilter($filters,true,true);
7027
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7028
-		$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 
7026
+		$filter_query = $this->getFilter($filters, true, true);
7027
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7028
+		$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 
7029 7029
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7030 7030
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7031 7031
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7037,7 +7037,7 @@  discard block
 block discarded – undo
7037 7037
 		$airport_array = array();
7038 7038
 		$temp_array = array();
7039 7039
         
7040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7041 7041
 		{
7042 7042
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7043 7043
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7057,11 +7057,11 @@  discard block
 block discarded – undo
7057 7057
 	* @return Array the airport list
7058 7058
 	*
7059 7059
 	*/
7060
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7060
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7061 7061
 	{
7062
-		$filter_query = $this->getFilter($filters,true,true);
7063
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7064
-		$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 
7062
+		$filter_query = $this->getFilter($filters, true, true);
7063
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7064
+		$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 
7065 7065
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7066 7066
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7067 7067
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7072,7 +7072,7 @@  discard block
 block discarded – undo
7072 7072
 		$airport_array = array();
7073 7073
 		$temp_array = array();
7074 7074
         
7075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7076 7076
 		{
7077 7077
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7078 7078
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7094,11 +7094,11 @@  discard block
 block discarded – undo
7094 7094
 	* @return Array the airport list
7095 7095
 	*
7096 7096
 	*/
7097
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7097
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7098 7098
 	{
7099
-		$filter_query = $this->getFilter($filters,true,true);
7100
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7101
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7099
+		$filter_query = $this->getFilter($filters, true, true);
7100
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7101
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7102 7102
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7103 7103
                     GROUP BY spotter_output.departure_airport_country
7104 7104
 					ORDER BY airport_departure_country_count DESC";
@@ -7110,7 +7110,7 @@  discard block
 block discarded – undo
7110 7110
 		$airport_array = array();
7111 7111
 		$temp_array = array();
7112 7112
         
7113
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7113
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7114 7114
 		{
7115 7115
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7116 7116
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7127,11 +7127,11 @@  discard block
 block discarded – undo
7127 7127
 	* @return Array the airport list
7128 7128
 	*
7129 7129
 	*/
7130
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7130
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7131 7131
 	{
7132
-		$filter_query = $this->getFilter($filters,true,true);
7133
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7134
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7132
+		$filter_query = $this->getFilter($filters, true, true);
7133
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7134
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7135 7135
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7136 7136
 			GROUP BY spotter_output.departure_airport_country
7137 7137
 			ORDER BY airport_departure_country_count DESC";
@@ -7147,11 +7147,11 @@  discard block
 block discarded – undo
7147 7147
 	* @return Array the airport list
7148 7148
 	*
7149 7149
 	*/
7150
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7150
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7151 7151
 	{
7152
-		$filter_query = $this->getFilter($filters,true,true);
7153
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7154
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7152
+		$filter_query = $this->getFilter($filters, true, true);
7153
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7154
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7155 7155
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7156 7156
 			GROUP BY spotter_output.departure_airport_country
7157 7157
 			ORDER BY airport_departure_country_count DESC";
@@ -7169,12 +7169,12 @@  discard block
 block discarded – undo
7169 7169
 	* @return Array the airport list
7170 7170
 	*
7171 7171
 	*/
7172
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7172
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7173 7173
 	{
7174
-		$filter_query = $this->getFilter($filters,true,true);
7175
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7174
+		$filter_query = $this->getFilter($filters, true, true);
7175
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7176 7176
 
7177
-		$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 
7177
+		$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 
7178 7178
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7179 7179
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7180 7180
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7186,7 +7186,7 @@  discard block
 block discarded – undo
7186 7186
 		$airport_array = array();
7187 7187
 		$temp_array = array();
7188 7188
         
7189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7190 7190
 		{
7191 7191
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7192 7192
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7207,11 +7207,11 @@  discard block
 block discarded – undo
7207 7207
 	* @return Array the airport list
7208 7208
 	*
7209 7209
 	*/
7210
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7210
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7211 7211
 	{
7212
-		$filter_query = $this->getFilter($filters,true,true);
7213
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7214
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7212
+		$filter_query = $this->getFilter($filters, true, true);
7213
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7214
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7215 7215
 			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 
7216 7216
                     GROUP BY spotter_output.departure_airport_country
7217 7217
 					ORDER BY airport_departure_country_count DESC";
@@ -7223,7 +7223,7 @@  discard block
 block discarded – undo
7223 7223
 		$airport_array = array();
7224 7224
 		$temp_array = array();
7225 7225
         
7226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7227 7227
 		{
7228 7228
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7229 7229
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7246,11 +7246,11 @@  discard block
 block discarded – undo
7246 7246
 	* @return Array the airport list
7247 7247
 	*
7248 7248
 	*/
7249
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7249
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7250 7250
 	{
7251 7251
 		global $globalDBdriver;
7252
-		$filter_query = $this->getFilter($filters,true,true);
7253
-		$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 
7252
+		$filter_query = $this->getFilter($filters, true, true);
7253
+		$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 
7254 7254
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7255 7255
                 if ($olderthanmonths > 0) {
7256 7256
             		if ($globalDBdriver == 'mysql') {
@@ -7270,28 +7270,28 @@  discard block
 block discarded – undo
7270 7270
 		if ($year != '') {
7271 7271
 			if ($globalDBdriver == 'mysql') {
7272 7272
 				$query .= " AND YEAR(spotter_output.date) = :year";
7273
-				$query_values = array_merge($query_values,array(':year' => $year));
7273
+				$query_values = array_merge($query_values, array(':year' => $year));
7274 7274
 			} else {
7275 7275
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7276
-				$query_values = array_merge($query_values,array(':year' => $year));
7276
+				$query_values = array_merge($query_values, array(':year' => $year));
7277 7277
 			}
7278 7278
 		}
7279 7279
 		if ($month != '') {
7280 7280
 			if ($globalDBdriver == 'mysql') {
7281 7281
 				$query .= " AND MONTH(spotter_output.date) = :month";
7282
-				$query_values = array_merge($query_values,array(':month' => $month));
7282
+				$query_values = array_merge($query_values, array(':month' => $month));
7283 7283
 			} else {
7284 7284
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7285
-				$query_values = array_merge($query_values,array(':month' => $month));
7285
+				$query_values = array_merge($query_values, array(':month' => $month));
7286 7286
 			}
7287 7287
 		}
7288 7288
 		if ($day != '') {
7289 7289
 			if ($globalDBdriver == 'mysql') {
7290 7290
 				$query .= " AND DAY(spotter_output.date) = :day";
7291
-				$query_values = array_merge($query_values,array(':day' => $day));
7291
+				$query_values = array_merge($query_values, array(':day' => $day));
7292 7292
 			} else {
7293 7293
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7294
-				$query_values = array_merge($query_values,array(':day' => $day));
7294
+				$query_values = array_merge($query_values, array(':day' => $day));
7295 7295
 			}
7296 7296
 		}
7297 7297
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -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['airport_arrival_icao'] = $row['arrival_airport_icao'];
7311 7311
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7328,11 +7328,11 @@  discard block
 block discarded – undo
7328 7328
 	* @return Array the airport list
7329 7329
 	*
7330 7330
 	*/
7331
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7331
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7332 7332
 	{
7333 7333
 		global $globalDBdriver;
7334
-		$filter_query = $this->getFilter($filters,true,true);
7335
-		$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 
7334
+		$filter_query = $this->getFilter($filters, true, true);
7335
+		$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 
7336 7336
 			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 <> '' ";
7337 7337
                 if ($olderthanmonths > 0) {
7338 7338
             		if ($globalDBdriver == 'mysql') {
@@ -7362,7 +7362,7 @@  discard block
 block discarded – undo
7362 7362
 		$airport_array = array();
7363 7363
 		$temp_array = array();
7364 7364
         
7365
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7365
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7366 7366
 		{
7367 7367
 			$temp_array['airline_icao'] = $row['airline_icao'];
7368 7368
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7387,11 +7387,11 @@  discard block
 block discarded – undo
7387 7387
 	* @return Array the airport list
7388 7388
 	*
7389 7389
 	*/
7390
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7390
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7391 7391
 	{
7392 7392
 		global $globalDBdriver;
7393
-		$filter_query = $this->getFilter($filters,true,true);
7394
-		$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 
7393
+		$filter_query = $this->getFilter($filters, true, true);
7394
+		$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 
7395 7395
 			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";
7396 7396
                 if ($olderthanmonths > 0) {
7397 7397
             		if ($globalDBdriver == 'mysql') {
@@ -7411,28 +7411,28 @@  discard block
 block discarded – undo
7411 7411
 		if ($year != '') {
7412 7412
 			if ($globalDBdriver == 'mysql') {
7413 7413
 				$query .= " AND YEAR(spotter_output.date) = :year";
7414
-				$query_values = array_merge($query_values,array(':year' => $year));
7414
+				$query_values = array_merge($query_values, array(':year' => $year));
7415 7415
 			} else {
7416 7416
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7417
-				$query_values = array_merge($query_values,array(':year' => $year));
7417
+				$query_values = array_merge($query_values, array(':year' => $year));
7418 7418
 			}
7419 7419
 		}
7420 7420
 		if ($month != '') {
7421 7421
 			if ($globalDBdriver == 'mysql') {
7422 7422
 				$query .= " AND MONTH(spotter_output.date) = :month";
7423
-				$query_values = array_merge($query_values,array(':month' => $month));
7423
+				$query_values = array_merge($query_values, array(':month' => $month));
7424 7424
 			} else {
7425 7425
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7426
-				$query_values = array_merge($query_values,array(':month' => $month));
7426
+				$query_values = array_merge($query_values, array(':month' => $month));
7427 7427
 			}
7428 7428
 		}
7429 7429
 		if ($day != '') {
7430 7430
 			if ($globalDBdriver == 'mysql') {
7431 7431
 				$query .= " AND DAY(spotter_output.date) = :day";
7432
-				$query_values = array_merge($query_values,array(':day' => $day));
7432
+				$query_values = array_merge($query_values, array(':day' => $day));
7433 7433
 			} else {
7434 7434
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7435
-				$query_values = array_merge($query_values,array(':day' => $day));
7435
+				$query_values = array_merge($query_values, array(':day' => $day));
7436 7436
 			}
7437 7437
 		}
7438 7438
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7445,7 +7445,7 @@  discard block
 block discarded – undo
7445 7445
       
7446 7446
 		$airport_array = array();
7447 7447
 		$temp_array = array();
7448
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7448
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7449 7449
 		{
7450 7450
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7451 7451
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7468,11 +7468,11 @@  discard block
 block discarded – undo
7468 7468
 	* @return Array the airport list
7469 7469
 	*
7470 7470
 	*/
7471
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7471
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7472 7472
 	{
7473 7473
 		global $globalDBdriver;
7474
-		$filter_query = $this->getFilter($filters,true,true);
7475
-		$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 
7474
+		$filter_query = $this->getFilter($filters, true, true);
7475
+		$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 
7476 7476
 			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 ";
7477 7477
                 if ($olderthanmonths > 0) {
7478 7478
             		if ($globalDBdriver == 'mysql') {
@@ -7502,7 +7502,7 @@  discard block
 block discarded – undo
7502 7502
 		$airport_array = array();
7503 7503
 		$temp_array = array();
7504 7504
         
7505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7506 7506
 		{
7507 7507
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7508 7508
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7528,9 +7528,9 @@  discard block
 block discarded – undo
7528 7528
 	*/
7529 7529
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7530 7530
 	{
7531
-		$filter_query = $this->getFilter($filters,true,true);
7532
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7533
-		$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 
7531
+		$filter_query = $this->getFilter($filters, true, true);
7532
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7533
+		$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 
7534 7534
 			    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 
7535 7535
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7536 7536
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7541,7 +7541,7 @@  discard block
 block discarded – undo
7541 7541
 		$airport_array = array();
7542 7542
 		$temp_array = array();
7543 7543
         
7544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7545 7545
 		{
7546 7546
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7547 7547
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7562,12 +7562,12 @@  discard block
 block discarded – undo
7562 7562
 	* @return Array the airport list
7563 7563
 	*
7564 7564
 	*/
7565
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7565
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7566 7566
 	{
7567
-		$filter_query = $this->getFilter($filters,true,true);
7568
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7567
+		$filter_query = $this->getFilter($filters, true, true);
7568
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7569 7569
 					
7570
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7570
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7571 7571
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7572 7572
                     GROUP BY spotter_output.arrival_airport_country
7573 7573
 					ORDER BY airport_arrival_country_count DESC";
@@ -7579,7 +7579,7 @@  discard block
 block discarded – undo
7579 7579
 		$airport_array = array();
7580 7580
 		$temp_array = array();
7581 7581
         
7582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7583 7583
 		{
7584 7584
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7585 7585
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7597,11 +7597,11 @@  discard block
 block discarded – undo
7597 7597
 	* @return Array the airport list
7598 7598
 	*
7599 7599
 	*/
7600
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7600
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7601 7601
 	{
7602
-		$filter_query = $this->getFilter($filters,true,true);
7603
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7604
-		$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 
7602
+		$filter_query = $this->getFilter($filters, true, true);
7603
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7604
+		$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 
7605 7605
 			    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 
7606 7606
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7607 7607
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7613,7 +7613,7 @@  discard block
 block discarded – undo
7613 7613
 		$airport_array = array();
7614 7614
 		$temp_array = array();
7615 7615
         
7616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7617 7617
 		{
7618 7618
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7619 7619
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7635,11 +7635,11 @@  discard block
 block discarded – undo
7635 7635
 	* @return Array the airport list
7636 7636
 	*
7637 7637
 	*/
7638
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7638
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7639 7639
 	{
7640
-		$filter_query = $this->getFilter($filters,true,true);
7641
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7642
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7640
+		$filter_query = $this->getFilter($filters, true, true);
7641
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7642
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7643 7643
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7644 7644
                     GROUP BY spotter_output.arrival_airport_country
7645 7645
 					ORDER BY airport_arrival_country_count DESC";
@@ -7651,7 +7651,7 @@  discard block
 block discarded – undo
7651 7651
 		$airport_array = array();
7652 7652
 		$temp_array = array();
7653 7653
         
7654
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7654
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7655 7655
 		{
7656 7656
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7657 7657
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7669,12 +7669,12 @@  discard block
 block discarded – undo
7669 7669
 	* @return Array the airport list
7670 7670
 	*
7671 7671
 	*/
7672
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7672
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
7673 7673
 	{
7674
-		$filter_query = $this->getFilter($filters,true,true);
7675
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7674
+		$filter_query = $this->getFilter($filters, true, true);
7675
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7676 7676
 
7677
-		$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 
7677
+		$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 
7678 7678
 			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 
7679 7679
                     GROUP BY spotter_output.arrival_airport_icao
7680 7680
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7686,7 +7686,7 @@  discard block
 block discarded – undo
7686 7686
 		$airport_array = array();
7687 7687
 		$temp_array = array();
7688 7688
         
7689
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7689
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7690 7690
 		{
7691 7691
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7692 7692
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7707,11 +7707,11 @@  discard block
 block discarded – undo
7707 7707
 	* @return Array the airport list
7708 7708
 	*
7709 7709
 	*/
7710
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7710
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
7711 7711
 	{
7712
-		$filter_query = $this->getFilter($filters,true,true);
7713
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7714
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7712
+		$filter_query = $this->getFilter($filters, true, true);
7713
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7714
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7715 7715
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
7716 7716
                     GROUP BY spotter_output.arrival_airport_country
7717 7717
 					ORDER BY airport_arrival_country_count DESC";
@@ -7723,7 +7723,7 @@  discard block
 block discarded – undo
7723 7723
 		$airport_array = array();
7724 7724
 		$temp_array = array();
7725 7725
         
7726
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7726
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7727 7727
 		{
7728 7728
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7729 7729
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7742,11 +7742,11 @@  discard block
 block discarded – undo
7742 7742
 	* @return Array the airport list
7743 7743
 	*
7744 7744
 	*/
7745
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7745
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
7746 7746
 	{
7747
-		$filter_query = $this->getFilter($filters,true,true);
7748
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7749
-		$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 
7747
+		$filter_query = $this->getFilter($filters, true, true);
7748
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7749
+		$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 
7750 7750
 			    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 
7751 7751
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7752 7752
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7758,7 +7758,7 @@  discard block
 block discarded – undo
7758 7758
 		$airport_array = array();
7759 7759
 		$temp_array = array();
7760 7760
         
7761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7762 7762
 		{
7763 7763
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7764 7764
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7779,11 +7779,11 @@  discard block
 block discarded – undo
7779 7779
 	* @return Array the airport list
7780 7780
 	*
7781 7781
 	*/
7782
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7782
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7783 7783
 	{
7784
-		$filter_query = $this->getFilter($filters,true,true);
7785
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7786
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7784
+		$filter_query = $this->getFilter($filters, true, true);
7785
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7786
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7787 7787
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7788 7788
                     GROUP BY spotter_output.arrival_airport_country
7789 7789
 					ORDER BY airport_arrival_country_count DESC";
@@ -7795,7 +7795,7 @@  discard block
 block discarded – undo
7795 7795
 		$airport_array = array();
7796 7796
 		$temp_array = array();
7797 7797
         
7798
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7798
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7799 7799
 		{
7800 7800
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7801 7801
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7813,11 +7813,11 @@  discard block
 block discarded – undo
7813 7813
 	* @return Array the airport list
7814 7814
 	*
7815 7815
 	*/
7816
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7816
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7817 7817
 	{
7818
-		$filter_query = $this->getFilter($filters,true,true);
7819
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7820
-		$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 
7818
+		$filter_query = $this->getFilter($filters, true, true);
7819
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7820
+		$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 
7821 7821
 			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 
7822 7822
                     GROUP BY spotter_output.arrival_airport_icao
7823 7823
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7829,7 +7829,7 @@  discard block
 block discarded – undo
7829 7829
 		$airport_array = array();
7830 7830
 		$temp_array = array();
7831 7831
         
7832
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7832
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7833 7833
 		{
7834 7834
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7835 7835
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7851,11 +7851,11 @@  discard block
 block discarded – undo
7851 7851
 	* @return Array the airport list
7852 7852
 	*
7853 7853
 	*/
7854
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7854
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7855 7855
 	{
7856
-		$filter_query = $this->getFilter($filters,true,true);
7857
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7858
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7856
+		$filter_query = $this->getFilter($filters, true, true);
7857
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7858
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7859 7859
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7860 7860
                     GROUP BY spotter_output.arrival_airport_country
7861 7861
 					ORDER BY airport_arrival_country_count DESC";
@@ -7867,7 +7867,7 @@  discard block
 block discarded – undo
7867 7867
 		$airport_array = array();
7868 7868
 		$temp_array = array();
7869 7869
         
7870
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7870
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7871 7871
 		{
7872 7872
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7873 7873
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7886,11 +7886,11 @@  discard block
 block discarded – undo
7886 7886
 	* @return Array the airport list
7887 7887
 	*
7888 7888
 	*/
7889
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7889
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7890 7890
 	{
7891 7891
 		global $globalTimezone, $globalDBdriver;
7892
-		$filter_query = $this->getFilter($filters,true,true);
7893
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7892
+		$filter_query = $this->getFilter($filters, true, true);
7893
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7894 7894
 		if ($globalTimezone != '') {
7895 7895
 			date_default_timezone_set($globalTimezone);
7896 7896
 			$datetime = new DateTime($date);
@@ -7898,12 +7898,12 @@  discard block
 block discarded – undo
7898 7898
 		} else $offset = '+00:00';
7899 7899
 
7900 7900
 		if ($globalDBdriver == 'mysql') {
7901
-			$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 
7901
+			$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 
7902 7902
 					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  
7903 7903
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7904 7904
 					ORDER BY airport_arrival_icao_count DESC";
7905 7905
 		} else {
7906
-			$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 
7906
+			$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 
7907 7907
 					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  
7908 7908
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7909 7909
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7915,7 +7915,7 @@  discard block
 block discarded – undo
7915 7915
 		$airport_array = array();
7916 7916
 		$temp_array = array();
7917 7917
         
7918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7919 7919
 		{
7920 7920
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7921 7921
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7939,8 +7939,8 @@  discard block
 block discarded – undo
7939 7939
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7940 7940
 	{
7941 7941
 		global $globalTimezone, $globalDBdriver;
7942
-		$filter_query = $this->getFilter($filters,true,true);
7943
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7942
+		$filter_query = $this->getFilter($filters, true, true);
7943
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7944 7944
 		if ($globalTimezone != '') {
7945 7945
 			date_default_timezone_set($globalTimezone);
7946 7946
 			$datetime = new DateTime($date);
@@ -7948,12 +7948,12 @@  discard block
 block discarded – undo
7948 7948
 		} else $offset = '+00:00';
7949 7949
 
7950 7950
 		if ($globalDBdriver == 'mysql') {
7951
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7951
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7952 7952
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7953 7953
 					GROUP BY spotter_output.arrival_airport_country
7954 7954
 					ORDER BY airport_arrival_country_count DESC";
7955 7955
 		} else {
7956
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7956
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7957 7957
 					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 
7958 7958
 					GROUP BY spotter_output.arrival_airport_country
7959 7959
 					ORDER BY airport_arrival_country_count DESC";
@@ -7965,7 +7965,7 @@  discard block
 block discarded – undo
7965 7965
 		$airport_array = array();
7966 7966
 		$temp_array = array();
7967 7967
         
7968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7969 7969
 		{
7970 7970
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7971 7971
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7983,11 +7983,11 @@  discard block
 block discarded – undo
7983 7983
 	* @return Array the airport list
7984 7984
 	*
7985 7985
 	*/
7986
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7986
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7987 7987
 	{
7988
-		$filter_query = $this->getFilter($filters,true,true);
7989
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7990
-		$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 
7988
+		$filter_query = $this->getFilter($filters, true, true);
7989
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7990
+		$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 
7991 7991
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7992 7992
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7993 7993
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7999,7 +7999,7 @@  discard block
 block discarded – undo
7999 7999
 		$airport_array = array();
8000 8000
 		$temp_array = array();
8001 8001
         
8002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8003 8003
 		{
8004 8004
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8005 8005
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8019,11 +8019,11 @@  discard block
 block discarded – undo
8019 8019
 	* @return Array the airport list
8020 8020
 	*
8021 8021
 	*/
8022
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8022
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8023 8023
 	{
8024
-		$filter_query = $this->getFilter($filters,true,true);
8025
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8026
-		$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 
8024
+		$filter_query = $this->getFilter($filters, true, true);
8025
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8026
+		$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 
8027 8027
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8028 8028
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8029 8029
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8034,7 +8034,7 @@  discard block
 block discarded – undo
8034 8034
 		$airport_array = array();
8035 8035
 		$temp_array = array();
8036 8036
         
8037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8038 8038
 		{
8039 8039
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8040 8040
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8054,11 +8054,11 @@  discard block
 block discarded – undo
8054 8054
 	* @return Array the airport list
8055 8055
 	*
8056 8056
 	*/
8057
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8057
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8058 8058
 	{
8059
-		$filter_query = $this->getFilter($filters,true,true);
8060
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8061
-		$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 
8059
+		$filter_query = $this->getFilter($filters, true, true);
8060
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8061
+		$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 
8062 8062
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8063 8063
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8064 8064
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8069,7 +8069,7 @@  discard block
 block discarded – undo
8069 8069
 		$airport_array = array();
8070 8070
 		$temp_array = array();
8071 8071
         
8072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8073 8073
 		{
8074 8074
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8075 8075
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8091,9 +8091,9 @@  discard block
 block discarded – undo
8091 8091
 	*/
8092 8092
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8093 8093
 	{
8094
-		$filter_query = $this->getFilter($filters,true,true);
8095
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8096
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8094
+		$filter_query = $this->getFilter($filters, true, true);
8095
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8096
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8097 8097
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8098 8098
                     GROUP BY spotter_output.arrival_airport_country
8099 8099
 					ORDER BY airport_arrival_country_count DESC";
@@ -8105,7 +8105,7 @@  discard block
 block discarded – undo
8105 8105
 		$airport_array = array();
8106 8106
 		$temp_array = array();
8107 8107
         
8108
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8108
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8109 8109
 		{
8110 8110
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8111 8111
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8124,9 +8124,9 @@  discard block
 block discarded – undo
8124 8124
 	*/
8125 8125
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8126 8126
 	{
8127
-		$filter_query = $this->getFilter($filters,true,true);
8128
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8129
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8127
+		$filter_query = $this->getFilter($filters, true, true);
8128
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8129
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8130 8130
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8131 8131
                     GROUP BY spotter_output.arrival_airport_country
8132 8132
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8144,9 +8144,9 @@  discard block
 block discarded – undo
8144 8144
 	*/
8145 8145
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8146 8146
 	{
8147
-		$filter_query = $this->getFilter($filters,true,true);
8148
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8149
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8147
+		$filter_query = $this->getFilter($filters, true, true);
8148
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8149
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8150 8150
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8151 8151
                     GROUP BY spotter_output.arrival_airport_country
8152 8152
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8164,11 +8164,11 @@  discard block
 block discarded – undo
8164 8164
 	* @return Array the airport list
8165 8165
 	*
8166 8166
 	*/
8167
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8167
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8168 8168
 	{
8169
-		$filter_query = $this->getFilter($filters,true,true);
8170
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8171
-		$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 
8169
+		$filter_query = $this->getFilter($filters, true, true);
8170
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8171
+		$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 
8172 8172
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8173 8173
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8174 8174
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8180,7 +8180,7 @@  discard block
 block discarded – undo
8180 8180
 		$airport_array = array();
8181 8181
 		$temp_array = array();
8182 8182
         
8183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8184 8184
 		{
8185 8185
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8186 8186
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8201,12 +8201,12 @@  discard block
 block discarded – undo
8201 8201
 	* @return Array the airport list
8202 8202
 	*
8203 8203
 	*/
8204
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8204
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8205 8205
 	{
8206 8206
 		global $globalDBdriver;
8207
-		$filter_query = $this->getFilter($filters,true,true);
8208
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8209
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8207
+		$filter_query = $this->getFilter($filters, true, true);
8208
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8209
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8210 8210
 			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 
8211 8211
                     GROUP BY spotter_output.arrival_airport_country
8212 8212
 					ORDER BY airport_arrival_country_count DESC";
@@ -8218,7 +8218,7 @@  discard block
 block discarded – undo
8218 8218
 		$airport_array = array();
8219 8219
 		$temp_array = array();
8220 8220
         
8221
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8221
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8222 8222
 		{
8223 8223
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8224 8224
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8237,38 +8237,38 @@  discard block
 block discarded – undo
8237 8237
 	* @return Array the airport departure list
8238 8238
 	*
8239 8239
 	*/
8240
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8240
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8241 8241
 	{
8242 8242
 		global $globalDBdriver;
8243
-		$filter_query = $this->getFilter($filters,true,true);
8244
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8243
+		$filter_query = $this->getFilter($filters, true, true);
8244
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8245 8245
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8246 8246
 		$query_values = array();
8247 8247
 		if ($year != '') {
8248 8248
 			if ($globalDBdriver == 'mysql') {
8249 8249
 				$query .= " AND YEAR(spotter_output.date) = :year";
8250
-				$query_values = array_merge($query_values,array(':year' => $year));
8250
+				$query_values = array_merge($query_values, array(':year' => $year));
8251 8251
 			} else {
8252 8252
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8253
-				$query_values = array_merge($query_values,array(':year' => $year));
8253
+				$query_values = array_merge($query_values, array(':year' => $year));
8254 8254
 			}
8255 8255
 		}
8256 8256
 		if ($month != '') {
8257 8257
 			if ($globalDBdriver == 'mysql') {
8258 8258
 				$query .= " AND MONTH(spotter_output.date) = :month";
8259
-				$query_values = array_merge($query_values,array(':month' => $month));
8259
+				$query_values = array_merge($query_values, array(':month' => $month));
8260 8260
 			} else {
8261 8261
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8262
-				$query_values = array_merge($query_values,array(':month' => $month));
8262
+				$query_values = array_merge($query_values, array(':month' => $month));
8263 8263
 			}
8264 8264
 		}
8265 8265
 		if ($day != '') {
8266 8266
 			if ($globalDBdriver == 'mysql') {
8267 8267
 				$query .= " AND DAY(spotter_output.date) = :day";
8268
-				$query_values = array_merge($query_values,array(':day' => $day));
8268
+				$query_values = array_merge($query_values, array(':day' => $day));
8269 8269
 			} else {
8270 8270
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8271
-				$query_values = array_merge($query_values,array(':day' => $day));
8271
+				$query_values = array_merge($query_values, array(':day' => $day));
8272 8272
 			}
8273 8273
 		}
8274 8274
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8282,7 +8282,7 @@  discard block
 block discarded – undo
8282 8282
 		$airport_array = array();
8283 8283
 		$temp_array = array();
8284 8284
         
8285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8286 8286
 		{
8287 8287
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8288 8288
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8300,38 +8300,38 @@  discard block
 block discarded – undo
8300 8300
 	* @return Array the airport arrival list
8301 8301
 	*
8302 8302
 	*/
8303
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8303
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8304 8304
 	{
8305 8305
 		global $globalDBdriver;
8306
-		$filter_query = $this->getFilter($filters,true,true);
8307
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8306
+		$filter_query = $this->getFilter($filters, true, true);
8307
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8308 8308
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8309 8309
 		$query_values = array();
8310 8310
 		if ($year != '') {
8311 8311
 			if ($globalDBdriver == 'mysql') {
8312 8312
 				$query .= " AND YEAR(spotter_output.date) = :year";
8313
-				$query_values = array_merge($query_values,array(':year' => $year));
8313
+				$query_values = array_merge($query_values, array(':year' => $year));
8314 8314
 			} else {
8315 8315
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8316
-				$query_values = array_merge($query_values,array(':year' => $year));
8316
+				$query_values = array_merge($query_values, array(':year' => $year));
8317 8317
 			}
8318 8318
 		}
8319 8319
 		if ($month != '') {
8320 8320
 			if ($globalDBdriver == 'mysql') {
8321 8321
 				$query .= " AND MONTH(spotter_output.date) = :month";
8322
-				$query_values = array_merge($query_values,array(':month' => $month));
8322
+				$query_values = array_merge($query_values, array(':month' => $month));
8323 8323
 			} else {
8324 8324
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8325
-				$query_values = array_merge($query_values,array(':month' => $month));
8325
+				$query_values = array_merge($query_values, array(':month' => $month));
8326 8326
 			}
8327 8327
 		}
8328 8328
 		if ($day != '') {
8329 8329
 			if ($globalDBdriver == 'mysql') {
8330 8330
 				$query .= " AND DAY(spotter_output.date) = :day";
8331
-				$query_values = array_merge($query_values,array(':day' => $day));
8331
+				$query_values = array_merge($query_values, array(':day' => $day));
8332 8332
 			} else {
8333 8333
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8334
-				$query_values = array_merge($query_values,array(':day' => $day));
8334
+				$query_values = array_merge($query_values, array(':day' => $day));
8335 8335
 			}
8336 8336
 		}
8337 8337
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8345,7 +8345,7 @@  discard block
 block discarded – undo
8345 8345
 		$airport_array = array();
8346 8346
 		$temp_array = array();
8347 8347
         
8348
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8348
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8349 8349
 		{
8350 8350
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8351 8351
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8368,8 +8368,8 @@  discard block
 block discarded – undo
8368 8368
 	*/
8369 8369
 	public function countAllRoutes($filters = array())
8370 8370
 	{
8371
-		$filter_query = $this->getFilter($filters,true,true);
8372
-		$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
8371
+		$filter_query = $this->getFilter($filters, true, true);
8372
+		$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
8373 8373
 		    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 <> ''
8374 8374
                     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
8375 8375
                     ORDER BY route_count DESC
@@ -8382,7 +8382,7 @@  discard block
 block discarded – undo
8382 8382
 		$routes_array = array();
8383 8383
 		$temp_array = array();
8384 8384
         
8385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8386 8386
 		{
8387 8387
 			$temp_array['route_count'] = $row['route_count'];
8388 8388
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8409,11 +8409,11 @@  discard block
 block discarded – undo
8409 8409
 	* @return Array the route list
8410 8410
 	*
8411 8411
 	*/
8412
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8412
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8413 8413
 	{
8414
-		$filter_query = $this->getFilter($filters,true,true);
8415
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8416
-		$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
8414
+		$filter_query = $this->getFilter($filters, true, true);
8415
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8416
+		$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
8417 8417
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8418 8418
 			    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 
8419 8419
 			    ORDER BY route_count DESC";
@@ -8424,7 +8424,7 @@  discard block
 block discarded – undo
8424 8424
 		$routes_array = array();
8425 8425
 		$temp_array = array();
8426 8426
         
8427
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8427
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8428 8428
 		{
8429 8429
 			$temp_array['route_count'] = $row['route_count'];
8430 8430
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8451,9 +8451,9 @@  discard block
 block discarded – undo
8451 8451
 	*/
8452 8452
 	public function countAllRoutesByRegistration($registration, $filters = array())
8453 8453
 	{
8454
-		$filter_query = $this->getFilter($filters,true,true);
8454
+		$filter_query = $this->getFilter($filters, true, true);
8455 8455
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8456
-		$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
8456
+		$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
8457 8457
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8458 8458
                     GROUP BY route
8459 8459
                     ORDER BY route_count DESC";
@@ -8465,7 +8465,7 @@  discard block
 block discarded – undo
8465 8465
 		$routes_array = array();
8466 8466
 		$temp_array = array();
8467 8467
         
8468
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8468
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8469 8469
 		{
8470 8470
 			$temp_array['route_count'] = $row['route_count'];
8471 8471
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8493,9 +8493,9 @@  discard block
 block discarded – undo
8493 8493
 	*/
8494 8494
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8495 8495
 	{
8496
-		$filter_query = $this->getFilter($filters,true,true);
8497
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8498
-		$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
8496
+		$filter_query = $this->getFilter($filters, true, true);
8497
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8498
+		$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
8499 8499
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8500 8500
 			    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 
8501 8501
 			    ORDER BY route_count DESC";
@@ -8507,7 +8507,7 @@  discard block
 block discarded – undo
8507 8507
 		$routes_array = array();
8508 8508
 		$temp_array = array();
8509 8509
         
8510
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8510
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8511 8511
 		{
8512 8512
 			$temp_array['route_count'] = $row['route_count'];
8513 8513
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8535,9 +8535,9 @@  discard block
 block discarded – undo
8535 8535
 	*/
8536 8536
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8537 8537
 	{
8538
-		$filter_query = $this->getFilter($filters,true,true);
8539
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8540
-		$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
8538
+		$filter_query = $this->getFilter($filters, true, true);
8539
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8540
+		$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
8541 8541
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8542 8542
 			    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 
8543 8543
 			    ORDER BY route_count DESC";
@@ -8548,7 +8548,7 @@  discard block
 block discarded – undo
8548 8548
 		$routes_array = array();
8549 8549
 		$temp_array = array();
8550 8550
         
8551
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8551
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8552 8552
 		{
8553 8553
 			$temp_array['route_count'] = $row['route_count'];
8554 8554
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8576,9 +8576,9 @@  discard block
 block discarded – undo
8576 8576
 	*/
8577 8577
 	public function countAllRoutesByCountry($country, $filters = array())
8578 8578
 	{
8579
-		$filter_query = $this->getFilter($filters,true,true);
8580
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8581
-		$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
8579
+		$filter_query = $this->getFilter($filters, true, true);
8580
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8581
+		$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
8582 8582
 			    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 
8583 8583
 			    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 
8584 8584
 			    ORDER BY route_count DESC";
@@ -8589,7 +8589,7 @@  discard block
 block discarded – undo
8589 8589
 		$routes_array = array();
8590 8590
 		$temp_array = array();
8591 8591
         
8592
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8592
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8593 8593
 		{
8594 8594
 			$temp_array['route_count'] = $row['route_count'];
8595 8595
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8617,8 +8617,8 @@  discard block
 block discarded – undo
8617 8617
 	public function countAllRoutesByDate($date, $filters = array())
8618 8618
 	{
8619 8619
 		global $globalTimezone, $globalDBdriver;
8620
-		$filter_query = $this->getFilter($filters,true,true);
8621
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8620
+		$filter_query = $this->getFilter($filters, true, true);
8621
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8622 8622
 		if ($globalTimezone != '') {
8623 8623
 			date_default_timezone_set($globalTimezone);
8624 8624
 			$datetime = new DateTime($date);
@@ -8626,12 +8626,12 @@  discard block
 block discarded – undo
8626 8626
 		} else $offset = '+00:00';
8627 8627
 		
8628 8628
 		if ($globalDBdriver == 'mysql') {
8629
-			$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
8629
+			$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
8630 8630
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8631 8631
 				    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
8632 8632
 				    ORDER BY route_count DESC";
8633 8633
 		} else {
8634
-			$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
8634
+			$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
8635 8635
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8636 8636
 				    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
8637 8637
 				    ORDER BY route_count DESC";
@@ -8643,7 +8643,7 @@  discard block
 block discarded – undo
8643 8643
 		$routes_array = array();
8644 8644
 		$temp_array = array();
8645 8645
         
8646
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8646
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8647 8647
 		{
8648 8648
 			$temp_array['route_count'] = $row['route_count'];
8649 8649
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8670,9 +8670,9 @@  discard block
 block discarded – undo
8670 8670
 	*/
8671 8671
 	public function countAllRoutesByIdent($ident, $filters = array())
8672 8672
 	{
8673
-		$filter_query = $this->getFilter($filters,true,true);
8674
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8675
-		$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
8673
+		$filter_query = $this->getFilter($filters, true, true);
8674
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8675
+		$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
8676 8676
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
8677 8677
                     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
8678 8678
                     ORDER BY route_count DESC";
@@ -8684,7 +8684,7 @@  discard block
 block discarded – undo
8684 8684
 		$routes_array = array();
8685 8685
 		$temp_array = array();
8686 8686
         
8687
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8687
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8688 8688
 		{
8689 8689
 			$temp_array['route_count'] = $row['route_count'];
8690 8690
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8708,11 +8708,11 @@  discard block
 block discarded – undo
8708 8708
 	* @return Array the route list
8709 8709
 	*
8710 8710
 	*/
8711
-	public function countAllRoutesByOwner($owner,$filters = array())
8711
+	public function countAllRoutesByOwner($owner, $filters = array())
8712 8712
 	{
8713
-		$filter_query = $this->getFilter($filters,true,true);
8714
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8715
-		$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
8713
+		$filter_query = $this->getFilter($filters, true, true);
8714
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8715
+		$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
8716 8716
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
8717 8717
                     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
8718 8718
                     ORDER BY route_count DESC";
@@ -8724,7 +8724,7 @@  discard block
 block discarded – undo
8724 8724
 		$routes_array = array();
8725 8725
 		$temp_array = array();
8726 8726
         
8727
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8727
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8728 8728
 		{
8729 8729
 			$temp_array['route_count'] = $row['route_count'];
8730 8730
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8748,11 +8748,11 @@  discard block
 block discarded – undo
8748 8748
 	* @return Array the route list
8749 8749
 	*
8750 8750
 	*/
8751
-	public function countAllRoutesByPilot($pilot,$filters = array())
8751
+	public function countAllRoutesByPilot($pilot, $filters = array())
8752 8752
 	{
8753
-		$filter_query = $this->getFilter($filters,true,true);
8754
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8755
-		$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
8753
+		$filter_query = $this->getFilter($filters, true, true);
8754
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8755
+		$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
8756 8756
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8757 8757
                     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
8758 8758
                     ORDER BY route_count DESC";
@@ -8764,7 +8764,7 @@  discard block
 block discarded – undo
8764 8764
 		$routes_array = array();
8765 8765
 		$temp_array = array();
8766 8766
         
8767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8768 8768
 		{
8769 8769
 			$temp_array['route_count'] = $row['route_count'];
8770 8770
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8791,9 +8791,9 @@  discard block
 block discarded – undo
8791 8791
 	*/
8792 8792
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8793 8793
 	{
8794
-		$filter_query = $this->getFilter($filters,true,true);
8795
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8796
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8794
+		$filter_query = $this->getFilter($filters, true, true);
8795
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8796
+		$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
8797 8797
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
8798 8798
                     GROUP BY route
8799 8799
                     ORDER BY route_count DESC";
@@ -8805,7 +8805,7 @@  discard block
 block discarded – undo
8805 8805
 		$routes_array = array();
8806 8806
 		$temp_array = array();
8807 8807
         
8808
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8808
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8809 8809
 		{
8810 8810
 			$temp_array['route_count'] = $row['route_count'];
8811 8811
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8833,8 +8833,8 @@  discard block
 block discarded – undo
8833 8833
 	*/
8834 8834
 	public function countAllRoutesWithWaypoints($filters = array())
8835 8835
 	{
8836
-		$filter_query = $this->getFilter($filters,true,true);
8837
-		$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
8836
+		$filter_query = $this->getFilter($filters, true, true);
8837
+		$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
8838 8838
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
8839 8839
                     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
8840 8840
                     ORDER BY route_count DESC
@@ -8847,7 +8847,7 @@  discard block
 block discarded – undo
8847 8847
 		$routes_array = array();
8848 8848
 		$temp_array = array();
8849 8849
         
8850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8851 8851
 		{
8852 8852
 			$temp_array['spotter_id'] = $row['spotter_id'];
8853 8853
 			$temp_array['route_count'] = $row['route_count'];
@@ -8872,11 +8872,11 @@  discard block
 block discarded – undo
8872 8872
 	* @return Array the callsign list
8873 8873
 	*
8874 8874
 	*/
8875
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8875
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
8876 8876
 	{
8877 8877
 		global $globalDBdriver;
8878
-		$filter_query = $this->getFilter($filters,true,true);
8879
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8878
+		$filter_query = $this->getFilter($filters, true, true);
8879
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8880 8880
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8881 8881
 		 if ($olderthanmonths > 0) {
8882 8882
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -8890,28 +8890,28 @@  discard block
 block discarded – undo
8890 8890
 		if ($year != '') {
8891 8891
 			if ($globalDBdriver == 'mysql') {
8892 8892
 				$query .= " AND YEAR(spotter_output.date) = :year";
8893
-				$query_values = array_merge($query_values,array(':year' => $year));
8893
+				$query_values = array_merge($query_values, array(':year' => $year));
8894 8894
 			} else {
8895 8895
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8896
-				$query_values = array_merge($query_values,array(':year' => $year));
8896
+				$query_values = array_merge($query_values, array(':year' => $year));
8897 8897
 			}
8898 8898
 		}
8899 8899
 		if ($month != '') {
8900 8900
 			if ($globalDBdriver == 'mysql') {
8901 8901
 				$query .= " AND MONTH(spotter_output.date) = :month";
8902
-				$query_values = array_merge($query_values,array(':month' => $month));
8902
+				$query_values = array_merge($query_values, array(':month' => $month));
8903 8903
 			} else {
8904 8904
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8905
-				$query_values = array_merge($query_values,array(':month' => $month));
8905
+				$query_values = array_merge($query_values, array(':month' => $month));
8906 8906
 			}
8907 8907
 		}
8908 8908
 		if ($day != '') {
8909 8909
 			if ($globalDBdriver == 'mysql') {
8910 8910
 				$query .= " AND DAY(spotter_output.date) = :day";
8911
-				$query_values = array_merge($query_values,array(':day' => $day));
8911
+				$query_values = array_merge($query_values, array(':day' => $day));
8912 8912
 			} else {
8913 8913
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8914
-				$query_values = array_merge($query_values,array(':day' => $day));
8914
+				$query_values = array_merge($query_values, array(':day' => $day));
8915 8915
 			}
8916 8916
 		}
8917 8917
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -8923,7 +8923,7 @@  discard block
 block discarded – undo
8923 8923
 		$callsign_array = array();
8924 8924
 		$temp_array = array();
8925 8925
         
8926
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8926
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8927 8927
 		{
8928 8928
 			$temp_array['callsign_icao'] = $row['ident'];
8929 8929
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8945,8 +8945,8 @@  discard block
 block discarded – undo
8945 8945
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8946 8946
 	{
8947 8947
 		global $globalDBdriver;
8948
-		$filter_query = $this->getFilter($filters,true,true);
8949
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8948
+		$filter_query = $this->getFilter($filters, true, true);
8949
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8950 8950
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8951 8951
 		 if ($olderthanmonths > 0) {
8952 8952
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -8965,7 +8965,7 @@  discard block
 block discarded – undo
8965 8965
 		$callsign_array = array();
8966 8966
 		$temp_array = array();
8967 8967
         
8968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8969 8969
 		{
8970 8970
 			$temp_array['callsign_icao'] = $row['ident'];
8971 8971
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9019,7 +9019,7 @@  discard block
 block discarded – undo
9019 9019
 		$date_array = array();
9020 9020
 		$temp_array = array();
9021 9021
         
9022
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9022
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9023 9023
 		{
9024 9024
 			$temp_array['date_name'] = $row['date_name'];
9025 9025
 			$temp_array['date_count'] = $row['date_count'];
@@ -9044,15 +9044,15 @@  discard block
 block discarded – undo
9044 9044
 			$datetime = new DateTime();
9045 9045
 			$offset = $datetime->format('P');
9046 9046
 		} else $offset = '+00:00';
9047
-		$filter_query = $this->getFilter($filters,true,true);
9047
+		$filter_query = $this->getFilter($filters, true, true);
9048 9048
 		if ($globalDBdriver == 'mysql') {
9049
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9049
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9050 9050
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9051 9051
 								GROUP BY spotter_output.airline_icao, date_name 
9052 9052
 								ORDER BY date_count DESC
9053 9053
 								LIMIT 10 OFFSET 0";
9054 9054
 		} else {
9055
-			$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
9055
+			$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
9056 9056
 								FROM spotter_output 
9057 9057
 								WHERE spotter_output.airline_icao <> '' 
9058 9058
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9067,7 +9067,7 @@  discard block
 block discarded – undo
9067 9067
 		$date_array = array();
9068 9068
 		$temp_array = array();
9069 9069
         
9070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9071 9071
 		{
9072 9072
 			$temp_array['date_name'] = $row['date_name'];
9073 9073
 			$temp_array['date_count'] = $row['date_count'];
@@ -9093,7 +9093,7 @@  discard block
 block discarded – undo
9093 9093
 			$datetime = new DateTime();
9094 9094
 			$offset = $datetime->format('P');
9095 9095
 		} else $offset = '+00:00';
9096
-		$filter_query = $this->getFilter($filters,true,true);
9096
+		$filter_query = $this->getFilter($filters, true, true);
9097 9097
 		if ($globalDBdriver == 'mysql') {
9098 9098
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9099 9099
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9114,7 +9114,7 @@  discard block
 block discarded – undo
9114 9114
 		$date_array = array();
9115 9115
 		$temp_array = array();
9116 9116
         
9117
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9117
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9118 9118
 		{
9119 9119
 			$temp_array['date_name'] = $row['date_name'];
9120 9120
 			$temp_array['date_count'] = $row['date_count'];
@@ -9139,7 +9139,7 @@  discard block
 block discarded – undo
9139 9139
 			$datetime = new DateTime();
9140 9140
 			$offset = $datetime->format('P');
9141 9141
 		} else $offset = '+00:00';
9142
-		$filter_query = $this->getFilter($filters,true,true);
9142
+		$filter_query = $this->getFilter($filters, true, true);
9143 9143
 		if ($globalDBdriver == 'mysql') {
9144 9144
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9145 9145
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9160,7 +9160,7 @@  discard block
 block discarded – undo
9160 9160
 		$date_array = array();
9161 9161
 		$temp_array = array();
9162 9162
         
9163
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9163
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9164 9164
 		{
9165 9165
 			$temp_array['date_name'] = $row['date_name'];
9166 9166
 			$temp_array['date_count'] = $row['date_count'];
@@ -9181,7 +9181,7 @@  discard block
 block discarded – undo
9181 9181
 	public function countAllDatesLastMonthByAirlines($filters = array())
9182 9182
 	{
9183 9183
 		global $globalTimezone, $globalDBdriver;
9184
-		$filter_query = $this->getFilter($filters,true,true);
9184
+		$filter_query = $this->getFilter($filters, true, true);
9185 9185
 		if ($globalTimezone != '') {
9186 9186
 			date_default_timezone_set($globalTimezone);
9187 9187
 			$datetime = new DateTime();
@@ -9189,13 +9189,13 @@  discard block
 block discarded – undo
9189 9189
 		} else $offset = '+00:00';
9190 9190
 		
9191 9191
 		if ($globalDBdriver == 'mysql') {
9192
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9192
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9193 9193
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9194 9194
 								GROUP BY spotter_output.airline_icao, date_name 
9195 9195
 								ORDER BY spotter_output.date ASC";
9196 9196
 			$query_data = array(':offset' => $offset);
9197 9197
 		} else {
9198
-			$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
9198
+			$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
9199 9199
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9200 9200
 								GROUP BY spotter_output.airline_icao, date_name 
9201 9201
 								ORDER BY date_name ASC";
@@ -9208,7 +9208,7 @@  discard block
 block discarded – undo
9208 9208
 		$date_array = array();
9209 9209
 		$temp_array = array();
9210 9210
         
9211
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9211
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9212 9212
 		{
9213 9213
 			$temp_array['date_name'] = $row['date_name'];
9214 9214
 			$temp_array['date_count'] = $row['date_count'];
@@ -9255,7 +9255,7 @@  discard block
 block discarded – undo
9255 9255
 		$date_array = array();
9256 9256
 		$temp_array = array();
9257 9257
         
9258
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9258
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9259 9259
 		{
9260 9260
 			$temp_array['month_name'] = $row['month_name'];
9261 9261
 			$temp_array['year_name'] = $row['year_name'];
@@ -9276,7 +9276,7 @@  discard block
 block discarded – undo
9276 9276
 	public function countAllMonthsByAirlines($filters = array())
9277 9277
 	{
9278 9278
 		global $globalTimezone, $globalDBdriver;
9279
-		$filter_query = $this->getFilter($filters,true,true);
9279
+		$filter_query = $this->getFilter($filters, true, true);
9280 9280
 		if ($globalTimezone != '') {
9281 9281
 			date_default_timezone_set($globalTimezone);
9282 9282
 			$datetime = new DateTime();
@@ -9284,12 +9284,12 @@  discard block
 block discarded – undo
9284 9284
 		} else $offset = '+00:00';
9285 9285
 
9286 9286
 		if ($globalDBdriver == 'mysql') {
9287
-			$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
9287
+			$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
9288 9288
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9289 9289
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9290 9290
 								ORDER BY date_count DESC";
9291 9291
 		} else {
9292
-			$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
9292
+			$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
9293 9293
 								FROM spotter_output 
9294 9294
 								WHERE spotter_output.airline_icao <> '' 
9295 9295
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9303,7 +9303,7 @@  discard block
 block discarded – undo
9303 9303
 		$date_array = array();
9304 9304
 		$temp_array = array();
9305 9305
         
9306
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9306
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9307 9307
 		{
9308 9308
 			$temp_array['month_name'] = $row['month_name'];
9309 9309
 			$temp_array['year_name'] = $row['year_name'];
@@ -9330,14 +9330,14 @@  discard block
 block discarded – undo
9330 9330
 			$datetime = new DateTime();
9331 9331
 			$offset = $datetime->format('P');
9332 9332
 		} else $offset = '+00:00';
9333
-		$filter_query = $this->getFilter($filters,true,true);
9333
+		$filter_query = $this->getFilter($filters, true, true);
9334 9334
 		if ($globalDBdriver == 'mysql') {
9335
-			$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
9335
+			$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
9336 9336
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9337 9337
 								GROUP BY year_name, month_name 
9338 9338
 								ORDER BY date_count DESC";
9339 9339
 		} else {
9340
-			$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
9340
+			$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
9341 9341
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9342 9342
 								GROUP BY year_name, month_name 
9343 9343
 								ORDER BY date_count DESC";
@@ -9349,7 +9349,7 @@  discard block
 block discarded – undo
9349 9349
 		$date_array = array();
9350 9350
 		$temp_array = array();
9351 9351
         
9352
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9352
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9353 9353
 		{
9354 9354
 			$temp_array['month_name'] = $row['month_name'];
9355 9355
 			$temp_array['year_name'] = $row['year_name'];
@@ -9375,15 +9375,15 @@  discard block
 block discarded – undo
9375 9375
 			$datetime = new DateTime();
9376 9376
 			$offset = $datetime->format('P');
9377 9377
 		} else $offset = '+00:00';
9378
-		$filter_query = $this->getFilter($filters,true,true);
9378
+		$filter_query = $this->getFilter($filters, true, true);
9379 9379
 
9380 9380
 		if ($globalDBdriver == 'mysql') {
9381
-			$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
9381
+			$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
9382 9382
 								FROM spotter_output".$filter_query." owner_name <> ''
9383 9383
 								GROUP BY year_name, month_name
9384 9384
 								ORDER BY date_count DESC";
9385 9385
 		} else {
9386
-			$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
9386
+			$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
9387 9387
 								FROM spotter_output".$filter_query." owner_name <> ''
9388 9388
 								GROUP BY year_name, month_name
9389 9389
 								ORDER BY date_count DESC";
@@ -9395,7 +9395,7 @@  discard block
 block discarded – undo
9395 9395
 		$date_array = array();
9396 9396
 		$temp_array = array();
9397 9397
         
9398
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9398
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9399 9399
 		{
9400 9400
 			$temp_array['month_name'] = $row['month_name'];
9401 9401
 			$temp_array['year_name'] = $row['year_name'];
@@ -9416,7 +9416,7 @@  discard block
 block discarded – undo
9416 9416
 	public function countAllMonthsOwnersByAirlines($filters = array())
9417 9417
 	{
9418 9418
 		global $globalTimezone, $globalDBdriver;
9419
-		$filter_query = $this->getFilter($filters,true,true);
9419
+		$filter_query = $this->getFilter($filters, true, true);
9420 9420
 		if ($globalTimezone != '') {
9421 9421
 			date_default_timezone_set($globalTimezone);
9422 9422
 			$datetime = new DateTime();
@@ -9424,12 +9424,12 @@  discard block
 block discarded – undo
9424 9424
 		} else $offset = '+00:00';
9425 9425
 
9426 9426
 		if ($globalDBdriver == 'mysql') {
9427
-			$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
9427
+			$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
9428 9428
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9429 9429
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9430 9430
 								ORDER BY date_count DESC";
9431 9431
 		} else {
9432
-			$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
9432
+			$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
9433 9433
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9434 9434
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9435 9435
 								ORDER BY date_count DESC";
@@ -9441,7 +9441,7 @@  discard block
 block discarded – undo
9441 9441
 		$date_array = array();
9442 9442
 		$temp_array = array();
9443 9443
         
9444
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9444
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9445 9445
 		{
9446 9446
 			$temp_array['month_name'] = $row['month_name'];
9447 9447
 			$temp_array['year_name'] = $row['year_name'];
@@ -9468,15 +9468,15 @@  discard block
 block discarded – undo
9468 9468
 			$datetime = new DateTime();
9469 9469
 			$offset = $datetime->format('P');
9470 9470
 		} else $offset = '+00:00';
9471
-		$filter_query = $this->getFilter($filters,true,true);
9471
+		$filter_query = $this->getFilter($filters, true, true);
9472 9472
 
9473 9473
 		if ($globalDBdriver == 'mysql') {
9474
-			$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
9474
+			$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
9475 9475
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9476 9476
 								GROUP BY year_name, month_name
9477 9477
 								ORDER BY date_count DESC";
9478 9478
 		} else {
9479
-			$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
9479
+			$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
9480 9480
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9481 9481
 								GROUP BY year_name, month_name
9482 9482
 								ORDER BY date_count DESC";
@@ -9488,7 +9488,7 @@  discard block
 block discarded – undo
9488 9488
 		$date_array = array();
9489 9489
 		$temp_array = array();
9490 9490
         
9491
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9491
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9492 9492
 		{
9493 9493
 			$temp_array['month_name'] = $row['month_name'];
9494 9494
 			$temp_array['year_name'] = $row['year_name'];
@@ -9509,7 +9509,7 @@  discard block
 block discarded – undo
9509 9509
 	public function countAllMonthsPilotsByAirlines($filters = array())
9510 9510
 	{
9511 9511
 		global $globalTimezone, $globalDBdriver;
9512
-		$filter_query = $this->getFilter($filters,true,true);
9512
+		$filter_query = $this->getFilter($filters, true, true);
9513 9513
 		if ($globalTimezone != '') {
9514 9514
 			date_default_timezone_set($globalTimezone);
9515 9515
 			$datetime = new DateTime();
@@ -9517,12 +9517,12 @@  discard block
 block discarded – undo
9517 9517
 		} else $offset = '+00:00';
9518 9518
 
9519 9519
 		if ($globalDBdriver == 'mysql') {
9520
-			$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
9520
+			$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
9521 9521
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9522 9522
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9523 9523
 								ORDER BY date_count DESC";
9524 9524
 		} else {
9525
-			$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
9525
+			$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
9526 9526
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9527 9527
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9528 9528
 								ORDER BY date_count DESC";
@@ -9534,7 +9534,7 @@  discard block
 block discarded – undo
9534 9534
 		$date_array = array();
9535 9535
 		$temp_array = array();
9536 9536
         
9537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9538 9538
 		{
9539 9539
 			$temp_array['month_name'] = $row['month_name'];
9540 9540
 			$temp_array['year_name'] = $row['year_name'];
@@ -9556,7 +9556,7 @@  discard block
 block discarded – undo
9556 9556
 	public function countAllMonthsAirlines($filters = array())
9557 9557
 	{
9558 9558
 		global $globalTimezone, $globalDBdriver;
9559
-		$filter_query = $this->getFilter($filters,true,true);
9559
+		$filter_query = $this->getFilter($filters, true, true);
9560 9560
 		if ($globalTimezone != '') {
9561 9561
 			date_default_timezone_set($globalTimezone);
9562 9562
 			$datetime = new DateTime();
@@ -9564,12 +9564,12 @@  discard block
 block discarded – undo
9564 9564
 		} else $offset = '+00:00';
9565 9565
 
9566 9566
 		if ($globalDBdriver == 'mysql') {
9567
-			$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
9567
+			$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
9568 9568
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9569 9569
 								GROUP BY year_name, month_name
9570 9570
 								ORDER BY date_count DESC";
9571 9571
 		} else {
9572
-			$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
9572
+			$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
9573 9573
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9574 9574
 								GROUP BY year_name, month_name
9575 9575
 								ORDER BY date_count DESC";
@@ -9581,7 +9581,7 @@  discard block
 block discarded – undo
9581 9581
 		$date_array = array();
9582 9582
 		$temp_array = array();
9583 9583
         
9584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9585 9585
 		{
9586 9586
 			$temp_array['month_name'] = $row['month_name'];
9587 9587
 			$temp_array['year_name'] = $row['year_name'];
@@ -9607,15 +9607,15 @@  discard block
 block discarded – undo
9607 9607
 			$datetime = new DateTime();
9608 9608
 			$offset = $datetime->format('P');
9609 9609
 		} else $offset = '+00:00';
9610
-		$filter_query = $this->getFilter($filters,true,true);
9610
+		$filter_query = $this->getFilter($filters, true, true);
9611 9611
 
9612 9612
 		if ($globalDBdriver == 'mysql') {
9613
-			$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
9613
+			$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
9614 9614
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9615 9615
 								GROUP BY year_name, month_name
9616 9616
 								ORDER BY date_count DESC";
9617 9617
 		} else {
9618
-			$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
9618
+			$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
9619 9619
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9620 9620
 								GROUP BY year_name, month_name
9621 9621
 								ORDER BY date_count DESC";
@@ -9627,7 +9627,7 @@  discard block
 block discarded – undo
9627 9627
 		$date_array = array();
9628 9628
 		$temp_array = array();
9629 9629
         
9630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9631 9631
 		{
9632 9632
 			$temp_array['month_name'] = $row['month_name'];
9633 9633
 			$temp_array['year_name'] = $row['year_name'];
@@ -9649,7 +9649,7 @@  discard block
 block discarded – undo
9649 9649
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9650 9650
 	{
9651 9651
 		global $globalTimezone, $globalDBdriver;
9652
-		$filter_query = $this->getFilter($filters,true,true);
9652
+		$filter_query = $this->getFilter($filters, true, true);
9653 9653
 		if ($globalTimezone != '') {
9654 9654
 			date_default_timezone_set($globalTimezone);
9655 9655
 			$datetime = new DateTime();
@@ -9657,12 +9657,12 @@  discard block
 block discarded – undo
9657 9657
 		} else $offset = '+00:00';
9658 9658
 
9659 9659
 		if ($globalDBdriver == 'mysql') {
9660
-			$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
9660
+			$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
9661 9661
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9662 9662
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9663 9663
 								ORDER BY date_count DESC";
9664 9664
 		} else {
9665
-			$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
9665
+			$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
9666 9666
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
9667 9667
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9668 9668
 								ORDER BY date_count DESC";
@@ -9674,7 +9674,7 @@  discard block
 block discarded – undo
9674 9674
 		$date_array = array();
9675 9675
 		$temp_array = array();
9676 9676
         
9677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9678 9678
 		{
9679 9679
 			$temp_array['month_name'] = $row['month_name'];
9680 9680
 			$temp_array['year_name'] = $row['year_name'];
@@ -9701,15 +9701,15 @@  discard block
 block discarded – undo
9701 9701
 			$datetime = new DateTime();
9702 9702
 			$offset = $datetime->format('P');
9703 9703
 		} else $offset = '+00:00';
9704
-		$filter_query = $this->getFilter($filters,true,true);
9704
+		$filter_query = $this->getFilter($filters, true, true);
9705 9705
 
9706 9706
 		if ($globalDBdriver == 'mysql') {
9707
-			$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
9707
+			$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
9708 9708
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9709 9709
 								GROUP BY year_name, month_name
9710 9710
 								ORDER BY date_count DESC";
9711 9711
 		} else {
9712
-			$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
9712
+			$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
9713 9713
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9714 9714
 								GROUP BY year_name, month_name
9715 9715
 								ORDER BY date_count DESC";
@@ -9721,7 +9721,7 @@  discard block
 block discarded – undo
9721 9721
 		$date_array = array();
9722 9722
 		$temp_array = array();
9723 9723
         
9724
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9724
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9725 9725
 		{
9726 9726
 			$temp_array['month_name'] = $row['month_name'];
9727 9727
 			$temp_array['year_name'] = $row['year_name'];
@@ -9743,7 +9743,7 @@  discard block
 block discarded – undo
9743 9743
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9744 9744
 	{
9745 9745
 		global $globalTimezone, $globalDBdriver;
9746
-		$filter_query = $this->getFilter($filters,true,true);
9746
+		$filter_query = $this->getFilter($filters, true, true);
9747 9747
 		if ($globalTimezone != '') {
9748 9748
 			date_default_timezone_set($globalTimezone);
9749 9749
 			$datetime = new DateTime();
@@ -9751,12 +9751,12 @@  discard block
 block discarded – undo
9751 9751
 		} else $offset = '+00:00';
9752 9752
 
9753 9753
 		if ($globalDBdriver == 'mysql') {
9754
-			$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
9754
+			$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
9755 9755
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9756 9756
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9757 9757
 								ORDER BY date_count DESC";
9758 9758
 		} else {
9759
-			$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
9759
+			$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
9760 9760
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9761 9761
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9762 9762
 								ORDER BY date_count DESC";
@@ -9768,7 +9768,7 @@  discard block
 block discarded – undo
9768 9768
 		$date_array = array();
9769 9769
 		$temp_array = array();
9770 9770
         
9771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9772 9772
 		{
9773 9773
 			$temp_array['month_name'] = $row['month_name'];
9774 9774
 			$temp_array['year_name'] = $row['year_name'];
@@ -9796,7 +9796,7 @@  discard block
 block discarded – undo
9796 9796
 			$datetime = new DateTime();
9797 9797
 			$offset = $datetime->format('P');
9798 9798
 		} else $offset = '+00:00';
9799
-		$filter_query = $this->getFilter($filters,true,true);
9799
+		$filter_query = $this->getFilter($filters, true, true);
9800 9800
 		if ($globalDBdriver == 'mysql') {
9801 9801
 			$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
9802 9802
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -9817,7 +9817,7 @@  discard block
 block discarded – undo
9817 9817
 		$date_array = array();
9818 9818
 		$temp_array = array();
9819 9819
         
9820
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9820
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9821 9821
 		{
9822 9822
 			$temp_array['year_name'] = $row['year_name'];
9823 9823
 			$temp_array['month_name'] = $row['month_name'];
@@ -9837,7 +9837,7 @@  discard block
 block discarded – undo
9837 9837
 	* @return Array the hour list
9838 9838
 	*
9839 9839
 	*/
9840
-	public function countAllHours($orderby,$filters = array())
9840
+	public function countAllHours($orderby, $filters = array())
9841 9841
 	{
9842 9842
 		global $globalTimezone, $globalDBdriver;
9843 9843
 		if ($globalTimezone != '') {
@@ -9885,7 +9885,7 @@  discard block
 block discarded – undo
9885 9885
 		$hour_array = array();
9886 9886
 		$temp_array = array();
9887 9887
         
9888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9889 9889
 		{
9890 9890
 			$temp_array['hour_name'] = $row['hour_name'];
9891 9891
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9905,7 +9905,7 @@  discard block
 block discarded – undo
9905 9905
 	public function countAllHoursByAirlines($orderby, $filters = array())
9906 9906
 	{
9907 9907
 		global $globalTimezone, $globalDBdriver;
9908
-		$filter_query = $this->getFilter($filters,true,true);
9908
+		$filter_query = $this->getFilter($filters, true, true);
9909 9909
 		if ($globalTimezone != '') {
9910 9910
 			date_default_timezone_set($globalTimezone);
9911 9911
 			$datetime = new DateTime();
@@ -9923,7 +9923,7 @@  discard block
 block discarded – undo
9923 9923
 		}
9924 9924
 		
9925 9925
 		if ($globalDBdriver == 'mysql') {
9926
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9926
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9927 9927
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9928 9928
 								GROUP BY spotter_output.airline_icao, hour_name 
9929 9929
 								".$orderby_sql;
@@ -9936,7 +9936,7 @@  discard block
 block discarded – undo
9936 9936
   */    
9937 9937
 		$query_data = array(':offset' => $offset);
9938 9938
 		} else {
9939
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9939
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9940 9940
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9941 9941
 								GROUP BY spotter_output.airline_icao, hour_name 
9942 9942
 								".$orderby_sql;
@@ -9949,7 +9949,7 @@  discard block
 block discarded – undo
9949 9949
 		$hour_array = array();
9950 9950
 		$temp_array = array();
9951 9951
         
9952
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9952
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9953 9953
 		{
9954 9954
 			$temp_array['hour_name'] = $row['hour_name'];
9955 9955
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9972,34 +9972,34 @@  discard block
 block discarded – undo
9972 9972
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9973 9973
 	{
9974 9974
 		global $globalTimezone, $globalDBdriver;
9975
-		$filter_query = $this->getFilter($filters,true,true);
9975
+		$filter_query = $this->getFilter($filters, true, true);
9976 9976
 		if ($globalTimezone != '') {
9977 9977
 			date_default_timezone_set($globalTimezone);
9978 9978
 			$datetime = new DateTime();
9979 9979
 			$offset = $datetime->format('P');
9980 9980
 		} else $offset = '+00:00';
9981 9981
 
9982
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9982
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
9983 9983
 
9984 9984
 		if ($globalDBdriver == 'mysql') {
9985
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9985
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9986 9986
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9987 9987
 								GROUP BY hour_name 
9988 9988
 								ORDER BY hour_name ASC";
9989 9989
 		} else {
9990
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9990
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9991 9991
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9992 9992
 								GROUP BY hour_name 
9993 9993
 								ORDER BY hour_name ASC";
9994 9994
 		}
9995 9995
 		
9996 9996
 		$sth = $this->db->prepare($query);
9997
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
9997
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
9998 9998
       
9999 9999
 		$hour_array = array();
10000 10000
 		$temp_array = array();
10001 10001
         
10002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10003 10003
 		{
10004 10004
 			$temp_array['hour_name'] = $row['hour_name'];
10005 10005
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10022,8 +10022,8 @@  discard block
 block discarded – undo
10022 10022
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10023 10023
 	{
10024 10024
 		global $globalTimezone, $globalDBdriver;
10025
-		$filter_query = $this->getFilter($filters,true,true);
10026
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10025
+		$filter_query = $this->getFilter($filters, true, true);
10026
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10027 10027
 		if ($globalTimezone != '') {
10028 10028
 			date_default_timezone_set($globalTimezone);
10029 10029
 			$datetime = new DateTime();
@@ -10031,24 +10031,24 @@  discard block
 block discarded – undo
10031 10031
 		} else $offset = '+00:00';
10032 10032
 
10033 10033
 		if ($globalDBdriver == 'mysql') {
10034
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10034
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10035 10035
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10036 10036
 								GROUP BY hour_name 
10037 10037
 								ORDER BY hour_name ASC";
10038 10038
 		} else {
10039
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10039
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10040 10040
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10041 10041
 								GROUP BY hour_name 
10042 10042
 								ORDER BY hour_name ASC";
10043 10043
 		}
10044 10044
 		
10045 10045
 		$sth = $this->db->prepare($query);
10046
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10046
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10047 10047
       
10048 10048
 		$hour_array = array();
10049 10049
 		$temp_array = array();
10050 10050
         
10051
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10051
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10052 10052
 		{
10053 10053
 			$temp_array['hour_name'] = $row['hour_name'];
10054 10054
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10069,8 +10069,8 @@  discard block
 block discarded – undo
10069 10069
 	public function countAllHoursByRegistration($registration, $filters = array())
10070 10070
 	{
10071 10071
 		global $globalTimezone, $globalDBdriver;
10072
-		$filter_query = $this->getFilter($filters,true,true);
10073
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10072
+		$filter_query = $this->getFilter($filters, true, true);
10073
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10074 10074
 		if ($globalTimezone != '') {
10075 10075
 			date_default_timezone_set($globalTimezone);
10076 10076
 			$datetime = new DateTime();
@@ -10078,24 +10078,24 @@  discard block
 block discarded – undo
10078 10078
 		} else $offset = '+00:00';
10079 10079
 
10080 10080
 		if ($globalDBdriver == 'mysql') {
10081
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10081
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10082 10082
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10083 10083
 								GROUP BY hour_name 
10084 10084
 								ORDER BY hour_name ASC";
10085 10085
 		} else {
10086
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10086
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10087 10087
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10088 10088
 								GROUP BY hour_name 
10089 10089
 								ORDER BY hour_name ASC";
10090 10090
 		}
10091 10091
 		
10092 10092
 		$sth = $this->db->prepare($query);
10093
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10093
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10094 10094
       
10095 10095
 		$hour_array = array();
10096 10096
 		$temp_array = array();
10097 10097
         
10098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10099 10099
 		{
10100 10100
 			$temp_array['hour_name'] = $row['hour_name'];
10101 10101
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10116,8 +10116,8 @@  discard block
 block discarded – undo
10116 10116
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10117 10117
 	{
10118 10118
 		global $globalTimezone, $globalDBdriver;
10119
-		$filter_query = $this->getFilter($filters,true,true);
10120
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10119
+		$filter_query = $this->getFilter($filters, true, true);
10120
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10121 10121
 		if ($globalTimezone != '') {
10122 10122
 			date_default_timezone_set($globalTimezone);
10123 10123
 			$datetime = new DateTime();
@@ -10125,24 +10125,24 @@  discard block
 block discarded – undo
10125 10125
 		} else $offset = '+00:00';
10126 10126
 
10127 10127
 		if ($globalDBdriver == 'mysql') {
10128
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10128
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10129 10129
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10130 10130
 								GROUP BY hour_name 
10131 10131
 								ORDER BY hour_name ASC";
10132 10132
 		} else {
10133
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10133
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10134 10134
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10135 10135
 								GROUP BY hour_name 
10136 10136
 								ORDER BY hour_name ASC";
10137 10137
 		}
10138 10138
 		
10139 10139
 		$sth = $this->db->prepare($query);
10140
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10140
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10141 10141
       
10142 10142
 		$hour_array = array();
10143 10143
 		$temp_array = array();
10144 10144
         
10145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10146 10146
 		{
10147 10147
 			$temp_array['hour_name'] = $row['hour_name'];
10148 10148
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10161,11 +10161,11 @@  discard block
 block discarded – undo
10161 10161
 	* @return Array the hour list
10162 10162
 	*
10163 10163
 	*/
10164
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10164
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10165 10165
 	{
10166 10166
 		global $globalTimezone, $globalDBdriver;
10167
-		$filter_query = $this->getFilter($filters,true,true);
10168
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10167
+		$filter_query = $this->getFilter($filters, true, true);
10168
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10169 10169
 		if ($globalTimezone != '') {
10170 10170
 			date_default_timezone_set($globalTimezone);
10171 10171
 			$datetime = new DateTime();
@@ -10173,24 +10173,24 @@  discard block
 block discarded – undo
10173 10173
 		} else $offset = '+00:00';
10174 10174
 
10175 10175
 		if ($globalDBdriver == 'mysql') {
10176
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10176
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10177 10177
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10178 10178
 								GROUP BY hour_name 
10179 10179
 								ORDER BY hour_name ASC";
10180 10180
 		} else {
10181
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10181
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10182 10182
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10183 10183
 								GROUP BY hour_name 
10184 10184
 								ORDER BY hour_name ASC";
10185 10185
 		}
10186 10186
 		
10187 10187
 		$sth = $this->db->prepare($query);
10188
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10188
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10189 10189
       
10190 10190
 		$hour_array = array();
10191 10191
 		$temp_array = array();
10192 10192
         
10193
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10193
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10194 10194
 		{
10195 10195
 			$temp_array['hour_name'] = $row['hour_name'];
10196 10196
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10212,8 +10212,8 @@  discard block
 block discarded – undo
10212 10212
 	public function countAllHoursByDate($date, $filters = array())
10213 10213
 	{
10214 10214
 		global $globalTimezone, $globalDBdriver;
10215
-		$filter_query = $this->getFilter($filters,true,true);
10216
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10215
+		$filter_query = $this->getFilter($filters, true, true);
10216
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10217 10217
 		if ($globalTimezone != '') {
10218 10218
 			date_default_timezone_set($globalTimezone);
10219 10219
 			$datetime = new DateTime($date);
@@ -10221,12 +10221,12 @@  discard block
 block discarded – undo
10221 10221
 		} else $offset = '+00:00';
10222 10222
 
10223 10223
 		if ($globalDBdriver == 'mysql') {
10224
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10224
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10225 10225
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10226 10226
 								GROUP BY hour_name 
10227 10227
 								ORDER BY hour_name ASC";
10228 10228
 		} else {
10229
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10229
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10230 10230
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10231 10231
 								GROUP BY hour_name 
10232 10232
 								ORDER BY hour_name ASC";
@@ -10238,7 +10238,7 @@  discard block
 block discarded – undo
10238 10238
 		$hour_array = array();
10239 10239
 		$temp_array = array();
10240 10240
         
10241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10242 10242
 		{
10243 10243
 			$temp_array['hour_name'] = $row['hour_name'];
10244 10244
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10260,8 +10260,8 @@  discard block
 block discarded – undo
10260 10260
 	public function countAllHoursByIdent($ident, $filters = array())
10261 10261
 	{
10262 10262
 		global $globalTimezone, $globalDBdriver;
10263
-		$filter_query = $this->getFilter($filters,true,true);
10264
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10263
+		$filter_query = $this->getFilter($filters, true, true);
10264
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10265 10265
 		if ($globalTimezone != '') {
10266 10266
 			date_default_timezone_set($globalTimezone);
10267 10267
 			$datetime = new DateTime();
@@ -10269,12 +10269,12 @@  discard block
 block discarded – undo
10269 10269
 		} else $offset = '+00:00';
10270 10270
 
10271 10271
 		if ($globalDBdriver == 'mysql') {
10272
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10272
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10273 10273
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10274 10274
 								GROUP BY hour_name 
10275 10275
 								ORDER BY hour_name ASC";
10276 10276
 		} else {
10277
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10277
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10278 10278
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10279 10279
 								GROUP BY hour_name 
10280 10280
 								ORDER BY hour_name ASC";
@@ -10282,12 +10282,12 @@  discard block
 block discarded – undo
10282 10282
       
10283 10283
 		
10284 10284
 		$sth = $this->db->prepare($query);
10285
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10285
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10286 10286
       
10287 10287
 		$hour_array = array();
10288 10288
 		$temp_array = array();
10289 10289
         
10290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10291 10291
 		{
10292 10292
 			$temp_array['hour_name'] = $row['hour_name'];
10293 10293
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10307,8 +10307,8 @@  discard block
 block discarded – undo
10307 10307
 	public function countAllHoursByOwner($owner, $filters = array())
10308 10308
 	{
10309 10309
 		global $globalTimezone, $globalDBdriver;
10310
-		$filter_query = $this->getFilter($filters,true,true);
10311
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10310
+		$filter_query = $this->getFilter($filters, true, true);
10311
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10312 10312
 		if ($globalTimezone != '') {
10313 10313
 			date_default_timezone_set($globalTimezone);
10314 10314
 			$datetime = new DateTime();
@@ -10316,12 +10316,12 @@  discard block
 block discarded – undo
10316 10316
 		} else $offset = '+00:00';
10317 10317
 
10318 10318
 		if ($globalDBdriver == 'mysql') {
10319
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10319
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10320 10320
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10321 10321
 								GROUP BY hour_name 
10322 10322
 								ORDER BY hour_name ASC";
10323 10323
 		} else {
10324
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10324
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10325 10325
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10326 10326
 								GROUP BY hour_name 
10327 10327
 								ORDER BY hour_name ASC";
@@ -10329,12 +10329,12 @@  discard block
 block discarded – undo
10329 10329
       
10330 10330
 		
10331 10331
 		$sth = $this->db->prepare($query);
10332
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10332
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10333 10333
       
10334 10334
 		$hour_array = array();
10335 10335
 		$temp_array = array();
10336 10336
         
10337
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10337
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10338 10338
 		{
10339 10339
 			$temp_array['hour_name'] = $row['hour_name'];
10340 10340
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10354,8 +10354,8 @@  discard block
 block discarded – undo
10354 10354
 	public function countAllHoursByPilot($pilot, $filters = array())
10355 10355
 	{
10356 10356
 		global $globalTimezone, $globalDBdriver;
10357
-		$filter_query = $this->getFilter($filters,true,true);
10358
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10357
+		$filter_query = $this->getFilter($filters, true, true);
10358
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10359 10359
 		if ($globalTimezone != '') {
10360 10360
 			date_default_timezone_set($globalTimezone);
10361 10361
 			$datetime = new DateTime();
@@ -10363,12 +10363,12 @@  discard block
 block discarded – undo
10363 10363
 		} else $offset = '+00:00';
10364 10364
 
10365 10365
 		if ($globalDBdriver == 'mysql') {
10366
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10366
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10367 10367
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10368 10368
 								GROUP BY hour_name 
10369 10369
 								ORDER BY hour_name ASC";
10370 10370
 		} else {
10371
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10371
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10372 10372
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10373 10373
 								GROUP BY hour_name 
10374 10374
 								ORDER BY hour_name ASC";
@@ -10376,12 +10376,12 @@  discard block
 block discarded – undo
10376 10376
       
10377 10377
 		
10378 10378
 		$sth = $this->db->prepare($query);
10379
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10379
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10380 10380
       
10381 10381
 		$hour_array = array();
10382 10382
 		$temp_array = array();
10383 10383
         
10384
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10384
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10385 10385
 		{
10386 10386
 			$temp_array['hour_name'] = $row['hour_name'];
10387 10387
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10400,12 +10400,12 @@  discard block
 block discarded – undo
10400 10400
 	* @return Array the hour list
10401 10401
 	*
10402 10402
 	*/
10403
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10403
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10404 10404
 	{
10405 10405
 		global $globalTimezone, $globalDBdriver;
10406
-		$filter_query = $this->getFilter($filters,true,true);
10407
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10408
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10406
+		$filter_query = $this->getFilter($filters, true, true);
10407
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10408
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10409 10409
 		if ($globalTimezone != '') {
10410 10410
 			date_default_timezone_set($globalTimezone);
10411 10411
 			$datetime = new DateTime();
@@ -10413,24 +10413,24 @@  discard block
 block discarded – undo
10413 10413
 		} else $offset = '+00:00';
10414 10414
 
10415 10415
 		if ($globalDBdriver == 'mysql') {
10416
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10416
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10417 10417
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10418 10418
 								GROUP BY hour_name 
10419 10419
 								ORDER BY hour_name ASC";
10420 10420
 		} else {
10421
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10421
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10422 10422
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10423 10423
 								GROUP BY hour_name 
10424 10424
 								ORDER BY hour_name ASC";
10425 10425
 		}
10426 10426
 		
10427 10427
 		$sth = $this->db->prepare($query);
10428
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10428
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10429 10429
       
10430 10430
 		$hour_array = array();
10431 10431
 		$temp_array = array();
10432 10432
         
10433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10434 10434
 		{
10435 10435
 			$temp_array['hour_name'] = $row['hour_name'];
10436 10436
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10451,8 +10451,8 @@  discard block
 block discarded – undo
10451 10451
 	public function countAllHoursByCountry($country, $filters = array())
10452 10452
 	{
10453 10453
 		global $globalTimezone, $globalDBdriver;
10454
-		$filter_query = $this->getFilter($filters,true,true);
10455
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10454
+		$filter_query = $this->getFilter($filters, true, true);
10455
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10456 10456
 		if ($globalTimezone != '') {
10457 10457
 			date_default_timezone_set($globalTimezone);
10458 10458
 			$datetime = new DateTime();
@@ -10460,24 +10460,24 @@  discard block
 block discarded – undo
10460 10460
 		} else $offset = '+00:00';
10461 10461
 
10462 10462
 		if ($globalDBdriver == 'mysql') {
10463
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10463
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10464 10464
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10465 10465
 								GROUP BY hour_name 
10466 10466
 								ORDER BY hour_name ASC";
10467 10467
 		} else {
10468
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10468
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10469 10469
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10470 10470
 								GROUP BY hour_name 
10471 10471
 								ORDER BY hour_name ASC";
10472 10472
 		}
10473 10473
 		
10474 10474
 		$sth = $this->db->prepare($query);
10475
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10475
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10476 10476
       
10477 10477
 		$hour_array = array();
10478 10478
 		$temp_array = array();
10479 10479
         
10480
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10480
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10481 10481
 		{
10482 10482
 			$temp_array['hour_name'] = $row['hour_name'];
10483 10483
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10497,29 +10497,29 @@  discard block
 block discarded – undo
10497 10497
 	* @return Integer the number of aircrafts
10498 10498
 	*
10499 10499
 	*/
10500
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10500
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10501 10501
 	{
10502 10502
 		global $globalDBdriver;
10503
-		$filter_query = $this->getFilter($filters,true,true);
10504
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10503
+		$filter_query = $this->getFilter($filters, true, true);
10504
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10505 10505
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10506 10506
 		$query_values = array();
10507 10507
 		if ($year != '') {
10508 10508
 			if ($globalDBdriver == 'mysql') {
10509 10509
 				$query .= " AND YEAR(spotter_output.date) = :year";
10510
-				$query_values = array_merge($query_values,array(':year' => $year));
10510
+				$query_values = array_merge($query_values, array(':year' => $year));
10511 10511
 			} else {
10512 10512
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10513
-				$query_values = array_merge($query_values,array(':year' => $year));
10513
+				$query_values = array_merge($query_values, array(':year' => $year));
10514 10514
 			}
10515 10515
 		}
10516 10516
 		if ($month != '') {
10517 10517
 			if ($globalDBdriver == 'mysql') {
10518 10518
 				$query .= " AND MONTH(spotter_output.date) = :month";
10519
-				$query_values = array_merge($query_values,array(':month' => $month));
10519
+				$query_values = array_merge($query_values, array(':month' => $month));
10520 10520
 			} else {
10521 10521
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10522
-				$query_values = array_merge($query_values,array(':month' => $month));
10522
+				$query_values = array_merge($query_values, array(':month' => $month));
10523 10523
 			}
10524 10524
 		}
10525 10525
 
@@ -10534,29 +10534,29 @@  discard block
 block discarded – undo
10534 10534
 	* @return Integer the number of aircrafts
10535 10535
 	*
10536 10536
 	*/
10537
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10537
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10538 10538
 	{
10539 10539
 		global $globalDBdriver;
10540
-		$filter_query = $this->getFilter($filters,true,true);
10541
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10540
+		$filter_query = $this->getFilter($filters, true, true);
10541
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10542 10542
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10543 10543
 		$query_values = array();
10544 10544
 		if ($year != '') {
10545 10545
 			if ($globalDBdriver == 'mysql') {
10546 10546
 				$query .= " AND YEAR(spotter_output.date) = :year";
10547
-				$query_values = array_merge($query_values,array(':year' => $year));
10547
+				$query_values = array_merge($query_values, array(':year' => $year));
10548 10548
 			} else {
10549 10549
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10550
-				$query_values = array_merge($query_values,array(':year' => $year));
10550
+				$query_values = array_merge($query_values, array(':year' => $year));
10551 10551
 			}
10552 10552
 		}
10553 10553
 		if ($month != '') {
10554 10554
 			if ($globalDBdriver == 'mysql') {
10555 10555
 				$query .= " AND MONTH(spotter_output.date) = :month";
10556
-				$query_values = array_merge($query_values,array(':month' => $month));
10556
+				$query_values = array_merge($query_values, array(':month' => $month));
10557 10557
 			} else {
10558 10558
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10559
-				$query_values = array_merge($query_values,array(':month' => $month));
10559
+				$query_values = array_merge($query_values, array(':month' => $month));
10560 10560
 			}
10561 10561
 		}
10562 10562
 		
@@ -10571,29 +10571,29 @@  discard block
 block discarded – undo
10571 10571
 	* @return Integer the number of pilots
10572 10572
 	*
10573 10573
 	*/
10574
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10574
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10575 10575
 	{
10576 10576
 		global $globalDBdriver;
10577
-		$filter_query = $this->getFilter($filters,true,true);
10578
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10577
+		$filter_query = $this->getFilter($filters, true, true);
10578
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10579 10579
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10580 10580
 		$query_values = array();
10581 10581
 		if ($year != '') {
10582 10582
 			if ($globalDBdriver == 'mysql') {
10583 10583
 				$query .= " AND YEAR(spotter_output.date) = :year";
10584
-				$query_values = array_merge($query_values,array(':year' => $year));
10584
+				$query_values = array_merge($query_values, array(':year' => $year));
10585 10585
 			} else {
10586 10586
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10587
-				$query_values = array_merge($query_values,array(':year' => $year));
10587
+				$query_values = array_merge($query_values, array(':year' => $year));
10588 10588
 			}
10589 10589
 		}
10590 10590
 		if ($month != '') {
10591 10591
 			if ($globalDBdriver == 'mysql') {
10592 10592
 				$query .= " AND MONTH(spotter_output.date) = :month";
10593
-				$query_values = array_merge($query_values,array(':month' => $month));
10593
+				$query_values = array_merge($query_values, array(':month' => $month));
10594 10594
 			} else {
10595 10595
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10596
-				$query_values = array_merge($query_values,array(':month' => $month));
10596
+				$query_values = array_merge($query_values, array(':month' => $month));
10597 10597
 			}
10598 10598
 		}
10599 10599
 		$sth = $this->db->prepare($query);
@@ -10607,29 +10607,29 @@  discard block
 block discarded – undo
10607 10607
 	* @return Integer the number of owners
10608 10608
 	*
10609 10609
 	*/
10610
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10610
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10611 10611
 	{
10612 10612
 		global $globalDBdriver;
10613
-		$filter_query = $this->getFilter($filters,true,true);
10614
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10613
+		$filter_query = $this->getFilter($filters, true, true);
10614
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10615 10615
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10616 10616
 		$query_values = array();
10617 10617
 		if ($year != '') {
10618 10618
 			if ($globalDBdriver == 'mysql') {
10619 10619
 				$query .= " AND YEAR(spotter_output.date) = :year";
10620
-				$query_values = array_merge($query_values,array(':year' => $year));
10620
+				$query_values = array_merge($query_values, array(':year' => $year));
10621 10621
 			} else {
10622 10622
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10623
-				$query_values = array_merge($query_values,array(':year' => $year));
10623
+				$query_values = array_merge($query_values, array(':year' => $year));
10624 10624
 			}
10625 10625
 		}
10626 10626
 		if ($month != '') {
10627 10627
 			if ($globalDBdriver == 'mysql') {
10628 10628
 				$query .= " AND MONTH(spotter_output.date) = :month";
10629
-				$query_values = array_merge($query_values,array(':month' => $month));
10629
+				$query_values = array_merge($query_values, array(':month' => $month));
10630 10630
 			} else {
10631 10631
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10632
-				$query_values = array_merge($query_values,array(':month' => $month));
10632
+				$query_values = array_merge($query_values, array(':month' => $month));
10633 10633
 			}
10634 10634
 		}
10635 10635
 		$sth = $this->db->prepare($query);
@@ -10644,32 +10644,32 @@  discard block
 block discarded – undo
10644 10644
 	* @return Integer the number of flights
10645 10645
 	*
10646 10646
 	*/
10647
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10647
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10648 10648
 	{
10649 10649
 		global $globalDBdriver;
10650
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10650
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10651 10651
 		$query_values = array();
10652 10652
 		$query = '';
10653 10653
 		if ($year != '') {
10654 10654
 			if ($globalDBdriver == 'mysql') {
10655 10655
 				$query .= " AND YEAR(spotter_output.date) = :year";
10656
-				$query_values = array_merge($query_values,array(':year' => $year));
10656
+				$query_values = array_merge($query_values, array(':year' => $year));
10657 10657
 			} else {
10658 10658
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10659
-				$query_values = array_merge($query_values,array(':year' => $year));
10659
+				$query_values = array_merge($query_values, array(':year' => $year));
10660 10660
 			}
10661 10661
 		}
10662 10662
 		if ($month != '') {
10663 10663
 			if ($globalDBdriver == 'mysql') {
10664 10664
 				$query .= " AND MONTH(spotter_output.date) = :month";
10665
-				$query_values = array_merge($query_values,array(':month' => $month));
10665
+				$query_values = array_merge($query_values, array(':month' => $month));
10666 10666
 			} else {
10667 10667
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10668
-				$query_values = array_merge($query_values,array(':month' => $month));
10668
+				$query_values = array_merge($query_values, array(':month' => $month));
10669 10669
 			}
10670 10670
 		}
10671 10671
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10672
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10672
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10673 10673
 		
10674 10674
 		//echo $query;
10675 10675
 		$sth = $this->db->prepare($queryi);
@@ -10683,29 +10683,29 @@  discard block
 block discarded – undo
10683 10683
 	* @return Integer the number of flights
10684 10684
 	*
10685 10685
 	*/
10686
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10686
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
10687 10687
 	{
10688 10688
 		global $globalDBdriver;
10689
-		$filter_query = $this->getFilter($filters,true,true);
10690
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10689
+		$filter_query = $this->getFilter($filters, true, true);
10690
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10691 10691
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
10692 10692
 		$query_values = array();
10693 10693
 		if ($year != '') {
10694 10694
 			if ($globalDBdriver == 'mysql') {
10695 10695
 				$query .= " AND YEAR(spotter_output.date) = :year";
10696
-				$query_values = array_merge($query_values,array(':year' => $year));
10696
+				$query_values = array_merge($query_values, array(':year' => $year));
10697 10697
 			} else {
10698 10698
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10699
-				$query_values = array_merge($query_values,array(':year' => $year));
10699
+				$query_values = array_merge($query_values, array(':year' => $year));
10700 10700
 			}
10701 10701
 		}
10702 10702
 		if ($month != '') {
10703 10703
 			if ($globalDBdriver == 'mysql') {
10704 10704
 				$query .= " AND MONTH(spotter_output.date) = :month";
10705
-				$query_values = array_merge($query_values,array(':month' => $month));
10705
+				$query_values = array_merge($query_values, array(':month' => $month));
10706 10706
 			} else {
10707 10707
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10708
-				$query_values = array_merge($query_values,array(':month' => $month));
10708
+				$query_values = array_merge($query_values, array(':month' => $month));
10709 10709
 			}
10710 10710
 		}
10711 10711
       
@@ -10722,10 +10722,10 @@  discard block
 block discarded – undo
10722 10722
 	* @return Integer the number of airlines
10723 10723
 	*
10724 10724
 	*/
10725
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10725
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
10726 10726
 	{
10727 10727
 		global $globalDBdriver;
10728
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10728
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10729 10729
 							FROM spotter_output";
10730 10730
       
10731 10731
 		$query_values = array();
@@ -10733,23 +10733,23 @@  discard block
 block discarded – undo
10733 10733
 		if ($year != '') {
10734 10734
 			if ($globalDBdriver == 'mysql') {
10735 10735
 				$query .= " AND YEAR(spotter_output.date) = :year";
10736
-				$query_values = array_merge($query_values,array(':year' => $year));
10736
+				$query_values = array_merge($query_values, array(':year' => $year));
10737 10737
 			} else {
10738 10738
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10739
-				$query_values = array_merge($query_values,array(':year' => $year));
10739
+				$query_values = array_merge($query_values, array(':year' => $year));
10740 10740
 			}
10741 10741
 		}
10742 10742
 		if ($month != '') {
10743 10743
 			if ($globalDBdriver == 'mysql') {
10744 10744
 				$query .= " AND MONTH(spotter_output.date) = :month";
10745
-				$query_values = array_merge($query_values,array(':month' => $month));
10745
+				$query_values = array_merge($query_values, array(':month' => $month));
10746 10746
 			} else {
10747 10747
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10748
-				$query_values = array_merge($query_values,array(':month' => $month));
10748
+				$query_values = array_merge($query_values, array(':month' => $month));
10749 10749
 			}
10750 10750
 		}
10751 10751
                 if ($query == '') $queryi .= $this->getFilter($filters);
10752
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10752
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10753 10753
 
10754 10754
 
10755 10755
 		$sth = $this->db->prepare($queryi);
@@ -10767,7 +10767,7 @@  discard block
 block discarded – undo
10767 10767
 	public function countAllHoursFromToday($filters = array())
10768 10768
 	{
10769 10769
 		global $globalTimezone, $globalDBdriver;
10770
-		$filter_query = $this->getFilter($filters,true,true);
10770
+		$filter_query = $this->getFilter($filters, true, true);
10771 10771
 		if ($globalTimezone != '') {
10772 10772
 			date_default_timezone_set($globalTimezone);
10773 10773
 			$datetime = new DateTime();
@@ -10775,12 +10775,12 @@  discard block
 block discarded – undo
10775 10775
 		} else $offset = '+00:00';
10776 10776
 
10777 10777
 		if ($globalDBdriver == 'mysql') {
10778
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10778
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10779 10779
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
10780 10780
 								GROUP BY hour_name 
10781 10781
 								ORDER BY hour_name ASC";
10782 10782
 		} else {
10783
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10783
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10784 10784
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
10785 10785
 								GROUP BY hour_name 
10786 10786
 								ORDER BY hour_name ASC";
@@ -10792,7 +10792,7 @@  discard block
 block discarded – undo
10792 10792
 		$hour_array = array();
10793 10793
 		$temp_array = array();
10794 10794
         
10795
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10795
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10796 10796
 		{
10797 10797
 			$temp_array['hour_name'] = $row['hour_name'];
10798 10798
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10811,14 +10811,14 @@  discard block
 block discarded – undo
10811 10811
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10812 10812
 	{
10813 10813
 		global $global_query, $globalDBdriver, $globalTimezone;
10814
-		$filter_query = $this->getFilter($filters,true,true);
10814
+		$filter_query = $this->getFilter($filters, true, true);
10815 10815
 		date_default_timezone_set('UTC');
10816 10816
 		$limit_query = '';
10817 10817
 		if ($limit != "")
10818 10818
 		{
10819 10819
 			$limit_array = explode(",", $limit);
10820
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
10821
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
10820
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
10821
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
10822 10822
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
10823 10823
 			{
10824 10824
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -10871,7 +10871,7 @@  discard block
 block discarded – undo
10871 10871
 			    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')
10872 10872
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
10873 10873
 			//echo $query;
10874
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
10874
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
10875 10875
 			/*
10876 10876
 			$sth = $this->db->prepare($query);
10877 10877
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -10890,9 +10890,9 @@  discard block
 block discarded – undo
10890 10890
 	*/
10891 10891
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10892 10892
 	{
10893
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
10893
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
10894 10894
 
10895
-		$query  = "SELECT spotter_output.spotter_id
10895
+		$query = "SELECT spotter_output.spotter_id
10896 10896
 								FROM spotter_output 
10897 10897
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
10898 10898
         
@@ -10900,7 +10900,7 @@  discard block
 block discarded – undo
10900 10900
 		$sth = $this->db->prepare($query);
10901 10901
 		$sth->execute();
10902 10902
 
10903
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10903
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10904 10904
 		{
10905 10905
 			return $row['spotter_id'];
10906 10906
 		}
@@ -10925,23 +10925,23 @@  discard block
 block discarded – undo
10925 10925
 		}
10926 10926
 		
10927 10927
 		$current_date = date("Y-m-d H:i:s");
10928
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
10928
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
10929 10929
 		
10930 10930
 		$diff = abs(strtotime($current_date) - strtotime($date));
10931 10931
 
10932
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
10932
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
10933 10933
 		$years = $time_array['years'];
10934 10934
 		
10935
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
10935
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
10936 10936
 		$months = $time_array['months'];
10937 10937
 		
10938
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
10938
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
10939 10939
 		$days = $time_array['days'];
10940
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
10940
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
10941 10941
 		$hours = $time_array['hours'];
10942
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
10942
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
10943 10943
 		$minutes = $time_array['minutes'];
10944
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10944
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10945 10945
 		
10946 10946
 		return $time_array;	
10947 10947
 	}	
@@ -10967,63 +10967,63 @@  discard block
 block discarded – undo
10967 10967
 			$temp_array['direction_degree'] = $direction;
10968 10968
 			$temp_array['direction_shortname'] = "N";
10969 10969
 			$temp_array['direction_fullname'] = "North";
10970
-		} elseif ($direction >= 22.5 && $direction < 45){
10970
+		} elseif ($direction >= 22.5 && $direction < 45) {
10971 10971
 			$temp_array['direction_degree'] = $direction;
10972 10972
 			$temp_array['direction_shortname'] = "NNE";
10973 10973
 			$temp_array['direction_fullname'] = "North-Northeast";
10974
-		} elseif ($direction >= 45 && $direction < 67.5){
10974
+		} elseif ($direction >= 45 && $direction < 67.5) {
10975 10975
 			$temp_array['direction_degree'] = $direction;
10976 10976
 			$temp_array['direction_shortname'] = "NE";
10977 10977
 			$temp_array['direction_fullname'] = "Northeast";
10978
-		} elseif ($direction >= 67.5 && $direction < 90){
10978
+		} elseif ($direction >= 67.5 && $direction < 90) {
10979 10979
 			$temp_array['direction_degree'] = $direction;
10980 10980
 			$temp_array['direction_shortname'] = "ENE";
10981 10981
 			$temp_array['direction_fullname'] = "East-Northeast";
10982
-		} elseif ($direction >= 90 && $direction < 112.5){
10982
+		} elseif ($direction >= 90 && $direction < 112.5) {
10983 10983
 			$temp_array['direction_degree'] = $direction;
10984 10984
 			$temp_array['direction_shortname'] = "E";
10985 10985
 			$temp_array['direction_fullname'] = "East";
10986
-		} elseif ($direction >= 112.5 && $direction < 135){
10986
+		} elseif ($direction >= 112.5 && $direction < 135) {
10987 10987
 			$temp_array['direction_degree'] = $direction;
10988 10988
 			$temp_array['direction_shortname'] = "ESE";
10989 10989
 			$temp_array['direction_fullname'] = "East-Southeast";
10990
-		} elseif ($direction >= 135 && $direction < 157.5){
10990
+		} elseif ($direction >= 135 && $direction < 157.5) {
10991 10991
 			$temp_array['direction_degree'] = $direction;
10992 10992
 			$temp_array['direction_shortname'] = "SE";
10993 10993
 			$temp_array['direction_fullname'] = "Southeast";
10994
-		} elseif ($direction >= 157.5 && $direction < 180){
10994
+		} elseif ($direction >= 157.5 && $direction < 180) {
10995 10995
 			$temp_array['direction_degree'] = $direction;
10996 10996
 			$temp_array['direction_shortname'] = "SSE";
10997 10997
 			$temp_array['direction_fullname'] = "South-Southeast";
10998
-		} elseif ($direction >= 180 && $direction < 202.5){
10998
+		} elseif ($direction >= 180 && $direction < 202.5) {
10999 10999
 			$temp_array['direction_degree'] = $direction;
11000 11000
 			$temp_array['direction_shortname'] = "S";
11001 11001
 			$temp_array['direction_fullname'] = "South";
11002
-		} elseif ($direction >= 202.5 && $direction < 225){
11002
+		} elseif ($direction >= 202.5 && $direction < 225) {
11003 11003
 			$temp_array['direction_degree'] = $direction;
11004 11004
 			$temp_array['direction_shortname'] = "SSW";
11005 11005
 			$temp_array['direction_fullname'] = "South-Southwest";
11006
-		} elseif ($direction >= 225 && $direction < 247.5){
11006
+		} elseif ($direction >= 225 && $direction < 247.5) {
11007 11007
 			$temp_array['direction_degree'] = $direction;
11008 11008
 			$temp_array['direction_shortname'] = "SW";
11009 11009
 			$temp_array['direction_fullname'] = "Southwest";
11010
-		} elseif ($direction >= 247.5 && $direction < 270){
11010
+		} elseif ($direction >= 247.5 && $direction < 270) {
11011 11011
 			$temp_array['direction_degree'] = $direction;
11012 11012
 			$temp_array['direction_shortname'] = "WSW";
11013 11013
 			$temp_array['direction_fullname'] = "West-Southwest";
11014
-		} elseif ($direction >= 270 && $direction < 292.5){
11014
+		} elseif ($direction >= 270 && $direction < 292.5) {
11015 11015
 			$temp_array['direction_degree'] = $direction;
11016 11016
 			$temp_array['direction_shortname'] = "W";
11017 11017
 			$temp_array['direction_fullname'] = "West";
11018
-		} elseif ($direction >= 292.5 && $direction < 315){
11018
+		} elseif ($direction >= 292.5 && $direction < 315) {
11019 11019
 			$temp_array['direction_degree'] = $direction;
11020 11020
 			$temp_array['direction_shortname'] = "WNW";
11021 11021
 			$temp_array['direction_fullname'] = "West-Northwest";
11022
-		} elseif ($direction >= 315 && $direction < 337.5){
11022
+		} elseif ($direction >= 315 && $direction < 337.5) {
11023 11023
 			$temp_array['direction_degree'] = $direction;
11024 11024
 			$temp_array['direction_shortname'] = "NW";
11025 11025
 			$temp_array['direction_fullname'] = "Northwest";
11026
-		} elseif ($direction >= 337.5 && $direction < 360){
11026
+		} elseif ($direction >= 337.5 && $direction < 360) {
11027 11027
 			$temp_array['direction_degree'] = $direction;
11028 11028
 			$temp_array['direction_shortname'] = "NNW";
11029 11029
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11076,9 +11076,9 @@  discard block
 block discarded – undo
11076 11076
 	*/
11077 11077
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11078 11078
 	{
11079
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11079
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11080 11080
 	
11081
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11081
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11082 11082
 		
11083 11083
 		$sth = $this->db->prepare($query);
11084 11084
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11101,9 +11101,9 @@  discard block
 block discarded – undo
11101 11101
 	*/
11102 11102
 	public function getAircraftTypeBymodeS($aircraft_modes)
11103 11103
 	{
11104
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11104
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11105 11105
 	
11106
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11106
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11107 11107
 		
11108 11108
 		$sth = $this->db->prepare($query);
11109 11109
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11124,11 +11124,11 @@  discard block
 block discarded – undo
11124 11124
 	* @param Float $longitude longitute of the flight
11125 11125
 	* @return String the countrie
11126 11126
 	*/
11127
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11127
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11128 11128
 	{
11129 11129
 		global $globalDBdriver, $globalDebug;
11130
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11131
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11130
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11131
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11132 11132
 	
11133 11133
 		$Connection = new Connection($this->db);
11134 11134
 		if (!$Connection->tableExists('countries')) return '';
@@ -11168,7 +11168,7 @@  discard block
 block discarded – undo
11168 11168
 	public function getCountryFromISO2($iso2)
11169 11169
 	{
11170 11170
 		global $globalDBdriver, $globalDebug;
11171
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11171
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11172 11172
 	
11173 11173
 		$Connection = new Connection($this->db);
11174 11174
 		if (!$Connection->tableExists('countries')) return '';
@@ -11200,19 +11200,19 @@  discard block
 block discarded – undo
11200 11200
 	*/
11201 11201
 	public function convertAircraftRegistration($registration)
11202 11202
 	{
11203
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11203
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11204 11204
 		$registration_prefix = '';
11205 11205
 		$registration_1 = substr($registration, 0, 1);
11206 11206
 		$registration_2 = substr($registration, 0, 2);
11207 11207
 
11208 11208
 		//first get the prefix based on two characters
11209
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11209
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11210 11210
       
11211 11211
 		
11212 11212
 		$sth = $this->db->prepare($query);
11213 11213
 		$sth->execute(array(':registration_2' => $registration_2));
11214 11214
         
11215
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11215
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11216 11216
 		{
11217 11217
 			$registration_prefix = $row['registration_prefix'];
11218 11218
 		}
@@ -11220,11 +11220,11 @@  discard block
 block discarded – undo
11220 11220
 		//if we didn't find a two chracter prefix lets just search the one with one character
11221 11221
 		if ($registration_prefix == '')
11222 11222
 		{
11223
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11223
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11224 11224
 			$sth = $this->db->prepare($query);
11225 11225
 			$sth->execute(array(':registration_1' => $registration_1));
11226 11226
 	        
11227
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11227
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11228 11228
 			{
11229 11229
 				$registration_prefix = $row['registration_prefix'];
11230 11230
 			}
@@ -11238,7 +11238,7 @@  discard block
 block discarded – undo
11238 11238
 			} else {
11239 11239
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11240 11240
 			}
11241
-		} else if(strlen($registration_prefix) == 2){
11241
+		} else if (strlen($registration_prefix) == 2) {
11242 11242
 			if (0 === strpos($registration, 'N')) {
11243 11243
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11244 11244
 			} else {
@@ -11257,17 +11257,17 @@  discard block
 block discarded – undo
11257 11257
 	*/
11258 11258
 	public function countryFromAircraftRegistration($registration)
11259 11259
 	{
11260
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11260
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11261 11261
 		
11262 11262
 		$registration_prefix = '';
11263
-		$registration_test = explode('-',$registration);
11263
+		$registration_test = explode('-', $registration);
11264 11264
 		$country = '';
11265 11265
 		if ($registration_test[0] != $registration) {
11266 11266
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11267 11267
 	      
11268 11268
 			$sth = $this->db->prepare($query);
11269 11269
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11270
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11270
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11271 11271
 			{
11272 11272
 				//$registration_prefix = $row['registration_prefix'];
11273 11273
 				$country = $row['country'];
@@ -11278,13 +11278,13 @@  discard block
 block discarded – undo
11278 11278
 
11279 11279
 			$country = '';
11280 11280
 			//first get the prefix based on two characters
11281
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11281
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11282 11282
       
11283 11283
 			
11284 11284
 			$sth = $this->db->prepare($query);
11285 11285
 			$sth->execute(array(':registration_2' => $registration_2));
11286 11286
         
11287
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11287
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11288 11288
 			{
11289 11289
 				$registration_prefix = $row['registration_prefix'];
11290 11290
 				$country = $row['country'];
@@ -11293,12 +11293,12 @@  discard block
 block discarded – undo
11293 11293
 			//if we didn't find a two chracter prefix lets just search the one with one character
11294 11294
 			if ($registration_prefix == "")
11295 11295
 			{
11296
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11296
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11297 11297
 	      
11298 11298
 				$sth = $this->db->prepare($query);
11299 11299
 				$sth->execute(array(':registration_1' => $registration_1));
11300 11300
 	        
11301
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11301
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11302 11302
 				{
11303 11303
 					//$registration_prefix = $row['registration_prefix'];
11304 11304
 					$country = $row['country'];
@@ -11318,17 +11318,17 @@  discard block
 block discarded – undo
11318 11318
 	*/
11319 11319
 	public function registrationPrefixFromAircraftRegistration($registration)
11320 11320
 	{
11321
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11321
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11322 11322
 		
11323 11323
 		$registration_prefix = '';
11324
-		$registration_test = explode('-',$registration);
11324
+		$registration_test = explode('-', $registration);
11325 11325
 		//$country = '';
11326 11326
 		if ($registration_test[0] != $registration) {
11327
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11327
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11328 11328
 	      
11329 11329
 			$sth = $this->db->prepare($query);
11330 11330
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11331
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11331
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11332 11332
 			{
11333 11333
 				$registration_prefix = $row['registration_prefix'];
11334 11334
 				//$country = $row['country'];
@@ -11338,13 +11338,13 @@  discard block
 block discarded – undo
11338 11338
 		        $registration_2 = substr($registration, 0, 2);
11339 11339
 
11340 11340
 			//first get the prefix based on two characters
11341
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11341
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11342 11342
       
11343 11343
 			
11344 11344
 			$sth = $this->db->prepare($query);
11345 11345
 			$sth->execute(array(':registration_2' => $registration_2));
11346 11346
         
11347
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11347
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11348 11348
 			{
11349 11349
 				$registration_prefix = $row['registration_prefix'];
11350 11350
 				//$country = $row['country'];
@@ -11353,12 +11353,12 @@  discard block
 block discarded – undo
11353 11353
 			//if we didn't find a two chracter prefix lets just search the one with one character
11354 11354
 			if ($registration_prefix == "")
11355 11355
 			{
11356
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11356
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11357 11357
 	      
11358 11358
 				$sth = $this->db->prepare($query);
11359 11359
 				$sth->execute(array(':registration_1' => $registration_1));
11360 11360
 	        
11361
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11361
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11362 11362
 				{
11363 11363
 					$registration_prefix = $row['registration_prefix'];
11364 11364
 					//$country = $row['country'];
@@ -11379,13 +11379,13 @@  discard block
 block discarded – undo
11379 11379
 	*/
11380 11380
 	public function countryFromAircraftRegistrationCode($registration)
11381 11381
 	{
11382
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11382
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11383 11383
 		
11384 11384
 		$country = '';
11385
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11385
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11386 11386
 		$sth = $this->db->prepare($query);
11387 11387
 		$sth->execute(array(':registration' => $registration));
11388
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11388
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11389 11389
 		{
11390 11390
 			$country = $row['country'];
11391 11391
 		}
@@ -11398,9 +11398,9 @@  discard block
 block discarded – undo
11398 11398
 	* @param String $flightaware_id flightaware_id from spotter_output table
11399 11399
 	* @param String $highlight New highlight value
11400 11400
 	*/
11401
-	public function setHighlightFlight($flightaware_id,$highlight) {
11401
+	public function setHighlightFlight($flightaware_id, $highlight) {
11402 11402
 		
11403
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11403
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11404 11404
 		$sth = $this->db->prepare($query);
11405 11405
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11406 11406
 	}
@@ -11412,13 +11412,13 @@  discard block
 block discarded – undo
11412 11412
 	* @param String $date Date of spotted aircraft
11413 11413
 	* @param String $highlight New highlight value
11414 11414
 	*/
11415
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11415
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11416 11416
 		if ($date == '') {
11417 11417
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11418 11418
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11419 11419
 		} else {
11420 11420
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11421
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11421
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11422 11422
 		}
11423 11423
 		$sth = $this->db->prepare($query);
11424 11424
 		$sth->execute($query_values);
@@ -11448,7 +11448,7 @@  discard block
 block discarded – undo
11448 11448
 		
11449 11449
 		$bitly_data = json_decode($bitly_data);
11450 11450
 		$bitly_url = '';
11451
-		if ($bitly_data->status_txt = "OK"){
11451
+		if ($bitly_data->status_txt = "OK") {
11452 11452
 			$bitly_url = $bitly_data->data->url;
11453 11453
 		}
11454 11454
 
@@ -11458,7 +11458,7 @@  discard block
 block discarded – undo
11458 11458
 
11459 11459
 	public function getOrderBy()
11460 11460
 	{
11461
-		$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"));
11461
+		$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"));
11462 11462
 		
11463 11463
 		return $orderby;
11464 11464
 		
@@ -11592,14 +11592,14 @@  discard block
 block discarded – undo
11592 11592
 		}
11593 11593
 		$sth = $this->db->prepare($query);
11594 11594
 		$sth->execute();
11595
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11595
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11596 11596
 		{
11597 11597
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11598 11598
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11599 11599
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11600
-				$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";
11600
+				$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";
11601 11601
 				$sthu = $this->db->prepare($update_query);
11602
-				$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']));
11602
+				$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']));
11603 11603
 			}
11604 11604
 		}
11605 11605
 		
@@ -11612,7 +11612,7 @@  discard block
 block discarded – undo
11612 11612
 		}
11613 11613
 		$sth = $this->db->prepare($query);
11614 11614
 		$sth->execute();
11615
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11615
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11616 11616
 		{
11617 11617
 			if (is_numeric(substr($row['ident'], -1, 1)))
11618 11618
 			{
@@ -11621,11 +11621,11 @@  discard block
 block discarded – undo
11621 11621
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11622 11622
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11623 11623
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11624
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11624
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11625 11625
 				if (isset($airline_array[0]['name'])) {
11626
-					$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";
11626
+					$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";
11627 11627
 					$sthu = $this->db->prepare($update_query);
11628
-					$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']));
11628
+					$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']));
11629 11629
 				}
11630 11630
 			}
11631 11631
 		}
@@ -11645,18 +11645,18 @@  discard block
 block discarded – undo
11645 11645
 		}
11646 11646
 		$sth = $this->db->prepare($query);
11647 11647
 		$sth->execute();
11648
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11648
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11649 11649
 		{
11650 11650
 			if ($row['aircraft_icao'] != '') {
11651 11651
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11652
-				if ($row['registration'] != ""){
11652
+				if ($row['registration'] != "") {
11653 11653
 					$image_array = $Image->getSpotterImage($row['registration']);
11654 11654
 					if (!isset($image_array[0]['registration'])) {
11655 11655
 						$Image->addSpotterImage($row['registration']);
11656 11656
 					}
11657 11657
 				}
11658 11658
 				if (count($aircraft_name) > 0) {
11659
-					$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";
11659
+					$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";
11660 11660
 					$sthu = $this->db->prepare($update_query);
11661 11661
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11662 11662
 				}
@@ -11671,10 +11671,10 @@  discard block
 block discarded – undo
11671 11671
 		$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";
11672 11672
 		$sth = $this->db->prepare($query);
11673 11673
 		$sth->execute();
11674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11675 11675
 		{
11676 11676
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
11677
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
11677
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
11678 11678
 				$airport_icao = '';
11679 11679
 				 if (isset($closestAirports[0])) {
11680 11680
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -11688,7 +11688,7 @@  discard block
 block discarded – undo
11688 11688
 								break;
11689 11689
 							}
11690 11690
 						}
11691
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11691
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
11692 11692
 						$airport_icao = $closestAirports[0]['icao'];
11693 11693
 						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";
11694 11694
 					} else {
@@ -11699,28 +11699,28 @@  discard block
 block discarded – undo
11699 11699
 				}
11700 11700
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11701 11701
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
11702
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11702
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11703 11703
 					$sthu = $this->db->prepare($update_query);
11704
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
11704
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
11705 11705
 				}
11706 11706
 			}
11707 11707
 		}
11708 11708
 	}
11709 11709
 	
11710
-	public function closestAirports($origLat,$origLon,$dist = 10) {
11710
+	public function closestAirports($origLat, $origLon, $dist = 10) {
11711 11711
 		global $globalDBdriver;
11712
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
11712
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
11713 11713
 /*
11714 11714
 		$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 
11715 11715
                       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)) 
11716 11716
                       having distance < $dist ORDER BY distance limit 100;";
11717 11717
 */
11718 11718
 		if ($globalDBdriver == 'mysql') {
11719
-			$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 
11719
+			$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 
11720 11720
 	                      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)) 
11721 11721
 	                      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;";
11722 11722
                 } else {
11723
-			$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 
11723
+			$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 
11724 11724
 	                      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)) 
11725 11725
 	                      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;";
11726 11726
     		}
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <?php 
173
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
173
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174 174
 ?>
175 175
 
176 176
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
177 177
 <?php    
178
-	    }
179
-    } else {
178
+		}
179
+	} else {
180 180
 ?>
181 181
 <?php
182 182
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 */
189 189
 ?>
190 190
 <?php 
191
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
191
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192 192
 ?>
193 193
 <?php
194 194
 //		if (isset($globalBeta) && $globalBeta) {
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 ?>
200 200
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script>
201 201
 <?php
202
-	    }
202
+		}
203 203
 ?>
204 204
 <?php
205 205
 //	}
206 206
 ?>
207 207
 <?php
208
-    }
208
+	}
209 209
 }
210 210
 ?>
211 211
 <?php
@@ -360,15 +360,15 @@  discard block
 block discarded – undo
360 360
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
361 361
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
362 362
 <?php
363
-    if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
363
+	if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
364 364
 ?>
365 365
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
366 366
 <?php
367
-    } else {
367
+	} else {
368 368
 ?>
369 369
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
370 370
 <?php
371
-    }
371
+	}
372 372
 ?>
373 373
 			<li><hr /></li>
374 374
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -376,34 +376,34 @@  discard block
 block discarded – undo
376 376
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
377 377
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
378 378
             <?php
379
-        	if ($globalACARS) {
380
-        	    if (isset($globalDemo) && $globalDemo) {
381
-    	    ?>
379
+			if ($globalACARS) {
380
+				if (isset($globalDemo) && $globalDemo) {
381
+			?>
382 382
             <li><hr /></li>
383 383
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
384 384
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
385 385
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
386 386
             <?php
387
-        	    } else {
388
-    	    ?>
387
+				} else {
388
+			?>
389 389
             <li><hr /></li>
390 390
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
391 391
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
392 392
             <?php
393
-        	    }
394
-        	}
395
-    	    ?>
393
+				}
394
+			}
395
+			?>
396 396
     	    <?php
397
-    	        if (isset($globalAccidents) && $globalAccidents) {
398
-    	    ?>
397
+				if (isset($globalAccidents) && $globalAccidents) {
398
+			?>
399 399
             <li><hr /></li>
400 400
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident messages"); ?></a></li>
401 401
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
402 402
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident messages"); ?></a></li>
403 403
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
404 404
             <?php
405
-        	}
406
-    	    ?>
405
+			}
406
+			?>
407 407
             <li><hr /></li>
408 408
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
409 409
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
   	    <form>
446 446
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
447 447
   		    <?php
448
-  		        $Language = new Language();
449
-  		        $alllang = $Language->getLanguages();
450
-  		        foreach ($alllang as $key => $lang) {
451
-  		            print '<option value="'.$key.'"';
452
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
453
-  		            print '>'.$lang[0].'</option>';
454
-  		        }
455
-  		    ?>
448
+  				$Language = new Language();
449
+  				$alllang = $Language->getLanguages();
450
+  				foreach ($alllang as $key => $lang) {
451
+  					print '<option value="'.$key.'"';
452
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
453
+  					print '>'.$lang[0].'</option>';
454
+  				}
455
+  			?>
456 456
   		</select>
457 457
   	    </form>
458 458
   	</div>
@@ -483,18 +483,18 @@  discard block
 block discarded – undo
483 483
 ?>
484 484
     <div class="top-header clear" role="main">
485 485
 <?php
486
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
486
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
487 487
 ?>
488 488
     <div id="archive-map"></div>
489 489
 <?php
490
-    }
490
+	}
491 491
 ?>
492 492
     </div>
493 493
 <?php
494 494
 }
495 495
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
496 496
 {
497
-    ?>
497
+	?>
498 498
     <div class="top-header clear" role="main">
499 499
         <div id="map"></div>
500 500
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -505,15 +505,15 @@  discard block
 block discarded – undo
505 505
         var zoom = 13;
506 506
 //create the map
507 507
 <?php
508
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
508
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
509 509
 ?>
510 510
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
511 511
 <?php
512
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
512
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
513 513
 ?>
514 514
   map = L.map('map', { zoomControl:true });
515 515
 <?php
516
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
516
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
517 517
 ?>
518 518
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
519 519
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -521,22 +521,22 @@  discard block
 block discarded – undo
521 521
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
522 522
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
523 523
 <?php
524
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
524
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
525 525
 ?>
526 526
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
527 527
 <?php
528
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
528
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
529 529
 ?>
530 530
   map = L.map('map', { zoomControl:true });
531 531
 <?php
532
-    }
532
+	}
533 533
 ?>
534 534
   //initialize the layer group for the aircrft markers
535 535
   var layer_data = L.layerGroup();
536 536
 
537 537
   //a few title layers
538 538
 <?php
539
-    if ($globalMapProvider == 'Mapbox') {
539
+	if ($globalMapProvider == 'Mapbox') {
540 540
 ?>
541 541
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
542 542
     maxZoom: 18,
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     token : '<?php print $globalMapboxToken; ?>'
548 548
   }).addTo(map);
549 549
 <?php
550
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
550
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
551 551
 ?>
552 552
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
553 553
     maxZoom: 18,
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
556 556
   }).addTo(map);
557 557
 <?php
558
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
558
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
559 559
 ?>
560 560
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
561 561
     maxZoom: 18,
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
565 565
   }).addTo(map);
566 566
 <?php
567
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
567
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
568 568
 ?>
569 569
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
570 570
     maxZoom: 18,
@@ -573,27 +573,27 @@  discard block
 block discarded – undo
573 573
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
574 574
   }).addTo(map);
575 575
 <?php
576
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
576
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
577 577
 ?>
578 578
     var googleLayer = new L.Google('ROADMAP');
579 579
     map.addLayer(googleLayer);
580 580
 <?php
581
-    } elseif ($globalMapProvider == 'Google-Satellite') {
581
+	} elseif ($globalMapProvider == 'Google-Satellite') {
582 582
 ?>
583 583
     var googleLayer = new L.Google('SATELLITE');
584 584
     map.addLayer(googleLayer);
585 585
 <?php
586
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
586
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
587 587
 ?>
588 588
     var googleLayer = new L.Google('HYBRID');
589 589
     map.addLayer(googleLayer);
590 590
 <?php
591
-    } elseif ($globalMapProvider == 'Google-Terrain') {
591
+	} elseif ($globalMapProvider == 'Google-Terrain') {
592 592
 ?>
593 593
     var googleLayer = new L.Google('Terrain');
594 594
     map.addLayer(googleLayer);
595 595
 <?php
596
-    }
596
+	}
597 597
 ?>
598 598
         </script>
599 599
     </div>
Please login to merge, or discard this patch.