Completed
Push — master ( b7c521...b3c778 )
by Yannick
06:35
created
require/class.Common.php 4 patches
Doc Comments   +9 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,6 +79,10 @@  discard block
 block discarded – undo
79 79
 		return strlen($headerLine); // Needed by curl
80 80
 	}
81 81
 
82
+	/**
83
+	 * @param string $url
84
+	 * @param string $file
85
+	 */
82 86
 	public static function download($url, $file, $referer = '') {
83 87
 		global $globalDebug;
84 88
 		$fp = fopen($file, 'w');
@@ -179,7 +183,7 @@  discard block
 block discarded – undo
179 183
 	* Check is distance realistic
180 184
 	* @param int $timeDifference the time between the reception of both messages
181 185
 	* @param float $distance distance covered
182
-	* @return whether distance is realistic
186
+	* @return boolean distance is realistic
183 187
 	*/
184 188
 	public function withinThreshold ($timeDifference, $distance) {
185 189
 		$x = abs($timeDifference);
@@ -202,6 +206,9 @@  discard block
 block discarded – undo
202 206
 	}
203 207
 
204 208
 
209
+	/**
210
+	 * @param string $latlong
211
+	 */
205 212
 	public function convertDec($dms,$latlong) {
206 213
 		if ($latlong == 'latitude') {
207 214
 			$deg = substr($dms, 0, 2);
@@ -303,7 +310,7 @@  discard block
 block discarded – undo
303 310
 	/**
304 311
 	* Returns list of available locales
305 312
 	*
306
-	* @return array
313
+	* @return string[]
307 314
 	 */
308 315
 	public function listLocaleDir()
309 316
 	{
Please login to merge, or discard this patch.
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
 	public 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
 	public 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
 	public 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.Connection.php 4 patches
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 34;
8 8
 	
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 	    global $globalDBdriver;
11 14
 	    if ($dbc === null) {
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
 		return true;
133 136
 	}
134 137
 
138
+	/**
139
+	 * @param string $table
140
+	 */
135 141
 	public function tableExists($table)
136 142
 	{
137 143
 		global $globalDBdriver, $globalDBname;
@@ -181,6 +187,11 @@  discard block
 block discarded – undo
181 187
 	/*
182 188
 	* Check if index exist
183 189
 	*/
190
+
191
+	/**
192
+	 * @param string $table
193
+	 * @param string $index
194
+	 */
184 195
 	public function indexExists($table,$index)
185 196
 	{
186 197
 		global $globalDBdriver, $globalDBname;
@@ -227,6 +238,11 @@  discard block
 block discarded – undo
227 238
 	* Check if a column name exist in a table
228 239
 	* @return Boolean column exist or not
229 240
 	*/
241
+
242
+	/**
243
+	 * @param string $table
244
+	 * @param string $name
245
+	 */
230 246
 	public function checkColumnName($table,$name)
231 247
 	{
232 248
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 34;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver;
11
-	    if ($dbc === null) {
10
+		global $globalDBdriver;
11
+		if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13
-		    if ($user === null && $pass === null) {
13
+			if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15
-		    } else {
15
+			} else {
16 16
 			$this->createDBConnection(null,$user,$pass);
17
-		    }
17
+			}
18 18
 		} else {
19
-		    $this->createDBConnection($dbname);
19
+			$this->createDBConnection($dbname);
20 20
 		}
21
-	    } elseif ($dbname === null || $dbname === 'default') {
21
+		} elseif ($dbname === null || $dbname === 'default') {
22 22
 		$this->db = $dbc;
23 23
 		if ($this->connectionExists() === false) {
24 24
 			/*
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 			*/
29 29
 			$this->createDBConnection();
30 30
 		}
31
-	    } else {
31
+		} else {
32 32
 		//$this->connectionExists();
33 33
 		$this->dbs[$dbname] = $dbc;
34
-	    }
34
+		}
35 35
 	}
36 36
 
37 37
 	public function db() {
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Creates the database connection
51
-	*
52
-	* @return Boolean of the database connection
53
-	*
54
-	*/
50
+	 * Creates the database connection
51
+	 *
52
+	 * @return Boolean of the database connection
53
+	 *
54
+	 */
55 55
 
56 56
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
57 57
 	{
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			return false;
149 149
 		}
150 150
 		if($results->rowCount()>0) {
151
-		    return true; 
151
+			return true; 
152 152
 		}
153 153
 		else return false;
154 154
 	}
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 				$sum = $sum->fetchColumn(0);
166 166
 			} else $sum = 0;
167 167
 			if (intval($sum) !== 2) {
168
-			     return false;
168
+				 return false;
169 169
 			}
170 170
 			
171 171
 		} catch(PDOException $e) {
172 172
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173
-            			throw $e;
174
-	                }
175
-	                //echo 'error ! '.$e->getMessage();
173
+						throw $e;
174
+					}
175
+					//echo 'error ! '.$e->getMessage();
176 176
 			return false;
177 177
 		}
178 178
 		return true; 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 		$version = 0;
271 271
 		if ($this->tableExists('aircraft')) {
272 272
 			if (!$this->tableExists('config')) {
273
-	    			$version = '1';
274
-	    			return $version;
273
+					$version = '1';
274
+					return $version;
275 275
 			} else {
276 276
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
277 277
 				try {
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	* @return Boolean if latest version or not
293 293
 	*/
294 294
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
295
+		if ($this->check_schema_version() == $this->latest_schema) return true;
296
+		else return false;
297 297
 	}
298 298
 
299 299
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 
4
-class Connection{
4
+class Connection {
5 5
 	public $db = null;
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 34;
8 8
 	
9
-	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
9
+	public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) {
10 10
 	    global $globalDBdriver;
11 11
 	    if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13 13
 		    if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15 15
 		    } else {
16
-			$this->createDBConnection(null,$user,$pass);
16
+			$this->createDBConnection(null, $user, $pass);
17 17
 		    }
18 18
 		} else {
19 19
 		    $this->createDBConnection($dbname);
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		while (true) {
92 92
 			try {
93 93
 				if ($globalDBSdriver == 'mysql') {
94
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser,  $globalDBSpass);
94
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass);
95 95
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 96
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
97
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
98
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500);
99
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
100
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
101
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
102 102
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 103
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 104
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 					$this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"');
109 109
 					//$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"');
110 110
 				} else {
111
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser,  $globalDBSpass);
111
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass);
112 112
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 113
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
114
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
115
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200);
116
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
117
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
118
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
119 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 120
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 121
 				}
122 122
 				break;
123
-			} catch(PDOException $e) {
123
+			} catch (PDOException $e) {
124 124
 				$i++;
125 125
 				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
126 126
 				//exit;
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			//$Connection = new Connection();
146 146
 			$results = $this->db->query($query);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return false;
149 149
 		}
150
-		if($results->rowCount()>0) {
150
+		if ($results->rowCount() > 0) {
151 151
 		    return true; 
152 152
 		}
153 153
 		else return false;
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 			     return false;
169 169
 			}
170 170
 			
171
-		} catch(PDOException $e) {
172
-			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
171
+		} catch (PDOException $e) {
172
+			if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173 173
             			throw $e;
174 174
 	                }
175 175
 	                //echo 'error ! '.$e->getMessage();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	/*
182 182
 	* Check if index exist
183 183
 	*/
184
-	public function indexExists($table,$index)
184
+	public function indexExists($table, $index)
185 185
 	{
186 186
 		global $globalDBdriver, $globalDBname;
187 187
 		if ($globalDBdriver == 'mysql') {
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 		try {
193 193
 			//$Connection = new Connection();
194 194
 			$results = $this->db->query($query);
195
-		} catch(PDOException $e) {
195
+		} catch (PDOException $e) {
196 196
 			return false;
197 197
 		}
198 198
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199
-		if($nb[0]['nb'] > 0) {
199
+		if ($nb[0]['nb'] > 0) {
200 200
 			return true; 
201 201
 		}
202 202
 		else return false;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$query = "SELECT * FROM ".$table." LIMIT 0";
212 212
 		try {
213 213
 			$results = $this->db->query($query);
214
-		} catch(PDOException $e) {
214
+		} catch (PDOException $e) {
215 215
 			return "error : ".$e->getMessage()."\n";
216 216
 		}
217 217
 		$columns = array();
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	* Check if a column name exist in a table
228 228
 	* @return Boolean column exist or not
229 229
 	*/
230
-	public function checkColumnName($table,$name)
230
+	public function checkColumnName($table, $name)
231 231
 	{
232 232
 		global $globalDBdriver, $globalDBname;
233 233
 		if ($globalDBdriver == 'mysql') {
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 		}
238 238
 			try {
239 239
 				$sth = $this->db()->prepare($query);
240
-				$sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name));
241
-			} catch(PDOException $e) {
240
+				$sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name));
241
+			} catch (PDOException $e) {
242 242
 				echo "error : ".$e->getMessage()."\n";
243 243
 			}
244 244
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 				try {
278 278
 					$sth = $this->db->prepare($query);
279 279
 					$sth->execute();
280
-				} catch(PDOException $e) {
280
+				} catch (PDOException $e) {
281 281
 					return "error : ".$e->getMessage()."\n";
282 282
 				}
283 283
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -64,8 +64,11 @@  discard block
 block discarded – undo
64 64
 				$globalDBSname = $globalDBname;
65 65
 				$globalDBSuser = $globalDBuser;
66 66
 				$globalDBSpass = $globalDBpass;
67
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
68
-				else $globalDBSport = $globalDBport;
67
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
68
+					$globalDBSport = 3306;
69
+				} else {
70
+					$globalDBSport = $globalDBport;
71
+				}
69 72
 			} else {
70 73
 				$DBname = 'default';
71 74
 				$globalDBSdriver = $globalDBdriver;
@@ -73,8 +76,11 @@  discard block
 block discarded – undo
73 76
 				$globalDBSname = $globalDBname;
74 77
 				$globalDBSuser = $user;
75 78
 				$globalDBSpass = $pass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
79
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
80
+					$globalDBSport = 3306;
81
+				} else {
82
+					$globalDBSport = $globalDBport;
83
+				}
78 84
 			}
79 85
 		} else {
80 86
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -82,11 +88,16 @@  discard block
 block discarded – undo
82 88
 			$globalDBSname = $globalDB[$DBname]['name'];
83 89
 			$globalDBSuser = $globalDB[$DBname]['user'];
84 90
 			$globalDBSpass = $globalDB[$DBname]['pass'];
85
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
86
-			else $globalDBSport = 3306;
91
+			if (isset($globalDB[$DBname]['port'])) {
92
+				$globalDBSport = $globalDB[$DBname]['port'];
93
+			} else {
94
+				$globalDBSport = 3306;
95
+			}
87 96
 		}
88 97
 		// Set number of try to connect to DB
89
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
98
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
99
+			$globalDBretry = 5;
100
+		}
90 101
 		$i = 0;
91 102
 		while (true) {
92 103
 			try {
@@ -95,10 +106,16 @@  discard block
 block discarded – undo
95 106
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 107
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97 108
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
109
+					if (!isset($globalDBTimeOut)) {
110
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
111
+					} else {
112
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
113
+					}
114
+					if (!isset($globalDBPersistent)) {
115
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
116
+					} else {
117
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					}
102 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 120
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 121
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -112,23 +129,35 @@  discard block
 block discarded – undo
112 129
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 130
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114 131
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
132
+					if (!isset($globalDBTimeOut)) {
133
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
134
+					} else {
135
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
136
+					}
137
+					if (!isset($globalDBPersistent)) {
138
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
139
+					} else {
140
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
141
+					}
119 142
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 143
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 144
 				}
122 145
 				break;
123 146
 			} catch(PDOException $e) {
124 147
 				$i++;
125
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
148
+				if (isset($globalDebug) && $globalDebug) {
149
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
150
+				}
126 151
 				//exit;
127
-				if ($i > $globalDBretry) return false;
152
+				if ($i > $globalDBretry) {
153
+					return false;
154
+				}
128 155
 				//return false;
129 156
 			}
130 157
 		}
131
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
158
+		if ($DBname === 'default') {
159
+			$this->db = $this->dbs['default'];
160
+		}
132 161
 		return true;
133 162
 	}
134 163
 
@@ -140,7 +169,9 @@  discard block
 block discarded – undo
140 169
 		} else {
141 170
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
142 171
 		}
143
-		if ($this->db == NULL) return false;
172
+		if ($this->db == NULL) {
173
+			return false;
174
+		}
144 175
 		try {
145 176
 			//$Connection = new Connection();
146 177
 			$results = $this->db->query($query);
@@ -149,21 +180,28 @@  discard block
 block discarded – undo
149 180
 		}
150 181
 		if($results->rowCount()>0) {
151 182
 		    return true; 
183
+		} else {
184
+			return false;
152 185
 		}
153
-		else return false;
154 186
 	}
155 187
 
156 188
 	public function connectionExists()
157 189
 	{
158 190
 		global $globalDBdriver, $globalDBCheckConnection;
159
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
191
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
192
+			return true;
193
+		}
160 194
 		$query = "SELECT 1 + 1";
161
-		if ($this->db === null) return false;
195
+		if ($this->db === null) {
196
+			return false;
197
+		}
162 198
 		try {
163 199
 			$sum = @$this->db->query($query);
164 200
 			if ($sum instanceof \PDOStatement) {
165 201
 				$sum = $sum->fetchColumn(0);
166
-			} else $sum = 0;
202
+			} else {
203
+				$sum = 0;
204
+			}
167 205
 			if (intval($sum) !== 2) {
168 206
 			     return false;
169 207
 			}
@@ -198,8 +236,9 @@  discard block
 block discarded – undo
198 236
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199 237
 		if($nb[0]['nb'] > 0) {
200 238
 			return true; 
239
+		} else {
240
+			return false;
201 241
 		}
202
-		else return false;
203 242
 	}
204 243
 
205 244
 	/*
@@ -243,9 +282,12 @@  discard block
 block discarded – undo
243 282
 			}
244 283
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
245 284
 			$sth->closeCursor();
246
-			if ($result['nb'] > 0) return true;
247
-			else return false;
248
-/*		} else {
285
+			if ($result['nb'] > 0) {
286
+				return true;
287
+			} else {
288
+				return false;
289
+			}
290
+			/*		} else {
249 291
 			$query = "SELECT * FROM ".$table." LIMIT 0";
250 292
 			try {
251 293
 				$results = $this->db->query($query);
@@ -284,7 +326,9 @@  discard block
 block discarded – undo
284 326
 				$sth->closeCursor();
285 327
 				return $result['value'];
286 328
 			}
287
-		} else return $version;
329
+		} else {
330
+			return $version;
331
+		}
288 332
 	}
289 333
 	
290 334
 	/*
@@ -292,8 +336,11 @@  discard block
 block discarded – undo
292 336
 	* @return Boolean if latest version or not
293 337
 	*/
294 338
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
339
+	    if ($this->check_schema_version() == $this->latest_schema) {
340
+	    	return true;
341
+	    } else {
342
+	    	return false;
343
+	    }
297 344
 	}
298 345
 
299 346
 }
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
@@ -8717,6 +8717,7 @@  discard block
 block discarded – undo
8717 8717
 	/**
8718 8718
 	* Counts all hours
8719 8719
 	*
8720
+	* @param string $orderby
8720 8721
 	* @return Array the hour list
8721 8722
 	*
8722 8723
 	*/
@@ -8782,6 +8783,7 @@  discard block
 block discarded – undo
8782 8783
 	/**
8783 8784
 	* Counts all hours
8784 8785
 	*
8786
+	* @param string $orderby
8785 8787
 	* @return Array the hour list
8786 8788
 	*
8787 8789
 	*/
@@ -9594,7 +9596,7 @@  discard block
 block discarded – undo
9594 9596
 	/**
9595 9597
 	* Parses the direction degrees to working
9596 9598
 	*
9597
-	* @param Float $direction the direction in degrees
9599
+	* @param integer $direction the direction in degrees
9598 9600
 	* @return Array the direction information
9599 9601
 	*
9600 9602
 	*/
Please login to merge, or discard this patch.
Braces   +718 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -122,8 +124,11 @@  discard block
 block discarded – undo
122 124
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
123 125
 			}
124 126
 		}
125
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
126
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
127
+		if ($filter_query_where == '' && $where) {
128
+			$filter_query_where = ' WHERE';
129
+		} elseif ($filter_query_where != '' && $and) {
130
+			$filter_query_where .= ' AND';
131
+		}
127 132
 		$filter_query = $filter_query_join.$filter_query_where;
128 133
 		return $filter_query;
129 134
 	}
@@ -143,10 +148,18 @@  discard block
 block discarded – undo
143 148
 		$Image = new Image($this->db);
144 149
 		$Schedule = new Schedule($this->db);
145 150
 		$ACARS = new ACARS($this->db);
146
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
147
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
148
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
149
-		if (!isset($globalVAM)) $globalVAM = FALSE;
151
+		if (!isset($globalIVAO)) {
152
+			$globalIVAO = FALSE;
153
+		}
154
+		if (!isset($globalVATSIM)) {
155
+			$globalVATSIM = FALSE;
156
+		}
157
+		if (!isset($globalphpVMS)) {
158
+			$globalphpVMS = FALSE;
159
+		}
160
+		if (!isset($globalVAM)) {
161
+			$globalVAM = FALSE;
162
+		}
150 163
 		date_default_timezone_set('UTC');
151 164
 		
152 165
 		if (!is_string($query))
@@ -193,21 +206,35 @@  discard block
 block discarded – undo
193 206
 			} else {
194 207
 				$temp_array['spotter_id'] = '';
195 208
 			}
196
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
197
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
209
+			if (isset($row['flightaware_id'])) {
210
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
211
+			}
212
+			if (isset($row['modes'])) {
213
+				$temp_array['modes'] = $row['modes'];
214
+			}
198 215
 			$temp_array['ident'] = $row['ident'];
199 216
 			if (isset($row['registration']) && $row['registration'] != '') {
200 217
 				$temp_array['registration'] = $row['registration'];
201 218
 			} elseif (isset($temp_array['modes'])) {
202 219
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
203
-			} else $temp_array['registration'] = '';
204
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
220
+			} else {
221
+				$temp_array['registration'] = '';
222
+			}
223
+			if (isset($row['aircraft_icao'])) {
224
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
225
+			}
205 226
 			
206 227
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
207 228
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
208
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
209
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
210
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
229
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
230
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
231
+			}
232
+			if (isset($row['latitude'])) {
233
+				$temp_array['latitude'] = $row['latitude'];
234
+			}
235
+			if (isset($row['longitude'])) {
236
+				$temp_array['longitude'] = $row['longitude'];
237
+			}
211 238
 			/*
212 239
 			if (Connection->tableExists('countries')) {
213 240
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -217,8 +244,12 @@  discard block
 block discarded – undo
217 244
 				}
218 245
 			}
219 246
 			*/
220
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
221
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
247
+			if (isset($row['waypoints'])) {
248
+				$temp_array['waypoints'] = $row['waypoints'];
249
+			}
250
+			if (isset($row['format_source'])) {
251
+				$temp_array['format_source'] = $row['format_source'];
252
+			}
222 253
 			if (isset($row['route_stop'])) {
223 254
 				$temp_array['route_stop'] = $row['route_stop'];
224 255
 				if ($row['route_stop'] != '') {
@@ -237,13 +268,19 @@  discard block
 block discarded – undo
237 268
 					}
238 269
 				}
239 270
 			}
240
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
271
+			if (isset($row['altitude'])) {
272
+				$temp_array['altitude'] = $row['altitude'];
273
+			}
241 274
 			if (isset($row['heading'])) {
242 275
 				$temp_array['heading'] = $row['heading'];
243 276
 				$heading_direction = $this->parseDirection($row['heading']);
244
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
277
+				if (isset($heading_direction[0]['direction_fullname'])) {
278
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
279
+				}
280
+			}
281
+			if (isset($row['ground_speed'])) {
282
+				$temp_array['ground_speed'] = $row['ground_speed'];
245 283
 			}
246
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
247 284
 			$temp_array['image'] = "";
248 285
 			$temp_array['image_thumbnail'] = "";
249 286
 			$temp_array['image_source'] = "";
@@ -251,7 +288,9 @@  discard block
 block discarded – undo
251 288
  
252 289
 			if (isset($row['highlight'])) {
253 290
 				$temp_array['highlight'] = $row['highlight'];
254
-			} else $temp_array['highlight'] = '';
291
+			} else {
292
+				$temp_array['highlight'] = '';
293
+			}
255 294
 			
256 295
 			if (isset($row['date'])) {
257 296
 				$dateArray = $this->parseDateString($row['date']);
@@ -299,7 +338,9 @@  discard block
 block discarded – undo
299 338
 				
300 339
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 340
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302
-					} else $temp_array['aircraft_shadow'] = 'default.png';
341
+					} else {
342
+						$temp_array['aircraft_shadow'] = 'default.png';
343
+					}
303 344
                                 } else {
304 345
                             		$temp_array['aircraft_shadow'] = 'default.png';
305 346
 					$temp_array['aircraft_name'] = 'N/A';
@@ -307,11 +348,17 @@  discard block
 block discarded – undo
307 348
                             	}
308 349
 			}
309 350
 			$fromsource = NULL;
310
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
311
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
312
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
313
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
314
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
351
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
352
+				$fromsource = $globalAirlinesSource;
353
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
354
+				$fromsource = 'vatsim';
355
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
356
+				$fromsource = 'ivao';
357
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
358
+				$fromsource = 'vatsim';
359
+			} elseif (isset($globalIVAO) && $globalIVAO) {
360
+				$fromsource = 'ivao';
361
+			}
315 362
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 363
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 364
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -334,12 +381,18 @@  discard block
 block discarded – undo
334 381
 				}
335 382
 			} else {
336 383
 				$temp_array['airline_icao'] = $row['airline_icao'];
337
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
338
-				else $temp_array['airline_iata'] = 'N/A';
384
+				if (isset($row['airline_iata'])) {
385
+					$temp_array['airline_iata'] = $row['airline_iata'];
386
+				} else {
387
+					$temp_array['airline_iata'] = 'N/A';
388
+				}
339 389
 				$temp_array['airline_name'] = $row['airline_name'];
340 390
 				$temp_array['airline_country'] = $row['airline_country'];
341
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
342
-				else $temp_array['airline_callsign'] = 'N/A';
391
+				if (isset($row['airline_callsign'])) {
392
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
393
+				} else {
394
+					$temp_array['airline_callsign'] = 'N/A';
395
+				}
343 396
 				$temp_array['airline_type'] = $row['airline_type'];
344 397
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
345 398
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -366,7 +419,9 @@  discard block
 block discarded – undo
366 419
 			}
367 420
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
368 421
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
369
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
422
+				if ($owner_info['owner'] != '') {
423
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
424
+				}
370 425
 				$temp_array['aircraft_base'] = $owner_info['base'];
371 426
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 427
 			}
@@ -374,9 +429,14 @@  discard block
 block discarded – undo
374 429
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 430
 			{
376 431
 				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']);
379
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
432
+					if (isset($temp_array['airline_icao'])) {
433
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
434
+					} else {
435
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
436
+					}
437
+				} else {
438
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
439
+				}
380 440
 				if (count($image_array) > 0) {
381 441
 					$temp_array['image'] = $image_array[0]['image'];
382 442
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -428,7 +488,9 @@  discard block
 block discarded – undo
428 488
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
429 489
 			if ($row['departure_airport_icao'] != '') {
430 490
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
431
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
491
+				if (!isset($departure_airport_array[0]['name'])) {
492
+					$departure_airport_array = $this->getAllAirportInfo('NA');
493
+				}
432 494
 			/*
433 495
 			} elseif ($row['departure_airport_name'] != '') {
434 496
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -436,7 +498,9 @@  discard block
 block discarded – undo
436 498
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
437 499
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
438 500
 			*/
439
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
501
+			} else {
502
+				$departure_airport_array = $this->getAllAirportInfo('NA');
503
+			}
440 504
 			if (isset($departure_airport_array[0]['name'])) {
441 505
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
442 506
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -456,8 +520,12 @@  discard block
 block discarded – undo
456 520
 			
457 521
 			if ($row['arrival_airport_icao'] != '') {
458 522
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
459
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
460
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
523
+				if (count($arrival_airport_array) == 0) {
524
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
525
+				}
526
+			} else {
527
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
528
+			}
461 529
 			if (isset($arrival_airport_array[0]['name'])) {
462 530
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
463 531
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -473,27 +541,45 @@  discard block
 block discarded – undo
473 541
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
474 542
 			}
475 543
 			*/
476
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
477
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
478
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
479
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
480
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
544
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
545
+				$temp_array['pilot_id'] = $row['pilot_id'];
546
+			}
547
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
548
+				$temp_array['pilot_name'] = $row['pilot_name'];
549
+			}
550
+			if (isset($row['source_name']) && $row['source_name'] != '') {
551
+				$temp_array['source_name'] = $row['source_name'];
552
+			}
553
+			if (isset($row['over_country']) && $row['over_country'] != '') {
554
+				$temp_array['over_country'] = $row['over_country'];
555
+			}
556
+			if (isset($row['distance']) && $row['distance'] != '') {
557
+				$temp_array['distance'] = $row['distance'];
558
+			}
481 559
 			if (isset($row['squawk'])) {
482 560
 				$temp_array['squawk'] = $row['squawk'];
483 561
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484 562
 					$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);
563
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
564
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
565
+					}
486 566
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487 567
 					$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);
568
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
569
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
570
+					}
571
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
572
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
573
+				}
490 574
 			}
491 575
     			
492 576
 			$temp_array['query_number_rows'] = $num_rows;
493 577
 			
494 578
 			$spotter_array[] = $temp_array;
495 579
 		}
496
-		if ($num_rows == 0) return array();
580
+		if ($num_rows == 0) {
581
+			return array();
582
+		}
497 583
 		$spotter_array[0]['query_number_rows'] = $num_rows;
498 584
 		return $spotter_array;
499 585
 	}	
@@ -526,7 +612,9 @@  discard block
 block discarded – undo
526 612
 				foreach ($q_array as $q_item){
527 613
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
528 614
 					$additional_query .= " AND (";
529
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
615
+					if (is_int($q_item)) {
616
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
617
+					}
530 618
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
531 619
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
532 620
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -547,7 +635,9 @@  discard block
 block discarded – undo
547 635
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
548 636
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
549 637
 					$translate = $Translation->ident2icao($q_item);
550
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
638
+					if ($translate != $q_item) {
639
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
640
+					}
551 641
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
552 642
 					$additional_query .= ")";
553 643
 				}
@@ -774,7 +864,9 @@  discard block
 block discarded – undo
774 864
 				date_default_timezone_set($globalTimezone);
775 865
 				$datetime = new DateTime();
776 866
 				$offset = $datetime->format('P');
777
-			} else $offset = '+00:00';
867
+			} else {
868
+				$offset = '+00:00';
869
+			}
778 870
 
779 871
 			if ($date_array[1] != "")
780 872
 			{
@@ -806,8 +898,12 @@  discard block
 block discarded – undo
806 898
 			{
807 899
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
808 900
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
809
-			} else $limit_query = "";
810
-		} else $limit_query = "";
901
+			} else {
902
+				$limit_query = "";
903
+			}
904
+		} else {
905
+			$limit_query = "";
906
+		}
811 907
 
812 908
 
813 909
 		if ($sort != "")
@@ -875,8 +971,12 @@  discard block
 block discarded – undo
875 971
 			{
876 972
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
877 973
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
878
-			} else $limit_query = "";
879
-		} else $limit_query = "";
974
+			} else {
975
+				$limit_query = "";
976
+			}
977
+		} else {
978
+			$limit_query = "";
979
+		}
880 980
 		
881 981
 		if ($sort != "")
882 982
 		{
@@ -1200,7 +1300,9 @@  discard block
 block discarded – undo
1200 1300
 		global $global_query;
1201 1301
 		
1202 1302
 		date_default_timezone_set('UTC');
1203
-		if ($id == '') return array();
1303
+		if ($id == '') {
1304
+			return array();
1305
+		}
1204 1306
 		$additional_query = "spotter_output.spotter_id = :id";
1205 1307
 		$query_values = array(':id' => $id);
1206 1308
 
@@ -1937,7 +2039,9 @@  discard block
 block discarded – undo
1937 2039
 		{
1938 2040
 			$highlight = $row['highlight'];
1939 2041
 		}
1940
-		if (isset($highlight)) return $highlight;
2042
+		if (isset($highlight)) {
2043
+			return $highlight;
2044
+		}
1941 2045
 	}
1942 2046
 
1943 2047
 	
@@ -1965,7 +2069,9 @@  discard block
 block discarded – undo
1965 2069
 		$sth->closeCursor();
1966 2070
 		if (count($row) > 0) {
1967 2071
 			return $row['usage'];
1968
-		} else return '';
2072
+		} else {
2073
+			return '';
2074
+		}
1969 2075
 	}
1970 2076
 
1971 2077
 	/**
@@ -1990,7 +2096,9 @@  discard block
 block discarded – undo
1990 2096
 		$sth->closeCursor();
1991 2097
 		if (count($row) > 0) {
1992 2098
 			return $row['icao'];
1993
-		} else return '';
2099
+		} else {
2100
+			return '';
2101
+		}
1994 2102
 	}
1995 2103
 
1996 2104
 	/**
@@ -2018,7 +2126,9 @@  discard block
 block discarded – undo
2018 2126
 			$airport_longitude = $row['longitude'];
2019 2127
 			$Common = new Common();
2020 2128
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2021
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2022 2132
 	}
2023 2133
 	
2024 2134
 	/**
@@ -2130,7 +2240,9 @@  discard block
 block discarded – undo
2130 2240
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131 2241
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132 2242
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2133
-		} else return array();
2243
+		} else {
2244
+			return array();
2245
+		}
2134 2246
 		if ($globalDBdriver == 'mysql') {
2135 2247
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2136 2248
 		} else {
@@ -2165,7 +2277,9 @@  discard block
 block discarded – undo
2165 2277
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166 2278
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167 2279
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2168
-		} else return array();
2280
+		} else {
2281
+			return array();
2282
+		}
2169 2283
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170 2284
 		$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 2285
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2200,7 +2314,9 @@  discard block
 block discarded – undo
2200 2314
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2315
 	{
2202 2316
 		global $globalUseRealAirlines;
2203
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2317
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2318
+			$fromsource = NULL;
2319
+		}
2204 2320
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2205 2321
 		if ($airline_icao == 'NA') {
2206 2322
 			$airline_array = array();
@@ -2269,7 +2385,9 @@  discard block
 block discarded – undo
2269 2385
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2386
 	{
2271 2387
 		global $globalUseRealAirlines;
2272
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2388
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2389
+			$fromsource = NULL;
2390
+		}
2273 2391
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274 2392
 		$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 2393
 		$sth = $this->db->prepare($query);
@@ -2285,7 +2403,9 @@  discard block
 block discarded – undo
2285 2403
 			$sth->execute(array(':fromsource' => $fromsource));
2286 2404
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2287 2405
 			$sth->closeCursor();
2288
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2406
+			if ($row['nb'] == 0) {
2407
+				$result = $this->getAllAirlineInfoByName($airline_name);
2408
+			}
2289 2409
 		}
2290 2410
 		return $result;
2291 2411
 	}
@@ -2348,15 +2468,20 @@  discard block
 block discarded – undo
2348 2468
 				'A320-211' => 'A320',
2349 2469
 				'747-8i' => 'B748',
2350 2470
 				'A380' => 'A388');
2351
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2471
+		if (isset($all_aircraft[$aircraft_type])) {
2472
+			return $all_aircraft[$aircraft_type];
2473
+		}
2352 2474
 
2353 2475
 		$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 2476
 		$aircraft_type = strtoupper($aircraft_type);
2355 2477
 		$sth = $this->db->prepare($query);
2356 2478
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2357 2479
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359
-		else return '';
2480
+		if (isset($result[0]['icao'])) {
2481
+			return $result[0]['icao'];
2482
+		} else {
2483
+			return '';
2484
+		}
2360 2485
 	}
2361 2486
 	
2362 2487
 	/**
@@ -2379,9 +2504,13 @@  discard block
 block discarded – undo
2379 2504
 		$sth->closeCursor();
2380 2505
 		if (isset($row['icaotypecode'])) {
2381 2506
 			$icao = $row['icaotypecode'];
2382
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2507
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2508
+				$icao = $this->aircraft_correct_icaotype[$icao];
2509
+			}
2383 2510
 			return $icao;
2384
-		} else return '';
2511
+		} else {
2512
+			return '';
2513
+		}
2385 2514
 	}
2386 2515
 
2387 2516
 	/**
@@ -2404,7 +2533,9 @@  discard block
 block discarded – undo
2404 2533
 		$sth->closeCursor();
2405 2534
 		if (isset($row['icaotypecode'])) {
2406 2535
 			return $row['icaotypecode'];
2407
-		} else return '';
2536
+		} else {
2537
+			return '';
2538
+		}
2408 2539
 	}
2409 2540
 
2410 2541
 	/**
@@ -2450,7 +2581,9 @@  discard block
 block discarded – undo
2450 2581
 		$sth->closeCursor();
2451 2582
 		if (isset($row['operator_correct'])) {
2452 2583
 			return $row['operator_correct'];
2453
-		} else return $operator;
2584
+		} else {
2585
+			return $operator;
2586
+		}
2454 2587
 	}
2455 2588
 
2456 2589
 	/**
@@ -2463,7 +2596,9 @@  discard block
 block discarded – undo
2463 2596
 	public function getRouteInfo($callsign)
2464 2597
 	{
2465 2598
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2599
+                if ($callsign == '') {
2600
+                	return array();
2601
+                }
2467 2602
 		$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 2603
 		
2469 2604
 		$sth = $this->db->prepare($query);
@@ -2473,7 +2608,9 @@  discard block
 block discarded – undo
2473 2608
 		$sth->closeCursor();
2474 2609
 		if (count($row) > 0) {
2475 2610
 			return $row;
2476
-		} else return array();
2611
+		} else {
2612
+			return array();
2613
+		}
2477 2614
 	}
2478 2615
 	
2479 2616
 	/**
@@ -2526,7 +2663,9 @@  discard block
 block discarded – undo
2526 2663
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2527 2664
 			$sth->closeCursor();
2528 2665
 			return $result;
2529
-		} else return array();
2666
+		} else {
2667
+			return array();
2668
+		}
2530 2669
 	}
2531 2670
 	
2532 2671
   
@@ -2685,8 +2824,11 @@  discard block
 block discarded – undo
2685 2824
 		$query .= " ORDER BY spotter_output.source_name ASC";
2686 2825
 
2687 2826
 		$sth = $this->db->prepare($query);
2688
-		if (!empty($query_values)) $sth->execute($query_values);
2689
-		else $sth->execute();
2827
+		if (!empty($query_values)) {
2828
+			$sth->execute($query_values);
2829
+		} else {
2830
+			$sth->execute();
2831
+		}
2690 2832
 
2691 2833
 		$source_array = array();
2692 2834
 		$temp_array = array();
@@ -2719,9 +2861,13 @@  discard block
 block discarded – undo
2719 2861
 								WHERE spotter_output.airline_icao <> '' 
2720 2862
 								ORDER BY spotter_output.airline_name ASC";
2721 2863
 			*/
2722
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2723
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2724
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2864
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2865
+				$forsource = $globalAirlinesSource;
2866
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2867
+				$forsource = 'vatsim';
2868
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2869
+				$forsource = 'ivao';
2870
+			}
2725 2871
 			if ($forsource === NULL) {
2726 2872
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2727 2873
 				$query_data = array();
@@ -2764,9 +2910,13 @@  discard block
 block discarded – undo
2764 2910
 	{
2765 2911
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766 2912
 		$filter_query = $this->getFilter($filters,true,true);
2767
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2913
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2914
+			$forsource = $globalAirlinesSource;
2915
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2916
+			$forsource = 'vatsim';
2917
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2918
+			$forsource = 'ivao';
2919
+		}
2770 2920
 		if ($forsource === NULL) {
2771 2921
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2772 2922
 			$query_data = array();
@@ -3041,7 +3191,9 @@  discard block
 block discarded – undo
3041 3191
 			date_default_timezone_set($globalTimezone);
3042 3192
 			$datetime = new DateTime();
3043 3193
 			$offset = $datetime->format('P');
3044
-		} else $offset = '+00:00';
3194
+		} else {
3195
+			$offset = '+00:00';
3196
+		}
3045 3197
 		if ($airport_icao == '') {
3046 3198
 			if ($globalDBdriver == 'mysql') {
3047 3199
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3073,7 +3225,9 @@  discard block
 block discarded – undo
3073 3225
 			date_default_timezone_set($globalTimezone);
3074 3226
 			$datetime = new DateTime();
3075 3227
 			$offset = $datetime->format('P');
3076
-		} else $offset = '+00:00';
3228
+		} else {
3229
+			$offset = '+00:00';
3230
+		}
3077 3231
 		if ($airport_icao == '') {
3078 3232
 			if ($globalDBdriver == 'mysql') {
3079 3233
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3106,7 +3260,9 @@  discard block
 block discarded – undo
3106 3260
 			date_default_timezone_set($globalTimezone);
3107 3261
 			$datetime = new DateTime();
3108 3262
 			$offset = $datetime->format('P');
3109
-		} else $offset = '+00:00';
3263
+		} else {
3264
+			$offset = '+00:00';
3265
+		}
3110 3266
 		if ($airport_icao == '') {
3111 3267
 			if ($globalDBdriver == 'mysql') {
3112 3268
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3145,7 +3301,9 @@  discard block
 block discarded – undo
3145 3301
 			date_default_timezone_set($globalTimezone);
3146 3302
 			$datetime = new DateTime();
3147 3303
 			$offset = $datetime->format('P');
3148
-		} else $offset = '+00:00';
3304
+		} else {
3305
+			$offset = '+00:00';
3306
+		}
3149 3307
 		if ($airport_icao == '') {
3150 3308
 			if ($globalDBdriver == 'mysql') {
3151 3309
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3190,7 +3348,9 @@  discard block
 block discarded – undo
3190 3348
 			date_default_timezone_set($globalTimezone);
3191 3349
 			$datetime = new DateTime();
3192 3350
 			$offset = $datetime->format('P');
3193
-		} else $offset = '+00:00';
3351
+		} else {
3352
+			$offset = '+00:00';
3353
+		}
3194 3354
 		if ($airport_icao == '') {
3195 3355
 			if ($globalDBdriver == 'mysql') {
3196 3356
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3225,7 +3385,9 @@  discard block
 block discarded – undo
3225 3385
 			date_default_timezone_set($globalTimezone);
3226 3386
 			$datetime = new DateTime();
3227 3387
 			$offset = $datetime->format('P');
3228
-		} else $offset = '+00:00';
3388
+		} else {
3389
+			$offset = '+00:00';
3390
+		}
3229 3391
 		if ($airport_icao == '') {
3230 3392
 			if ($globalDBdriver == 'mysql') {
3231 3393
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3267,7 +3429,9 @@  discard block
 block discarded – undo
3267 3429
 			date_default_timezone_set($globalTimezone);
3268 3430
 			$datetime = new DateTime();
3269 3431
 			$offset = $datetime->format('P');
3270
-		} else $offset = '+00:00';
3432
+		} else {
3433
+			$offset = '+00:00';
3434
+		}
3271 3435
 		if ($airport_icao == '') {
3272 3436
 			if ($globalDBdriver == 'mysql') {
3273 3437
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3301,7 +3465,9 @@  discard block
 block discarded – undo
3301 3465
 			date_default_timezone_set($globalTimezone);
3302 3466
 			$datetime = new DateTime();
3303 3467
 			$offset = $datetime->format('P');
3304
-		} else $offset = '+00:00';
3468
+		} else {
3469
+			$offset = '+00:00';
3470
+		}
3305 3471
 		if ($airport_icao == '') {
3306 3472
 			if ($globalDBdriver == 'mysql') {
3307 3473
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3349,7 +3515,9 @@  discard block
 block discarded – undo
3349 3515
 			date_default_timezone_set($globalTimezone);
3350 3516
 			$datetime = new DateTime();
3351 3517
 			$offset = $datetime->format('P');
3352
-		} else $offset = '+00:00';
3518
+		} else {
3519
+			$offset = '+00:00';
3520
+		}
3353 3521
 
3354 3522
 		if ($globalDBdriver == 'mysql') {
3355 3523
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3469,7 +3637,9 @@  discard block
 block discarded – undo
3469 3637
 	*/	
3470 3638
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3471 3639
 	{
3472
-		if ($groundspeed == '') $groundspeed = NULL;
3640
+		if ($groundspeed == '') {
3641
+			$groundspeed = NULL;
3642
+		}
3473 3643
 		$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';
3474 3644
                 $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);
3475 3645
 
@@ -3519,10 +3689,18 @@  discard block
 block discarded – undo
3519 3689
 		$Image = new Image($this->db);
3520 3690
 		$Common = new Common();
3521 3691
 		
3522
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3523
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3524
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3525
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3692
+		if (!isset($globalIVAO)) {
3693
+			$globalIVAO = FALSE;
3694
+		}
3695
+		if (!isset($globalVATSIM)) {
3696
+			$globalVATSIM = FALSE;
3697
+		}
3698
+		if (!isset($globalphpVMS)) {
3699
+			$globalphpVMS = FALSE;
3700
+		}
3701
+		if (!isset($globalVAM)) {
3702
+			$globalVAM = FALSE;
3703
+		}
3526 3704
 		date_default_timezone_set('UTC');
3527 3705
 		
3528 3706
 		//getting the registration
@@ -3535,23 +3713,33 @@  discard block
 block discarded – undo
3535 3713
 				if ($ModeS != '') {
3536 3714
 					$timeelapsed = microtime(true);
3537 3715
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3538
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3716
+					if ($globalDebugTimeElapsed) {
3717
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3718
+					}
3539 3719
 				} else {
3540 3720
 					$myhex = explode('-',$flightaware_id);
3541 3721
 					if (count($myhex) > 0) {
3542 3722
 						$timeelapsed = microtime(true);
3543 3723
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3544
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3724
+						if ($globalDebugTimeElapsed) {
3725
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3726
+						}
3545 3727
 					}
3546 3728
 				}
3547 3729
 			}
3548 3730
 		}
3549 3731
 		$fromsource = NULL;
3550
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3551
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3552
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3553
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3554
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3732
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3733
+			$fromsource = $globalAirlinesSource;
3734
+		} elseif ($format_source == 'vatsimtxt') {
3735
+			$fromsource = 'vatsim';
3736
+		} elseif ($format_source == 'whazzup') {
3737
+			$fromsource = 'ivao';
3738
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3739
+			$fromsource = 'vatsim';
3740
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3741
+			$fromsource = 'ivao';
3742
+		}
3555 3743
 		//getting the airline information
3556 3744
 		if ($ident != "")
3557 3745
 		{
@@ -3575,15 +3763,21 @@  discard block
 block discarded – undo
3575 3763
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3576 3764
 						$airline_array = $this->getAllAirlineInfo("NA");
3577 3765
 					}
3578
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3766
+					if ($globalDebugTimeElapsed) {
3767
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3768
+					}
3579 3769
 
3580 3770
 				} else {
3581 3771
 					$timeelapsed = microtime(true);
3582 3772
 					$airline_array = $this->getAllAirlineInfo("NA");
3583
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3773
+					if ($globalDebugTimeElapsed) {
3774
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3775
+					}
3584 3776
 				}
3585 3777
 			}
3586
-		} else $airline_array = array();
3778
+		} else {
3779
+			$airline_array = array();
3780
+		}
3587 3781
 		
3588 3782
 		//getting the aircraft information
3589 3783
 		$aircraft_array = array();
@@ -3597,27 +3791,37 @@  discard block
 block discarded – undo
3597 3791
 				{
3598 3792
 					$timeelapsed = microtime(true);
3599 3793
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3600
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3794
+					if ($globalDebugTimeElapsed) {
3795
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3796
+					}
3601 3797
 				} else {
3602 3798
 					$timeelapsed = microtime(true);
3603 3799
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3604
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3800
+					if ($globalDebugTimeElapsed) {
3801
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3802
+					}
3605 3803
 				}
3606 3804
 			}
3607 3805
 		} else {
3608 3806
 			if ($ModeS != '') {
3609 3807
 				$timeelapsed = microtime(true);
3610 3808
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3611
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3809
+				if ($globalDebugTimeElapsed) {
3810
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+				}
3612 3812
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3613 3813
 				{
3614 3814
 					$timeelapsed = microtime(true);
3615 3815
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3616
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+					if ($globalDebugTimeElapsed) {
3817
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3818
+					}
3617 3819
 				} else {
3618 3820
 					$timeelapsed = microtime(true);
3619 3821
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3620
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3822
+					if ($globalDebugTimeElapsed) {
3823
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3824
+					}
3621 3825
 				}
3622 3826
 			}
3623 3827
 		}
@@ -3633,7 +3837,9 @@  discard block
 block discarded – undo
3633 3837
 			} else {
3634 3838
 				$timeelapsed = microtime(true);
3635 3839
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3636
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3840
+				if ($globalDebugTimeElapsed) {
3841
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3842
+				}
3637 3843
 			}
3638 3844
 		}
3639 3845
 		
@@ -3648,7 +3854,9 @@  discard block
 block discarded – undo
3648 3854
 			} else {
3649 3855
 				$timeelapsed = microtime(true);
3650 3856
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3651
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3857
+				if ($globalDebugTimeElapsed) {
3858
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3859
+				}
3652 3860
 			}
3653 3861
 		}
3654 3862
 
@@ -3682,7 +3890,9 @@  discard block
 block discarded – undo
3682 3890
 			{
3683 3891
 				return false;
3684 3892
 			}
3685
-		} else $altitude = 0;
3893
+		} else {
3894
+			$altitude = 0;
3895
+		}
3686 3896
 		
3687 3897
 		if ($heading != "")
3688 3898
 		{
@@ -3711,7 +3921,9 @@  discard block
 block discarded – undo
3711 3921
 		{
3712 3922
 			$timeelapsed = microtime(true);
3713 3923
 			$image_array = $Image->getSpotterImage($registration);
3714
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3924
+			if ($globalDebugTimeElapsed) {
3925
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3926
+			}
3715 3927
 			if (!isset($image_array[0]['registration']))
3716 3928
 			{
3717 3929
 				//echo "Add image !!!! \n";
@@ -3719,14 +3931,21 @@  discard block
 block discarded – undo
3719 3931
 			}
3720 3932
 			$timeelapsed = microtime(true);
3721 3933
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3722
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3723
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3934
+			if ($globalDebugTimeElapsed) {
3935
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3936
+			}
3937
+			if ($owner_info['owner'] != '') {
3938
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3939
+			}
3724 3940
 		}
3725 3941
     
3726 3942
 		if ($globalIVAO && $aircraft_icao != '')
3727 3943
 		{
3728
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3729
-            		else $airline_icao = '';
3944
+            		if (isset($airline_array[0]['icao'])) {
3945
+            			$airline_icao = $airline_array[0]['icao'];
3946
+            		} else {
3947
+            			$airline_icao = '';
3948
+            		}
3730 3949
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3731 3950
 			if (!isset($image_array[0]['registration']))
3732 3951
 			{
@@ -3771,16 +3990,28 @@  discard block
 block discarded – undo
3771 3990
                 {
3772 3991
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3773 3992
                 }
3774
-                if ($registration == '') $registration = 'NA';
3993
+                if ($registration == '') {
3994
+                	$registration = 'NA';
3995
+                }
3775 3996
                 if ($latitude == '' && $longitude == '') {
3776 3997
             		$latitude = 0;
3777 3998
             		$longitude = 0;
3778 3999
             	}
3779
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3780
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3781
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3782
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3783
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4000
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4001
+                	$squawk = NULL;
4002
+                }
4003
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4004
+                	$verticalrate = NULL;
4005
+                }
4006
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4007
+                	$heading = 0;
4008
+                }
4009
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4010
+                	$groundspeed = 0;
4011
+                }
4012
+                if (!isset($aircraft_owner)) {
4013
+                	$aircraft_owner = NULL;
4014
+                }
3784 4015
                 $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) 
3785 4016
                 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)";
3786 4017
 
@@ -3791,9 +4022,13 @@  discard block
 block discarded – undo
3791 4022
 		if ($airline_type == '') {
3792 4023
 			$timeelapsed = microtime(true);
3793 4024
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3794
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4025
+			if ($globalDebugTimeElapsed) {
4026
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4027
+			}
4028
+		}
4029
+		if ($airline_type == null) {
4030
+			$airline_type = '';
3795 4031
 		}
3796
-		if ($airline_type == null) $airline_type = '';
3797 4032
                 $aircraft_type = $aircraft_array[0]['type'];
3798 4033
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3799 4034
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3957,7 +4192,9 @@  discard block
 block discarded – undo
3957 4192
 			}
3958 4193
 		}
3959 4194
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3960
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4195
+		if ($limit) {
4196
+			$query .= " LIMIT 10 OFFSET 0";
4197
+		}
3961 4198
 
3962 4199
 		$sth = $this->db->prepare($query);
3963 4200
 		$sth->execute($query_values);
@@ -4030,7 +4267,9 @@  discard block
 block discarded – undo
4030 4267
 		}
4031 4268
 		
4032 4269
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4033
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4270
+		if ($limit) {
4271
+			$query .= " LIMIT 10 OFFSET 0";
4272
+		}
4034 4273
       
4035 4274
 		
4036 4275
 		$sth = $this->db->prepare($query);
@@ -4074,7 +4313,9 @@  discard block
 block discarded – undo
4074 4313
 			}
4075 4314
 		}
4076 4315
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4077
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4316
+		if ($limit) {
4317
+			$query .= " LIMIT 10 OFFSET 0";
4318
+		}
4078 4319
       
4079 4320
 		
4080 4321
 		$sth = $this->db->prepare($query);
@@ -4150,7 +4391,9 @@  discard block
 block discarded – undo
4150 4391
 			}
4151 4392
 		}
4152 4393
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4153
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4394
+		if ($limit) {
4395
+			$query .= " LIMIT 10 OFFSET 0";
4396
+		}
4154 4397
 		
4155 4398
 		$sth = $this->db->prepare($query);
4156 4399
 		$sth->execute($query_values);
@@ -4192,7 +4435,9 @@  discard block
 block discarded – undo
4192 4435
 			}
4193 4436
 		}
4194 4437
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4195
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4438
+		if ($limit) {
4439
+			$query .= " LIMIT 10 OFFSET 0";
4440
+		}
4196 4441
       
4197 4442
 		
4198 4443
 		$sth = $this->db->prepare($query);
@@ -4435,7 +4680,9 @@  discard block
 block discarded – undo
4435 4680
 			date_default_timezone_set($globalTimezone);
4436 4681
 			$datetime = new DateTime($date);
4437 4682
 			$offset = $datetime->format('P');
4438
-		} else $offset = '+00:00';
4683
+		} else {
4684
+			$offset = '+00:00';
4685
+		}
4439 4686
 
4440 4687
 		if ($globalDBdriver == 'mysql') {
4441 4688
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4483,7 +4730,9 @@  discard block
 block discarded – undo
4483 4730
 			date_default_timezone_set($globalTimezone);
4484 4731
 			$datetime = new DateTime($date);
4485 4732
 			$offset = $datetime->format('P');
4486
-		} else $offset = '+00:00';
4733
+		} else {
4734
+			$offset = '+00:00';
4735
+		}
4487 4736
 		
4488 4737
 		if ($globalDBdriver == 'mysql') {
4489 4738
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4759,7 +5008,9 @@  discard block
 block discarded – undo
4759 5008
 		}
4760 5009
 		$query .= " GROUP BY spotter_output.airline_country
4761 5010
 					ORDER BY airline_country_count DESC";
4762
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5011
+		if ($limit) {
5012
+			$query .= " LIMIT 10 OFFSET 0";
5013
+		}
4763 5014
       
4764 5015
 		$sth = $this->db->prepare($query);
4765 5016
 		$sth->execute($query_values);
@@ -4787,7 +5038,9 @@  discard block
 block discarded – undo
4787 5038
 		global $globalDBdriver;
4788 5039
 		//$filter_query = $this->getFilter($filters,true,true);
4789 5040
 		$Connection= new Connection($this->db);
4790
-		if (!$Connection->tableExists('countries')) return array();
5041
+		if (!$Connection->tableExists('countries')) {
5042
+			return array();
5043
+		}
4791 5044
 		/*
4792 5045
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4793 5046
 					FROM countries c, spotter_output s
@@ -4819,7 +5072,9 @@  discard block
 block discarded – undo
4819 5072
 		}
4820 5073
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
4821 5074
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4822
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5075
+		if ($limit) {
5076
+			$query .= " LIMIT 10 OFFSET 0";
5077
+		}
4823 5078
       
4824 5079
 		
4825 5080
 		$sth = $this->db->prepare($query);
@@ -4896,7 +5151,9 @@  discard block
 block discarded – undo
4896 5151
 		}
4897 5152
 
4898 5153
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4899
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5154
+		if ($limit) {
5155
+			$query .= " LIMIT 10 OFFSET 0";
5156
+		}
4900 5157
  
4901 5158
 		$sth = $this->db->prepare($query);
4902 5159
 		$sth->execute($query_values);
@@ -4970,7 +5227,9 @@  discard block
 block discarded – undo
4970 5227
 		}
4971 5228
 
4972 5229
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4973
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5230
+		if ($limit) {
5231
+			$query .= " LIMIT 10 OFFSET 0";
5232
+		}
4974 5233
  
4975 5234
 		$sth = $this->db->prepare($query);
4976 5235
 		$sth->execute($query_values);
@@ -5017,7 +5276,9 @@  discard block
 block discarded – undo
5017 5276
 		}
5018 5277
 
5019 5278
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5020
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5279
+		if ($limit) {
5280
+			$query .= " LIMIT 10 OFFSET 0";
5281
+		}
5021 5282
  
5022 5283
 		$sth = $this->db->prepare($query);
5023 5284
 		$sth->execute();
@@ -5070,7 +5331,9 @@  discard block
 block discarded – undo
5070 5331
 			if($row['registration'] != "")
5071 5332
 			{
5072 5333
 				$image_array = $Image->getSpotterImage($row['registration']);
5073
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5334
+				if (isset($image_array[0]['image_thumbnail'])) {
5335
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5336
+				}
5074 5337
 			}
5075 5338
 			$temp_array['registration_count'] = $row['registration_count'];
5076 5339
 
@@ -5145,7 +5408,9 @@  discard block
 block discarded – undo
5145 5408
 			if($row['registration'] != "")
5146 5409
 			{
5147 5410
 				$image_array = $Image->getSpotterImage($row['registration']);
5148
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5411
+				if (isset($image_array[0]['image_thumbnail'])) {
5412
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5413
+				}
5149 5414
 			}
5150 5415
 			$temp_array['registration_count'] = $row['registration_count'];
5151 5416
 
@@ -5252,7 +5517,9 @@  discard block
 block discarded – undo
5252 5517
 			if($row['registration'] != "")
5253 5518
 			{
5254 5519
 				$image_array = $Image->getSpotterImage($row['registration']);
5255
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5520
+				if (isset($image_array[0]['image_thumbnail'])) {
5521
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5522
+				}
5256 5523
 			}
5257 5524
 			$temp_array['registration_count'] = $row['registration_count'];
5258 5525
 			$aircraft_array[] = $temp_array;
@@ -5377,7 +5644,9 @@  discard block
 block discarded – undo
5377 5644
 			date_default_timezone_set($globalTimezone);
5378 5645
 			$datetime = new DateTime($date);
5379 5646
 			$offset = $datetime->format('P');
5380
-		} else $offset = '+00:00';
5647
+		} else {
5648
+			$offset = '+00:00';
5649
+		}
5381 5650
 
5382 5651
 		if ($globalDBdriver == 'mysql') {
5383 5652
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5424,7 +5693,9 @@  discard block
 block discarded – undo
5424 5693
 			date_default_timezone_set($globalTimezone);
5425 5694
 			$datetime = new DateTime($date);
5426 5695
 			$offset = $datetime->format('P');
5427
-		} else $offset = '+00:00';
5696
+		} else {
5697
+			$offset = '+00:00';
5698
+		}
5428 5699
 
5429 5700
 		if ($globalDBdriver == 'mysql') {
5430 5701
 			$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 
@@ -5453,7 +5724,9 @@  discard block
 block discarded – undo
5453 5724
 			if($row['registration'] != "")
5454 5725
 			{
5455 5726
 				$image_array = $Image->getSpotterImage($row['registration']);
5456
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5727
+				if (isset($image_array[0]['image_thumbnail'])) {
5728
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5729
+				}
5457 5730
 			}
5458 5731
 			$temp_array['registration_count'] = $row['registration_count'];
5459 5732
  
@@ -5478,7 +5751,9 @@  discard block
 block discarded – undo
5478 5751
 			date_default_timezone_set($globalTimezone);
5479 5752
 			$datetime = new DateTime($date);
5480 5753
 			$offset = $datetime->format('P');
5481
-		} else $offset = '+00:00';
5754
+		} else {
5755
+			$offset = '+00:00';
5756
+		}
5482 5757
 
5483 5758
 		if ($globalDBdriver == 'mysql') {
5484 5759
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5616,8 +5891,11 @@  discard block
 block discarded – undo
5616 5891
 			if($row['registration'] != "")
5617 5892
 			{
5618 5893
 				$image_array = $Image->getSpotterImage($row['registration']);
5619
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5620
-				else $temp_array['image_thumbnail'] = '';
5894
+				if (isset($image_array[0]['image_thumbnail'])) {
5895
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5896
+				} else {
5897
+					$temp_array['image_thumbnail'] = '';
5898
+				}
5621 5899
 			}
5622 5900
 			$temp_array['registration_count'] = $row['registration_count'];
5623 5901
 			$aircraft_array[] = $temp_array;
@@ -5660,8 +5938,11 @@  discard block
 block discarded – undo
5660 5938
 			if($row['registration'] != "")
5661 5939
 			{
5662 5940
 				$image_array = $Image->getSpotterImage($row['registration']);
5663
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5664
-				else $temp_array['image_thumbnail'] = '';
5941
+				if (isset($image_array[0]['image_thumbnail'])) {
5942
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5943
+				} else {
5944
+					$temp_array['image_thumbnail'] = '';
5945
+				}
5665 5946
 			}
5666 5947
 			$temp_array['registration_count'] = $row['registration_count'];
5667 5948
 			$aircraft_array[] = $temp_array;
@@ -5704,8 +5985,11 @@  discard block
 block discarded – undo
5704 5985
 			if($row['registration'] != "")
5705 5986
 			{
5706 5987
 				$image_array = $Image->getSpotterImage($row['registration']);
5707
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5708
-				else $temp_array['image_thumbnail'] = '';
5988
+				if (isset($image_array[0]['image_thumbnail'])) {
5989
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5990
+				} else {
5991
+					$temp_array['image_thumbnail'] = '';
5992
+				}
5709 5993
 			}
5710 5994
 			$temp_array['registration_count'] = $row['registration_count'];
5711 5995
 			$aircraft_array[] = $temp_array;
@@ -5854,7 +6138,9 @@  discard block
 block discarded – undo
5854 6138
 			if($row['registration'] != "")
5855 6139
 			{
5856 6140
 				$image_array = $Image->getSpotterImage($row['registration']);
5857
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6141
+				if (isset($image_array[0]['image_thumbnail'])) {
6142
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6143
+				}
5858 6144
 			}
5859 6145
 			$temp_array['registration_count'] = $row['registration_count'];
5860 6146
           
@@ -5971,7 +6257,9 @@  discard block
 block discarded – undo
5971 6257
 			if($row['registration'] != "")
5972 6258
 			{
5973 6259
 				$image_array = $Image->getSpotterImage($row['registration']);
5974
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6260
+				if (isset($image_array[0]['image_thumbnail'])) {
6261
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6262
+				}
5975 6263
 			}
5976 6264
 			$temp_array['registration_count'] = $row['registration_count'];
5977 6265
           
@@ -6137,7 +6425,9 @@  discard block
 block discarded – undo
6137 6425
 			}
6138 6426
 		}
6139 6427
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6140
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6428
+		if ($limit) {
6429
+			$query .= " LIMIT 10 OFFSET 0";
6430
+		}
6141 6431
 		
6142 6432
 		$sth = $this->db->prepare($query);
6143 6433
 		$sth->execute($query_values);
@@ -6156,7 +6446,9 @@  discard block
 block discarded – undo
6156 6446
 			if($row['registration'] != "")
6157 6447
 			{
6158 6448
 				$image_array = $Image->getSpotterImage($row['registration']);
6159
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6449
+				if (isset($image_array[0]['image_thumbnail'])) {
6450
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6451
+				}
6160 6452
 			}
6161 6453
           
6162 6454
 			$aircraft_array[] = $temp_array;
@@ -6197,7 +6489,9 @@  discard block
 block discarded – undo
6197 6489
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6198 6490
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6199 6491
                 $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";
6200
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6492
+		if ($limit) {
6493
+			$query .= " LIMIT 10 OFFSET 0";
6494
+		}
6201 6495
 		
6202 6496
 		$sth = $this->db->prepare($query);
6203 6497
 		$sth->execute();
@@ -6217,7 +6511,9 @@  discard block
 block discarded – undo
6217 6511
 			if($row['registration'] != "")
6218 6512
 			{
6219 6513
 				$image_array = $Image->getSpotterImage($row['registration']);
6220
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6514
+				if (isset($image_array[0]['image_thumbnail'])) {
6515
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6516
+				}
6221 6517
 			}
6222 6518
           
6223 6519
 			$aircraft_array[] = $temp_array;
@@ -6283,7 +6579,9 @@  discard block
 block discarded – undo
6283 6579
 		}
6284 6580
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6285 6581
 				ORDER BY airport_departure_icao_count DESC";
6286
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6582
+		if ($limit) {
6583
+			$query .= " LIMIT 10 OFFSET 0";
6584
+		}
6287 6585
 
6288 6586
 		$sth = $this->db->prepare($query);
6289 6587
 		$sth->execute($query_values);
@@ -6334,7 +6632,9 @@  discard block
 block discarded – undo
6334 6632
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6335 6633
                 $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
6336 6634
 				ORDER BY airport_departure_icao_count DESC";
6337
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6635
+		if ($limit) {
6636
+			$query .= " LIMIT 10 OFFSET 0";
6637
+		}
6338 6638
       
6339 6639
 		$sth = $this->db->prepare($query);
6340 6640
 		$sth->execute();
@@ -6412,7 +6712,9 @@  discard block
 block discarded – undo
6412 6712
 		}
6413 6713
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6414 6714
 				ORDER BY airport_departure_icao_count DESC";
6415
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6715
+		if ($limit) {
6716
+			$query .= " LIMIT 10 OFFSET 0";
6717
+		}
6416 6718
     		//echo $query;
6417 6719
 		$sth = $this->db->prepare($query);
6418 6720
 		$sth->execute($query_values);
@@ -6464,7 +6766,9 @@  discard block
 block discarded – undo
6464 6766
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6465 6767
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6466 6768
 				ORDER BY airport_departure_icao_count DESC";
6467
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6769
+		if ($limit) {
6770
+			$query .= " LIMIT 10 OFFSET 0";
6771
+		}
6468 6772
       
6469 6773
 		$sth = $this->db->prepare($query);
6470 6774
 		$sth->execute();
@@ -6859,7 +7163,9 @@  discard block
 block discarded – undo
6859 7163
 			date_default_timezone_set($globalTimezone);
6860 7164
 			$datetime = new DateTime($date);
6861 7165
 			$offset = $datetime->format('P');
6862
-		} else $offset = '+00:00';
7166
+		} else {
7167
+			$offset = '+00:00';
7168
+		}
6863 7169
 
6864 7170
 		if ($globalDBdriver == 'mysql') {
6865 7171
 			$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,7 +7215,9 @@  discard block
 block discarded – undo
6909 7215
 			date_default_timezone_set($globalTimezone);
6910 7216
 			$datetime = new DateTime($date);
6911 7217
 			$offset = $datetime->format('P');
6912
-		} else $offset = '+00:00';
7218
+		} else {
7219
+			$offset = '+00:00';
7220
+		}
6913 7221
 
6914 7222
 		if ($globalDBdriver == 'mysql') {
6915 7223
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7258,7 +7566,9 @@  discard block
 block discarded – undo
7258 7566
 		}
7259 7567
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7260 7568
 					ORDER BY airport_arrival_icao_count DESC";
7261
-		if ($limit) $query .= " LIMIT 10";
7569
+		if ($limit) {
7570
+			$query .= " LIMIT 10";
7571
+		}
7262 7572
       
7263 7573
 		
7264 7574
 		$sth = $this->db->prepare($query);
@@ -7278,7 +7588,9 @@  discard block
 block discarded – undo
7278 7588
 			if ($icaoaskey) {
7279 7589
 				$icao = $row['arrival_airport_icao'];
7280 7590
 				$airport_array[$icao] = $temp_array;
7281
-			} else $airport_array[] = $temp_array;
7591
+			} else {
7592
+				$airport_array[] = $temp_array;
7593
+			}
7282 7594
 		}
7283 7595
 
7284 7596
 		return $airport_array;
@@ -7315,7 +7627,9 @@  discard block
 block discarded – undo
7315 7627
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7316 7628
                 $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
7317 7629
 					ORDER BY airport_arrival_icao_count DESC";
7318
-		if ($limit) $query .= " LIMIT 10";
7630
+		if ($limit) {
7631
+			$query .= " LIMIT 10";
7632
+		}
7319 7633
       
7320 7634
 		
7321 7635
 		$sth = $this->db->prepare($query);
@@ -7336,7 +7650,9 @@  discard block
 block discarded – undo
7336 7650
 			if ($icaoaskey) {
7337 7651
 				$icao = $row['arrival_airport_icao'];
7338 7652
 				$airport_array[$icao] = $temp_array;
7339
-			} else $airport_array[] = $temp_array;
7653
+			} else {
7654
+				$airport_array[] = $temp_array;
7655
+			}
7340 7656
 		}
7341 7657
 
7342 7658
 		return $airport_array;
@@ -7399,7 +7715,9 @@  discard block
 block discarded – undo
7399 7715
 		}
7400 7716
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7401 7717
 					ORDER BY airport_arrival_icao_count DESC";
7402
-		if ($limit) $query .= " LIMIT 10";
7718
+		if ($limit) {
7719
+			$query .= " LIMIT 10";
7720
+		}
7403 7721
       
7404 7722
 		
7405 7723
 		$sth = $this->db->prepare($query);
@@ -7418,7 +7736,9 @@  discard block
 block discarded – undo
7418 7736
 			if ($icaoaskey) {
7419 7737
 				$icao = $row['arrival_airport_icao'];
7420 7738
 				$airport_array[$icao] = $temp_array;
7421
-			} else $airport_array[] = $temp_array;
7739
+			} else {
7740
+				$airport_array[] = $temp_array;
7741
+			}
7422 7742
 		}
7423 7743
 
7424 7744
 		return $airport_array;
@@ -7455,7 +7775,9 @@  discard block
 block discarded – undo
7455 7775
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7456 7776
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7457 7777
 					ORDER BY airport_arrival_icao_count DESC";
7458
-		if ($limit) $query .= " LIMIT 10";
7778
+		if ($limit) {
7779
+			$query .= " LIMIT 10";
7780
+		}
7459 7781
       
7460 7782
 		
7461 7783
 		$sth = $this->db->prepare($query);
@@ -7476,7 +7798,9 @@  discard block
 block discarded – undo
7476 7798
 			if ($icaoaskey) {
7477 7799
 				$icao = $row['arrival_airport_icao'];
7478 7800
 				$airport_array[$icao] = $temp_array;
7479
-			} else $airport_array[] = $temp_array;
7801
+			} else {
7802
+				$airport_array[] = $temp_array;
7803
+			}
7480 7804
 		}
7481 7805
 
7482 7806
 		return $airport_array;
@@ -7857,7 +8181,9 @@  discard block
 block discarded – undo
7857 8181
 			date_default_timezone_set($globalTimezone);
7858 8182
 			$datetime = new DateTime($date);
7859 8183
 			$offset = $datetime->format('P');
7860
-		} else $offset = '+00:00';
8184
+		} else {
8185
+			$offset = '+00:00';
8186
+		}
7861 8187
 
7862 8188
 		if ($globalDBdriver == 'mysql') {
7863 8189
 			$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,7 +8233,9 @@  discard block
 block discarded – undo
7907 8233
 			date_default_timezone_set($globalTimezone);
7908 8234
 			$datetime = new DateTime($date);
7909 8235
 			$offset = $datetime->format('P');
7910
-		} else $offset = '+00:00';
8236
+		} else {
8237
+			$offset = '+00:00';
8238
+		}
7911 8239
 
7912 8240
 		if ($globalDBdriver == 'mysql') {
7913 8241
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8278,7 +8606,9 @@  discard block
 block discarded – undo
8278 8606
 		}
8279 8607
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8280 8608
 					ORDER BY airport_arrival_country_count DESC";
8281
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8609
+		if ($limit) {
8610
+			$query .= " LIMIT 10 OFFSET 0";
8611
+		}
8282 8612
       
8283 8613
 		
8284 8614
 		$sth = $this->db->prepare($query);
@@ -8565,7 +8895,9 @@  discard block
 block discarded – undo
8565 8895
 			date_default_timezone_set($globalTimezone);
8566 8896
 			$datetime = new DateTime($date);
8567 8897
 			$offset = $datetime->format('P');
8568
-		} else $offset = '+00:00';
8898
+		} else {
8899
+			$offset = '+00:00';
8900
+		}
8569 8901
 		
8570 8902
 		if ($globalDBdriver == 'mysql') {
8571 8903
 			$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
@@ -8821,12 +9153,18 @@  discard block
 block discarded – undo
8821 9153
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8822 9154
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8823 9155
 		 if ($olderthanmonths > 0) {
8824
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8825
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9156
+			if ($globalDBdriver == 'mysql') {
9157
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9158
+			} else {
9159
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9160
+			}
8826 9161
 		}
8827 9162
 		if ($sincedate != '') {
8828
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
8829
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9163
+			if ($globalDBdriver == 'mysql') {
9164
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9165
+			} else {
9166
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9167
+			}
8830 9168
 		}
8831 9169
 		$query_values = array();
8832 9170
 		if ($year != '') {
@@ -8857,7 +9195,9 @@  discard block
 block discarded – undo
8857 9195
 			}
8858 9196
 		}
8859 9197
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8860
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9198
+		if ($limit) {
9199
+			$query .= " LIMIT 10 OFFSET 0";
9200
+		}
8861 9201
       		
8862 9202
 		$sth = $this->db->prepare($query);
8863 9203
 		$sth->execute($query_values);
@@ -8891,15 +9231,23 @@  discard block
 block discarded – undo
8891 9231
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8892 9232
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8893 9233
 		 if ($olderthanmonths > 0) {
8894
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8895
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9234
+			if ($globalDBdriver == 'mysql') {
9235
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9236
+			} else {
9237
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9238
+			}
8896 9239
 		}
8897 9240
 		if ($sincedate != '') {
8898
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
8899
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9241
+			if ($globalDBdriver == 'mysql') {
9242
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9243
+			} else {
9244
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9245
+			}
8900 9246
 		}
8901 9247
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8902
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9248
+		if ($limit) {
9249
+			$query .= " LIMIT 10 OFFSET 0";
9250
+		}
8903 9251
       		
8904 9252
 		$sth = $this->db->prepare($query);
8905 9253
 		$sth->execute();
@@ -8936,7 +9284,9 @@  discard block
 block discarded – undo
8936 9284
 			date_default_timezone_set($globalTimezone);
8937 9285
 			$datetime = new DateTime();
8938 9286
 			$offset = $datetime->format('P');
8939
-		} else $offset = '+00:00';
9287
+		} else {
9288
+			$offset = '+00:00';
9289
+		}
8940 9290
 
8941 9291
 		if ($globalDBdriver == 'mysql') {
8942 9292
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8985,7 +9335,9 @@  discard block
 block discarded – undo
8985 9335
 			date_default_timezone_set($globalTimezone);
8986 9336
 			$datetime = new DateTime();
8987 9337
 			$offset = $datetime->format('P');
8988
-		} else $offset = '+00:00';
9338
+		} else {
9339
+			$offset = '+00:00';
9340
+		}
8989 9341
 		$filter_query = $this->getFilter($filters,true,true);
8990 9342
 		if ($globalDBdriver == 'mysql') {
8991 9343
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9034,7 +9386,9 @@  discard block
 block discarded – undo
9034 9386
 			date_default_timezone_set($globalTimezone);
9035 9387
 			$datetime = new DateTime();
9036 9388
 			$offset = $datetime->format('P');
9037
-		} else $offset = '+00:00';
9389
+		} else {
9390
+			$offset = '+00:00';
9391
+		}
9038 9392
 		$filter_query = $this->getFilter($filters,true,true);
9039 9393
 		if ($globalDBdriver == 'mysql') {
9040 9394
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9080,7 +9434,9 @@  discard block
 block discarded – undo
9080 9434
 			date_default_timezone_set($globalTimezone);
9081 9435
 			$datetime = new DateTime();
9082 9436
 			$offset = $datetime->format('P');
9083
-		} else $offset = '+00:00';
9437
+		} else {
9438
+			$offset = '+00:00';
9439
+		}
9084 9440
 		$filter_query = $this->getFilter($filters,true,true);
9085 9441
 		if ($globalDBdriver == 'mysql') {
9086 9442
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9128,7 +9484,9 @@  discard block
 block discarded – undo
9128 9484
 			date_default_timezone_set($globalTimezone);
9129 9485
 			$datetime = new DateTime();
9130 9486
 			$offset = $datetime->format('P');
9131
-		} else $offset = '+00:00';
9487
+		} else {
9488
+			$offset = '+00:00';
9489
+		}
9132 9490
 		
9133 9491
 		if ($globalDBdriver == 'mysql') {
9134 9492
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9176,7 +9534,9 @@  discard block
 block discarded – undo
9176 9534
 			date_default_timezone_set($globalTimezone);
9177 9535
 			$datetime = new DateTime();
9178 9536
 			$offset = $datetime->format('P');
9179
-		} else $offset = '+00:00';
9537
+		} else {
9538
+			$offset = '+00:00';
9539
+		}
9180 9540
 
9181 9541
 		if ($globalDBdriver == 'mysql') {
9182 9542
 			$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
@@ -9223,7 +9583,9 @@  discard block
 block discarded – undo
9223 9583
 			date_default_timezone_set($globalTimezone);
9224 9584
 			$datetime = new DateTime();
9225 9585
 			$offset = $datetime->format('P');
9226
-		} else $offset = '+00:00';
9586
+		} else {
9587
+			$offset = '+00:00';
9588
+		}
9227 9589
 
9228 9590
 		if ($globalDBdriver == 'mysql') {
9229 9591
 			$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
@@ -9271,7 +9633,9 @@  discard block
 block discarded – undo
9271 9633
 			date_default_timezone_set($globalTimezone);
9272 9634
 			$datetime = new DateTime();
9273 9635
 			$offset = $datetime->format('P');
9274
-		} else $offset = '+00:00';
9636
+		} else {
9637
+			$offset = '+00:00';
9638
+		}
9275 9639
 		$filter_query = $this->getFilter($filters,true,true);
9276 9640
 		if ($globalDBdriver == 'mysql') {
9277 9641
 			$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
@@ -9316,7 +9680,9 @@  discard block
 block discarded – undo
9316 9680
 			date_default_timezone_set($globalTimezone);
9317 9681
 			$datetime = new DateTime();
9318 9682
 			$offset = $datetime->format('P');
9319
-		} else $offset = '+00:00';
9683
+		} else {
9684
+			$offset = '+00:00';
9685
+		}
9320 9686
 		$filter_query = $this->getFilter($filters,true,true);
9321 9687
 
9322 9688
 		if ($globalDBdriver == 'mysql') {
@@ -9363,7 +9729,9 @@  discard block
 block discarded – undo
9363 9729
 			date_default_timezone_set($globalTimezone);
9364 9730
 			$datetime = new DateTime();
9365 9731
 			$offset = $datetime->format('P');
9366
-		} else $offset = '+00:00';
9732
+		} else {
9733
+			$offset = '+00:00';
9734
+		}
9367 9735
 
9368 9736
 		if ($globalDBdriver == 'mysql') {
9369 9737
 			$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
@@ -9409,7 +9777,9 @@  discard block
 block discarded – undo
9409 9777
 			date_default_timezone_set($globalTimezone);
9410 9778
 			$datetime = new DateTime();
9411 9779
 			$offset = $datetime->format('P');
9412
-		} else $offset = '+00:00';
9780
+		} else {
9781
+			$offset = '+00:00';
9782
+		}
9413 9783
 		$filter_query = $this->getFilter($filters,true,true);
9414 9784
 
9415 9785
 		if ($globalDBdriver == 'mysql') {
@@ -9456,7 +9826,9 @@  discard block
 block discarded – undo
9456 9826
 			date_default_timezone_set($globalTimezone);
9457 9827
 			$datetime = new DateTime();
9458 9828
 			$offset = $datetime->format('P');
9459
-		} else $offset = '+00:00';
9829
+		} else {
9830
+			$offset = '+00:00';
9831
+		}
9460 9832
 
9461 9833
 		if ($globalDBdriver == 'mysql') {
9462 9834
 			$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
@@ -9503,7 +9875,9 @@  discard block
 block discarded – undo
9503 9875
 			date_default_timezone_set($globalTimezone);
9504 9876
 			$datetime = new DateTime();
9505 9877
 			$offset = $datetime->format('P');
9506
-		} else $offset = '+00:00';
9878
+		} else {
9879
+			$offset = '+00:00';
9880
+		}
9507 9881
 
9508 9882
 		if ($globalDBdriver == 'mysql') {
9509 9883
 			$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
@@ -9548,7 +9922,9 @@  discard block
 block discarded – undo
9548 9922
 			date_default_timezone_set($globalTimezone);
9549 9923
 			$datetime = new DateTime();
9550 9924
 			$offset = $datetime->format('P');
9551
-		} else $offset = '+00:00';
9925
+		} else {
9926
+			$offset = '+00:00';
9927
+		}
9552 9928
 		$filter_query = $this->getFilter($filters,true,true);
9553 9929
 
9554 9930
 		if ($globalDBdriver == 'mysql') {
@@ -9596,7 +9972,9 @@  discard block
 block discarded – undo
9596 9972
 			date_default_timezone_set($globalTimezone);
9597 9973
 			$datetime = new DateTime();
9598 9974
 			$offset = $datetime->format('P');
9599
-		} else $offset = '+00:00';
9975
+		} else {
9976
+			$offset = '+00:00';
9977
+		}
9600 9978
 
9601 9979
 		if ($globalDBdriver == 'mysql') {
9602 9980
 			$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
@@ -9642,7 +10020,9 @@  discard block
 block discarded – undo
9642 10020
 			date_default_timezone_set($globalTimezone);
9643 10021
 			$datetime = new DateTime();
9644 10022
 			$offset = $datetime->format('P');
9645
-		} else $offset = '+00:00';
10023
+		} else {
10024
+			$offset = '+00:00';
10025
+		}
9646 10026
 		$filter_query = $this->getFilter($filters,true,true);
9647 10027
 
9648 10028
 		if ($globalDBdriver == 'mysql') {
@@ -9690,7 +10070,9 @@  discard block
 block discarded – undo
9690 10070
 			date_default_timezone_set($globalTimezone);
9691 10071
 			$datetime = new DateTime();
9692 10072
 			$offset = $datetime->format('P');
9693
-		} else $offset = '+00:00';
10073
+		} else {
10074
+			$offset = '+00:00';
10075
+		}
9694 10076
 
9695 10077
 		if ($globalDBdriver == 'mysql') {
9696 10078
 			$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
@@ -9737,7 +10119,9 @@  discard block
 block discarded – undo
9737 10119
 			date_default_timezone_set($globalTimezone);
9738 10120
 			$datetime = new DateTime();
9739 10121
 			$offset = $datetime->format('P');
9740
-		} else $offset = '+00:00';
10122
+		} else {
10123
+			$offset = '+00:00';
10124
+		}
9741 10125
 		$filter_query = $this->getFilter($filters,true,true);
9742 10126
 		if ($globalDBdriver == 'mysql') {
9743 10127
 			$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
@@ -9786,7 +10170,9 @@  discard block
 block discarded – undo
9786 10170
 			date_default_timezone_set($globalTimezone);
9787 10171
 			$datetime = new DateTime();
9788 10172
 			$offset = $datetime->format('P');
9789
-		} else $offset = '+00:00';
10173
+		} else {
10174
+			$offset = '+00:00';
10175
+		}
9790 10176
 
9791 10177
 		$orderby_sql = '';
9792 10178
 		if ($orderby == "hour")
@@ -9852,7 +10238,9 @@  discard block
 block discarded – undo
9852 10238
 			date_default_timezone_set($globalTimezone);
9853 10239
 			$datetime = new DateTime();
9854 10240
 			$offset = $datetime->format('P');
9855
-		} else $offset = '+00:00';
10241
+		} else {
10242
+			$offset = '+00:00';
10243
+		}
9856 10244
 
9857 10245
 		$orderby_sql = '';
9858 10246
 		if ($orderby == "hour")
@@ -9919,7 +10307,9 @@  discard block
 block discarded – undo
9919 10307
 			date_default_timezone_set($globalTimezone);
9920 10308
 			$datetime = new DateTime();
9921 10309
 			$offset = $datetime->format('P');
9922
-		} else $offset = '+00:00';
10310
+		} else {
10311
+			$offset = '+00:00';
10312
+		}
9923 10313
 
9924 10314
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9925 10315
 
@@ -9970,7 +10360,9 @@  discard block
 block discarded – undo
9970 10360
 			date_default_timezone_set($globalTimezone);
9971 10361
 			$datetime = new DateTime();
9972 10362
 			$offset = $datetime->format('P');
9973
-		} else $offset = '+00:00';
10363
+		} else {
10364
+			$offset = '+00:00';
10365
+		}
9974 10366
 
9975 10367
 		if ($globalDBdriver == 'mysql') {
9976 10368
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10017,7 +10409,9 @@  discard block
 block discarded – undo
10017 10409
 			date_default_timezone_set($globalTimezone);
10018 10410
 			$datetime = new DateTime();
10019 10411
 			$offset = $datetime->format('P');
10020
-		} else $offset = '+00:00';
10412
+		} else {
10413
+			$offset = '+00:00';
10414
+		}
10021 10415
 
10022 10416
 		if ($globalDBdriver == 'mysql') {
10023 10417
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10064,7 +10458,9 @@  discard block
 block discarded – undo
10064 10458
 			date_default_timezone_set($globalTimezone);
10065 10459
 			$datetime = new DateTime();
10066 10460
 			$offset = $datetime->format('P');
10067
-		} else $offset = '+00:00';
10461
+		} else {
10462
+			$offset = '+00:00';
10463
+		}
10068 10464
 
10069 10465
 		if ($globalDBdriver == 'mysql') {
10070 10466
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10112,7 +10508,9 @@  discard block
 block discarded – undo
10112 10508
 			date_default_timezone_set($globalTimezone);
10113 10509
 			$datetime = new DateTime();
10114 10510
 			$offset = $datetime->format('P');
10115
-		} else $offset = '+00:00';
10511
+		} else {
10512
+			$offset = '+00:00';
10513
+		}
10116 10514
 
10117 10515
 		if ($globalDBdriver == 'mysql') {
10118 10516
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10160,7 +10558,9 @@  discard block
 block discarded – undo
10160 10558
 			date_default_timezone_set($globalTimezone);
10161 10559
 			$datetime = new DateTime($date);
10162 10560
 			$offset = $datetime->format('P');
10163
-		} else $offset = '+00:00';
10561
+		} else {
10562
+			$offset = '+00:00';
10563
+		}
10164 10564
 
10165 10565
 		if ($globalDBdriver == 'mysql') {
10166 10566
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10208,7 +10608,9 @@  discard block
 block discarded – undo
10208 10608
 			date_default_timezone_set($globalTimezone);
10209 10609
 			$datetime = new DateTime();
10210 10610
 			$offset = $datetime->format('P');
10211
-		} else $offset = '+00:00';
10611
+		} else {
10612
+			$offset = '+00:00';
10613
+		}
10212 10614
 
10213 10615
 		if ($globalDBdriver == 'mysql') {
10214 10616
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10255,7 +10657,9 @@  discard block
 block discarded – undo
10255 10657
 			date_default_timezone_set($globalTimezone);
10256 10658
 			$datetime = new DateTime();
10257 10659
 			$offset = $datetime->format('P');
10258
-		} else $offset = '+00:00';
10660
+		} else {
10661
+			$offset = '+00:00';
10662
+		}
10259 10663
 
10260 10664
 		if ($globalDBdriver == 'mysql') {
10261 10665
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10302,7 +10706,9 @@  discard block
 block discarded – undo
10302 10706
 			date_default_timezone_set($globalTimezone);
10303 10707
 			$datetime = new DateTime();
10304 10708
 			$offset = $datetime->format('P');
10305
-		} else $offset = '+00:00';
10709
+		} else {
10710
+			$offset = '+00:00';
10711
+		}
10306 10712
 
10307 10713
 		if ($globalDBdriver == 'mysql') {
10308 10714
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10352,7 +10758,9 @@  discard block
 block discarded – undo
10352 10758
 			date_default_timezone_set($globalTimezone);
10353 10759
 			$datetime = new DateTime();
10354 10760
 			$offset = $datetime->format('P');
10355
-		} else $offset = '+00:00';
10761
+		} else {
10762
+			$offset = '+00:00';
10763
+		}
10356 10764
 
10357 10765
 		if ($globalDBdriver == 'mysql') {
10358 10766
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10399,7 +10807,9 @@  discard block
 block discarded – undo
10399 10807
 			date_default_timezone_set($globalTimezone);
10400 10808
 			$datetime = new DateTime();
10401 10809
 			$offset = $datetime->format('P');
10402
-		} else $offset = '+00:00';
10810
+		} else {
10811
+			$offset = '+00:00';
10812
+		}
10403 10813
 
10404 10814
 		if ($globalDBdriver == 'mysql') {
10405 10815
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10610,8 +11020,11 @@  discard block
 block discarded – undo
10610 11020
 				$query_values = array_merge($query_values,array(':month' => $month));
10611 11021
 			}
10612 11022
 		}
10613
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10614
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11023
+		if (empty($query_values)) {
11024
+			$queryi .= $this->getFilter($filters);
11025
+		} else {
11026
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11027
+		}
10615 11028
 		
10616 11029
 		//echo $query;
10617 11030
 		$sth = $this->db->prepare($queryi);
@@ -10690,8 +11103,11 @@  discard block
 block discarded – undo
10690 11103
 				$query_values = array_merge($query_values,array(':month' => $month));
10691 11104
 			}
10692 11105
 		}
10693
-                if ($query == '') $queryi .= $this->getFilter($filters);
10694
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11106
+                if ($query == '') {
11107
+                	$queryi .= $this->getFilter($filters);
11108
+                } else {
11109
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11110
+                }
10695 11111
 
10696 11112
 
10697 11113
 		$sth = $this->db->prepare($queryi);
@@ -10714,7 +11130,9 @@  discard block
 block discarded – undo
10714 11130
 			date_default_timezone_set($globalTimezone);
10715 11131
 			$datetime = new DateTime();
10716 11132
 			$offset = $datetime->format('P');
10717
-		} else $offset = '+00:00';
11133
+		} else {
11134
+			$offset = '+00:00';
11135
+		}
10718 11136
 
10719 11137
 		if ($globalDBdriver == 'mysql') {
10720 11138
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10900,7 +11318,9 @@  discard block
 block discarded – undo
10900 11318
 	*/
10901 11319
 	public function parseDirection($direction = 0)
10902 11320
 	{
10903
-		if ($direction == '') $direction = 0;
11321
+		if ($direction == '') {
11322
+			$direction = 0;
11323
+		}
10904 11324
 		$direction_array = array();
10905 11325
 		$temp_array = array();
10906 11326
 
@@ -11001,7 +11421,9 @@  discard block
 block discarded – undo
11001 11421
 		if (isset($result->AirlineFlightInfoResult))
11002 11422
 		{
11003 11423
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11004
-		} else return '';
11424
+		} else {
11425
+			return '';
11426
+		}
11005 11427
 		
11006 11428
 		$registration = $this->convertAircraftRegistration($registration);
11007 11429
 		
@@ -11030,7 +11452,9 @@  discard block
 block discarded – undo
11030 11452
 		if (count($row) > 0) {
11031 11453
 		    //return $row['Registration'];
11032 11454
 		    return $row['registration'];
11033
-		} else return '';
11455
+		} else {
11456
+			return '';
11457
+		}
11034 11458
 	
11035 11459
 	}
11036 11460
 
@@ -11053,9 +11477,14 @@  discard block
 block discarded – undo
11053 11477
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11054 11478
 		$sth->closeCursor();
11055 11479
 		if (count($row) > 0) {
11056
-		    if ($row['type_flight'] == null) return '';
11057
-		    else return $row['type_flight'];
11058
-		} else return '';
11480
+		    if ($row['type_flight'] == null) {
11481
+		    	return '';
11482
+		    } else {
11483
+		    	return $row['type_flight'];
11484
+		    }
11485
+		} else {
11486
+			return '';
11487
+		}
11059 11488
 	
11060 11489
 	}
11061 11490
 
@@ -11073,7 +11502,9 @@  discard block
 block discarded – undo
11073 11502
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11074 11503
 	
11075 11504
 		$Connection = new Connection($this->db);
11076
-		if (!$Connection->tableExists('countries')) return '';
11505
+		if (!$Connection->tableExists('countries')) {
11506
+			return '';
11507
+		}
11077 11508
 	
11078 11509
 		try {
11079 11510
 			/*
@@ -11093,9 +11524,13 @@  discard block
 block discarded – undo
11093 11524
 			$sth->closeCursor();
11094 11525
 			if (count($row) > 0) {
11095 11526
 				return $row;
11096
-			} else return '';
11527
+			} else {
11528
+				return '';
11529
+			}
11097 11530
 		} catch (PDOException $e) {
11098
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11531
+			if (isset($globalDebug) && $globalDebug) {
11532
+				echo 'Error : '.$e->getMessage()."\n";
11533
+			}
11099 11534
 			return '';
11100 11535
 		}
11101 11536
 	
@@ -11113,7 +11548,9 @@  discard block
 block discarded – undo
11113 11548
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11114 11549
 	
11115 11550
 		$Connection = new Connection($this->db);
11116
-		if (!$Connection->tableExists('countries')) return '';
11551
+		if (!$Connection->tableExists('countries')) {
11552
+			return '';
11553
+		}
11117 11554
 	
11118 11555
 		try {
11119 11556
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11125,9 +11562,13 @@  discard block
 block discarded – undo
11125 11562
 			$sth->closeCursor();
11126 11563
 			if (count($row) > 0) {
11127 11564
 				return $row;
11128
-			} else return '';
11565
+			} else {
11566
+				return '';
11567
+			}
11129 11568
 		} catch (PDOException $e) {
11130
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11569
+			if (isset($globalDebug) && $globalDebug) {
11570
+				echo 'Error : '.$e->getMessage()."\n";
11571
+			}
11131 11572
 			return '';
11132 11573
 		}
11133 11574
 	
@@ -11377,7 +11818,9 @@  discard block
 block discarded – undo
11377 11818
 	{
11378 11819
 		global $globalBitlyAccessToken;
11379 11820
 		
11380
-		if ($globalBitlyAccessToken == '') return $url;
11821
+		if ($globalBitlyAccessToken == '') {
11822
+			return $url;
11823
+		}
11381 11824
         
11382 11825
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11383 11826
 		
@@ -11526,7 +11969,9 @@  discard block
 block discarded – undo
11526 11969
 		
11527 11970
 
11528 11971
 		// routes
11529
-		if ($globalDebug) print "Routes...\n";
11972
+		if ($globalDebug) {
11973
+			print "Routes...\n";
11974
+		}
11530 11975
 		if ($globalDBdriver == 'mysql') {
11531 11976
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
11532 11977
 		} else {
@@ -11545,7 +11990,9 @@  discard block
 block discarded – undo
11545 11990
 			}
11546 11991
 		}
11547 11992
 		
11548
-		if ($globalDebug) print "Airlines...\n";
11993
+		if ($globalDebug) {
11994
+			print "Airlines...\n";
11995
+		}
11549 11996
 		//airlines
11550 11997
 		if ($globalDBdriver == 'mysql') {
11551 11998
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -11559,10 +12006,15 @@  discard block
 block discarded – undo
11559 12006
 			if (is_numeric(substr($row['ident'], -1, 1)))
11560 12007
 			{
11561 12008
 				$fromsource = NULL;
11562
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11563
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11564
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11565
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12009
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12010
+					$fromsource = 'vatsim';
12011
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12012
+					$fromsource = 'ivao';
12013
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12014
+					$fromsource = 'vatsim';
12015
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12016
+					$fromsource = 'ivao';
12017
+				}
11566 12018
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11567 12019
 				if (isset($airline_array[0]['name'])) {
11568 12020
 					$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";
@@ -11572,13 +12024,17 @@  discard block
 block discarded – undo
11572 12024
 			}
11573 12025
 		}
11574 12026
 
11575
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12027
+		if ($globalDebug) {
12028
+			print "Remove Duplicate in aircraft_modes...\n";
12029
+		}
11576 12030
 		//duplicate modes
11577 12031
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
11578 12032
 		$sth = $this->db->prepare($query);
11579 12033
 		$sth->execute();
11580 12034
 		
11581
-		if ($globalDebug) print "Aircraft...\n";
12035
+		if ($globalDebug) {
12036
+			print "Aircraft...\n";
12037
+		}
11582 12038
 		//aircraft
11583 12039
 		if ($globalDBdriver == 'mysql') {
11584 12040
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -11621,26 +12077,38 @@  discard block
 block discarded – undo
11621 12077
 				 if (isset($closestAirports[0])) {
11622 12078
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
11623 12079
 						$airport_icao = $closestAirports[0]['icao'];
11624
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12080
+						if ($globalDebug) {
12081
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12082
+						}
11625 12083
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
11626 12084
 						foreach ($closestAirports as $airport) {
11627 12085
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
11628 12086
 								$airport_icao = $airport['icao'];
11629
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12087
+								if ($globalDebug) {
12088
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12089
+								}
11630 12090
 								break;
11631 12091
 							}
11632 12092
 						}
11633 12093
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11634 12094
 						$airport_icao = $closestAirports[0]['icao'];
11635
-						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";
12095
+						if ($globalDebug) {
12096
+							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";
12097
+						}
11636 12098
 					} else {
11637
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12099
+						if ($globalDebug) {
12100
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12101
+						}
11638 12102
 					}
11639 12103
 				} else {
11640
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12104
+					if ($globalDebug) {
12105
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12106
+					}
11641 12107
 				}
11642 12108
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11643
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12109
+					if ($globalDebug) {
12110
+						echo "Updating airport to ".$airport_icao."...\n";
12111
+					}
11644 12112
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11645 12113
 					$sthu = $this->db->prepare($update_query);
11646 12114
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
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,8 +2875,8 @@  discard block
 block discarded – undo
2875 2875
 	*/
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878
-		$filter_query = $this->getFilter($filters,true,true);
2879
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2878
+		$filter_query = $this->getFilter($filters, true, true);
2879
+		$query = "SELECT DISTINCT spotter_output.owner_name
2880 2880
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2881 2881
 				ORDER BY spotter_output.owner_name ASC";
2882 2882
 		
@@ -2893,8 +2893,8 @@  discard block
 block discarded – undo
2893 2893
 	*/
2894 2894
 	public function getAllPilotNames($filters = array())
2895 2895
 	{
2896
-		$filter_query = $this->getFilter($filters,true,true);
2897
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2896
+		$filter_query = $this->getFilter($filters, true, true);
2897
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2898 2898
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2899 2899
 				ORDER BY spotter_output.pilot_name ASC";
2900 2900
 		
@@ -2927,21 +2927,21 @@  discard block
 block discarded – undo
2927 2927
    
2928 2928
 		$temp_array = array();
2929 2929
 		
2930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2931 2931
 		{
2932 2932
 			$temp_array['airport_country'] = $row['airport_country'];
2933 2933
 
2934 2934
 			$airport_array[$row['airport_country']] = $temp_array;
2935 2935
 		}
2936
-		$filter_query = $this->getFilter($filters,true,true);
2937
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2936
+		$filter_query = $this->getFilter($filters, true, true);
2937
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2938 2938
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2939 2939
 								ORDER BY spotter_output.arrival_airport_country ASC";
2940 2940
 					
2941 2941
 		$sth = $this->db->prepare($query);
2942 2942
 		$sth->execute();
2943 2943
 		
2944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2945 2945
 		{
2946 2946
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2947 2947
 			{
@@ -2964,9 +2964,9 @@  discard block
 block discarded – undo
2964 2964
 	*/
2965 2965
 	public function getAllCountries($filters = array())
2966 2966
 	{
2967
-		$Connection= new Connection($this->db);
2967
+		$Connection = new Connection($this->db);
2968 2968
 		if ($Connection->tableExists('countries')) {
2969
-			$query  = "SELECT countries.name AS airport_country
2969
+			$query = "SELECT countries.name AS airport_country
2970 2970
 				FROM countries
2971 2971
 				ORDER BY countries.name ASC";
2972 2972
 			$sth = $this->db->prepare($query);
@@ -2975,14 +2975,14 @@  discard block
 block discarded – undo
2975 2975
 			$temp_array = array();
2976 2976
 			$country_array = array();
2977 2977
 		
2978
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2978
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2979 2979
 			{
2980 2980
 				$temp_array['country'] = $row['airport_country'];
2981 2981
 				$country_array[$row['airport_country']] = $temp_array;
2982 2982
 			}
2983 2983
 		} else {
2984
-			$filter_query = $this->getFilter($filters,true,true);
2985
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2984
+			$filter_query = $this->getFilter($filters, true, true);
2985
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2986 2986
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2987 2987
 								ORDER BY spotter_output.departure_airport_country ASC";
2988 2988
 
@@ -2991,20 +2991,20 @@  discard block
 block discarded – undo
2991 2991
    
2992 2992
 			$temp_array = array();
2993 2993
 			$country_array = array();
2994
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2994
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2995 2995
 			{
2996 2996
 				$temp_array['country'] = $row['airport_country'];
2997 2997
 				$country_array[$row['airport_country']] = $temp_array;
2998 2998
 			}
2999 2999
 
3000
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3000
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3001 3001
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3002 3002
 								ORDER BY spotter_output.arrival_airport_country ASC";
3003 3003
 					
3004 3004
 		$sth = $this->db->prepare($query);
3005 3005
 		$sth->execute();
3006 3006
 		
3007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3008 3008
 		{
3009 3009
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3010 3010
 			{
@@ -3014,14 +3014,14 @@  discard block
 block discarded – undo
3014 3014
 			}
3015 3015
 		}
3016 3016
 		
3017
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3017
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3018 3018
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3019 3019
 								ORDER BY spotter_output.airline_country ASC";
3020 3020
 					
3021 3021
 		$sth = $this->db->prepare($query);
3022 3022
 		$sth->execute();
3023 3023
 		
3024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3025 3025
 		{
3026 3026
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3027 3027
 			{
@@ -3045,8 +3045,8 @@  discard block
 block discarded – undo
3045 3045
 	*/
3046 3046
 	public function getAllIdents($filters = array())
3047 3047
 	{
3048
-		$filter_query = $this->getFilter($filters,true,true);
3049
-		$query  = "SELECT DISTINCT spotter_output.ident
3048
+		$filter_query = $this->getFilter($filters, true, true);
3049
+		$query = "SELECT DISTINCT spotter_output.ident
3050 3050
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3051 3051
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3052 3052
 
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
 		$ident_array = array();
3057 3057
 		$temp_array = array();
3058 3058
 		
3059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3060 3060
 		{
3061 3061
 			$temp_array['ident'] = $row['ident'];
3062 3062
 			$ident_array[] = $temp_array;
@@ -3070,9 +3070,9 @@  discard block
 block discarded – undo
3070 3070
 	* @return Array number, icao, name and city of airports
3071 3071
 	*/
3072 3072
 
3073
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3073
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3074 3074
 		global $globalTimezone, $globalDBdriver;
3075
-		$filter_query = $this->getFilter($filters,true,true);
3075
+		$filter_query = $this->getFilter($filters, true, true);
3076 3076
 		if ($globalTimezone != '') {
3077 3077
 			date_default_timezone_set($globalTimezone);
3078 3078
 			$datetime = new DateTime();
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
 
3138 3138
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3139 3139
 		global $globalTimezone, $globalDBdriver;
3140
-		$filter_query = $this->getFilter($filters,true,true);
3140
+		$filter_query = $this->getFilter($filters, true, true);
3141 3141
 		if ($globalTimezone != '') {
3142 3142
 			date_default_timezone_set($globalTimezone);
3143 3143
 			$datetime = new DateTime();
@@ -3221,7 +3221,7 @@  discard block
 block discarded – undo
3221 3221
 
3222 3222
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3223 3223
 		global $globalTimezone, $globalDBdriver;
3224
-		$filter_query = $this->getFilter($filters,true,true);
3224
+		$filter_query = $this->getFilter($filters, true, true);
3225 3225
 		if ($globalTimezone != '') {
3226 3226
 			date_default_timezone_set($globalTimezone);
3227 3227
 			$datetime = new DateTime();
@@ -3254,9 +3254,9 @@  discard block
 block discarded – undo
3254 3254
 	* @return Array number, icao, name and city of airports
3255 3255
 	*/
3256 3256
 
3257
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3257
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3258 3258
 		global $globalTimezone, $globalDBdriver;
3259
-		$filter_query = $this->getFilter($filters,true,true);
3259
+		$filter_query = $this->getFilter($filters, true, true);
3260 3260
 		if ($globalTimezone != '') {
3261 3261
 			date_default_timezone_set($globalTimezone);
3262 3262
 			$datetime = new DateTime();
@@ -3388,12 +3388,12 @@  discard block
 block discarded – undo
3388 3388
 		} else $offset = '+00:00';
3389 3389
 
3390 3390
 		if ($globalDBdriver == 'mysql') {
3391
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3391
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3392 3392
 								FROM spotter_output
3393 3393
 								WHERE spotter_output.date <> '' 
3394 3394
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3395 3395
 		} else {
3396
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3396
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3397 3397
 								FROM spotter_output
3398 3398
 								WHERE spotter_output.date <> '' 
3399 3399
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3405,7 +3405,7 @@  discard block
 block discarded – undo
3405 3405
 		$date_array = array();
3406 3406
 		$temp_array = array();
3407 3407
 		
3408
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3408
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3409 3409
 		{
3410 3410
 			$temp_array['date'] = $row['date'];
3411 3411
 
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 	*/
3426 3426
 	public function getAllRoutes()
3427 3427
 	{
3428
-		$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 
3428
+		$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 
3429 3429
 				FROM spotter_output
3430 3430
 				WHERE spotter_output.ident <> '' 
3431 3431
 				GROUP BY route
@@ -3436,7 +3436,7 @@  discard block
 block discarded – undo
3436 3436
 
3437 3437
 		$routes_array = array();
3438 3438
 		$temp_array = array();
3439
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3439
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3440 3440
 		{
3441 3441
 			$temp_array['route'] = $row['route'];
3442 3442
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3455,21 +3455,21 @@  discard block
 block discarded – undo
3455 3455
 	* @return String success or false
3456 3456
 	*
3457 3457
 	*/	
3458
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3458
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3459 3459
 	{
3460 3460
 		if (!is_numeric(substr($ident, 0, 3)))
3461 3461
 		{
3462 3462
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3463
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3463
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3464 3464
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3465
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3465
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3466 3466
 			} else {
3467 3467
 				$airline_array = $this->getAllAirlineInfo("NA");
3468 3468
 			}
3469 3469
 			if (count($airline_array) == 0) {
3470 3470
 				$airline_array = $this->getAllAirlineInfo("NA");
3471 3471
 			}
3472
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3472
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3473 3473
 				$airline_array = $this->getAllAirlineInfo("NA");
3474 3474
 			}
3475 3475
 		} else {
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
 
3483 3483
 
3484 3484
 		$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';
3485
-                $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);
3485
+                $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);
3486 3486
 
3487 3487
 		try {
3488 3488
 			$sth = $this->db->prepare($query);
@@ -3503,11 +3503,11 @@  discard block
 block discarded – undo
3503 3503
 	* @return String success or false
3504 3504
 	*
3505 3505
 	*/	
3506
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3506
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3507 3507
 	{
3508 3508
 		if ($groundspeed == '') $groundspeed = NULL;
3509 3509
 		$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';
3510
-                $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);
3510
+                $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);
3511 3511
 
3512 3512
 		try {
3513 3513
 			$sth = $this->db->prepare($query);
@@ -3547,7 +3547,7 @@  discard block
 block discarded – undo
3547 3547
 	* @param String $verticalrate vertival rate of flight
3548 3548
 	* @return String success or false
3549 3549
 	*/
3550
-	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 = '')
3550
+	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 = '')
3551 3551
 	{
3552 3552
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3553 3553
 		
@@ -3571,13 +3571,13 @@  discard block
 block discarded – undo
3571 3571
 				if ($ModeS != '') {
3572 3572
 					$timeelapsed = microtime(true);
3573 3573
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3574
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3574
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3575 3575
 				} else {
3576
-					$myhex = explode('-',$flightaware_id);
3576
+					$myhex = explode('-', $flightaware_id);
3577 3577
 					if (count($myhex) > 0) {
3578 3578
 						$timeelapsed = microtime(true);
3579 3579
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3580
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3580
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3581 3581
 					}
3582 3582
 				}
3583 3583
 			}
@@ -3599,24 +3599,24 @@  discard block
 block discarded – undo
3599 3599
 				{
3600 3600
 					$timeelapsed = microtime(true);
3601 3601
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3602
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3602
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3603 3603
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3604
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3604
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3605 3605
 					} else {
3606 3606
 						$airline_array = $this->getAllAirlineInfo("NA");
3607 3607
 					}
3608 3608
 					if (count($airline_array) == 0) {
3609 3609
 						$airline_array = $this->getAllAirlineInfo("NA");
3610 3610
 					}
3611
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3611
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3612 3612
 						$airline_array = $this->getAllAirlineInfo("NA");
3613 3613
 					}
3614
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3614
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3615 3615
 
3616 3616
 				} else {
3617 3617
 					$timeelapsed = microtime(true);
3618 3618
 					$airline_array = $this->getAllAirlineInfo("NA");
3619
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3619
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3620 3620
 				}
3621 3621
 			}
3622 3622
 		} else $airline_array = array();
@@ -3633,27 +3633,27 @@  discard block
 block discarded – undo
3633 3633
 				{
3634 3634
 					$timeelapsed = microtime(true);
3635 3635
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3636
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3636
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3637 3637
 				} else {
3638 3638
 					$timeelapsed = microtime(true);
3639 3639
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3640
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3640
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3641 3641
 				}
3642 3642
 			}
3643 3643
 		} else {
3644 3644
 			if ($ModeS != '') {
3645 3645
 				$timeelapsed = microtime(true);
3646 3646
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3647
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3647
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3648 3648
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3649 3649
 				{
3650 3650
 					$timeelapsed = microtime(true);
3651 3651
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3652
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3652
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3653 3653
 				} else {
3654 3654
 					$timeelapsed = microtime(true);
3655 3655
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3656
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3656
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3657 3657
 				}
3658 3658
 			}
3659 3659
 		}
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
 			} else {
3670 3670
 				$timeelapsed = microtime(true);
3671 3671
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3672
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3673 3673
 			}
3674 3674
 		}
3675 3675
 		
@@ -3684,7 +3684,7 @@  discard block
 block discarded – undo
3684 3684
 			} else {
3685 3685
 				$timeelapsed = microtime(true);
3686 3686
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3687
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3687
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3688 3688
 			}
3689 3689
 		}
3690 3690
 
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
 		{
3748 3748
 			$timeelapsed = microtime(true);
3749 3749
 			$image_array = $Image->getSpotterImage($registration);
3750
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3750
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3751 3751
 			if (!isset($image_array[0]['registration']))
3752 3752
 			{
3753 3753
 				//echo "Add image !!!! \n";
@@ -3755,7 +3755,7 @@  discard block
 block discarded – undo
3755 3755
 			}
3756 3756
 			$timeelapsed = microtime(true);
3757 3757
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3758
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3758
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3759 3759
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3760 3760
 		}
3761 3761
     
@@ -3763,33 +3763,33 @@  discard block
 block discarded – undo
3763 3763
 		{
3764 3764
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765 3765
             		else $airline_icao = '';
3766
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3766
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3767 3767
 			if (!isset($image_array[0]['registration']))
3768 3768
 			{
3769 3769
 				//echo "Add image !!!! \n";
3770
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3770
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3771 3771
 			}
3772 3772
 		}
3773 3773
     
3774
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3775
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3776
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3777
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3778
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3779
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3780
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3781
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3782
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3783
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3784
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3785
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3786
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3787
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3788
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3789
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3790
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3791
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3792
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3774
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3775
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3776
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3777
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3778
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3779
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3780
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3781
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3782
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3783
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3784
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3785
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3786
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3787
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3788
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3789
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3790
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3791
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3792
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3793 3793
 	
3794 3794
 		if (count($airline_array) == 0) 
3795 3795
 		{
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818 3818
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819 3819
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
-                $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) 
3820
+                $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) 
3821 3821
                 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)";
3822 3822
 
3823 3823
                 $airline_name = $airline_array[0]['name'];
@@ -3827,7 +3827,7 @@  discard block
 block discarded – undo
3827 3827
 		if ($airline_type == '') {
3828 3828
 			$timeelapsed = microtime(true);
3829 3829
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3830
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3831 3831
 		}
3832 3832
 		if ($airline_type == null) $airline_type = '';
3833 3833
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3839,7 +3839,7 @@  discard block
 block discarded – undo
3839 3839
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3840 3840
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3841 3841
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3842
-                $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);
3842
+                $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);
3843 3843
 
3844 3844
 		try {
3845 3845
 		        
@@ -3865,13 +3865,13 @@  discard block
 block discarded – undo
3865 3865
 	{
3866 3866
 		global $globalDBdriver, $globalTimezone;
3867 3867
 		if ($globalDBdriver == 'mysql') {
3868
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3868
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3869 3869
 								WHERE spotter_output.ident = :ident 
3870 3870
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3871 3871
 								AND spotter_output.date < UTC_TIMESTAMP()";
3872 3872
 			$query_data = array(':ident' => $ident);
3873 3873
 		} else {
3874
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3874
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3875 3875
 								WHERE spotter_output.ident = :ident 
3876 3876
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3877 3877
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3880,8 +3880,8 @@  discard block
 block discarded – undo
3880 3880
 		
3881 3881
 		$sth = $this->db->prepare($query);
3882 3882
 		$sth->execute($query_data);
3883
-    		$ident_result='';
3884
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3883
+    		$ident_result = '';
3884
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3885 3885
 		{
3886 3886
 			$ident_result = $row['ident'];
3887 3887
 		}
@@ -3907,8 +3907,8 @@  discard block
 block discarded – undo
3907 3907
 				return false;
3908 3908
 			} else {
3909 3909
 				$q_array = explode(" ", $q);
3910
-				foreach ($q_array as $q_item){
3911
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3910
+				foreach ($q_array as $q_item) {
3911
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3912 3912
 					$additional_query .= " AND (";
3913 3913
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3914 3914
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3923,11 +3923,11 @@  discard block
 block discarded – undo
3923 3923
 			}
3924 3924
 		}
3925 3925
 		if ($globalDBdriver == 'mysql') {
3926
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3926
+			$query = "SELECT spotter_output.* FROM spotter_output 
3927 3927
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3928 3928
 				AND spotter_output.date < UTC_TIMESTAMP()";
3929 3929
 		} else {
3930
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3930
+			$query = "SELECT spotter_output.* FROM spotter_output 
3931 3931
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3932 3932
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3933 3933
 		}
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	* @return Array the airline list
3945 3945
 	*
3946 3946
 	*/
3947
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3947
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3948 3948
 	{
3949 3949
 		global $globalDBdriver;
3950
-		$filter_query = $this->getFilter($filters,true,true);
3951
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3950
+		$filter_query = $this->getFilter($filters, true, true);
3951
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3952 3952
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3953 3953
 		if ($olderthanmonths > 0) {
3954 3954
 			if ($globalDBdriver == 'mysql') {
@@ -3968,28 +3968,28 @@  discard block
 block discarded – undo
3968 3968
 		if ($year != '') {
3969 3969
 			if ($globalDBdriver == 'mysql') {
3970 3970
 				$query .= " AND YEAR(spotter_output.date) = :year";
3971
-				$query_values = array_merge($query_values,array(':year' => $year));
3971
+				$query_values = array_merge($query_values, array(':year' => $year));
3972 3972
 			} else {
3973 3973
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
3974
-				$query_values = array_merge($query_values,array(':year' => $year));
3974
+				$query_values = array_merge($query_values, array(':year' => $year));
3975 3975
 			}
3976 3976
 		}
3977 3977
 		if ($month != '') {
3978 3978
 			if ($globalDBdriver == 'mysql') {
3979 3979
 				$query .= " AND MONTH(spotter_output.date) = :month";
3980
-				$query_values = array_merge($query_values,array(':month' => $month));
3980
+				$query_values = array_merge($query_values, array(':month' => $month));
3981 3981
 			} else {
3982 3982
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
3983
-				$query_values = array_merge($query_values,array(':month' => $month));
3983
+				$query_values = array_merge($query_values, array(':month' => $month));
3984 3984
 			}
3985 3985
 		}
3986 3986
 		if ($day != '') {
3987 3987
 			if ($globalDBdriver == 'mysql') {
3988 3988
 				$query .= " AND DAY(spotter_output.date) = :day";
3989
-				$query_values = array_merge($query_values,array(':day' => $day));
3989
+				$query_values = array_merge($query_values, array(':day' => $day));
3990 3990
 			} else {
3991 3991
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
3992
-				$query_values = array_merge($query_values,array(':day' => $day));
3992
+				$query_values = array_merge($query_values, array(':day' => $day));
3993 3993
 			}
3994 3994
 		}
3995 3995
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -3999,7 +3999,7 @@  discard block
 block discarded – undo
3999 3999
 		$sth->execute($query_values);
4000 4000
 		$airline_array = array();
4001 4001
 		$temp_array = array();
4002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4003 4003
 		{
4004 4004
 			$temp_array['airline_name'] = $row['airline_name'];
4005 4005
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4016,11 +4016,11 @@  discard block
 block discarded – undo
4016 4016
 	* @return Array the pilots list
4017 4017
 	*
4018 4018
 	*/
4019
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4019
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4020 4020
 	{
4021 4021
 		global $globalDBdriver;
4022
-		$filter_query = $this->getFilter($filters,true,true);
4023
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4022
+		$filter_query = $this->getFilter($filters, true, true);
4023
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4024 4024
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
4025 4025
                 if ($olderthanmonths > 0) {
4026 4026
             		if ($globalDBdriver == 'mysql') {
@@ -4040,28 +4040,28 @@  discard block
 block discarded – undo
4040 4040
 		if ($year != '') {
4041 4041
 			if ($globalDBdriver == 'mysql') {
4042 4042
 				$query .= " AND YEAR(spotter_output.date) = :year";
4043
-				$query_values = array_merge($query_values,array(':year' => $year));
4043
+				$query_values = array_merge($query_values, array(':year' => $year));
4044 4044
 			} else {
4045 4045
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4046
-				$query_values = array_merge($query_values,array(':year' => $year));
4046
+				$query_values = array_merge($query_values, array(':year' => $year));
4047 4047
 			}
4048 4048
 		}
4049 4049
 		if ($month != '') {
4050 4050
 			if ($globalDBdriver == 'mysql') {
4051 4051
 				$query .= " AND MONTH(spotter_output.date) = :month";
4052
-				$query_values = array_merge($query_values,array(':month' => $month));
4052
+				$query_values = array_merge($query_values, array(':month' => $month));
4053 4053
 			} else {
4054 4054
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4055
-				$query_values = array_merge($query_values,array(':month' => $month));
4055
+				$query_values = array_merge($query_values, array(':month' => $month));
4056 4056
 			}
4057 4057
 		}
4058 4058
 		if ($day != '') {
4059 4059
 			if ($globalDBdriver == 'mysql') {
4060 4060
 				$query .= " AND DAY(spotter_output.date) = :day";
4061
-				$query_values = array_merge($query_values,array(':day' => $day));
4061
+				$query_values = array_merge($query_values, array(':day' => $day));
4062 4062
 			} else {
4063 4063
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4064
-				$query_values = array_merge($query_values,array(':day' => $day));
4064
+				$query_values = array_merge($query_values, array(':day' => $day));
4065 4065
 			}
4066 4066
 		}
4067 4067
 		
@@ -4073,7 +4073,7 @@  discard block
 block discarded – undo
4073 4073
 		$sth->execute($query_values);
4074 4074
 		$airline_array = array();
4075 4075
 		$temp_array = array();
4076
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4076
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4077 4077
 		{
4078 4078
 			$temp_array['pilot_name'] = $row['pilot_name'];
4079 4079
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4093,7 +4093,7 @@  discard block
 block discarded – undo
4093 4093
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4094 4094
 	{
4095 4095
 		global $globalDBdriver;
4096
-		$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
4096
+		$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
4097 4097
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4098 4098
                 if ($olderthanmonths > 0) {
4099 4099
             		if ($globalDBdriver == 'mysql') {
@@ -4119,7 +4119,7 @@  discard block
 block discarded – undo
4119 4119
 		$airline_array = array();
4120 4120
 		$temp_array = array();
4121 4121
         
4122
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4122
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4123 4123
 		{
4124 4124
 			$temp_array['pilot_name'] = $row['pilot_name'];
4125 4125
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4137,11 +4137,11 @@  discard block
 block discarded – undo
4137 4137
 	* @return Array the pilots list
4138 4138
 	*
4139 4139
 	*/
4140
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4140
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4141 4141
 	{
4142 4142
 		global $globalDBdriver;
4143
-		$filter_query = $this->getFilter($filters,true,true);
4144
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4143
+		$filter_query = $this->getFilter($filters, true, true);
4144
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4145 4145
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4146 4146
                 if ($olderthanmonths > 0) {
4147 4147
             		if ($globalDBdriver == 'mysql') {
@@ -4161,28 +4161,28 @@  discard block
 block discarded – undo
4161 4161
 		if ($year != '') {
4162 4162
 			if ($globalDBdriver == 'mysql') {
4163 4163
 				$query .= " AND YEAR(spotter_output.date) = :year";
4164
-				$query_values = array_merge($query_values,array(':year' => $year));
4164
+				$query_values = array_merge($query_values, array(':year' => $year));
4165 4165
 			} else {
4166 4166
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4167
-				$query_values = array_merge($query_values,array(':year' => $year));
4167
+				$query_values = array_merge($query_values, array(':year' => $year));
4168 4168
 			}
4169 4169
 		}
4170 4170
 		if ($month != '') {
4171 4171
 			if ($globalDBdriver == 'mysql') {
4172 4172
 				$query .= " AND MONTH(spotter_output.date) = :month";
4173
-				$query_values = array_merge($query_values,array(':month' => $month));
4173
+				$query_values = array_merge($query_values, array(':month' => $month));
4174 4174
 			} else {
4175 4175
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4176
-				$query_values = array_merge($query_values,array(':month' => $month));
4176
+				$query_values = array_merge($query_values, array(':month' => $month));
4177 4177
 			}
4178 4178
 		}
4179 4179
 		if ($day != '') {
4180 4180
 			if ($globalDBdriver == 'mysql') {
4181 4181
 				$query .= " AND DAY(spotter_output.date) = :day";
4182
-				$query_values = array_merge($query_values,array(':day' => $day));
4182
+				$query_values = array_merge($query_values, array(':day' => $day));
4183 4183
 			} else {
4184 4184
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4185
-				$query_values = array_merge($query_values,array(':day' => $day));
4185
+				$query_values = array_merge($query_values, array(':day' => $day));
4186 4186
 			}
4187 4187
 		}
4188 4188
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4192,7 +4192,7 @@  discard block
 block discarded – undo
4192 4192
 		$sth->execute($query_values);
4193 4193
 		$airline_array = array();
4194 4194
 		$temp_array = array();
4195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4196 4196
 		{
4197 4197
 			$temp_array['owner_name'] = $row['owner_name'];
4198 4198
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4207,11 +4207,11 @@  discard block
 block discarded – undo
4207 4207
 	* @return Array the pilots list
4208 4208
 	*
4209 4209
 	*/
4210
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4210
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4211 4211
 	{
4212 4212
 		global $globalDBdriver;
4213
-		$filter_query = $this->getFilter($filters,true,true);
4214
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4213
+		$filter_query = $this->getFilter($filters, true, true);
4214
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4215 4215
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4216 4216
                 if ($olderthanmonths > 0) {
4217 4217
             		if ($globalDBdriver == 'mysql') {
@@ -4237,7 +4237,7 @@  discard block
 block discarded – undo
4237 4237
 		$airline_array = array();
4238 4238
 		$temp_array = array();
4239 4239
         
4240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4241 4241
 		{
4242 4242
 			$temp_array['owner_name'] = $row['owner_name'];
4243 4243
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4253,11 +4253,11 @@  discard block
 block discarded – undo
4253 4253
 	* @return Array the airline list
4254 4254
 	*
4255 4255
 	*/
4256
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4256
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4257 4257
 	{
4258
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4259
-		$filter_query = $this->getFilter($filters,true,true);
4260
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4258
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4259
+		$filter_query = $this->getFilter($filters, true, true);
4260
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4261 4261
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4262 4262
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4263 4263
 			    ORDER BY airline_count DESC";
@@ -4269,7 +4269,7 @@  discard block
 block discarded – undo
4269 4269
 		$airline_array = array();
4270 4270
 		$temp_array = array();
4271 4271
         
4272
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4272
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4273 4273
 		{
4274 4274
 			$temp_array['airline_name'] = $row['airline_name'];
4275 4275
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4289,11 +4289,11 @@  discard block
 block discarded – undo
4289 4289
 	* @return Array the airline country list
4290 4290
 	*
4291 4291
 	*/
4292
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4292
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4293 4293
 	{
4294
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4295
-		$filter_query = $this->getFilter($filters,true,true);
4296
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4294
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4295
+		$filter_query = $this->getFilter($filters, true, true);
4296
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4297 4297
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4298 4298
                     GROUP BY spotter_output.airline_country
4299 4299
 					ORDER BY airline_country_count DESC
@@ -4306,7 +4306,7 @@  discard block
 block discarded – undo
4306 4306
 		$airline_country_array = array();
4307 4307
 		$temp_array = array();
4308 4308
         
4309
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4309
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4310 4310
 		{
4311 4311
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4312 4312
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4325,11 +4325,11 @@  discard block
 block discarded – undo
4325 4325
 	* @return Array the airline list
4326 4326
 	*
4327 4327
 	*/
4328
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4328
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4329 4329
 	{
4330
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4331
-		$filter_query = $this->getFilter($filters,true,true);
4332
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4330
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4331
+		$filter_query = $this->getFilter($filters, true, true);
4332
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4333 4333
 		    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 ) 
4334 4334
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4335 4335
 		    ORDER BY airline_count DESC";
@@ -4341,7 +4341,7 @@  discard block
 block discarded – undo
4341 4341
 		$airline_array = array();
4342 4342
 		$temp_array = array();
4343 4343
         
4344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4345 4345
 		{
4346 4346
 			$temp_array['airline_name'] = $row['airline_name'];
4347 4347
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4360,11 +4360,11 @@  discard block
 block discarded – undo
4360 4360
 	* @return Array the airline country list
4361 4361
 	*
4362 4362
 	*/
4363
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4363
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4364 4364
 	{
4365
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4366
-		$filter_query = $this->getFilter($filters,true,true);
4367
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4365
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4366
+		$filter_query = $this->getFilter($filters, true, true);
4367
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4368 4368
 		 			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 )
4369 4369
 					GROUP BY spotter_output.airline_country
4370 4370
 					ORDER BY airline_country_count DESC
@@ -4377,7 +4377,7 @@  discard block
 block discarded – undo
4377 4377
 		$airline_country_array = array();
4378 4378
 		$temp_array = array();
4379 4379
         
4380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4381 4381
 		{
4382 4382
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4383 4383
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4394,11 +4394,11 @@  discard block
 block discarded – undo
4394 4394
 	* @return Array the airline list
4395 4395
 	*
4396 4396
 	*/
4397
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4397
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4398 4398
 	{
4399
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4400
-		$filter_query = $this->getFilter($filters,true,true);
4401
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4399
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4400
+		$filter_query = $this->getFilter($filters, true, true);
4401
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4402 4402
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4403 4403
 					GROUP BY spotter_output.airline_name
4404 4404
 					ORDER BY airline_count DESC";
@@ -4409,7 +4409,7 @@  discard block
 block discarded – undo
4409 4409
 		$airline_array = array();
4410 4410
 		$temp_array = array();
4411 4411
         
4412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4413 4413
 		{
4414 4414
 			$temp_array['airline_name'] = $row['airline_name'];
4415 4415
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4429,11 +4429,11 @@  discard block
 block discarded – undo
4429 4429
 	* @return Array the airline country list
4430 4430
 	*
4431 4431
 	*/
4432
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4432
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4433 4433
 	{
4434
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4435
-		$filter_query = $this->getFilter($filters,true,true);
4436
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4434
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4435
+		$filter_query = $this->getFilter($filters, true, true);
4436
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4437 4437
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4438 4438
 					GROUP BY spotter_output.airline_country
4439 4439
 					ORDER BY airline_country_count DESC
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
 		$airline_country_array = array();
4447 4447
 		$temp_array = array();
4448 4448
         
4449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4450 4450
 		{
4451 4451
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4452 4452
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4462,11 +4462,11 @@  discard block
 block discarded – undo
4462 4462
 	* @return Array the airline list
4463 4463
 	*
4464 4464
 	*/
4465
-	public function countAllAirlinesByDate($date,$filters = array())
4465
+	public function countAllAirlinesByDate($date, $filters = array())
4466 4466
 	{
4467 4467
 		global $globalTimezone, $globalDBdriver;
4468
-		$filter_query = $this->getFilter($filters,true,true);
4469
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4468
+		$filter_query = $this->getFilter($filters, true, true);
4469
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4470 4470
 		if ($globalTimezone != '') {
4471 4471
 			date_default_timezone_set($globalTimezone);
4472 4472
 			$datetime = new DateTime($date);
@@ -4474,12 +4474,12 @@  discard block
 block discarded – undo
4474 4474
 		} else $offset = '+00:00';
4475 4475
 
4476 4476
 		if ($globalDBdriver == 'mysql') {
4477
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4477
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4478 4478
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4479 4479
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4480 4480
 					ORDER BY airline_count DESC";
4481 4481
 		} else {
4482
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4482
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4483 4483
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4484 4484
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4485 4485
 					ORDER BY airline_count DESC";
@@ -4490,7 +4490,7 @@  discard block
 block discarded – undo
4490 4490
 
4491 4491
 		$airline_array = array();
4492 4492
 		$temp_array = array();
4493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4494 4494
 		{
4495 4495
 			$temp_array['airline_name'] = $row['airline_name'];
4496 4496
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 	* @return Array the airline country list
4511 4511
 	*
4512 4512
 	*/
4513
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4513
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4514 4514
 	{
4515 4515
 		global $globalTimezone, $globalDBdriver;
4516
-		$filter_query = $this->getFilter($filters,true,true);
4517
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4516
+		$filter_query = $this->getFilter($filters, true, true);
4517
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4518 4518
 		if ($globalTimezone != '') {
4519 4519
 			date_default_timezone_set($globalTimezone);
4520 4520
 			$datetime = new DateTime($date);
@@ -4522,13 +4522,13 @@  discard block
 block discarded – undo
4522 4522
 		} else $offset = '+00:00';
4523 4523
 		
4524 4524
 		if ($globalDBdriver == 'mysql') {
4525
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4525
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4526 4526
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4527 4527
 					GROUP BY spotter_output.airline_country
4528 4528
 					ORDER BY airline_country_count DESC
4529 4529
 					LIMIT 10 OFFSET 0";
4530 4530
 		} else {
4531
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4531
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4532 4532
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4533 4533
 					GROUP BY spotter_output.airline_country
4534 4534
 					ORDER BY airline_country_count DESC
@@ -4540,7 +4540,7 @@  discard block
 block discarded – undo
4540 4540
  
4541 4541
 		$airline_country_array = array();
4542 4542
 		$temp_array = array();
4543
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4543
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4544 4544
 		{
4545 4545
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4546 4546
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4557,11 +4557,11 @@  discard block
 block discarded – undo
4557 4557
 	* @return Array the airline list
4558 4558
 	*
4559 4559
 	*/
4560
-	public function countAllAirlinesByIdent($ident,$filters = array())
4560
+	public function countAllAirlinesByIdent($ident, $filters = array())
4561 4561
 	{
4562
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4563
-		$filter_query = $this->getFilter($filters,true,true);
4564
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4562
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4563
+		$filter_query = $this->getFilter($filters, true, true);
4564
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4565 4565
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4566 4566
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4567 4567
 				ORDER BY airline_count DESC";
@@ -4578,11 +4578,11 @@  discard block
 block discarded – undo
4578 4578
 	* @return Array the airline list
4579 4579
 	*
4580 4580
 	*/
4581
-	public function countAllAirlinesByOwner($owner,$filters = array())
4581
+	public function countAllAirlinesByOwner($owner, $filters = array())
4582 4582
 	{
4583
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4584
-		$filter_query = $this->getFilter($filters,true,true);
4585
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4583
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4584
+		$filter_query = $this->getFilter($filters, true, true);
4585
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4586 4586
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4587 4587
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4588 4588
 				ORDER BY airline_count DESC";
@@ -4599,11 +4599,11 @@  discard block
 block discarded – undo
4599 4599
 	* @return Array the airline list
4600 4600
 	*
4601 4601
 	*/
4602
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4602
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4603 4603
 	{
4604
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4605
-		$filter_query = $this->getFilter($filters,true,true);
4606
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4604
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4605
+		$filter_query = $this->getFilter($filters, true, true);
4606
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4607 4607
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4608 4608
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4609 4609
 				ORDER BY airline_count DESC";
@@ -4620,25 +4620,25 @@  discard block
 block discarded – undo
4620 4620
 	* @return Array the airline list
4621 4621
 	*
4622 4622
 	*/
4623
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4623
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4624 4624
 	{
4625
-		$filter_query = $this->getFilter($filters,true,true);
4626
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4627
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4625
+		$filter_query = $this->getFilter($filters, true, true);
4626
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4627
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4628 4628
 
4629
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4629
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4630 4630
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4631 4631
 					GROUP BY spotter_output.airline_name
4632 4632
 					ORDER BY airline_count DESC";
4633 4633
       
4634 4634
 		
4635 4635
 		$sth = $this->db->prepare($query);
4636
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4636
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4637 4637
       
4638 4638
 		$airline_array = array();
4639 4639
 		$temp_array = array();
4640 4640
         
4641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4642 4642
 		{
4643 4643
 			$temp_array['airline_name'] = $row['airline_name'];
4644 4644
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4656,13 +4656,13 @@  discard block
 block discarded – undo
4656 4656
 	* @return Array the airline country list
4657 4657
 	*
4658 4658
 	*/
4659
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4659
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4660 4660
 	{
4661
-		$filter_query = $this->getFilter($filters,true,true);
4662
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4663
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4661
+		$filter_query = $this->getFilter($filters, true, true);
4662
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4663
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4664 4664
       
4665
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4665
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4666 4666
 		 		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) 
4667 4667
 				GROUP BY spotter_output.airline_country
4668 4668
 				ORDER BY airline_country_count DESC
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
       
4671 4671
 		
4672 4672
 		$sth = $this->db->prepare($query);
4673
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4673
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4674 4674
       
4675 4675
 		$airline_country_array = array();
4676 4676
 		$temp_array = array();
4677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4678 4678
 		{
4679 4679
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4680 4680
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4692,11 +4692,11 @@  discard block
 block discarded – undo
4692 4692
 	* @return Array the airline list
4693 4693
 	*
4694 4694
 	*/
4695
-	public function countAllAirlinesByCountry($country,$filters = array())
4695
+	public function countAllAirlinesByCountry($country, $filters = array())
4696 4696
 	{
4697
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4698
-		$filter_query = $this->getFilter($filters,true,true);
4699
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4697
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4698
+		$filter_query = $this->getFilter($filters, true, true);
4699
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4700 4700
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4701 4701
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4702 4702
 			    ORDER BY airline_count DESC";
@@ -4707,7 +4707,7 @@  discard block
 block discarded – undo
4707 4707
 
4708 4708
 		$airline_array = array();
4709 4709
 		$temp_array = array();
4710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4711 4711
 		{
4712 4712
 			$temp_array['airline_name'] = $row['airline_name'];
4713 4713
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	* @return Array the airline country list
4727 4727
 	*
4728 4728
 	*/
4729
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4729
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4730 4730
 	{
4731
-		$filter_query = $this->getFilter($filters,true,true);
4732
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4733
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4731
+		$filter_query = $this->getFilter($filters, true, true);
4732
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4733
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4734 4734
 		 		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 
4735 4735
 				GROUP BY spotter_output.airline_country
4736 4736
 				ORDER BY airline_country_count DESC
@@ -4742,7 +4742,7 @@  discard block
 block discarded – undo
4742 4742
 
4743 4743
 		$airline_country_array = array();
4744 4744
 		$temp_array = array();
4745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4746 4746
 		{
4747 4747
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4748 4748
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4762,35 +4762,35 @@  discard block
 block discarded – undo
4762 4762
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4763 4763
 	{
4764 4764
 		global $globalDBdriver;
4765
-		$filter_query = $this->getFilter($filters,true,true);
4766
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4765
+		$filter_query = $this->getFilter($filters, true, true);
4766
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4767 4767
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4768 4768
 		$query_values = array();
4769 4769
 		if ($year != '') {
4770 4770
 			if ($globalDBdriver == 'mysql') {
4771 4771
 				$query .= " AND YEAR(spotter_output.date) = :year";
4772
-				$query_values = array_merge($query_values,array(':year' => $year));
4772
+				$query_values = array_merge($query_values, array(':year' => $year));
4773 4773
 			} else {
4774 4774
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4775
-				$query_values = array_merge($query_values,array(':year' => $year));
4775
+				$query_values = array_merge($query_values, array(':year' => $year));
4776 4776
 			}
4777 4777
 		}
4778 4778
 		if ($month != '') {
4779 4779
 			if ($globalDBdriver == 'mysql') {
4780 4780
 				$query .= " AND MONTH(spotter_output.date) = :month";
4781
-				$query_values = array_merge($query_values,array(':month' => $month));
4781
+				$query_values = array_merge($query_values, array(':month' => $month));
4782 4782
 			} else {
4783 4783
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4784
-				$query_values = array_merge($query_values,array(':month' => $month));
4784
+				$query_values = array_merge($query_values, array(':month' => $month));
4785 4785
 			}
4786 4786
 		}
4787 4787
 		if ($day != '') {
4788 4788
 			if ($globalDBdriver == 'mysql') {
4789 4789
 				$query .= " AND DAY(spotter_output.date) = :day";
4790
-				$query_values = array_merge($query_values,array(':day' => $day));
4790
+				$query_values = array_merge($query_values, array(':day' => $day));
4791 4791
 			} else {
4792 4792
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4793
-				$query_values = array_merge($query_values,array(':day' => $day));
4793
+				$query_values = array_merge($query_values, array(':day' => $day));
4794 4794
 			}
4795 4795
 		}
4796 4796
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4802,7 +4802,7 @@  discard block
 block discarded – undo
4802 4802
 
4803 4803
 		$airline_array = array();
4804 4804
 		$temp_array = array();
4805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4806 4806
 		{
4807 4807
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4808 4808
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4818,11 +4818,11 @@  discard block
 block discarded – undo
4818 4818
 	* @return Array the airline country list
4819 4819
 	*
4820 4820
 	*/
4821
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4821
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4822 4822
 	{
4823 4823
 		global $globalDBdriver;
4824 4824
 		//$filter_query = $this->getFilter($filters,true,true);
4825
-		$Connection= new Connection($this->db);
4825
+		$Connection = new Connection($this->db);
4826 4826
 		if (!$Connection->tableExists('countries')) return array();
4827 4827
 		/*
4828 4828
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4837,7 +4837,7 @@  discard block
 block discarded – undo
4837 4837
 */
4838 4838
 		require_once('class.SpotterLive.php');
4839 4839
 		$SpotterLive = new SpotterLive();
4840
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4840
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4841 4841
 		$filter_query .= ' over_country IS NOT NULL';
4842 4842
                 if ($olderthanmonths > 0) {
4843 4843
 			if ($globalDBdriver == 'mysql') {
@@ -4864,7 +4864,7 @@  discard block
 block discarded – undo
4864 4864
 		$flight_array = array();
4865 4865
 		$temp_array = array();
4866 4866
         
4867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4868 4868
 		{
4869 4869
 			$temp_array['flight_count'] = $row['nb'];
4870 4870
 			$temp_array['flight_country'] = $row['name'];
@@ -4882,11 +4882,11 @@  discard block
 block discarded – undo
4882 4882
 	* @return Array the aircraft list
4883 4883
 	*
4884 4884
 	*/
4885
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4885
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4886 4886
 	{
4887 4887
 		global $globalDBdriver;
4888
-		$filter_query = $this->getFilter($filters,true,true);
4889
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4888
+		$filter_query = $this->getFilter($filters, true, true);
4889
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4890 4890
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4891 4891
 		if ($olderthanmonths > 0) {
4892 4892
 			if ($globalDBdriver == 'mysql') {
@@ -4906,28 +4906,28 @@  discard block
 block discarded – undo
4906 4906
 		if ($year != '') {
4907 4907
 			if ($globalDBdriver == 'mysql') {
4908 4908
 				$query .= " AND YEAR(spotter_output.date) = :year";
4909
-				$query_values = array_merge($query_values,array(':year' => $year));
4909
+				$query_values = array_merge($query_values, array(':year' => $year));
4910 4910
 			} else {
4911 4911
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4912
-				$query_values = array_merge($query_values,array(':year' => $year));
4912
+				$query_values = array_merge($query_values, array(':year' => $year));
4913 4913
 			}
4914 4914
 		}
4915 4915
 		if ($month != '') {
4916 4916
 			if ($globalDBdriver == 'mysql') {
4917 4917
 				$query .= " AND MONTH(spotter_output.date) = :month";
4918
-				$query_values = array_merge($query_values,array(':month' => $month));
4918
+				$query_values = array_merge($query_values, array(':month' => $month));
4919 4919
 			} else {
4920 4920
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4921
-				$query_values = array_merge($query_values,array(':month' => $month));
4921
+				$query_values = array_merge($query_values, array(':month' => $month));
4922 4922
 			}
4923 4923
 		}
4924 4924
 		if ($day != '') {
4925 4925
 			if ($globalDBdriver == 'mysql') {
4926 4926
 				$query .= " AND DAY(spotter_output.date) = :day";
4927
-				$query_values = array_merge($query_values,array(':day' => $day));
4927
+				$query_values = array_merge($query_values, array(':day' => $day));
4928 4928
 			} else {
4929 4929
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4930
-				$query_values = array_merge($query_values,array(':day' => $day));
4930
+				$query_values = array_merge($query_values, array(':day' => $day));
4931 4931
 			}
4932 4932
 		}
4933 4933
 
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
 
4940 4940
 		$aircraft_array = array();
4941 4941
 		$temp_array = array();
4942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4943 4943
 		{
4944 4944
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4945 4945
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4956,11 +4956,11 @@  discard block
 block discarded – undo
4956 4956
 	* @return Array the aircraft list
4957 4957
 	*
4958 4958
 	*/
4959
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4959
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
4962
-		$filter_query = $this->getFilter($filters,true,true);
4963
-		$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 
4962
+		$filter_query = $this->getFilter($filters, true, true);
4963
+		$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 4964
 		    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' ";
4965 4965
 		if ($olderthanmonths > 0) {
4966 4966
 			if ($globalDBdriver == 'mysql') {
@@ -4980,28 +4980,28 @@  discard block
 block discarded – undo
4980 4980
 		if ($year != '') {
4981 4981
 			if ($globalDBdriver == 'mysql') {
4982 4982
 				$query .= " AND YEAR(spotter_output.date) = :year";
4983
-				$query_values = array_merge($query_values,array(':year' => $year));
4983
+				$query_values = array_merge($query_values, array(':year' => $year));
4984 4984
 			} else {
4985 4985
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4986
-				$query_values = array_merge($query_values,array(':year' => $year));
4986
+				$query_values = array_merge($query_values, array(':year' => $year));
4987 4987
 			}
4988 4988
 		}
4989 4989
 		if ($month != '') {
4990 4990
 			if ($globalDBdriver == 'mysql') {
4991 4991
 				$query .= " AND MONTH(spotter_output.date) = :month";
4992
-				$query_values = array_merge($query_values,array(':month' => $month));
4992
+				$query_values = array_merge($query_values, array(':month' => $month));
4993 4993
 			} else {
4994 4994
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4995
-				$query_values = array_merge($query_values,array(':month' => $month));
4995
+				$query_values = array_merge($query_values, array(':month' => $month));
4996 4996
 			}
4997 4997
 		}
4998 4998
 		if ($day != '') {
4999 4999
 			if ($globalDBdriver == 'mysql') {
5000 5000
 				$query .= " AND DAY(spotter_output.date) = :day";
5001
-				$query_values = array_merge($query_values,array(':day' => $day));
5001
+				$query_values = array_merge($query_values, array(':day' => $day));
5002 5002
 			} else {
5003 5003
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5004
-				$query_values = array_merge($query_values,array(':day' => $day));
5004
+				$query_values = array_merge($query_values, array(':day' => $day));
5005 5005
 			}
5006 5006
 		}
5007 5007
 
@@ -5013,7 +5013,7 @@  discard block
 block discarded – undo
5013 5013
 
5014 5014
 		$aircraft_array = array();
5015 5015
 		$temp_array = array();
5016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5017 5017
 		{
5018 5018
 			$temp_array['airline_icao'] = $row['airline_icao'];
5019 5019
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5031,11 +5031,11 @@  discard block
 block discarded – undo
5031 5031
 	* @return Array the aircraft list
5032 5032
 	*
5033 5033
 	*/
5034
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5034
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5035 5035
 	{
5036 5036
 		global $globalDBdriver;
5037
-		$filter_query = $this->getFilter($filters,true,true);
5038
-		$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 
5037
+		$filter_query = $this->getFilter($filters, true, true);
5038
+		$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 5039
 		    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' ";
5040 5040
 		if ($olderthanmonths > 0) {
5041 5041
 			if ($globalDBdriver == 'mysql') {
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
 
5061 5061
 		$aircraft_array = array();
5062 5062
 		$temp_array = array();
5063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5064 5064
 		{
5065 5065
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5066 5066
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5079,13 +5079,13 @@  discard block
 block discarded – undo
5079 5079
 	* @return Array the aircraft list
5080 5080
 	*
5081 5081
 	*/
5082
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5082
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5083 5083
 	{
5084 5084
 		$Image = new Image($this->db);
5085
-		$filter_query = $this->getFilter($filters,true,true);
5086
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5085
+		$filter_query = $this->getFilter($filters, true, true);
5086
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5087 5087
 
5088
-		$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  
5088
+		$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  
5089 5089
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5090 5090
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5091 5091
 				ORDER BY registration_count DESC";
@@ -5096,14 +5096,14 @@  discard block
 block discarded – undo
5096 5096
 		$aircraft_array = array();
5097 5097
 		$temp_array = array();
5098 5098
         
5099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5100 5100
 		{
5101 5101
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5102 5102
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5103 5103
 			$temp_array['registration'] = $row['registration'];
5104 5104
 			$temp_array['airline_name'] = $row['airline_name'];
5105 5105
 			$temp_array['image_thumbnail'] = "";
5106
-			if($row['registration'] != "")
5106
+			if ($row['registration'] != "")
5107 5107
 			{
5108 5108
 				$image_array = $Image->getSpotterImage($row['registration']);
5109 5109
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5122,11 +5122,11 @@  discard block
 block discarded – undo
5122 5122
 	* @return Array the aircraft list
5123 5123
 	*
5124 5124
 	*/
5125
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5125
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5126 5126
 	{
5127
-		$filter_query = $this->getFilter($filters,true,true);
5128
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5129
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5127
+		$filter_query = $this->getFilter($filters, true, true);
5128
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5129
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5130 5130
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5131 5131
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5132 5132
 			    ORDER BY aircraft_icao_count DESC";
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
 		$aircraft_array = array();
5138 5138
 		$temp_array = array();
5139 5139
 
5140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5141 5141
 		{
5142 5142
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5143 5143
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5155,13 +5155,13 @@  discard block
 block discarded – undo
5155 5155
 	* @return Array the aircraft list
5156 5156
 	*
5157 5157
 	*/
5158
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5158
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5159 5159
 	{
5160
-		$filter_query = $this->getFilter($filters,true,true);
5160
+		$filter_query = $this->getFilter($filters, true, true);
5161 5161
 		$Image = new Image($this->db);
5162
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5162
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5163 5163
 
5164
-		$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 
5164
+		$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 
5165 5165
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5166 5166
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5167 5167
 			    ORDER BY registration_count DESC";
@@ -5171,14 +5171,14 @@  discard block
 block discarded – undo
5171 5171
 
5172 5172
 		$aircraft_array = array();
5173 5173
 		$temp_array = array();
5174
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5174
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5175 5175
 		{
5176 5176
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5177 5177
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5178 5178
 			$temp_array['registration'] = $row['registration'];
5179 5179
 			$temp_array['airline_name'] = $row['airline_name'];
5180 5180
 			$temp_array['image_thumbnail'] = "";
5181
-			if($row['registration'] != "")
5181
+			if ($row['registration'] != "")
5182 5182
 			{
5183 5183
 				$image_array = $Image->getSpotterImage($row['registration']);
5184 5184
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5197,11 +5197,11 @@  discard block
 block discarded – undo
5197 5197
 	* @return Array the aircraft list
5198 5198
 	*
5199 5199
 	*/
5200
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5200
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5201 5201
 	{
5202
-		$filter_query = $this->getFilter($filters,true,true);
5203
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5204
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5202
+		$filter_query = $this->getFilter($filters, true, true);
5203
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5204
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5205 5205
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5206 5206
 				GROUP BY spotter_output.aircraft_manufacturer 
5207 5207
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5212,7 +5212,7 @@  discard block
 block discarded – undo
5212 5212
 		$aircraft_array = array();
5213 5213
 		$temp_array = array();
5214 5214
 
5215
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5215
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5216 5216
 		{
5217 5217
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5218 5218
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5229,12 +5229,12 @@  discard block
 block discarded – undo
5229 5229
 	* @return Array the aircraft list
5230 5230
 	*
5231 5231
 	*/
5232
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5232
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5233 5233
 	{
5234
-		$filter_query = $this->getFilter($filters,true,true);
5235
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5234
+		$filter_query = $this->getFilter($filters, true, true);
5235
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5236 5236
 
5237
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5237
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5238 5238
 				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) 
5239 5239
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5240 5240
 				ORDER BY aircraft_icao_count DESC";
@@ -5244,7 +5244,7 @@  discard block
 block discarded – undo
5244 5244
 
5245 5245
 		$aircraft_array = array();
5246 5246
 		$temp_array = array();
5247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5248 5248
 		{
5249 5249
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5250 5250
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5262,13 +5262,13 @@  discard block
 block discarded – undo
5262 5262
 	* @return Array the aircraft list
5263 5263
 	*
5264 5264
 	*/
5265
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5265
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5266 5266
 	{
5267
-		$filter_query = $this->getFilter($filters,true,true);
5267
+		$filter_query = $this->getFilter($filters, true, true);
5268 5268
 		$Image = new Image($this->db);
5269
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5269
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5270 5270
 
5271
-		$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  
5271
+		$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  
5272 5272
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5273 5273
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5274 5274
 		    ORDER BY registration_count DESC";
@@ -5278,14 +5278,14 @@  discard block
 block discarded – undo
5278 5278
 
5279 5279
 		$aircraft_array = array();
5280 5280
 		$temp_array = array();
5281
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5281
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5282 5282
 		{
5283 5283
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5284 5284
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5285 5285
 			$temp_array['registration'] = $row['registration'];
5286 5286
 			$temp_array['airline_name'] = $row['airline_name'];
5287 5287
 			$temp_array['image_thumbnail'] = "";
5288
-			if($row['registration'] != "")
5288
+			if ($row['registration'] != "")
5289 5289
 			{
5290 5290
 				$image_array = $Image->getSpotterImage($row['registration']);
5291 5291
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5303,11 +5303,11 @@  discard block
 block discarded – undo
5303 5303
 	* @return Array the aircraft list
5304 5304
 	*
5305 5305
 	*/
5306
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5306
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5307 5307
 	{
5308
-		$filter_query = $this->getFilter($filters,true,true);
5309
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5310
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5308
+		$filter_query = $this->getFilter($filters, true, true);
5309
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5310
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5311 5311
                     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)  
5312 5312
                     GROUP BY spotter_output.aircraft_manufacturer 
5313 5313
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5318,7 +5318,7 @@  discard block
 block discarded – undo
5318 5318
 
5319 5319
 		$aircraft_array = array();
5320 5320
 		$temp_array = array();
5321
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5321
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5322 5322
 		{
5323 5323
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5324 5324
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5333,12 +5333,12 @@  discard block
 block discarded – undo
5333 5333
 	* @return Array the aircraft list
5334 5334
 	*
5335 5335
 	*/
5336
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5336
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5337 5337
 	{
5338
-		$filter_query = $this->getFilter($filters,true,true);
5339
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5338
+		$filter_query = $this->getFilter($filters, true, true);
5339
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5340 5340
 
5341
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5341
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5342 5342
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5343 5343
                     GROUP BY spotter_output.aircraft_name 
5344 5344
 					ORDER BY aircraft_icao_count DESC";
@@ -5347,7 +5347,7 @@  discard block
 block discarded – undo
5347 5347
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5348 5348
 		$aircraft_array = array();
5349 5349
 		$temp_array = array();
5350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5351 5351
 		{
5352 5352
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5353 5353
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5366,11 +5366,11 @@  discard block
 block discarded – undo
5366 5366
 	*/
5367 5367
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5368 5368
 	{
5369
-		$filter_query = $this->getFilter($filters,true,true);
5369
+		$filter_query = $this->getFilter($filters, true, true);
5370 5370
 		$Image = new Image($this->db);
5371
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5371
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5372 5372
 
5373
-		$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   
5373
+		$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   
5374 5374
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5375 5375
                     GROUP BY spotter_output.registration 
5376 5376
 					ORDER BY registration_count DESC";
@@ -5380,14 +5380,14 @@  discard block
 block discarded – undo
5380 5380
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5381 5381
 		$aircraft_array = array();
5382 5382
 		$temp_array = array();
5383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5384 5384
 		{
5385 5385
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5386 5386
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5387 5387
 			$temp_array['registration'] = $row['registration'];
5388 5388
 			$temp_array['airline_name'] = $row['airline_name'];
5389 5389
 			$temp_array['image_thumbnail'] = "";
5390
-			if($row['registration'] != "")
5390
+			if ($row['registration'] != "")
5391 5391
 			{
5392 5392
 				$image_array = $Image->getSpotterImage($row['registration']);
5393 5393
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5404,11 +5404,11 @@  discard block
 block discarded – undo
5404 5404
 	* @return Array the aircraft list
5405 5405
 	*
5406 5406
 	*/
5407
-	public function countAllAircraftTypesByDate($date,$filters = array())
5407
+	public function countAllAircraftTypesByDate($date, $filters = array())
5408 5408
 	{
5409 5409
 		global $globalTimezone, $globalDBdriver;
5410
-		$filter_query = $this->getFilter($filters,true,true);
5411
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5410
+		$filter_query = $this->getFilter($filters, true, true);
5411
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5412 5412
 		if ($globalTimezone != '') {
5413 5413
 			date_default_timezone_set($globalTimezone);
5414 5414
 			$datetime = new DateTime($date);
@@ -5416,12 +5416,12 @@  discard block
 block discarded – undo
5416 5416
 		} else $offset = '+00:00';
5417 5417
 
5418 5418
 		if ($globalDBdriver == 'mysql') {
5419
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5419
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5420 5420
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5421 5421
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5422 5422
 					ORDER BY aircraft_icao_count DESC";
5423 5423
 		} else {
5424
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5424
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5425 5425
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5426 5426
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5427 5427
 					ORDER BY aircraft_icao_count DESC";
@@ -5432,7 +5432,7 @@  discard block
 block discarded – undo
5432 5432
 
5433 5433
 		$aircraft_array = array();
5434 5434
 		$temp_array = array();
5435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5436 5436
 		{
5437 5437
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5438 5438
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5450,12 +5450,12 @@  discard block
 block discarded – undo
5450 5450
 	* @return Array the aircraft list
5451 5451
 	*
5452 5452
 	*/
5453
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5453
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5454 5454
 	{
5455 5455
 		global $globalTimezone, $globalDBdriver;
5456
-		$filter_query = $this->getFilter($filters,true,true);
5456
+		$filter_query = $this->getFilter($filters, true, true);
5457 5457
 		$Image = new Image($this->db);
5458
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5458
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5459 5459
 		if ($globalTimezone != '') {
5460 5460
 			date_default_timezone_set($globalTimezone);
5461 5461
 			$datetime = new DateTime($date);
@@ -5463,12 +5463,12 @@  discard block
 block discarded – undo
5463 5463
 		} else $offset = '+00:00';
5464 5464
 
5465 5465
 		if ($globalDBdriver == 'mysql') {
5466
-			$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 
5466
+			$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 
5467 5467
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5468 5468
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5469 5469
 					ORDER BY registration_count DESC";
5470 5470
 		} else {
5471
-			$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    
5471
+			$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    
5472 5472
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5473 5473
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5474 5474
 					ORDER BY registration_count DESC";
@@ -5479,14 +5479,14 @@  discard block
 block discarded – undo
5479 5479
 
5480 5480
 		$aircraft_array = array();
5481 5481
 		$temp_array = array();
5482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5483 5483
 		{
5484 5484
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5485 5485
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5486 5486
 			$temp_array['registration'] = $row['registration'];
5487 5487
 			$temp_array['airline_name'] = $row['airline_name'];
5488 5488
 			$temp_array['image_thumbnail'] = "";
5489
-			if($row['registration'] != "")
5489
+			if ($row['registration'] != "")
5490 5490
 			{
5491 5491
 				$image_array = $Image->getSpotterImage($row['registration']);
5492 5492
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5505,11 +5505,11 @@  discard block
 block discarded – undo
5505 5505
 	* @return Array the aircraft manufacturer list
5506 5506
 	*
5507 5507
 	*/
5508
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5508
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5509 5509
 	{
5510 5510
 		global $globalTimezone, $globalDBdriver;
5511
-		$filter_query = $this->getFilter($filters,true,true);
5512
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5511
+		$filter_query = $this->getFilter($filters, true, true);
5512
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5513 5513
 		if ($globalTimezone != '') {
5514 5514
 			date_default_timezone_set($globalTimezone);
5515 5515
 			$datetime = new DateTime($date);
@@ -5517,12 +5517,12 @@  discard block
 block discarded – undo
5517 5517
 		} else $offset = '+00:00';
5518 5518
 
5519 5519
 		if ($globalDBdriver == 'mysql') {
5520
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5520
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5521 5521
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5522 5522
 				GROUP BY spotter_output.aircraft_manufacturer 
5523 5523
 				ORDER BY aircraft_manufacturer_count DESC";
5524 5524
 		} else {
5525
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5525
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5526 5526
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5527 5527
 				GROUP BY spotter_output.aircraft_manufacturer 
5528 5528
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5534,7 +5534,7 @@  discard block
 block discarded – undo
5534 5534
 		$aircraft_array = array();
5535 5535
 		$temp_array = array();
5536 5536
 
5537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5538 5538
 		{
5539 5539
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5540 5540
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5551,11 +5551,11 @@  discard block
 block discarded – undo
5551 5551
 	* @return Array the aircraft list
5552 5552
 	*
5553 5553
 	*/
5554
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5554
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5555 5555
 	{
5556
-		$filter_query = $this->getFilter($filters,true,true);
5557
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5558
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5556
+		$filter_query = $this->getFilter($filters, true, true);
5557
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5558
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5559 5559
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5560 5560
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5561 5561
 				ORDER BY aircraft_icao_count DESC";
@@ -5566,7 +5566,7 @@  discard block
 block discarded – undo
5566 5566
 		$aircraft_array = array();
5567 5567
 		$temp_array = array();
5568 5568
 
5569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5570 5570
 		{
5571 5571
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5572 5572
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5583,11 +5583,11 @@  discard block
 block discarded – undo
5583 5583
 	* @return Array the aircraft list
5584 5584
 	*
5585 5585
 	*/
5586
-	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5586
+	public function countAllAircraftTypesByPilot($pilot, $filters = array())
5587 5587
 	{
5588
-		$filter_query = $this->getFilter($filters,true,true);
5589
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5590
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5588
+		$filter_query = $this->getFilter($filters, true, true);
5589
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5590
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5591 5591
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot) 
5592 5592
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5593 5593
 				ORDER BY aircraft_icao_count DESC";
@@ -5603,11 +5603,11 @@  discard block
 block discarded – undo
5603 5603
 	* @return Array the aircraft list
5604 5604
 	*
5605 5605
 	*/
5606
-	public function countAllAircraftTypesByOwner($owner,$filters = array())
5606
+	public function countAllAircraftTypesByOwner($owner, $filters = array())
5607 5607
 	{
5608
-		$filter_query = $this->getFilter($filters,true,true);
5609
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5610
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5608
+		$filter_query = $this->getFilter($filters, true, true);
5609
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5610
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5611 5611
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
5612 5612
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5613 5613
 				ORDER BY aircraft_icao_count DESC";
@@ -5624,13 +5624,13 @@  discard block
 block discarded – undo
5624 5624
 	* @return Array the aircraft list
5625 5625
 	*
5626 5626
 	*/
5627
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5627
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5628 5628
 	{
5629
-		$filter_query = $this->getFilter($filters,true,true);
5629
+		$filter_query = $this->getFilter($filters, true, true);
5630 5630
 		$Image = new Image($this->db);
5631
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5631
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5632 5632
 
5633
-		$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  
5633
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5634 5634
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5635 5635
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5636 5636
 		    ORDER BY registration_count DESC";
@@ -5642,14 +5642,14 @@  discard block
 block discarded – undo
5642 5642
 		$aircraft_array = array();
5643 5643
 		$temp_array = array();
5644 5644
         
5645
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5645
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5646 5646
 		{
5647 5647
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5648 5648
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5649 5649
 			$temp_array['registration'] = $row['registration'];
5650 5650
 			$temp_array['airline_name'] = $row['airline_name'];
5651 5651
 			$temp_array['image_thumbnail'] = "";
5652
-			if($row['registration'] != "")
5652
+			if ($row['registration'] != "")
5653 5653
 			{
5654 5654
 				$image_array = $Image->getSpotterImage($row['registration']);
5655 5655
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5667,13 +5667,13 @@  discard block
 block discarded – undo
5667 5667
 	* @return Array the aircraft list
5668 5668
 	*
5669 5669
 	*/
5670
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5670
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array())
5671 5671
 	{
5672
-		$filter_query = $this->getFilter($filters,true,true);
5672
+		$filter_query = $this->getFilter($filters, true, true);
5673 5673
 		$Image = new Image($this->db);
5674
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5674
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5675 5675
 
5676
-		$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  
5676
+		$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  
5677 5677
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner 
5678 5678
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5679 5679
 		    ORDER BY registration_count DESC";
@@ -5685,7 +5685,7 @@  discard block
 block discarded – undo
5685 5685
 		$aircraft_array = array();
5686 5686
 		$temp_array = array();
5687 5687
         
5688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5689 5689
 		{
5690 5690
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5691 5691
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5693,7 +5693,7 @@  discard block
 block discarded – undo
5693 5693
 			$temp_array['registration'] = $row['registration'];
5694 5694
 			$temp_array['airline_name'] = $row['airline_name'];
5695 5695
 			$temp_array['image_thumbnail'] = "";
5696
-			if($row['registration'] != "")
5696
+			if ($row['registration'] != "")
5697 5697
 			{
5698 5698
 				$image_array = $Image->getSpotterImage($row['registration']);
5699 5699
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5711,13 +5711,13 @@  discard block
 block discarded – undo
5711 5711
 	* @return Array the aircraft list
5712 5712
 	*
5713 5713
 	*/
5714
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5714
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array())
5715 5715
 	{
5716
-		$filter_query = $this->getFilter($filters,true,true);
5716
+		$filter_query = $this->getFilter($filters, true, true);
5717 5717
 		$Image = new Image($this->db);
5718
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5718
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5719 5719
 
5720
-		$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  
5720
+		$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  
5721 5721
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5722 5722
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5723 5723
 		    ORDER BY registration_count DESC";
@@ -5729,7 +5729,7 @@  discard block
 block discarded – undo
5729 5729
 		$aircraft_array = array();
5730 5730
 		$temp_array = array();
5731 5731
         
5732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5733 5733
 		{
5734 5734
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5735 5735
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5737,7 +5737,7 @@  discard block
 block discarded – undo
5737 5737
 			$temp_array['registration'] = $row['registration'];
5738 5738
 			$temp_array['airline_name'] = $row['airline_name'];
5739 5739
 			$temp_array['image_thumbnail'] = "";
5740
-			if($row['registration'] != "")
5740
+			if ($row['registration'] != "")
5741 5741
 			{
5742 5742
 				$image_array = $Image->getSpotterImage($row['registration']);
5743 5743
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5756,11 +5756,11 @@  discard block
 block discarded – undo
5756 5756
 	* @return Array the aircraft manufacturer list
5757 5757
 	*
5758 5758
 	*/
5759
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5759
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5760 5760
 	{
5761
-		$filter_query = $this->getFilter($filters,true,true);
5762
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5763
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5761
+		$filter_query = $this->getFilter($filters, true, true);
5762
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5763
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5764 5764
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5765 5765
                     GROUP BY spotter_output.aircraft_manufacturer 
5766 5766
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5770,7 +5770,7 @@  discard block
 block discarded – undo
5770 5770
 		$sth->execute(array(':ident' => $ident));
5771 5771
 		$aircraft_array = array();
5772 5772
 		$temp_array = array();
5773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5774 5774
 		{
5775 5775
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5776 5776
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5785,11 +5785,11 @@  discard block
 block discarded – undo
5785 5785
 	* @return Array the aircraft manufacturer list
5786 5786
 	*
5787 5787
 	*/
5788
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5788
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array())
5789 5789
 	{
5790
-		$filter_query = $this->getFilter($filters,true,true);
5791
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5792
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5790
+		$filter_query = $this->getFilter($filters, true, true);
5791
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5792
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5793 5793
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner 
5794 5794
 		    GROUP BY spotter_output.aircraft_manufacturer 
5795 5795
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5806,11 +5806,11 @@  discard block
 block discarded – undo
5806 5806
 	* @return Array the aircraft manufacturer list
5807 5807
 	*
5808 5808
 	*/
5809
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5809
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array())
5810 5810
 	{
5811
-		$filter_query = $this->getFilter($filters,true,true);
5812
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5813
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5811
+		$filter_query = $this->getFilter($filters, true, true);
5812
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5813
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5814 5814
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5815 5815
 		    GROUP BY spotter_output.aircraft_manufacturer 
5816 5816
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5828,24 +5828,24 @@  discard block
 block discarded – undo
5828 5828
 	* @return Array the aircraft list
5829 5829
 	*
5830 5830
 	*/
5831
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5831
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5832 5832
 	{
5833
-		$filter_query = $this->getFilter($filters,true,true);
5834
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5835
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5833
+		$filter_query = $this->getFilter($filters, true, true);
5834
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5835
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5836 5836
 		
5837 5837
 
5838
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5838
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5839 5839
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5840 5840
                     GROUP BY spotter_output.aircraft_name 
5841 5841
 					ORDER BY aircraft_icao_count DESC";
5842 5842
  
5843 5843
 		
5844 5844
 		$sth = $this->db->prepare($query);
5845
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5845
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5846 5846
 		$aircraft_array = array();
5847 5847
 		$temp_array = array();
5848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5849 5849
 		{
5850 5850
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5851 5851
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5861,33 +5861,33 @@  discard block
 block discarded – undo
5861 5861
 	* @return Array the aircraft list
5862 5862
 	*
5863 5863
 	*/
5864
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5864
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5865 5865
 	{
5866
-		$filter_query = $this->getFilter($filters,true,true);
5866
+		$filter_query = $this->getFilter($filters, true, true);
5867 5867
 		$Image = new Image($this->db);
5868
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5869
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5868
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5869
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5870 5870
 
5871
-		$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   
5871
+		$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   
5872 5872
                     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)   
5873 5873
                     GROUP BY spotter_output.registration 
5874 5874
 					ORDER BY registration_count DESC";
5875 5875
 
5876 5876
 		
5877 5877
 		$sth = $this->db->prepare($query);
5878
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5878
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5879 5879
       
5880 5880
 		$aircraft_array = array();
5881 5881
 		$temp_array = array();
5882 5882
         
5883
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5883
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5884 5884
 		{
5885 5885
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5886 5886
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5887 5887
 			$temp_array['registration'] = $row['registration'];
5888 5888
 			$temp_array['airline_name'] = $row['airline_name'];
5889 5889
 			$temp_array['image_thumbnail'] = "";
5890
-			if($row['registration'] != "")
5890
+			if ($row['registration'] != "")
5891 5891
 			{
5892 5892
 				$image_array = $Image->getSpotterImage($row['registration']);
5893 5893
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5907,25 +5907,25 @@  discard block
 block discarded – undo
5907 5907
 	* @return Array the aircraft manufacturer list
5908 5908
 	*
5909 5909
 	*/
5910
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5910
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5911 5911
 	{
5912
-		$filter_query = $this->getFilter($filters,true,true);
5913
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5914
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5912
+		$filter_query = $this->getFilter($filters, true, true);
5913
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5914
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5915 5915
 
5916
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5916
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5917 5917
                     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) 
5918 5918
                     GROUP BY spotter_output.aircraft_manufacturer 
5919 5919
 					ORDER BY aircraft_manufacturer_count DESC";
5920 5920
 
5921 5921
 		
5922 5922
 		$sth = $this->db->prepare($query);
5923
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5923
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5924 5924
       
5925 5925
 		$aircraft_array = array();
5926 5926
 		$temp_array = array();
5927 5927
         
5928
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5928
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5929 5929
 		{
5930 5930
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5931 5931
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5945,11 +5945,11 @@  discard block
 block discarded – undo
5945 5945
 	* @return Array the aircraft list
5946 5946
 	*
5947 5947
 	*/
5948
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5948
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5949 5949
 	{
5950
-		$filter_query = $this->getFilter($filters,true,true);
5951
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5952
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5950
+		$filter_query = $this->getFilter($filters, true, true);
5951
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5952
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5953 5953
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5954 5954
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5955 5955
 			    ORDER BY aircraft_icao_count DESC";
@@ -5961,7 +5961,7 @@  discard block
 block discarded – undo
5961 5961
 		$aircraft_array = array();
5962 5962
 		$temp_array = array();
5963 5963
         
5964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5965 5965
 		{
5966 5966
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5967 5967
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5980,12 +5980,12 @@  discard block
 block discarded – undo
5980 5980
 	* @return Array the aircraft list
5981 5981
 	*
5982 5982
 	*/
5983
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5983
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5984 5984
 	{
5985
-		$filter_query = $this->getFilter($filters,true,true);
5985
+		$filter_query = $this->getFilter($filters, true, true);
5986 5986
 		$Image = new Image($this->db);
5987
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5988
-		$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 
5987
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5988
+		$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 5989
 			    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)    
5990 5990
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5991 5991
 			    ORDER BY registration_count DESC";
@@ -5997,14 +5997,14 @@  discard block
 block discarded – undo
5997 5997
 		$aircraft_array = array();
5998 5998
 		$temp_array = array();
5999 5999
         
6000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6001 6001
 		{
6002 6002
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6003 6003
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6004 6004
 			$temp_array['registration'] = $row['registration'];
6005 6005
 			$temp_array['airline_name'] = $row['airline_name'];
6006 6006
 			$temp_array['image_thumbnail'] = "";
6007
-			if($row['registration'] != "")
6007
+			if ($row['registration'] != "")
6008 6008
 			{
6009 6009
 				$image_array = $Image->getSpotterImage($row['registration']);
6010 6010
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6024,11 +6024,11 @@  discard block
 block discarded – undo
6024 6024
 	* @return Array the aircraft manufacturer list
6025 6025
 	*
6026 6026
 	*/
6027
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6027
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6028 6028
 	{
6029
-		$filter_query = $this->getFilter($filters,true,true);
6030
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6031
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6029
+		$filter_query = $this->getFilter($filters, true, true);
6030
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6031
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6032 6032
                     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) 
6033 6033
                     GROUP BY spotter_output.aircraft_manufacturer 
6034 6034
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6040,7 +6040,7 @@  discard block
 block discarded – undo
6040 6040
 		$aircraft_array = array();
6041 6041
 		$temp_array = array();
6042 6042
         
6043
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6043
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6044 6044
 		{
6045 6045
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6046 6046
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6059,38 +6059,38 @@  discard block
 block discarded – undo
6059 6059
 	* @return Array the aircraft list
6060 6060
 	*
6061 6061
 	*/
6062
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6062
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6063 6063
 	{
6064 6064
 		global $globalDBdriver;
6065
-		$filter_query = $this->getFilter($filters,true,true);
6066
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6065
+		$filter_query = $this->getFilter($filters, true, true);
6066
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6067 6067
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6068 6068
                 $query_values = array();
6069 6069
 		if ($year != '') {
6070 6070
 			if ($globalDBdriver == 'mysql') {
6071 6071
 				$query .= " AND YEAR(spotter_output.date) = :year";
6072
-				$query_values = array_merge($query_values,array(':year' => $year));
6072
+				$query_values = array_merge($query_values, array(':year' => $year));
6073 6073
 			} else {
6074 6074
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6075
-				$query_values = array_merge($query_values,array(':year' => $year));
6075
+				$query_values = array_merge($query_values, array(':year' => $year));
6076 6076
 			}
6077 6077
 		}
6078 6078
 		if ($month != '') {
6079 6079
 			if ($globalDBdriver == 'mysql') {
6080 6080
 				$query .= " AND MONTH(spotter_output.date) = :month";
6081
-				$query_values = array_merge($query_values,array(':month' => $month));
6081
+				$query_values = array_merge($query_values, array(':month' => $month));
6082 6082
 			} else {
6083 6083
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6084
-				$query_values = array_merge($query_values,array(':month' => $month));
6084
+				$query_values = array_merge($query_values, array(':month' => $month));
6085 6085
 			}
6086 6086
 		}
6087 6087
 		if ($day != '') {
6088 6088
 			if ($globalDBdriver == 'mysql') {
6089 6089
 				$query .= " AND DAY(spotter_output.date) = :day";
6090
-				$query_values = array_merge($query_values,array(':day' => $day));
6090
+				$query_values = array_merge($query_values, array(':day' => $day));
6091 6091
 			} else {
6092 6092
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6093
-				$query_values = array_merge($query_values,array(':day' => $day));
6093
+				$query_values = array_merge($query_values, array(':day' => $day));
6094 6094
 			}
6095 6095
 		}
6096 6096
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6104,7 +6104,7 @@  discard block
 block discarded – undo
6104 6104
 		$manufacturer_array = array();
6105 6105
 		$temp_array = array();
6106 6106
         
6107
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6107
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6108 6108
 		{
6109 6109
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6110 6110
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6123,12 +6123,12 @@  discard block
 block discarded – undo
6123 6123
 	* @return Array the aircraft list
6124 6124
 	*
6125 6125
 	*/
6126
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6126
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6127 6127
 	{
6128 6128
 		global $globalDBdriver;
6129 6129
 		$Image = new Image($this->db);
6130
-		$filter_query = $this->getFilter($filters,true,true);
6131
-		$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    
6130
+		$filter_query = $this->getFilter($filters, true, true);
6131
+		$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 6132
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6133 6133
                 if ($olderthanmonths > 0) {
6134 6134
             		if ($globalDBdriver == 'mysql') {
@@ -6148,28 +6148,28 @@  discard block
 block discarded – undo
6148 6148
 		if ($year != '') {
6149 6149
 			if ($globalDBdriver == 'mysql') {
6150 6150
 				$query .= " AND YEAR(spotter_output.date) = :year";
6151
-				$query_values = array_merge($query_values,array(':year' => $year));
6151
+				$query_values = array_merge($query_values, array(':year' => $year));
6152 6152
 			} else {
6153 6153
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6154
-				$query_values = array_merge($query_values,array(':year' => $year));
6154
+				$query_values = array_merge($query_values, array(':year' => $year));
6155 6155
 			}
6156 6156
 		}
6157 6157
 		if ($month != '') {
6158 6158
 			if ($globalDBdriver == 'mysql') {
6159 6159
 				$query .= " AND MONTH(spotter_output.date) = :month";
6160
-				$query_values = array_merge($query_values,array(':month' => $month));
6160
+				$query_values = array_merge($query_values, array(':month' => $month));
6161 6161
 			} else {
6162 6162
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6163
-				$query_values = array_merge($query_values,array(':month' => $month));
6163
+				$query_values = array_merge($query_values, array(':month' => $month));
6164 6164
 			}
6165 6165
 		}
6166 6166
 		if ($day != '') {
6167 6167
 			if ($globalDBdriver == 'mysql') {
6168 6168
 				$query .= " AND DAY(spotter_output.date) = :day";
6169
-				$query_values = array_merge($query_values,array(':day' => $day));
6169
+				$query_values = array_merge($query_values, array(':day' => $day));
6170 6170
 			} else {
6171 6171
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6172
-				$query_values = array_merge($query_values,array(':day' => $day));
6172
+				$query_values = array_merge($query_values, array(':day' => $day));
6173 6173
 			}
6174 6174
 		}
6175 6175
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6181,7 +6181,7 @@  discard block
 block discarded – undo
6181 6181
 		$aircraft_array = array();
6182 6182
 		$temp_array = array();
6183 6183
         
6184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6185 6185
 		{
6186 6186
 			$temp_array['registration'] = $row['registration'];
6187 6187
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6189,7 +6189,7 @@  discard block
 block discarded – undo
6189 6189
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6190 6190
 			$temp_array['airline_name'] = $row['airline_name'];
6191 6191
 			$temp_array['image_thumbnail'] = "";
6192
-			if($row['registration'] != "")
6192
+			if ($row['registration'] != "")
6193 6193
 			{
6194 6194
 				$image_array = $Image->getSpotterImage($row['registration']);
6195 6195
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6208,12 +6208,12 @@  discard block
 block discarded – undo
6208 6208
 	* @return Array the aircraft list
6209 6209
 	*
6210 6210
 	*/
6211
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6211
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6212 6212
 	{
6213 6213
 		global $globalDBdriver;
6214
-		$filter_query = $this->getFilter($filters,true,true);
6214
+		$filter_query = $this->getFilter($filters, true, true);
6215 6215
 		$Image = new Image($this->db);
6216
-		$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    
6216
+		$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    
6217 6217
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6218 6218
                 if ($olderthanmonths > 0) {
6219 6219
             		if ($globalDBdriver == 'mysql') {
@@ -6241,7 +6241,7 @@  discard block
 block discarded – undo
6241 6241
 		$aircraft_array = array();
6242 6242
 		$temp_array = array();
6243 6243
         
6244
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6244
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6245 6245
 		{
6246 6246
 			$temp_array['registration'] = $row['registration'];
6247 6247
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6250,7 +6250,7 @@  discard block
 block discarded – undo
6250 6250
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6251 6251
 			$temp_array['airline_name'] = $row['airline_name'];
6252 6252
 			$temp_array['image_thumbnail'] = "";
6253
-			if($row['registration'] != "")
6253
+			if ($row['registration'] != "")
6254 6254
 			{
6255 6255
 				$image_array = $Image->getSpotterImage($row['registration']);
6256 6256
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	* @return Array the airport list
6270 6270
 	*
6271 6271
 	*/
6272
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6272
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6273 6273
 	{
6274 6274
 		global $globalDBdriver;
6275
-		$filter_query = $this->getFilter($filters,true,true);
6276
-		$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 
6275
+		$filter_query = $this->getFilter($filters, true, true);
6276
+		$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 6277
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6278 6278
                 if ($olderthanmonths > 0) {
6279 6279
             		if ($globalDBdriver == 'mysql') {
@@ -6293,28 +6293,28 @@  discard block
 block discarded – undo
6293 6293
 		if ($year != '') {
6294 6294
 			if ($globalDBdriver == 'mysql') {
6295 6295
 				$query .= " AND YEAR(spotter_output.date) = :year";
6296
-				$query_values = array_merge($query_values,array(':year' => $year));
6296
+				$query_values = array_merge($query_values, array(':year' => $year));
6297 6297
 			} else {
6298 6298
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6299
-				$query_values = array_merge($query_values,array(':year' => $year));
6299
+				$query_values = array_merge($query_values, array(':year' => $year));
6300 6300
 			}
6301 6301
 		}
6302 6302
 		if ($month != '') {
6303 6303
 			if ($globalDBdriver == 'mysql') {
6304 6304
 				$query .= " AND MONTH(spotter_output.date) = :month";
6305
-				$query_values = array_merge($query_values,array(':month' => $month));
6305
+				$query_values = array_merge($query_values, array(':month' => $month));
6306 6306
 			} else {
6307 6307
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6308
-				$query_values = array_merge($query_values,array(':month' => $month));
6308
+				$query_values = array_merge($query_values, array(':month' => $month));
6309 6309
 			}
6310 6310
 		}
6311 6311
 		if ($day != '') {
6312 6312
 			if ($globalDBdriver == 'mysql') {
6313 6313
 				$query .= " AND DAY(spotter_output.date) = :day";
6314
-				$query_values = array_merge($query_values,array(':day' => $day));
6314
+				$query_values = array_merge($query_values, array(':day' => $day));
6315 6315
 			} else {
6316 6316
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6317
-				$query_values = array_merge($query_values,array(':day' => $day));
6317
+				$query_values = array_merge($query_values, array(':day' => $day));
6318 6318
 			}
6319 6319
 		}
6320 6320
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6326,7 +6326,7 @@  discard block
 block discarded – undo
6326 6326
 
6327 6327
 		$airport_array = array();
6328 6328
 		$temp_array = array();
6329
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6329
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6330 6330
 		{
6331 6331
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6332 6332
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6345,11 +6345,11 @@  discard block
 block discarded – undo
6345 6345
 	* @return Array the airport list
6346 6346
 	*
6347 6347
 	*/
6348
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6348
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6349 6349
 	{
6350 6350
 		global $globalDBdriver;
6351
-		$filter_query = $this->getFilter($filters,true,true);
6352
-		$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 
6351
+		$filter_query = $this->getFilter($filters, true, true);
6352
+		$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 6353
 			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 <> '' ";
6354 6354
                 if ($olderthanmonths > 0) {
6355 6355
             		if ($globalDBdriver == 'mysql') {
@@ -6378,7 +6378,7 @@  discard block
 block discarded – undo
6378 6378
 		$airport_array = array();
6379 6379
 		$temp_array = array();
6380 6380
         
6381
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6381
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6382 6382
 		{
6383 6383
 			$temp_array['airline_icao'] = $row['airline_icao'];
6384 6384
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6398,11 +6398,11 @@  discard block
 block discarded – undo
6398 6398
 	* @return Array the airport list
6399 6399
 	*
6400 6400
 	*/
6401
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6401
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404
-		$filter_query = $this->getFilter($filters,true,true);
6405
-		$query  = "SELECT DISTINCT spotter_output.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
6404
+		$filter_query = $this->getFilter($filters, true, true);
6405
+		$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 6406
 				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";
6407 6407
                 if ($olderthanmonths > 0) {
6408 6408
             		if ($globalDBdriver == 'mysql') {
@@ -6422,28 +6422,28 @@  discard block
 block discarded – undo
6422 6422
 		if ($year != '') {
6423 6423
 			if ($globalDBdriver == 'mysql') {
6424 6424
 				$query .= " AND YEAR(spotter_output.date) = :year";
6425
-				$query_values = array_merge($query_values,array(':year' => $year));
6425
+				$query_values = array_merge($query_values, array(':year' => $year));
6426 6426
 			} else {
6427 6427
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6428
-				$query_values = array_merge($query_values,array(':year' => $year));
6428
+				$query_values = array_merge($query_values, array(':year' => $year));
6429 6429
 			}
6430 6430
 		}
6431 6431
 		if ($month != '') {
6432 6432
 			if ($globalDBdriver == 'mysql') {
6433 6433
 				$query .= " AND MONTH(spotter_output.date) = :month";
6434
-				$query_values = array_merge($query_values,array(':month' => $month));
6434
+				$query_values = array_merge($query_values, array(':month' => $month));
6435 6435
 			} else {
6436 6436
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6437
-				$query_values = array_merge($query_values,array(':month' => $month));
6437
+				$query_values = array_merge($query_values, array(':month' => $month));
6438 6438
 			}
6439 6439
 		}
6440 6440
 		if ($day != '') {
6441 6441
 			if ($globalDBdriver == 'mysql') {
6442 6442
 				$query .= " AND DAY(spotter_output.date) = :day";
6443
-				$query_values = array_merge($query_values,array(':day' => $day));
6443
+				$query_values = array_merge($query_values, array(':day' => $day));
6444 6444
 			} else {
6445 6445
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6446
-				$query_values = array_merge($query_values,array(':day' => $day));
6446
+				$query_values = array_merge($query_values, array(':day' => $day));
6447 6447
 			}
6448 6448
 		}
6449 6449
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6456,7 +6456,7 @@  discard block
 block discarded – undo
6456 6456
 		$airport_array = array();
6457 6457
 		$temp_array = array();
6458 6458
         
6459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6460 6460
 		{
6461 6461
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6462 6462
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6475,11 +6475,11 @@  discard block
 block discarded – undo
6475 6475
 	* @return Array the airport list
6476 6476
 	*
6477 6477
 	*/
6478
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6478
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6479 6479
 	{
6480 6480
 		global $globalDBdriver;
6481
-		$filter_query = $this->getFilter($filters,true,true);
6482
-		$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
6481
+		$filter_query = $this->getFilter($filters, true, true);
6482
+		$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 6483
 				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 ";
6484 6484
                 if ($olderthanmonths > 0) {
6485 6485
             		if ($globalDBdriver == 'mysql') {
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
 		$airport_array = array();
6509 6509
 		$temp_array = array();
6510 6510
         
6511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6512 6512
 		{
6513 6513
 			$temp_array['airline_icao'] = $row['airline_icao'];
6514 6514
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6528,11 +6528,11 @@  discard block
 block discarded – undo
6528 6528
 	* @return Array the airport list
6529 6529
 	*
6530 6530
 	*/
6531
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6531
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6532 6532
 	{
6533
-		$filter_query = $this->getFilter($filters,true,true);
6534
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6535
-		$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 
6533
+		$filter_query = $this->getFilter($filters, true, true);
6534
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6535
+		$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 
6536 6536
 			    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 <> '' 
6537 6537
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6538 6538
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6544,7 +6544,7 @@  discard block
 block discarded – undo
6544 6544
 		$airport_array = array();
6545 6545
 		$temp_array = array();
6546 6546
         
6547
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6547
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6548 6548
 		{
6549 6549
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6550 6550
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6566,11 +6566,11 @@  discard block
 block discarded – undo
6566 6566
 	* @return Array the airport list
6567 6567
 	*
6568 6568
 	*/
6569
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6569
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6570 6570
 	{
6571
-		$filter_query = $this->getFilter($filters,true,true);
6572
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6573
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6571
+		$filter_query = $this->getFilter($filters, true, true);
6572
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6573
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6574 6574
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6575 6575
                     GROUP BY spotter_output.departure_airport_country
6576 6576
 					ORDER BY airport_departure_country_count DESC";
@@ -6582,7 +6582,7 @@  discard block
 block discarded – undo
6582 6582
 		$airport_array = array();
6583 6583
 		$temp_array = array();
6584 6584
         
6585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6586 6586
 		{
6587 6587
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6588 6588
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6601,11 +6601,11 @@  discard block
 block discarded – undo
6601 6601
 	* @return Array the airport list
6602 6602
 	*
6603 6603
 	*/
6604
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6604
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6605 6605
 	{
6606
-		$filter_query = $this->getFilter($filters,true,true);
6607
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6608
-		$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 
6606
+		$filter_query = $this->getFilter($filters, true, true);
6607
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6608
+		$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 
6609 6609
 			    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 <> '' 
6610 6610
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6611 6611
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6617,7 +6617,7 @@  discard block
 block discarded – undo
6617 6617
 		$airport_array = array();
6618 6618
 		$temp_array = array();
6619 6619
         
6620
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6620
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6621 6621
 		{
6622 6622
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6623 6623
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6638,11 +6638,11 @@  discard block
 block discarded – undo
6638 6638
 	* @return Array the airport list
6639 6639
 	*
6640 6640
 	*/
6641
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6641
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6642 6642
 	{
6643
-		$filter_query = $this->getFilter($filters,true,true);
6644
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6645
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6643
+		$filter_query = $this->getFilter($filters, true, true);
6644
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6645
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6646 6646
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6647 6647
                     GROUP BY spotter_output.departure_airport_country
6648 6648
 					ORDER BY airport_departure_country_count DESC";
@@ -6654,7 +6654,7 @@  discard block
 block discarded – undo
6654 6654
 		$airport_array = array();
6655 6655
 		$temp_array = array();
6656 6656
         
6657
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6657
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6658 6658
 		{
6659 6659
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6660 6660
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6672,11 +6672,11 @@  discard block
 block discarded – undo
6672 6672
 	* @return Array the airport list
6673 6673
 	*
6674 6674
 	*/
6675
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6675
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6676 6676
 	{
6677
-		$filter_query = $this->getFilter($filters,true,true);
6678
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6679
-		$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 
6677
+		$filter_query = $this->getFilter($filters, true, true);
6678
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6679
+		$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 
6680 6680
 			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 <> '' 
6681 6681
                     GROUP BY spotter_output.departure_airport_icao
6682 6682
 					ORDER BY airport_departure_icao_count DESC";
@@ -6688,7 +6688,7 @@  discard block
 block discarded – undo
6688 6688
 		$airport_array = array();
6689 6689
 		$temp_array = array();
6690 6690
         
6691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6692 6692
 		{
6693 6693
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6694 6694
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6709,11 +6709,11 @@  discard block
 block discarded – undo
6709 6709
 	* @return Array the airport list
6710 6710
 	*
6711 6711
 	*/
6712
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6712
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6713 6713
 	{
6714
-		$filter_query = $this->getFilter($filters,true,true);
6715
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6716
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6714
+		$filter_query = $this->getFilter($filters, true, true);
6715
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6716
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6717 6717
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6718 6718
                     GROUP BY spotter_output.departure_airport_country
6719 6719
 					ORDER BY airport_departure_country_count DESC";
@@ -6725,7 +6725,7 @@  discard block
 block discarded – undo
6725 6725
 		$airport_array = array();
6726 6726
 		$temp_array = array();
6727 6727
         
6728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6729 6729
 		{
6730 6730
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6731 6731
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6743,11 +6743,11 @@  discard block
 block discarded – undo
6743 6743
 	* @return Array the airport list
6744 6744
 	*
6745 6745
 	*/
6746
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6746
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6747 6747
 	{
6748
-		$filter_query = $this->getFilter($filters,true,true);
6749
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6750
-		$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 
6748
+		$filter_query = $this->getFilter($filters, true, true);
6749
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6750
+		$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 
6751 6751
 			    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 <> '' 
6752 6752
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6753 6753
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6759,7 +6759,7 @@  discard block
 block discarded – undo
6759 6759
 		$airport_array = array();
6760 6760
 		$temp_array = array();
6761 6761
         
6762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6763 6763
 		{
6764 6764
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6765 6765
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6780,11 +6780,11 @@  discard block
 block discarded – undo
6780 6780
 	* @return Array the airport list
6781 6781
 	*
6782 6782
 	*/
6783
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6783
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6784 6784
 	{
6785
-		$filter_query = $this->getFilter($filters,true,true);
6786
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6787
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6785
+		$filter_query = $this->getFilter($filters, true, true);
6786
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6787
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6788 6788
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6789 6789
                     GROUP BY spotter_output.departure_airport_country
6790 6790
 					ORDER BY airport_departure_country_count DESC";
@@ -6796,7 +6796,7 @@  discard block
 block discarded – undo
6796 6796
 		$airport_array = array();
6797 6797
 		$temp_array = array();
6798 6798
         
6799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6800 6800
 		{
6801 6801
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6802 6802
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6815,11 +6815,11 @@  discard block
 block discarded – undo
6815 6815
 	* @return Array the airport list
6816 6816
 	*
6817 6817
 	*/
6818
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6818
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6819 6819
 	{
6820
-		$filter_query = $this->getFilter($filters,true,true);
6821
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6822
-		$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 
6820
+		$filter_query = $this->getFilter($filters, true, true);
6821
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6822
+		$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 
6823 6823
 			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 <> '' 
6824 6824
                     GROUP BY spotter_output.departure_airport_icao
6825 6825
 					ORDER BY airport_departure_icao_count DESC";
@@ -6831,7 +6831,7 @@  discard block
 block discarded – undo
6831 6831
 		$airport_array = array();
6832 6832
 		$temp_array = array();
6833 6833
         
6834
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6834
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6835 6835
 		{
6836 6836
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6837 6837
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6852,11 +6852,11 @@  discard block
 block discarded – undo
6852 6852
 	* @return Array the airport list
6853 6853
 	*
6854 6854
 	*/
6855
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6855
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6856 6856
 	{
6857
-		$filter_query = $this->getFilter($filters,true,true);
6858
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6859
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6857
+		$filter_query = $this->getFilter($filters, true, true);
6858
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6859
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6860 6860
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6861 6861
                     GROUP BY spotter_output.departure_airport_country
6862 6862
 					ORDER BY airport_departure_country_count DESC";
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
 		$airport_array = array();
6869 6869
 		$temp_array = array();
6870 6870
         
6871
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6871
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6872 6872
 		{
6873 6873
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6874 6874
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6886,11 +6886,11 @@  discard block
 block discarded – undo
6886 6886
 	* @return Array the airport list
6887 6887
 	*
6888 6888
 	*/
6889
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6889
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6890 6890
 	{
6891 6891
 		global $globalTimezone, $globalDBdriver;
6892
-		$filter_query = $this->getFilter($filters,true,true);
6893
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6892
+		$filter_query = $this->getFilter($filters, true, true);
6893
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6894 6894
 		if ($globalTimezone != '') {
6895 6895
 			date_default_timezone_set($globalTimezone);
6896 6896
 			$datetime = new DateTime($date);
@@ -6898,12 +6898,12 @@  discard block
 block discarded – undo
6898 6898
 		} else $offset = '+00:00';
6899 6899
 
6900 6900
 		if ($globalDBdriver == 'mysql') {
6901
-			$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 
6901
+			$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 
6902 6902
 					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
6903 6903
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6904 6904
 					ORDER BY airport_departure_icao_count DESC";
6905 6905
 		} else {
6906
-			$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 
6906
+			$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 
6907 6907
 					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
6908 6908
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6909 6909
 					ORDER BY airport_departure_icao_count DESC";
@@ -6915,7 +6915,7 @@  discard block
 block discarded – undo
6915 6915
 		$airport_array = array();
6916 6916
 		$temp_array = array();
6917 6917
         
6918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6919 6919
 		{
6920 6920
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6921 6921
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6936,11 +6936,11 @@  discard block
 block discarded – undo
6936 6936
 	* @return Array the airport list
6937 6937
 	*
6938 6938
 	*/
6939
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6939
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6940 6940
 	{
6941 6941
 		global $globalTimezone, $globalDBdriver;
6942
-		$filter_query = $this->getFilter($filters,true,true);
6943
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6942
+		$filter_query = $this->getFilter($filters, true, true);
6943
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6944 6944
 		if ($globalTimezone != '') {
6945 6945
 			date_default_timezone_set($globalTimezone);
6946 6946
 			$datetime = new DateTime($date);
@@ -6948,12 +6948,12 @@  discard block
 block discarded – undo
6948 6948
 		} else $offset = '+00:00';
6949 6949
 
6950 6950
 		if ($globalDBdriver == 'mysql') {
6951
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6951
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6952 6952
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6953 6953
 					GROUP BY spotter_output.departure_airport_country
6954 6954
 					ORDER BY airport_departure_country_count DESC";
6955 6955
 		} else {
6956
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6956
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6957 6957
 					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 
6958 6958
 					GROUP BY spotter_output.departure_airport_country
6959 6959
 					ORDER BY airport_departure_country_count DESC";
@@ -6965,7 +6965,7 @@  discard block
 block discarded – undo
6965 6965
 		$airport_array = array();
6966 6966
 		$temp_array = array();
6967 6967
         
6968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6969 6969
 		{
6970 6970
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6971 6971
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6983,11 +6983,11 @@  discard block
 block discarded – undo
6983 6983
 	* @return Array the airport list
6984 6984
 	*
6985 6985
 	*/
6986
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6986
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6987 6987
 	{
6988
-		$filter_query = $this->getFilter($filters,true,true);
6989
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6990
-		$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 
6988
+		$filter_query = $this->getFilter($filters, true, true);
6989
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6990
+		$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 
6991 6991
 		    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 
6992 6992
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6993 6993
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6999,7 +6999,7 @@  discard block
 block discarded – undo
6999 6999
 		$airport_array = array();
7000 7000
 		$temp_array = array();
7001 7001
         
7002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7003 7003
 		{
7004 7004
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7005 7005
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7019,11 +7019,11 @@  discard block
 block discarded – undo
7019 7019
 	* @return Array the airport list
7020 7020
 	*
7021 7021
 	*/
7022
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7022
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7023 7023
 	{
7024
-		$filter_query = $this->getFilter($filters,true,true);
7025
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7026
-		$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 
7024
+		$filter_query = $this->getFilter($filters, true, true);
7025
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7026
+		$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 
7027 7027
 		    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 
7028 7028
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7029 7029
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7035,7 +7035,7 @@  discard block
 block discarded – undo
7035 7035
 		$airport_array = array();
7036 7036
 		$temp_array = array();
7037 7037
         
7038
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7038
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7039 7039
 		{
7040 7040
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7041 7041
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7055,11 +7055,11 @@  discard block
 block discarded – undo
7055 7055
 	* @return Array the airport list
7056 7056
 	*
7057 7057
 	*/
7058
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7058
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7059 7059
 	{
7060
-		$filter_query = $this->getFilter($filters,true,true);
7061
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7062
-		$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 
7060
+		$filter_query = $this->getFilter($filters, true, true);
7061
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7062
+		$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 
7063 7063
 		    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) 
7064 7064
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7065 7065
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7070,7 +7070,7 @@  discard block
 block discarded – undo
7070 7070
 		$airport_array = array();
7071 7071
 		$temp_array = array();
7072 7072
         
7073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7074 7074
 		{
7075 7075
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7076 7076
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7092,11 +7092,11 @@  discard block
 block discarded – undo
7092 7092
 	* @return Array the airport list
7093 7093
 	*
7094 7094
 	*/
7095
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7095
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7096 7096
 	{
7097
-		$filter_query = $this->getFilter($filters,true,true);
7098
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7099
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7097
+		$filter_query = $this->getFilter($filters, true, true);
7098
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7099
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7100 7100
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7101 7101
                     GROUP BY spotter_output.departure_airport_country
7102 7102
 					ORDER BY airport_departure_country_count DESC";
@@ -7108,7 +7108,7 @@  discard block
 block discarded – undo
7108 7108
 		$airport_array = array();
7109 7109
 		$temp_array = array();
7110 7110
         
7111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7112 7112
 		{
7113 7113
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7114 7114
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7125,11 +7125,11 @@  discard block
 block discarded – undo
7125 7125
 	* @return Array the airport list
7126 7126
 	*
7127 7127
 	*/
7128
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7128
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7129 7129
 	{
7130
-		$filter_query = $this->getFilter($filters,true,true);
7131
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7132
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7130
+		$filter_query = $this->getFilter($filters, true, true);
7131
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7132
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7133 7133
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7134 7134
 			GROUP BY spotter_output.departure_airport_country
7135 7135
 			ORDER BY airport_departure_country_count DESC";
@@ -7145,11 +7145,11 @@  discard block
 block discarded – undo
7145 7145
 	* @return Array the airport list
7146 7146
 	*
7147 7147
 	*/
7148
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7148
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7149 7149
 	{
7150
-		$filter_query = $this->getFilter($filters,true,true);
7151
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7152
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7150
+		$filter_query = $this->getFilter($filters, true, true);
7151
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7152
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7153 7153
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7154 7154
 			GROUP BY spotter_output.departure_airport_country
7155 7155
 			ORDER BY airport_departure_country_count DESC";
@@ -7167,12 +7167,12 @@  discard block
 block discarded – undo
7167 7167
 	* @return Array the airport list
7168 7168
 	*
7169 7169
 	*/
7170
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7170
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7171 7171
 	{
7172
-		$filter_query = $this->getFilter($filters,true,true);
7173
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7172
+		$filter_query = $this->getFilter($filters, true, true);
7173
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7174 7174
 
7175
-		$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 
7175
+		$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 
7176 7176
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7177 7177
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7178 7178
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7184,7 +7184,7 @@  discard block
 block discarded – undo
7184 7184
 		$airport_array = array();
7185 7185
 		$temp_array = array();
7186 7186
         
7187
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7187
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7188 7188
 		{
7189 7189
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7190 7190
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7205,11 +7205,11 @@  discard block
 block discarded – undo
7205 7205
 	* @return Array the airport list
7206 7206
 	*
7207 7207
 	*/
7208
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7208
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7209 7209
 	{
7210
-		$filter_query = $this->getFilter($filters,true,true);
7211
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7212
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7210
+		$filter_query = $this->getFilter($filters, true, true);
7211
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7212
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7213 7213
 			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 
7214 7214
                     GROUP BY spotter_output.departure_airport_country
7215 7215
 					ORDER BY airport_departure_country_count DESC";
@@ -7221,7 +7221,7 @@  discard block
 block discarded – undo
7221 7221
 		$airport_array = array();
7222 7222
 		$temp_array = array();
7223 7223
         
7224
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7224
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7225 7225
 		{
7226 7226
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7227 7227
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7244,11 +7244,11 @@  discard block
 block discarded – undo
7244 7244
 	* @return Array the airport list
7245 7245
 	*
7246 7246
 	*/
7247
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7247
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7248 7248
 	{
7249 7249
 		global $globalDBdriver;
7250
-		$filter_query = $this->getFilter($filters,true,true);
7251
-		$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 
7250
+		$filter_query = $this->getFilter($filters, true, true);
7251
+		$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 7252
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7253 7253
                 if ($olderthanmonths > 0) {
7254 7254
             		if ($globalDBdriver == 'mysql') {
@@ -7268,28 +7268,28 @@  discard block
 block discarded – undo
7268 7268
 		if ($year != '') {
7269 7269
 			if ($globalDBdriver == 'mysql') {
7270 7270
 				$query .= " AND YEAR(spotter_output.date) = :year";
7271
-				$query_values = array_merge($query_values,array(':year' => $year));
7271
+				$query_values = array_merge($query_values, array(':year' => $year));
7272 7272
 			} else {
7273 7273
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7274
-				$query_values = array_merge($query_values,array(':year' => $year));
7274
+				$query_values = array_merge($query_values, array(':year' => $year));
7275 7275
 			}
7276 7276
 		}
7277 7277
 		if ($month != '') {
7278 7278
 			if ($globalDBdriver == 'mysql') {
7279 7279
 				$query .= " AND MONTH(spotter_output.date) = :month";
7280
-				$query_values = array_merge($query_values,array(':month' => $month));
7280
+				$query_values = array_merge($query_values, array(':month' => $month));
7281 7281
 			} else {
7282 7282
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7283
-				$query_values = array_merge($query_values,array(':month' => $month));
7283
+				$query_values = array_merge($query_values, array(':month' => $month));
7284 7284
 			}
7285 7285
 		}
7286 7286
 		if ($day != '') {
7287 7287
 			if ($globalDBdriver == 'mysql') {
7288 7288
 				$query .= " AND DAY(spotter_output.date) = :day";
7289
-				$query_values = array_merge($query_values,array(':day' => $day));
7289
+				$query_values = array_merge($query_values, array(':day' => $day));
7290 7290
 			} else {
7291 7291
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7292
-				$query_values = array_merge($query_values,array(':day' => $day));
7292
+				$query_values = array_merge($query_values, array(':day' => $day));
7293 7293
 			}
7294 7294
 		}
7295 7295
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7303,7 +7303,7 @@  discard block
 block discarded – undo
7303 7303
 		$airport_array = array();
7304 7304
 		$temp_array = array();
7305 7305
         
7306
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7306
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7307 7307
 		{
7308 7308
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7309 7309
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7326,11 +7326,11 @@  discard block
 block discarded – undo
7326 7326
 	* @return Array the airport list
7327 7327
 	*
7328 7328
 	*/
7329
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7329
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7330 7330
 	{
7331 7331
 		global $globalDBdriver;
7332
-		$filter_query = $this->getFilter($filters,true,true);
7333
-		$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 
7332
+		$filter_query = $this->getFilter($filters, true, true);
7333
+		$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 7334
 			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 <> '' ";
7335 7335
                 if ($olderthanmonths > 0) {
7336 7336
             		if ($globalDBdriver == 'mysql') {
@@ -7360,7 +7360,7 @@  discard block
 block discarded – undo
7360 7360
 		$airport_array = array();
7361 7361
 		$temp_array = array();
7362 7362
         
7363
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7363
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7364 7364
 		{
7365 7365
 			$temp_array['airline_icao'] = $row['airline_icao'];
7366 7366
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7385,11 +7385,11 @@  discard block
 block discarded – undo
7385 7385
 	* @return Array the airport list
7386 7386
 	*
7387 7387
 	*/
7388
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7388
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7389 7389
 	{
7390 7390
 		global $globalDBdriver;
7391
-		$filter_query = $this->getFilter($filters,true,true);
7392
-		$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 
7391
+		$filter_query = $this->getFilter($filters, true, true);
7392
+		$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 7393
 			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";
7394 7394
                 if ($olderthanmonths > 0) {
7395 7395
             		if ($globalDBdriver == 'mysql') {
@@ -7409,28 +7409,28 @@  discard block
 block discarded – undo
7409 7409
 		if ($year != '') {
7410 7410
 			if ($globalDBdriver == 'mysql') {
7411 7411
 				$query .= " AND YEAR(spotter_output.date) = :year";
7412
-				$query_values = array_merge($query_values,array(':year' => $year));
7412
+				$query_values = array_merge($query_values, array(':year' => $year));
7413 7413
 			} else {
7414 7414
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7415
-				$query_values = array_merge($query_values,array(':year' => $year));
7415
+				$query_values = array_merge($query_values, array(':year' => $year));
7416 7416
 			}
7417 7417
 		}
7418 7418
 		if ($month != '') {
7419 7419
 			if ($globalDBdriver == 'mysql') {
7420 7420
 				$query .= " AND MONTH(spotter_output.date) = :month";
7421
-				$query_values = array_merge($query_values,array(':month' => $month));
7421
+				$query_values = array_merge($query_values, array(':month' => $month));
7422 7422
 			} else {
7423 7423
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7424
-				$query_values = array_merge($query_values,array(':month' => $month));
7424
+				$query_values = array_merge($query_values, array(':month' => $month));
7425 7425
 			}
7426 7426
 		}
7427 7427
 		if ($day != '') {
7428 7428
 			if ($globalDBdriver == 'mysql') {
7429 7429
 				$query .= " AND DAY(spotter_output.date) = :day";
7430
-				$query_values = array_merge($query_values,array(':day' => $day));
7430
+				$query_values = array_merge($query_values, array(':day' => $day));
7431 7431
 			} else {
7432 7432
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7433
-				$query_values = array_merge($query_values,array(':day' => $day));
7433
+				$query_values = array_merge($query_values, array(':day' => $day));
7434 7434
 			}
7435 7435
 		}
7436 7436
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7443,7 +7443,7 @@  discard block
 block discarded – undo
7443 7443
       
7444 7444
 		$airport_array = array();
7445 7445
 		$temp_array = array();
7446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7447 7447
 		{
7448 7448
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7449 7449
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7466,11 +7466,11 @@  discard block
 block discarded – undo
7466 7466
 	* @return Array the airport list
7467 7467
 	*
7468 7468
 	*/
7469
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7469
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7470 7470
 	{
7471 7471
 		global $globalDBdriver;
7472
-		$filter_query = $this->getFilter($filters,true,true);
7473
-		$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 
7472
+		$filter_query = $this->getFilter($filters, true, true);
7473
+		$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 7474
 			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 ";
7475 7475
                 if ($olderthanmonths > 0) {
7476 7476
             		if ($globalDBdriver == 'mysql') {
@@ -7500,7 +7500,7 @@  discard block
 block discarded – undo
7500 7500
 		$airport_array = array();
7501 7501
 		$temp_array = array();
7502 7502
         
7503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7504 7504
 		{
7505 7505
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7506 7506
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7526,9 +7526,9 @@  discard block
 block discarded – undo
7526 7526
 	*/
7527 7527
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7528 7528
 	{
7529
-		$filter_query = $this->getFilter($filters,true,true);
7530
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7531
-		$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 
7529
+		$filter_query = $this->getFilter($filters, true, true);
7530
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7531
+		$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 
7532 7532
 			    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 
7533 7533
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7534 7534
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7539,7 +7539,7 @@  discard block
 block discarded – undo
7539 7539
 		$airport_array = array();
7540 7540
 		$temp_array = array();
7541 7541
         
7542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7543 7543
 		{
7544 7544
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7545 7545
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7560,12 +7560,12 @@  discard block
 block discarded – undo
7560 7560
 	* @return Array the airport list
7561 7561
 	*
7562 7562
 	*/
7563
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7563
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7564 7564
 	{
7565
-		$filter_query = $this->getFilter($filters,true,true);
7566
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7565
+		$filter_query = $this->getFilter($filters, true, true);
7566
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7567 7567
 					
7568
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7568
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7569 7569
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7570 7570
                     GROUP BY spotter_output.arrival_airport_country
7571 7571
 					ORDER BY airport_arrival_country_count DESC";
@@ -7577,7 +7577,7 @@  discard block
 block discarded – undo
7577 7577
 		$airport_array = array();
7578 7578
 		$temp_array = array();
7579 7579
         
7580
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7580
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7581 7581
 		{
7582 7582
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7583 7583
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7595,11 +7595,11 @@  discard block
 block discarded – undo
7595 7595
 	* @return Array the airport list
7596 7596
 	*
7597 7597
 	*/
7598
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7598
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7599 7599
 	{
7600
-		$filter_query = $this->getFilter($filters,true,true);
7601
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7602
-		$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 
7600
+		$filter_query = $this->getFilter($filters, true, true);
7601
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7602
+		$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 
7603 7603
 			    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 
7604 7604
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7605 7605
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7611,7 +7611,7 @@  discard block
 block discarded – undo
7611 7611
 		$airport_array = array();
7612 7612
 		$temp_array = array();
7613 7613
         
7614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7615 7615
 		{
7616 7616
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7617 7617
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7633,11 +7633,11 @@  discard block
 block discarded – undo
7633 7633
 	* @return Array the airport list
7634 7634
 	*
7635 7635
 	*/
7636
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7636
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7637 7637
 	{
7638
-		$filter_query = $this->getFilter($filters,true,true);
7639
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7640
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7638
+		$filter_query = $this->getFilter($filters, true, true);
7639
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7640
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7641 7641
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7642 7642
                     GROUP BY spotter_output.arrival_airport_country
7643 7643
 					ORDER BY airport_arrival_country_count DESC";
@@ -7649,7 +7649,7 @@  discard block
 block discarded – undo
7649 7649
 		$airport_array = array();
7650 7650
 		$temp_array = array();
7651 7651
         
7652
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7652
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7653 7653
 		{
7654 7654
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7655 7655
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7667,12 +7667,12 @@  discard block
 block discarded – undo
7667 7667
 	* @return Array the airport list
7668 7668
 	*
7669 7669
 	*/
7670
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7670
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
7671 7671
 	{
7672
-		$filter_query = $this->getFilter($filters,true,true);
7673
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7672
+		$filter_query = $this->getFilter($filters, true, true);
7673
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7674 7674
 
7675
-		$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 
7675
+		$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 
7676 7676
 			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 
7677 7677
                     GROUP BY spotter_output.arrival_airport_icao
7678 7678
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7684,7 +7684,7 @@  discard block
 block discarded – undo
7684 7684
 		$airport_array = array();
7685 7685
 		$temp_array = array();
7686 7686
         
7687
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7687
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7688 7688
 		{
7689 7689
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7690 7690
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7705,11 +7705,11 @@  discard block
 block discarded – undo
7705 7705
 	* @return Array the airport list
7706 7706
 	*
7707 7707
 	*/
7708
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7708
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
7709 7709
 	{
7710
-		$filter_query = $this->getFilter($filters,true,true);
7711
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7712
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7710
+		$filter_query = $this->getFilter($filters, true, true);
7711
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7712
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7713 7713
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
7714 7714
                     GROUP BY spotter_output.arrival_airport_country
7715 7715
 					ORDER BY airport_arrival_country_count DESC";
@@ -7721,7 +7721,7 @@  discard block
 block discarded – undo
7721 7721
 		$airport_array = array();
7722 7722
 		$temp_array = array();
7723 7723
         
7724
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7724
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7725 7725
 		{
7726 7726
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7727 7727
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7740,11 +7740,11 @@  discard block
 block discarded – undo
7740 7740
 	* @return Array the airport list
7741 7741
 	*
7742 7742
 	*/
7743
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7743
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
7744 7744
 	{
7745
-		$filter_query = $this->getFilter($filters,true,true);
7746
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7747
-		$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 
7745
+		$filter_query = $this->getFilter($filters, true, true);
7746
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7747
+		$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 
7748 7748
 			    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 
7749 7749
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7750 7750
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7756,7 +7756,7 @@  discard block
 block discarded – undo
7756 7756
 		$airport_array = array();
7757 7757
 		$temp_array = array();
7758 7758
         
7759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7760 7760
 		{
7761 7761
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7762 7762
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7777,11 +7777,11 @@  discard block
 block discarded – undo
7777 7777
 	* @return Array the airport list
7778 7778
 	*
7779 7779
 	*/
7780
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7780
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7781 7781
 	{
7782
-		$filter_query = $this->getFilter($filters,true,true);
7783
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7784
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7782
+		$filter_query = $this->getFilter($filters, true, true);
7783
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7784
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7785 7785
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7786 7786
                     GROUP BY spotter_output.arrival_airport_country
7787 7787
 					ORDER BY airport_arrival_country_count DESC";
@@ -7793,7 +7793,7 @@  discard block
 block discarded – undo
7793 7793
 		$airport_array = array();
7794 7794
 		$temp_array = array();
7795 7795
         
7796
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7796
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7797 7797
 		{
7798 7798
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7799 7799
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7811,11 +7811,11 @@  discard block
 block discarded – undo
7811 7811
 	* @return Array the airport list
7812 7812
 	*
7813 7813
 	*/
7814
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7814
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7815 7815
 	{
7816
-		$filter_query = $this->getFilter($filters,true,true);
7817
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7818
-		$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 
7816
+		$filter_query = $this->getFilter($filters, true, true);
7817
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7818
+		$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 
7819 7819
 			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 
7820 7820
                     GROUP BY spotter_output.arrival_airport_icao
7821 7821
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7827,7 +7827,7 @@  discard block
 block discarded – undo
7827 7827
 		$airport_array = array();
7828 7828
 		$temp_array = array();
7829 7829
         
7830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7831 7831
 		{
7832 7832
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7833 7833
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7849,11 +7849,11 @@  discard block
 block discarded – undo
7849 7849
 	* @return Array the airport list
7850 7850
 	*
7851 7851
 	*/
7852
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7852
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7853 7853
 	{
7854
-		$filter_query = $this->getFilter($filters,true,true);
7855
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7856
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7854
+		$filter_query = $this->getFilter($filters, true, true);
7855
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7856
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7857 7857
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7858 7858
                     GROUP BY spotter_output.arrival_airport_country
7859 7859
 					ORDER BY airport_arrival_country_count DESC";
@@ -7865,7 +7865,7 @@  discard block
 block discarded – undo
7865 7865
 		$airport_array = array();
7866 7866
 		$temp_array = array();
7867 7867
         
7868
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7868
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7869 7869
 		{
7870 7870
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7871 7871
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7884,11 +7884,11 @@  discard block
 block discarded – undo
7884 7884
 	* @return Array the airport list
7885 7885
 	*
7886 7886
 	*/
7887
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7887
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
7890
-		$filter_query = $this->getFilter($filters,true,true);
7891
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7890
+		$filter_query = $this->getFilter($filters, true, true);
7891
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7892 7892
 		if ($globalTimezone != '') {
7893 7893
 			date_default_timezone_set($globalTimezone);
7894 7894
 			$datetime = new DateTime($date);
@@ -7896,12 +7896,12 @@  discard block
 block discarded – undo
7896 7896
 		} else $offset = '+00:00';
7897 7897
 
7898 7898
 		if ($globalDBdriver == 'mysql') {
7899
-			$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 
7899
+			$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 
7900 7900
 					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  
7901 7901
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7902 7902
 					ORDER BY airport_arrival_icao_count DESC";
7903 7903
 		} else {
7904
-			$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 
7904
+			$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 
7905 7905
 					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  
7906 7906
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7907 7907
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7913,7 +7913,7 @@  discard block
 block discarded – undo
7913 7913
 		$airport_array = array();
7914 7914
 		$temp_array = array();
7915 7915
         
7916
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7916
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7917 7917
 		{
7918 7918
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7919 7919
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7937,8 +7937,8 @@  discard block
 block discarded – undo
7937 7937
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7938 7938
 	{
7939 7939
 		global $globalTimezone, $globalDBdriver;
7940
-		$filter_query = $this->getFilter($filters,true,true);
7941
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7940
+		$filter_query = $this->getFilter($filters, true, true);
7941
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7942 7942
 		if ($globalTimezone != '') {
7943 7943
 			date_default_timezone_set($globalTimezone);
7944 7944
 			$datetime = new DateTime($date);
@@ -7946,12 +7946,12 @@  discard block
 block discarded – undo
7946 7946
 		} else $offset = '+00:00';
7947 7947
 
7948 7948
 		if ($globalDBdriver == 'mysql') {
7949
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7949
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7950 7950
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7951 7951
 					GROUP BY spotter_output.arrival_airport_country
7952 7952
 					ORDER BY airport_arrival_country_count DESC";
7953 7953
 		} else {
7954
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7954
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7955 7955
 					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 
7956 7956
 					GROUP BY spotter_output.arrival_airport_country
7957 7957
 					ORDER BY airport_arrival_country_count DESC";
@@ -7963,7 +7963,7 @@  discard block
 block discarded – undo
7963 7963
 		$airport_array = array();
7964 7964
 		$temp_array = array();
7965 7965
         
7966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7967 7967
 		{
7968 7968
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7969 7969
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7981,11 +7981,11 @@  discard block
 block discarded – undo
7981 7981
 	* @return Array the airport list
7982 7982
 	*
7983 7983
 	*/
7984
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7984
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7985 7985
 	{
7986
-		$filter_query = $this->getFilter($filters,true,true);
7987
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7988
-		$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 
7986
+		$filter_query = $this->getFilter($filters, true, true);
7987
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7988
+		$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 
7989 7989
 		    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  
7990 7990
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7991 7991
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7997,7 +7997,7 @@  discard block
 block discarded – undo
7997 7997
 		$airport_array = array();
7998 7998
 		$temp_array = array();
7999 7999
         
8000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8001 8001
 		{
8002 8002
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8003 8003
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8017,11 +8017,11 @@  discard block
 block discarded – undo
8017 8017
 	* @return Array the airport list
8018 8018
 	*
8019 8019
 	*/
8020
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8020
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8021 8021
 	{
8022
-		$filter_query = $this->getFilter($filters,true,true);
8023
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8024
-		$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 
8022
+		$filter_query = $this->getFilter($filters, true, true);
8023
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8024
+		$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 
8025 8025
 		    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 
8026 8026
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8027 8027
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8032,7 +8032,7 @@  discard block
 block discarded – undo
8032 8032
 		$airport_array = array();
8033 8033
 		$temp_array = array();
8034 8034
         
8035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8036 8036
 		{
8037 8037
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8038 8038
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8052,11 +8052,11 @@  discard block
 block discarded – undo
8052 8052
 	* @return Array the airport list
8053 8053
 	*
8054 8054
 	*/
8055
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8055
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8056 8056
 	{
8057
-		$filter_query = $this->getFilter($filters,true,true);
8058
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8059
-		$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 
8057
+		$filter_query = $this->getFilter($filters, true, true);
8058
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8059
+		$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 
8060 8060
 		    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) 
8061 8061
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8062 8062
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8067,7 +8067,7 @@  discard block
 block discarded – undo
8067 8067
 		$airport_array = array();
8068 8068
 		$temp_array = array();
8069 8069
         
8070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8071 8071
 		{
8072 8072
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8073 8073
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8089,9 +8089,9 @@  discard block
 block discarded – undo
8089 8089
 	*/
8090 8090
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8091 8091
 	{
8092
-		$filter_query = $this->getFilter($filters,true,true);
8093
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8094
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8092
+		$filter_query = $this->getFilter($filters, true, true);
8093
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8094
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8095 8095
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8096 8096
                     GROUP BY spotter_output.arrival_airport_country
8097 8097
 					ORDER BY airport_arrival_country_count DESC";
@@ -8103,7 +8103,7 @@  discard block
 block discarded – undo
8103 8103
 		$airport_array = array();
8104 8104
 		$temp_array = array();
8105 8105
         
8106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8107 8107
 		{
8108 8108
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8109 8109
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8122,9 +8122,9 @@  discard block
 block discarded – undo
8122 8122
 	*/
8123 8123
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8124 8124
 	{
8125
-		$filter_query = $this->getFilter($filters,true,true);
8126
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8127
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8125
+		$filter_query = $this->getFilter($filters, true, true);
8126
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8127
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8128 8128
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8129 8129
                     GROUP BY spotter_output.arrival_airport_country
8130 8130
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8142,9 +8142,9 @@  discard block
 block discarded – undo
8142 8142
 	*/
8143 8143
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8144 8144
 	{
8145
-		$filter_query = $this->getFilter($filters,true,true);
8146
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8147
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8145
+		$filter_query = $this->getFilter($filters, true, true);
8146
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8147
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8148 8148
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8149 8149
                     GROUP BY spotter_output.arrival_airport_country
8150 8150
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8162,11 +8162,11 @@  discard block
 block discarded – undo
8162 8162
 	* @return Array the airport list
8163 8163
 	*
8164 8164
 	*/
8165
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8165
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8166 8166
 	{
8167
-		$filter_query = $this->getFilter($filters,true,true);
8168
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8169
-		$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 
8167
+		$filter_query = $this->getFilter($filters, true, true);
8168
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8169
+		$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 
8170 8170
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8171 8171
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8172 8172
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8178,7 +8178,7 @@  discard block
 block discarded – undo
8178 8178
 		$airport_array = array();
8179 8179
 		$temp_array = array();
8180 8180
         
8181
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8181
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8182 8182
 		{
8183 8183
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8184 8184
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8199,12 +8199,12 @@  discard block
 block discarded – undo
8199 8199
 	* @return Array the airport list
8200 8200
 	*
8201 8201
 	*/
8202
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8202
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8203 8203
 	{
8204 8204
 		global $globalDBdriver;
8205
-		$filter_query = $this->getFilter($filters,true,true);
8206
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8207
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8205
+		$filter_query = $this->getFilter($filters, true, true);
8206
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8207
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8208 8208
 			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 
8209 8209
                     GROUP BY spotter_output.arrival_airport_country
8210 8210
 					ORDER BY airport_arrival_country_count DESC";
@@ -8216,7 +8216,7 @@  discard block
 block discarded – undo
8216 8216
 		$airport_array = array();
8217 8217
 		$temp_array = array();
8218 8218
         
8219
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8219
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8220 8220
 		{
8221 8221
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8222 8222
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8235,38 +8235,38 @@  discard block
 block discarded – undo
8235 8235
 	* @return Array the airport departure list
8236 8236
 	*
8237 8237
 	*/
8238
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8238
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8239 8239
 	{
8240 8240
 		global $globalDBdriver;
8241
-		$filter_query = $this->getFilter($filters,true,true);
8242
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8241
+		$filter_query = $this->getFilter($filters, true, true);
8242
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8243 8243
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8244 8244
 		$query_values = array();
8245 8245
 		if ($year != '') {
8246 8246
 			if ($globalDBdriver == 'mysql') {
8247 8247
 				$query .= " AND YEAR(spotter_output.date) = :year";
8248
-				$query_values = array_merge($query_values,array(':year' => $year));
8248
+				$query_values = array_merge($query_values, array(':year' => $year));
8249 8249
 			} else {
8250 8250
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8251
-				$query_values = array_merge($query_values,array(':year' => $year));
8251
+				$query_values = array_merge($query_values, array(':year' => $year));
8252 8252
 			}
8253 8253
 		}
8254 8254
 		if ($month != '') {
8255 8255
 			if ($globalDBdriver == 'mysql') {
8256 8256
 				$query .= " AND MONTH(spotter_output.date) = :month";
8257
-				$query_values = array_merge($query_values,array(':month' => $month));
8257
+				$query_values = array_merge($query_values, array(':month' => $month));
8258 8258
 			} else {
8259 8259
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8260
-				$query_values = array_merge($query_values,array(':month' => $month));
8260
+				$query_values = array_merge($query_values, array(':month' => $month));
8261 8261
 			}
8262 8262
 		}
8263 8263
 		if ($day != '') {
8264 8264
 			if ($globalDBdriver == 'mysql') {
8265 8265
 				$query .= " AND DAY(spotter_output.date) = :day";
8266
-				$query_values = array_merge($query_values,array(':day' => $day));
8266
+				$query_values = array_merge($query_values, array(':day' => $day));
8267 8267
 			} else {
8268 8268
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8269
-				$query_values = array_merge($query_values,array(':day' => $day));
8269
+				$query_values = array_merge($query_values, array(':day' => $day));
8270 8270
 			}
8271 8271
 		}
8272 8272
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8280,7 +8280,7 @@  discard block
 block discarded – undo
8280 8280
 		$airport_array = array();
8281 8281
 		$temp_array = array();
8282 8282
         
8283
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8283
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8284 8284
 		{
8285 8285
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8286 8286
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8298,38 +8298,38 @@  discard block
 block discarded – undo
8298 8298
 	* @return Array the airport arrival list
8299 8299
 	*
8300 8300
 	*/
8301
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8301
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8302 8302
 	{
8303 8303
 		global $globalDBdriver;
8304
-		$filter_query = $this->getFilter($filters,true,true);
8305
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8304
+		$filter_query = $this->getFilter($filters, true, true);
8305
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8306 8306
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8307 8307
 		$query_values = array();
8308 8308
 		if ($year != '') {
8309 8309
 			if ($globalDBdriver == 'mysql') {
8310 8310
 				$query .= " AND YEAR(spotter_output.date) = :year";
8311
-				$query_values = array_merge($query_values,array(':year' => $year));
8311
+				$query_values = array_merge($query_values, array(':year' => $year));
8312 8312
 			} else {
8313 8313
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8314
-				$query_values = array_merge($query_values,array(':year' => $year));
8314
+				$query_values = array_merge($query_values, array(':year' => $year));
8315 8315
 			}
8316 8316
 		}
8317 8317
 		if ($month != '') {
8318 8318
 			if ($globalDBdriver == 'mysql') {
8319 8319
 				$query .= " AND MONTH(spotter_output.date) = :month";
8320
-				$query_values = array_merge($query_values,array(':month' => $month));
8320
+				$query_values = array_merge($query_values, array(':month' => $month));
8321 8321
 			} else {
8322 8322
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8323
-				$query_values = array_merge($query_values,array(':month' => $month));
8323
+				$query_values = array_merge($query_values, array(':month' => $month));
8324 8324
 			}
8325 8325
 		}
8326 8326
 		if ($day != '') {
8327 8327
 			if ($globalDBdriver == 'mysql') {
8328 8328
 				$query .= " AND DAY(spotter_output.date) = :day";
8329
-				$query_values = array_merge($query_values,array(':day' => $day));
8329
+				$query_values = array_merge($query_values, array(':day' => $day));
8330 8330
 			} else {
8331 8331
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8332
-				$query_values = array_merge($query_values,array(':day' => $day));
8332
+				$query_values = array_merge($query_values, array(':day' => $day));
8333 8333
 			}
8334 8334
 		}
8335 8335
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8343,7 +8343,7 @@  discard block
 block discarded – undo
8343 8343
 		$airport_array = array();
8344 8344
 		$temp_array = array();
8345 8345
         
8346
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8346
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8347 8347
 		{
8348 8348
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8349 8349
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8366,8 +8366,8 @@  discard block
 block discarded – undo
8366 8366
 	*/
8367 8367
 	public function countAllRoutes($filters = array())
8368 8368
 	{
8369
-		$filter_query = $this->getFilter($filters,true,true);
8370
-		$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
8369
+		$filter_query = $this->getFilter($filters, true, true);
8370
+		$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 8371
 		    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 <> ''
8372 8372
                     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
8373 8373
                     ORDER BY route_count DESC
@@ -8380,7 +8380,7 @@  discard block
 block discarded – undo
8380 8380
 		$routes_array = array();
8381 8381
 		$temp_array = array();
8382 8382
         
8383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8384 8384
 		{
8385 8385
 			$temp_array['route_count'] = $row['route_count'];
8386 8386
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8407,11 +8407,11 @@  discard block
 block discarded – undo
8407 8407
 	* @return Array the route list
8408 8408
 	*
8409 8409
 	*/
8410
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8410
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8411 8411
 	{
8412
-		$filter_query = $this->getFilter($filters,true,true);
8413
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8414
-		$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
8412
+		$filter_query = $this->getFilter($filters, true, true);
8413
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8414
+		$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
8415 8415
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8416 8416
 			    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 
8417 8417
 			    ORDER BY route_count DESC";
@@ -8422,7 +8422,7 @@  discard block
 block discarded – undo
8422 8422
 		$routes_array = array();
8423 8423
 		$temp_array = array();
8424 8424
         
8425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8426 8426
 		{
8427 8427
 			$temp_array['route_count'] = $row['route_count'];
8428 8428
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8449,9 +8449,9 @@  discard block
 block discarded – undo
8449 8449
 	*/
8450 8450
 	public function countAllRoutesByRegistration($registration, $filters = array())
8451 8451
 	{
8452
-		$filter_query = $this->getFilter($filters,true,true);
8452
+		$filter_query = $this->getFilter($filters, true, true);
8453 8453
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8454
-		$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
8454
+		$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
8455 8455
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8456 8456
                     GROUP BY route
8457 8457
                     ORDER BY route_count DESC";
@@ -8463,7 +8463,7 @@  discard block
 block discarded – undo
8463 8463
 		$routes_array = array();
8464 8464
 		$temp_array = array();
8465 8465
         
8466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8467 8467
 		{
8468 8468
 			$temp_array['route_count'] = $row['route_count'];
8469 8469
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8491,9 +8491,9 @@  discard block
 block discarded – undo
8491 8491
 	*/
8492 8492
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8493 8493
 	{
8494
-		$filter_query = $this->getFilter($filters,true,true);
8495
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8496
-		$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
8494
+		$filter_query = $this->getFilter($filters, true, true);
8495
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8496
+		$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
8497 8497
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8498 8498
 			    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 
8499 8499
 			    ORDER BY route_count DESC";
@@ -8505,7 +8505,7 @@  discard block
 block discarded – undo
8505 8505
 		$routes_array = array();
8506 8506
 		$temp_array = array();
8507 8507
         
8508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8509 8509
 		{
8510 8510
 			$temp_array['route_count'] = $row['route_count'];
8511 8511
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8533,9 +8533,9 @@  discard block
 block discarded – undo
8533 8533
 	*/
8534 8534
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8535 8535
 	{
8536
-		$filter_query = $this->getFilter($filters,true,true);
8537
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8538
-		$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
8536
+		$filter_query = $this->getFilter($filters, true, true);
8537
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8538
+		$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
8539 8539
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8540 8540
 			    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 
8541 8541
 			    ORDER BY route_count DESC";
@@ -8546,7 +8546,7 @@  discard block
 block discarded – undo
8546 8546
 		$routes_array = array();
8547 8547
 		$temp_array = array();
8548 8548
         
8549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8550 8550
 		{
8551 8551
 			$temp_array['route_count'] = $row['route_count'];
8552 8552
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8574,9 +8574,9 @@  discard block
 block discarded – undo
8574 8574
 	*/
8575 8575
 	public function countAllRoutesByCountry($country, $filters = array())
8576 8576
 	{
8577
-		$filter_query = $this->getFilter($filters,true,true);
8578
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8579
-		$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
8577
+		$filter_query = $this->getFilter($filters, true, true);
8578
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8579
+		$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
8580 8580
 			    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 
8581 8581
 			    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 
8582 8582
 			    ORDER BY route_count DESC";
@@ -8587,7 +8587,7 @@  discard block
 block discarded – undo
8587 8587
 		$routes_array = array();
8588 8588
 		$temp_array = array();
8589 8589
         
8590
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8590
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8591 8591
 		{
8592 8592
 			$temp_array['route_count'] = $row['route_count'];
8593 8593
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8615,8 +8615,8 @@  discard block
 block discarded – undo
8615 8615
 	public function countAllRoutesByDate($date, $filters = array())
8616 8616
 	{
8617 8617
 		global $globalTimezone, $globalDBdriver;
8618
-		$filter_query = $this->getFilter($filters,true,true);
8619
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8618
+		$filter_query = $this->getFilter($filters, true, true);
8619
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8620 8620
 		if ($globalTimezone != '') {
8621 8621
 			date_default_timezone_set($globalTimezone);
8622 8622
 			$datetime = new DateTime($date);
@@ -8624,12 +8624,12 @@  discard block
 block discarded – undo
8624 8624
 		} else $offset = '+00:00';
8625 8625
 		
8626 8626
 		if ($globalDBdriver == 'mysql') {
8627
-			$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
8627
+			$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
8628 8628
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8629 8629
 				    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
8630 8630
 				    ORDER BY route_count DESC";
8631 8631
 		} else {
8632
-			$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
8632
+			$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
8633 8633
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8634 8634
 				    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
8635 8635
 				    ORDER BY route_count DESC";
@@ -8641,7 +8641,7 @@  discard block
 block discarded – undo
8641 8641
 		$routes_array = array();
8642 8642
 		$temp_array = array();
8643 8643
         
8644
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8644
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8645 8645
 		{
8646 8646
 			$temp_array['route_count'] = $row['route_count'];
8647 8647
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8668,9 +8668,9 @@  discard block
 block discarded – undo
8668 8668
 	*/
8669 8669
 	public function countAllRoutesByIdent($ident, $filters = array())
8670 8670
 	{
8671
-		$filter_query = $this->getFilter($filters,true,true);
8672
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8673
-		$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
8671
+		$filter_query = $this->getFilter($filters, true, true);
8672
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8673
+		$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
8674 8674
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
8675 8675
                     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
8676 8676
                     ORDER BY route_count DESC";
@@ -8682,7 +8682,7 @@  discard block
 block discarded – undo
8682 8682
 		$routes_array = array();
8683 8683
 		$temp_array = array();
8684 8684
         
8685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8686 8686
 		{
8687 8687
 			$temp_array['route_count'] = $row['route_count'];
8688 8688
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8706,11 +8706,11 @@  discard block
 block discarded – undo
8706 8706
 	* @return Array the route list
8707 8707
 	*
8708 8708
 	*/
8709
-	public function countAllRoutesByOwner($owner,$filters = array())
8709
+	public function countAllRoutesByOwner($owner, $filters = array())
8710 8710
 	{
8711
-		$filter_query = $this->getFilter($filters,true,true);
8712
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8713
-		$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
8711
+		$filter_query = $this->getFilter($filters, true, true);
8712
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8713
+		$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
8714 8714
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
8715 8715
                     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
8716 8716
                     ORDER BY route_count DESC";
@@ -8722,7 +8722,7 @@  discard block
 block discarded – undo
8722 8722
 		$routes_array = array();
8723 8723
 		$temp_array = array();
8724 8724
         
8725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8726 8726
 		{
8727 8727
 			$temp_array['route_count'] = $row['route_count'];
8728 8728
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8746,11 +8746,11 @@  discard block
 block discarded – undo
8746 8746
 	* @return Array the route list
8747 8747
 	*
8748 8748
 	*/
8749
-	public function countAllRoutesByPilot($pilot,$filters = array())
8749
+	public function countAllRoutesByPilot($pilot, $filters = array())
8750 8750
 	{
8751
-		$filter_query = $this->getFilter($filters,true,true);
8752
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8753
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8751
+		$filter_query = $this->getFilter($filters, true, true);
8752
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8753
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8754 8754
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8755 8755
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8756 8756
                     ORDER BY route_count DESC";
@@ -8762,7 +8762,7 @@  discard block
 block discarded – undo
8762 8762
 		$routes_array = array();
8763 8763
 		$temp_array = array();
8764 8764
         
8765
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8765
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8766 8766
 		{
8767 8767
 			$temp_array['route_count'] = $row['route_count'];
8768 8768
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8789,9 +8789,9 @@  discard block
 block discarded – undo
8789 8789
 	*/
8790 8790
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8791 8791
 	{
8792
-		$filter_query = $this->getFilter($filters,true,true);
8793
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8794
-		$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
8792
+		$filter_query = $this->getFilter($filters, true, true);
8793
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8794
+		$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
8795 8795
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
8796 8796
                     GROUP BY route
8797 8797
                     ORDER BY route_count DESC";
@@ -8803,7 +8803,7 @@  discard block
 block discarded – undo
8803 8803
 		$routes_array = array();
8804 8804
 		$temp_array = array();
8805 8805
         
8806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8807 8807
 		{
8808 8808
 			$temp_array['route_count'] = $row['route_count'];
8809 8809
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8831,8 +8831,8 @@  discard block
 block discarded – undo
8831 8831
 	*/
8832 8832
 	public function countAllRoutesWithWaypoints($filters = array())
8833 8833
 	{
8834
-		$filter_query = $this->getFilter($filters,true,true);
8835
-		$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
8834
+		$filter_query = $this->getFilter($filters, true, true);
8835
+		$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 8836
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
8837 8837
                     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
8838 8838
                     ORDER BY route_count DESC
@@ -8845,7 +8845,7 @@  discard block
 block discarded – undo
8845 8845
 		$routes_array = array();
8846 8846
 		$temp_array = array();
8847 8847
         
8848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8849 8849
 		{
8850 8850
 			$temp_array['spotter_id'] = $row['spotter_id'];
8851 8851
 			$temp_array['route_count'] = $row['route_count'];
@@ -8870,11 +8870,11 @@  discard block
 block discarded – undo
8870 8870
 	* @return Array the callsign list
8871 8871
 	*
8872 8872
 	*/
8873
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8873
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
8874 8874
 	{
8875 8875
 		global $globalDBdriver;
8876
-		$filter_query = $this->getFilter($filters,true,true);
8877
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8876
+		$filter_query = $this->getFilter($filters, true, true);
8877
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8878 8878
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8879 8879
 		 if ($olderthanmonths > 0) {
8880 8880
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -8888,28 +8888,28 @@  discard block
 block discarded – undo
8888 8888
 		if ($year != '') {
8889 8889
 			if ($globalDBdriver == 'mysql') {
8890 8890
 				$query .= " AND YEAR(spotter_output.date) = :year";
8891
-				$query_values = array_merge($query_values,array(':year' => $year));
8891
+				$query_values = array_merge($query_values, array(':year' => $year));
8892 8892
 			} else {
8893 8893
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8894
-				$query_values = array_merge($query_values,array(':year' => $year));
8894
+				$query_values = array_merge($query_values, array(':year' => $year));
8895 8895
 			}
8896 8896
 		}
8897 8897
 		if ($month != '') {
8898 8898
 			if ($globalDBdriver == 'mysql') {
8899 8899
 				$query .= " AND MONTH(spotter_output.date) = :month";
8900
-				$query_values = array_merge($query_values,array(':month' => $month));
8900
+				$query_values = array_merge($query_values, array(':month' => $month));
8901 8901
 			} else {
8902 8902
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8903
-				$query_values = array_merge($query_values,array(':month' => $month));
8903
+				$query_values = array_merge($query_values, array(':month' => $month));
8904 8904
 			}
8905 8905
 		}
8906 8906
 		if ($day != '') {
8907 8907
 			if ($globalDBdriver == 'mysql') {
8908 8908
 				$query .= " AND DAY(spotter_output.date) = :day";
8909
-				$query_values = array_merge($query_values,array(':day' => $day));
8909
+				$query_values = array_merge($query_values, array(':day' => $day));
8910 8910
 			} else {
8911 8911
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8912
-				$query_values = array_merge($query_values,array(':day' => $day));
8912
+				$query_values = array_merge($query_values, array(':day' => $day));
8913 8913
 			}
8914 8914
 		}
8915 8915
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -8921,7 +8921,7 @@  discard block
 block discarded – undo
8921 8921
 		$callsign_array = array();
8922 8922
 		$temp_array = array();
8923 8923
         
8924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8925 8925
 		{
8926 8926
 			$temp_array['callsign_icao'] = $row['ident'];
8927 8927
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8943,8 +8943,8 @@  discard block
 block discarded – undo
8943 8943
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8944 8944
 	{
8945 8945
 		global $globalDBdriver;
8946
-		$filter_query = $this->getFilter($filters,true,true);
8947
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8946
+		$filter_query = $this->getFilter($filters, true, true);
8947
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8948 8948
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8949 8949
 		 if ($olderthanmonths > 0) {
8950 8950
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -8963,7 +8963,7 @@  discard block
 block discarded – undo
8963 8963
 		$callsign_array = array();
8964 8964
 		$temp_array = array();
8965 8965
         
8966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8967 8967
 		{
8968 8968
 			$temp_array['callsign_icao'] = $row['ident'];
8969 8969
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9017,7 +9017,7 @@  discard block
 block discarded – undo
9017 9017
 		$date_array = array();
9018 9018
 		$temp_array = array();
9019 9019
         
9020
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9020
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9021 9021
 		{
9022 9022
 			$temp_array['date_name'] = $row['date_name'];
9023 9023
 			$temp_array['date_count'] = $row['date_count'];
@@ -9042,15 +9042,15 @@  discard block
 block discarded – undo
9042 9042
 			$datetime = new DateTime();
9043 9043
 			$offset = $datetime->format('P');
9044 9044
 		} else $offset = '+00:00';
9045
-		$filter_query = $this->getFilter($filters,true,true);
9045
+		$filter_query = $this->getFilter($filters, true, true);
9046 9046
 		if ($globalDBdriver == 'mysql') {
9047
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9047
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9048 9048
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9049 9049
 								GROUP BY spotter_output.airline_icao, date_name 
9050 9050
 								ORDER BY date_count DESC
9051 9051
 								LIMIT 10 OFFSET 0";
9052 9052
 		} else {
9053
-			$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
9053
+			$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
9054 9054
 								FROM spotter_output 
9055 9055
 								WHERE spotter_output.airline_icao <> '' 
9056 9056
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9065,7 +9065,7 @@  discard block
 block discarded – undo
9065 9065
 		$date_array = array();
9066 9066
 		$temp_array = array();
9067 9067
         
9068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9069 9069
 		{
9070 9070
 			$temp_array['date_name'] = $row['date_name'];
9071 9071
 			$temp_array['date_count'] = $row['date_count'];
@@ -9091,7 +9091,7 @@  discard block
 block discarded – undo
9091 9091
 			$datetime = new DateTime();
9092 9092
 			$offset = $datetime->format('P');
9093 9093
 		} else $offset = '+00:00';
9094
-		$filter_query = $this->getFilter($filters,true,true);
9094
+		$filter_query = $this->getFilter($filters, true, true);
9095 9095
 		if ($globalDBdriver == 'mysql') {
9096 9096
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9097 9097
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9112,7 +9112,7 @@  discard block
 block discarded – undo
9112 9112
 		$date_array = array();
9113 9113
 		$temp_array = array();
9114 9114
         
9115
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9115
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9116 9116
 		{
9117 9117
 			$temp_array['date_name'] = $row['date_name'];
9118 9118
 			$temp_array['date_count'] = $row['date_count'];
@@ -9137,7 +9137,7 @@  discard block
 block discarded – undo
9137 9137
 			$datetime = new DateTime();
9138 9138
 			$offset = $datetime->format('P');
9139 9139
 		} else $offset = '+00:00';
9140
-		$filter_query = $this->getFilter($filters,true,true);
9140
+		$filter_query = $this->getFilter($filters, true, true);
9141 9141
 		if ($globalDBdriver == 'mysql') {
9142 9142
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9143 9143
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9158,7 +9158,7 @@  discard block
 block discarded – undo
9158 9158
 		$date_array = array();
9159 9159
 		$temp_array = array();
9160 9160
         
9161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9162 9162
 		{
9163 9163
 			$temp_array['date_name'] = $row['date_name'];
9164 9164
 			$temp_array['date_count'] = $row['date_count'];
@@ -9179,7 +9179,7 @@  discard block
 block discarded – undo
9179 9179
 	public function countAllDatesLastMonthByAirlines($filters = array())
9180 9180
 	{
9181 9181
 		global $globalTimezone, $globalDBdriver;
9182
-		$filter_query = $this->getFilter($filters,true,true);
9182
+		$filter_query = $this->getFilter($filters, true, true);
9183 9183
 		if ($globalTimezone != '') {
9184 9184
 			date_default_timezone_set($globalTimezone);
9185 9185
 			$datetime = new DateTime();
@@ -9187,13 +9187,13 @@  discard block
 block discarded – undo
9187 9187
 		} else $offset = '+00:00';
9188 9188
 		
9189 9189
 		if ($globalDBdriver == 'mysql') {
9190
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9190
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9191 9191
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9192 9192
 								GROUP BY spotter_output.airline_icao, date_name 
9193 9193
 								ORDER BY spotter_output.date ASC";
9194 9194
 			$query_data = array(':offset' => $offset);
9195 9195
 		} else {
9196
-			$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
9196
+			$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
9197 9197
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9198 9198
 								GROUP BY spotter_output.airline_icao, date_name 
9199 9199
 								ORDER BY date_name ASC";
@@ -9206,7 +9206,7 @@  discard block
 block discarded – undo
9206 9206
 		$date_array = array();
9207 9207
 		$temp_array = array();
9208 9208
         
9209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9210 9210
 		{
9211 9211
 			$temp_array['date_name'] = $row['date_name'];
9212 9212
 			$temp_array['date_count'] = $row['date_count'];
@@ -9253,7 +9253,7 @@  discard block
 block discarded – undo
9253 9253
 		$date_array = array();
9254 9254
 		$temp_array = array();
9255 9255
         
9256
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9256
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9257 9257
 		{
9258 9258
 			$temp_array['month_name'] = $row['month_name'];
9259 9259
 			$temp_array['year_name'] = $row['year_name'];
@@ -9274,7 +9274,7 @@  discard block
 block discarded – undo
9274 9274
 	public function countAllMonthsByAirlines($filters = array())
9275 9275
 	{
9276 9276
 		global $globalTimezone, $globalDBdriver;
9277
-		$filter_query = $this->getFilter($filters,true,true);
9277
+		$filter_query = $this->getFilter($filters, true, true);
9278 9278
 		if ($globalTimezone != '') {
9279 9279
 			date_default_timezone_set($globalTimezone);
9280 9280
 			$datetime = new DateTime();
@@ -9282,12 +9282,12 @@  discard block
 block discarded – undo
9282 9282
 		} else $offset = '+00:00';
9283 9283
 
9284 9284
 		if ($globalDBdriver == 'mysql') {
9285
-			$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
9285
+			$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
9286 9286
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9287 9287
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9288 9288
 								ORDER BY date_count DESC";
9289 9289
 		} else {
9290
-			$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
9290
+			$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
9291 9291
 								FROM spotter_output 
9292 9292
 								WHERE spotter_output.airline_icao <> '' 
9293 9293
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9301,7 +9301,7 @@  discard block
 block discarded – undo
9301 9301
 		$date_array = array();
9302 9302
 		$temp_array = array();
9303 9303
         
9304
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9304
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9305 9305
 		{
9306 9306
 			$temp_array['month_name'] = $row['month_name'];
9307 9307
 			$temp_array['year_name'] = $row['year_name'];
@@ -9328,14 +9328,14 @@  discard block
 block discarded – undo
9328 9328
 			$datetime = new DateTime();
9329 9329
 			$offset = $datetime->format('P');
9330 9330
 		} else $offset = '+00:00';
9331
-		$filter_query = $this->getFilter($filters,true,true);
9331
+		$filter_query = $this->getFilter($filters, true, true);
9332 9332
 		if ($globalDBdriver == 'mysql') {
9333
-			$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
9333
+			$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
9334 9334
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9335 9335
 								GROUP BY year_name, month_name 
9336 9336
 								ORDER BY date_count DESC";
9337 9337
 		} else {
9338
-			$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
9338
+			$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
9339 9339
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9340 9340
 								GROUP BY year_name, month_name 
9341 9341
 								ORDER BY date_count DESC";
@@ -9347,7 +9347,7 @@  discard block
 block discarded – undo
9347 9347
 		$date_array = array();
9348 9348
 		$temp_array = array();
9349 9349
         
9350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9351 9351
 		{
9352 9352
 			$temp_array['month_name'] = $row['month_name'];
9353 9353
 			$temp_array['year_name'] = $row['year_name'];
@@ -9373,15 +9373,15 @@  discard block
 block discarded – undo
9373 9373
 			$datetime = new DateTime();
9374 9374
 			$offset = $datetime->format('P');
9375 9375
 		} else $offset = '+00:00';
9376
-		$filter_query = $this->getFilter($filters,true,true);
9376
+		$filter_query = $this->getFilter($filters, true, true);
9377 9377
 
9378 9378
 		if ($globalDBdriver == 'mysql') {
9379
-			$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
9379
+			$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
9380 9380
 								FROM spotter_output".$filter_query." owner_name <> ''
9381 9381
 								GROUP BY year_name, month_name
9382 9382
 								ORDER BY date_count DESC";
9383 9383
 		} else {
9384
-			$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
9384
+			$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
9385 9385
 								FROM spotter_output".$filter_query." owner_name <> ''
9386 9386
 								GROUP BY year_name, month_name
9387 9387
 								ORDER BY date_count DESC";
@@ -9393,7 +9393,7 @@  discard block
 block discarded – undo
9393 9393
 		$date_array = array();
9394 9394
 		$temp_array = array();
9395 9395
         
9396
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9396
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9397 9397
 		{
9398 9398
 			$temp_array['month_name'] = $row['month_name'];
9399 9399
 			$temp_array['year_name'] = $row['year_name'];
@@ -9414,7 +9414,7 @@  discard block
 block discarded – undo
9414 9414
 	public function countAllMonthsOwnersByAirlines($filters = array())
9415 9415
 	{
9416 9416
 		global $globalTimezone, $globalDBdriver;
9417
-		$filter_query = $this->getFilter($filters,true,true);
9417
+		$filter_query = $this->getFilter($filters, true, true);
9418 9418
 		if ($globalTimezone != '') {
9419 9419
 			date_default_timezone_set($globalTimezone);
9420 9420
 			$datetime = new DateTime();
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 		} else $offset = '+00:00';
9423 9423
 
9424 9424
 		if ($globalDBdriver == 'mysql') {
9425
-			$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
9425
+			$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
9426 9426
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9427 9427
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9428 9428
 								ORDER BY date_count DESC";
9429 9429
 		} else {
9430
-			$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
9430
+			$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
9431 9431
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9432 9432
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9433 9433
 								ORDER BY date_count DESC";
@@ -9439,7 +9439,7 @@  discard block
 block discarded – undo
9439 9439
 		$date_array = array();
9440 9440
 		$temp_array = array();
9441 9441
         
9442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9443 9443
 		{
9444 9444
 			$temp_array['month_name'] = $row['month_name'];
9445 9445
 			$temp_array['year_name'] = $row['year_name'];
@@ -9466,15 +9466,15 @@  discard block
 block discarded – undo
9466 9466
 			$datetime = new DateTime();
9467 9467
 			$offset = $datetime->format('P');
9468 9468
 		} else $offset = '+00:00';
9469
-		$filter_query = $this->getFilter($filters,true,true);
9469
+		$filter_query = $this->getFilter($filters, true, true);
9470 9470
 
9471 9471
 		if ($globalDBdriver == 'mysql') {
9472
-			$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
9472
+			$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
9473 9473
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9474 9474
 								GROUP BY year_name, month_name
9475 9475
 								ORDER BY date_count DESC";
9476 9476
 		} else {
9477
-			$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
9477
+			$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
9478 9478
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9479 9479
 								GROUP BY year_name, month_name
9480 9480
 								ORDER BY date_count DESC";
@@ -9486,7 +9486,7 @@  discard block
 block discarded – undo
9486 9486
 		$date_array = array();
9487 9487
 		$temp_array = array();
9488 9488
         
9489
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9489
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9490 9490
 		{
9491 9491
 			$temp_array['month_name'] = $row['month_name'];
9492 9492
 			$temp_array['year_name'] = $row['year_name'];
@@ -9507,7 +9507,7 @@  discard block
 block discarded – undo
9507 9507
 	public function countAllMonthsPilotsByAirlines($filters = array())
9508 9508
 	{
9509 9509
 		global $globalTimezone, $globalDBdriver;
9510
-		$filter_query = $this->getFilter($filters,true,true);
9510
+		$filter_query = $this->getFilter($filters, true, true);
9511 9511
 		if ($globalTimezone != '') {
9512 9512
 			date_default_timezone_set($globalTimezone);
9513 9513
 			$datetime = new DateTime();
@@ -9515,12 +9515,12 @@  discard block
 block discarded – undo
9515 9515
 		} else $offset = '+00:00';
9516 9516
 
9517 9517
 		if ($globalDBdriver == 'mysql') {
9518
-			$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
9518
+			$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
9519 9519
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9520 9520
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9521 9521
 								ORDER BY date_count DESC";
9522 9522
 		} else {
9523
-			$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
9523
+			$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
9524 9524
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9525 9525
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9526 9526
 								ORDER BY date_count DESC";
@@ -9532,7 +9532,7 @@  discard block
 block discarded – undo
9532 9532
 		$date_array = array();
9533 9533
 		$temp_array = array();
9534 9534
         
9535
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9535
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9536 9536
 		{
9537 9537
 			$temp_array['month_name'] = $row['month_name'];
9538 9538
 			$temp_array['year_name'] = $row['year_name'];
@@ -9554,7 +9554,7 @@  discard block
 block discarded – undo
9554 9554
 	public function countAllMonthsAirlines($filters = array())
9555 9555
 	{
9556 9556
 		global $globalTimezone, $globalDBdriver;
9557
-		$filter_query = $this->getFilter($filters,true,true);
9557
+		$filter_query = $this->getFilter($filters, true, true);
9558 9558
 		if ($globalTimezone != '') {
9559 9559
 			date_default_timezone_set($globalTimezone);
9560 9560
 			$datetime = new DateTime();
@@ -9562,12 +9562,12 @@  discard block
 block discarded – undo
9562 9562
 		} else $offset = '+00:00';
9563 9563
 
9564 9564
 		if ($globalDBdriver == 'mysql') {
9565
-			$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
9565
+			$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
9566 9566
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9567 9567
 								GROUP BY year_name, month_name
9568 9568
 								ORDER BY date_count DESC";
9569 9569
 		} else {
9570
-			$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
9570
+			$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
9571 9571
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9572 9572
 								GROUP BY year_name, month_name
9573 9573
 								ORDER BY date_count DESC";
@@ -9579,7 +9579,7 @@  discard block
 block discarded – undo
9579 9579
 		$date_array = array();
9580 9580
 		$temp_array = array();
9581 9581
         
9582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9583 9583
 		{
9584 9584
 			$temp_array['month_name'] = $row['month_name'];
9585 9585
 			$temp_array['year_name'] = $row['year_name'];
@@ -9605,15 +9605,15 @@  discard block
 block discarded – undo
9605 9605
 			$datetime = new DateTime();
9606 9606
 			$offset = $datetime->format('P');
9607 9607
 		} else $offset = '+00:00';
9608
-		$filter_query = $this->getFilter($filters,true,true);
9608
+		$filter_query = $this->getFilter($filters, true, true);
9609 9609
 
9610 9610
 		if ($globalDBdriver == 'mysql') {
9611
-			$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
9611
+			$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
9612 9612
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9613 9613
 								GROUP BY year_name, month_name
9614 9614
 								ORDER BY date_count DESC";
9615 9615
 		} else {
9616
-			$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
9616
+			$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
9617 9617
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9618 9618
 								GROUP BY year_name, month_name
9619 9619
 								ORDER BY date_count DESC";
@@ -9625,7 +9625,7 @@  discard block
 block discarded – undo
9625 9625
 		$date_array = array();
9626 9626
 		$temp_array = array();
9627 9627
         
9628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9629 9629
 		{
9630 9630
 			$temp_array['month_name'] = $row['month_name'];
9631 9631
 			$temp_array['year_name'] = $row['year_name'];
@@ -9647,7 +9647,7 @@  discard block
 block discarded – undo
9647 9647
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9648 9648
 	{
9649 9649
 		global $globalTimezone, $globalDBdriver;
9650
-		$filter_query = $this->getFilter($filters,true,true);
9650
+		$filter_query = $this->getFilter($filters, true, true);
9651 9651
 		if ($globalTimezone != '') {
9652 9652
 			date_default_timezone_set($globalTimezone);
9653 9653
 			$datetime = new DateTime();
@@ -9655,12 +9655,12 @@  discard block
 block discarded – undo
9655 9655
 		} else $offset = '+00:00';
9656 9656
 
9657 9657
 		if ($globalDBdriver == 'mysql') {
9658
-			$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
9658
+			$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
9659 9659
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9660 9660
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9661 9661
 								ORDER BY date_count DESC";
9662 9662
 		} else {
9663
-			$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
9663
+			$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
9664 9664
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
9665 9665
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9666 9666
 								ORDER BY date_count DESC";
@@ -9672,7 +9672,7 @@  discard block
 block discarded – undo
9672 9672
 		$date_array = array();
9673 9673
 		$temp_array = array();
9674 9674
         
9675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9676 9676
 		{
9677 9677
 			$temp_array['month_name'] = $row['month_name'];
9678 9678
 			$temp_array['year_name'] = $row['year_name'];
@@ -9699,15 +9699,15 @@  discard block
 block discarded – undo
9699 9699
 			$datetime = new DateTime();
9700 9700
 			$offset = $datetime->format('P');
9701 9701
 		} else $offset = '+00:00';
9702
-		$filter_query = $this->getFilter($filters,true,true);
9702
+		$filter_query = $this->getFilter($filters, true, true);
9703 9703
 
9704 9704
 		if ($globalDBdriver == 'mysql') {
9705
-			$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
9705
+			$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
9706 9706
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9707 9707
 								GROUP BY year_name, month_name
9708 9708
 								ORDER BY date_count DESC";
9709 9709
 		} else {
9710
-			$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
9710
+			$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
9711 9711
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9712 9712
 								GROUP BY year_name, month_name
9713 9713
 								ORDER BY date_count DESC";
@@ -9719,7 +9719,7 @@  discard block
 block discarded – undo
9719 9719
 		$date_array = array();
9720 9720
 		$temp_array = array();
9721 9721
         
9722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9723 9723
 		{
9724 9724
 			$temp_array['month_name'] = $row['month_name'];
9725 9725
 			$temp_array['year_name'] = $row['year_name'];
@@ -9741,7 +9741,7 @@  discard block
 block discarded – undo
9741 9741
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9742 9742
 	{
9743 9743
 		global $globalTimezone, $globalDBdriver;
9744
-		$filter_query = $this->getFilter($filters,true,true);
9744
+		$filter_query = $this->getFilter($filters, true, true);
9745 9745
 		if ($globalTimezone != '') {
9746 9746
 			date_default_timezone_set($globalTimezone);
9747 9747
 			$datetime = new DateTime();
@@ -9749,12 +9749,12 @@  discard block
 block discarded – undo
9749 9749
 		} else $offset = '+00:00';
9750 9750
 
9751 9751
 		if ($globalDBdriver == 'mysql') {
9752
-			$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
9752
+			$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
9753 9753
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9754 9754
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9755 9755
 								ORDER BY date_count DESC";
9756 9756
 		} else {
9757
-			$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
9757
+			$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
9758 9758
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9759 9759
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9760 9760
 								ORDER BY date_count DESC";
@@ -9766,7 +9766,7 @@  discard block
 block discarded – undo
9766 9766
 		$date_array = array();
9767 9767
 		$temp_array = array();
9768 9768
         
9769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9770 9770
 		{
9771 9771
 			$temp_array['month_name'] = $row['month_name'];
9772 9772
 			$temp_array['year_name'] = $row['year_name'];
@@ -9794,7 +9794,7 @@  discard block
 block discarded – undo
9794 9794
 			$datetime = new DateTime();
9795 9795
 			$offset = $datetime->format('P');
9796 9796
 		} else $offset = '+00:00';
9797
-		$filter_query = $this->getFilter($filters,true,true);
9797
+		$filter_query = $this->getFilter($filters, true, true);
9798 9798
 		if ($globalDBdriver == 'mysql') {
9799 9799
 			$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
9800 9800
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -9815,7 +9815,7 @@  discard block
 block discarded – undo
9815 9815
 		$date_array = array();
9816 9816
 		$temp_array = array();
9817 9817
         
9818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9819 9819
 		{
9820 9820
 			$temp_array['year_name'] = $row['year_name'];
9821 9821
 			$temp_array['month_name'] = $row['month_name'];
@@ -9835,7 +9835,7 @@  discard block
 block discarded – undo
9835 9835
 	* @return Array the hour list
9836 9836
 	*
9837 9837
 	*/
9838
-	public function countAllHours($orderby,$filters = array())
9838
+	public function countAllHours($orderby, $filters = array())
9839 9839
 	{
9840 9840
 		global $globalTimezone, $globalDBdriver;
9841 9841
 		if ($globalTimezone != '') {
@@ -9883,7 +9883,7 @@  discard block
 block discarded – undo
9883 9883
 		$hour_array = array();
9884 9884
 		$temp_array = array();
9885 9885
         
9886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9887 9887
 		{
9888 9888
 			$temp_array['hour_name'] = $row['hour_name'];
9889 9889
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9903,7 +9903,7 @@  discard block
 block discarded – undo
9903 9903
 	public function countAllHoursByAirlines($orderby, $filters = array())
9904 9904
 	{
9905 9905
 		global $globalTimezone, $globalDBdriver;
9906
-		$filter_query = $this->getFilter($filters,true,true);
9906
+		$filter_query = $this->getFilter($filters, true, true);
9907 9907
 		if ($globalTimezone != '') {
9908 9908
 			date_default_timezone_set($globalTimezone);
9909 9909
 			$datetime = new DateTime();
@@ -9921,7 +9921,7 @@  discard block
 block discarded – undo
9921 9921
 		}
9922 9922
 		
9923 9923
 		if ($globalDBdriver == 'mysql') {
9924
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9924
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9925 9925
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9926 9926
 								GROUP BY spotter_output.airline_icao, hour_name 
9927 9927
 								".$orderby_sql;
@@ -9934,7 +9934,7 @@  discard block
 block discarded – undo
9934 9934
   */    
9935 9935
 		$query_data = array(':offset' => $offset);
9936 9936
 		} else {
9937
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9937
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9938 9938
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9939 9939
 								GROUP BY spotter_output.airline_icao, hour_name 
9940 9940
 								".$orderby_sql;
@@ -9947,7 +9947,7 @@  discard block
 block discarded – undo
9947 9947
 		$hour_array = array();
9948 9948
 		$temp_array = array();
9949 9949
         
9950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9951 9951
 		{
9952 9952
 			$temp_array['hour_name'] = $row['hour_name'];
9953 9953
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9970,34 +9970,34 @@  discard block
 block discarded – undo
9970 9970
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9971 9971
 	{
9972 9972
 		global $globalTimezone, $globalDBdriver;
9973
-		$filter_query = $this->getFilter($filters,true,true);
9973
+		$filter_query = $this->getFilter($filters, true, true);
9974 9974
 		if ($globalTimezone != '') {
9975 9975
 			date_default_timezone_set($globalTimezone);
9976 9976
 			$datetime = new DateTime();
9977 9977
 			$offset = $datetime->format('P');
9978 9978
 		} else $offset = '+00:00';
9979 9979
 
9980
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9980
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
9981 9981
 
9982 9982
 		if ($globalDBdriver == 'mysql') {
9983
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9983
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9984 9984
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9985 9985
 								GROUP BY hour_name 
9986 9986
 								ORDER BY hour_name ASC";
9987 9987
 		} else {
9988
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9988
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9989 9989
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9990 9990
 								GROUP BY hour_name 
9991 9991
 								ORDER BY hour_name ASC";
9992 9992
 		}
9993 9993
 		
9994 9994
 		$sth = $this->db->prepare($query);
9995
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
9995
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
9996 9996
       
9997 9997
 		$hour_array = array();
9998 9998
 		$temp_array = array();
9999 9999
         
10000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10001 10001
 		{
10002 10002
 			$temp_array['hour_name'] = $row['hour_name'];
10003 10003
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10020,8 +10020,8 @@  discard block
 block discarded – undo
10020 10020
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10021 10021
 	{
10022 10022
 		global $globalTimezone, $globalDBdriver;
10023
-		$filter_query = $this->getFilter($filters,true,true);
10024
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10023
+		$filter_query = $this->getFilter($filters, true, true);
10024
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10025 10025
 		if ($globalTimezone != '') {
10026 10026
 			date_default_timezone_set($globalTimezone);
10027 10027
 			$datetime = new DateTime();
@@ -10029,24 +10029,24 @@  discard block
 block discarded – undo
10029 10029
 		} else $offset = '+00:00';
10030 10030
 
10031 10031
 		if ($globalDBdriver == 'mysql') {
10032
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10032
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10033 10033
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10034 10034
 								GROUP BY hour_name 
10035 10035
 								ORDER BY hour_name ASC";
10036 10036
 		} else {
10037
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10037
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10038 10038
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10039 10039
 								GROUP BY hour_name 
10040 10040
 								ORDER BY hour_name ASC";
10041 10041
 		}
10042 10042
 		
10043 10043
 		$sth = $this->db->prepare($query);
10044
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10044
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10045 10045
       
10046 10046
 		$hour_array = array();
10047 10047
 		$temp_array = array();
10048 10048
         
10049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10050 10050
 		{
10051 10051
 			$temp_array['hour_name'] = $row['hour_name'];
10052 10052
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10067,8 +10067,8 @@  discard block
 block discarded – undo
10067 10067
 	public function countAllHoursByRegistration($registration, $filters = array())
10068 10068
 	{
10069 10069
 		global $globalTimezone, $globalDBdriver;
10070
-		$filter_query = $this->getFilter($filters,true,true);
10071
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10070
+		$filter_query = $this->getFilter($filters, true, true);
10071
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10072 10072
 		if ($globalTimezone != '') {
10073 10073
 			date_default_timezone_set($globalTimezone);
10074 10074
 			$datetime = new DateTime();
@@ -10076,24 +10076,24 @@  discard block
 block discarded – undo
10076 10076
 		} else $offset = '+00:00';
10077 10077
 
10078 10078
 		if ($globalDBdriver == 'mysql') {
10079
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10079
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10080 10080
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10081 10081
 								GROUP BY hour_name 
10082 10082
 								ORDER BY hour_name ASC";
10083 10083
 		} else {
10084
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10084
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10085 10085
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10086 10086
 								GROUP BY hour_name 
10087 10087
 								ORDER BY hour_name ASC";
10088 10088
 		}
10089 10089
 		
10090 10090
 		$sth = $this->db->prepare($query);
10091
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10091
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10092 10092
       
10093 10093
 		$hour_array = array();
10094 10094
 		$temp_array = array();
10095 10095
         
10096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10097 10097
 		{
10098 10098
 			$temp_array['hour_name'] = $row['hour_name'];
10099 10099
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10114,8 +10114,8 @@  discard block
 block discarded – undo
10114 10114
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10115 10115
 	{
10116 10116
 		global $globalTimezone, $globalDBdriver;
10117
-		$filter_query = $this->getFilter($filters,true,true);
10118
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10117
+		$filter_query = $this->getFilter($filters, true, true);
10118
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10119 10119
 		if ($globalTimezone != '') {
10120 10120
 			date_default_timezone_set($globalTimezone);
10121 10121
 			$datetime = new DateTime();
@@ -10123,24 +10123,24 @@  discard block
 block discarded – undo
10123 10123
 		} else $offset = '+00:00';
10124 10124
 
10125 10125
 		if ($globalDBdriver == 'mysql') {
10126
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10126
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10127 10127
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10128 10128
 								GROUP BY hour_name 
10129 10129
 								ORDER BY hour_name ASC";
10130 10130
 		} else {
10131
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10131
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10132 10132
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10133 10133
 								GROUP BY hour_name 
10134 10134
 								ORDER BY hour_name ASC";
10135 10135
 		}
10136 10136
 		
10137 10137
 		$sth = $this->db->prepare($query);
10138
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10138
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10139 10139
       
10140 10140
 		$hour_array = array();
10141 10141
 		$temp_array = array();
10142 10142
         
10143
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10143
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10144 10144
 		{
10145 10145
 			$temp_array['hour_name'] = $row['hour_name'];
10146 10146
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10159,11 +10159,11 @@  discard block
 block discarded – undo
10159 10159
 	* @return Array the hour list
10160 10160
 	*
10161 10161
 	*/
10162
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10162
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10163 10163
 	{
10164 10164
 		global $globalTimezone, $globalDBdriver;
10165
-		$filter_query = $this->getFilter($filters,true,true);
10166
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10165
+		$filter_query = $this->getFilter($filters, true, true);
10166
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10167 10167
 		if ($globalTimezone != '') {
10168 10168
 			date_default_timezone_set($globalTimezone);
10169 10169
 			$datetime = new DateTime();
@@ -10171,24 +10171,24 @@  discard block
 block discarded – undo
10171 10171
 		} else $offset = '+00:00';
10172 10172
 
10173 10173
 		if ($globalDBdriver == 'mysql') {
10174
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10174
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10175 10175
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10176 10176
 								GROUP BY hour_name 
10177 10177
 								ORDER BY hour_name ASC";
10178 10178
 		} else {
10179
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10179
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10180 10180
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10181 10181
 								GROUP BY hour_name 
10182 10182
 								ORDER BY hour_name ASC";
10183 10183
 		}
10184 10184
 		
10185 10185
 		$sth = $this->db->prepare($query);
10186
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10186
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10187 10187
       
10188 10188
 		$hour_array = array();
10189 10189
 		$temp_array = array();
10190 10190
         
10191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10192 10192
 		{
10193 10193
 			$temp_array['hour_name'] = $row['hour_name'];
10194 10194
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10210,8 +10210,8 @@  discard block
 block discarded – undo
10210 10210
 	public function countAllHoursByDate($date, $filters = array())
10211 10211
 	{
10212 10212
 		global $globalTimezone, $globalDBdriver;
10213
-		$filter_query = $this->getFilter($filters,true,true);
10214
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10213
+		$filter_query = $this->getFilter($filters, true, true);
10214
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10215 10215
 		if ($globalTimezone != '') {
10216 10216
 			date_default_timezone_set($globalTimezone);
10217 10217
 			$datetime = new DateTime($date);
@@ -10219,12 +10219,12 @@  discard block
 block discarded – undo
10219 10219
 		} else $offset = '+00:00';
10220 10220
 
10221 10221
 		if ($globalDBdriver == 'mysql') {
10222
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10222
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10223 10223
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10224 10224
 								GROUP BY hour_name 
10225 10225
 								ORDER BY hour_name ASC";
10226 10226
 		} else {
10227
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10227
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10228 10228
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10229 10229
 								GROUP BY hour_name 
10230 10230
 								ORDER BY hour_name ASC";
@@ -10236,7 +10236,7 @@  discard block
 block discarded – undo
10236 10236
 		$hour_array = array();
10237 10237
 		$temp_array = array();
10238 10238
         
10239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10240 10240
 		{
10241 10241
 			$temp_array['hour_name'] = $row['hour_name'];
10242 10242
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10258,8 +10258,8 @@  discard block
 block discarded – undo
10258 10258
 	public function countAllHoursByIdent($ident, $filters = array())
10259 10259
 	{
10260 10260
 		global $globalTimezone, $globalDBdriver;
10261
-		$filter_query = $this->getFilter($filters,true,true);
10262
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10261
+		$filter_query = $this->getFilter($filters, true, true);
10262
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10263 10263
 		if ($globalTimezone != '') {
10264 10264
 			date_default_timezone_set($globalTimezone);
10265 10265
 			$datetime = new DateTime();
@@ -10267,12 +10267,12 @@  discard block
 block discarded – undo
10267 10267
 		} else $offset = '+00:00';
10268 10268
 
10269 10269
 		if ($globalDBdriver == 'mysql') {
10270
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10270
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10271 10271
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10272 10272
 								GROUP BY hour_name 
10273 10273
 								ORDER BY hour_name ASC";
10274 10274
 		} else {
10275
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10275
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10276 10276
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10277 10277
 								GROUP BY hour_name 
10278 10278
 								ORDER BY hour_name ASC";
@@ -10280,12 +10280,12 @@  discard block
 block discarded – undo
10280 10280
       
10281 10281
 		
10282 10282
 		$sth = $this->db->prepare($query);
10283
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10283
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10284 10284
       
10285 10285
 		$hour_array = array();
10286 10286
 		$temp_array = array();
10287 10287
         
10288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10289 10289
 		{
10290 10290
 			$temp_array['hour_name'] = $row['hour_name'];
10291 10291
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10305,8 +10305,8 @@  discard block
 block discarded – undo
10305 10305
 	public function countAllHoursByOwner($owner, $filters = array())
10306 10306
 	{
10307 10307
 		global $globalTimezone, $globalDBdriver;
10308
-		$filter_query = $this->getFilter($filters,true,true);
10309
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10308
+		$filter_query = $this->getFilter($filters, true, true);
10309
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10310 10310
 		if ($globalTimezone != '') {
10311 10311
 			date_default_timezone_set($globalTimezone);
10312 10312
 			$datetime = new DateTime();
@@ -10314,12 +10314,12 @@  discard block
 block discarded – undo
10314 10314
 		} else $offset = '+00:00';
10315 10315
 
10316 10316
 		if ($globalDBdriver == 'mysql') {
10317
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10317
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10318 10318
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10319 10319
 								GROUP BY hour_name 
10320 10320
 								ORDER BY hour_name ASC";
10321 10321
 		} else {
10322
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10322
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10323 10323
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10324 10324
 								GROUP BY hour_name 
10325 10325
 								ORDER BY hour_name ASC";
@@ -10327,12 +10327,12 @@  discard block
 block discarded – undo
10327 10327
       
10328 10328
 		
10329 10329
 		$sth = $this->db->prepare($query);
10330
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10330
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10331 10331
       
10332 10332
 		$hour_array = array();
10333 10333
 		$temp_array = array();
10334 10334
         
10335
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10335
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10336 10336
 		{
10337 10337
 			$temp_array['hour_name'] = $row['hour_name'];
10338 10338
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10352,8 +10352,8 @@  discard block
 block discarded – undo
10352 10352
 	public function countAllHoursByPilot($pilot, $filters = array())
10353 10353
 	{
10354 10354
 		global $globalTimezone, $globalDBdriver;
10355
-		$filter_query = $this->getFilter($filters,true,true);
10356
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10355
+		$filter_query = $this->getFilter($filters, true, true);
10356
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10357 10357
 		if ($globalTimezone != '') {
10358 10358
 			date_default_timezone_set($globalTimezone);
10359 10359
 			$datetime = new DateTime();
@@ -10361,12 +10361,12 @@  discard block
 block discarded – undo
10361 10361
 		} else $offset = '+00:00';
10362 10362
 
10363 10363
 		if ($globalDBdriver == 'mysql') {
10364
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10364
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10365 10365
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10366 10366
 								GROUP BY hour_name 
10367 10367
 								ORDER BY hour_name ASC";
10368 10368
 		} else {
10369
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10369
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10370 10370
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10371 10371
 								GROUP BY hour_name 
10372 10372
 								ORDER BY hour_name ASC";
@@ -10374,12 +10374,12 @@  discard block
 block discarded – undo
10374 10374
       
10375 10375
 		
10376 10376
 		$sth = $this->db->prepare($query);
10377
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10377
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10378 10378
       
10379 10379
 		$hour_array = array();
10380 10380
 		$temp_array = array();
10381 10381
         
10382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10383 10383
 		{
10384 10384
 			$temp_array['hour_name'] = $row['hour_name'];
10385 10385
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10398,12 +10398,12 @@  discard block
 block discarded – undo
10398 10398
 	* @return Array the hour list
10399 10399
 	*
10400 10400
 	*/
10401
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10401
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10402 10402
 	{
10403 10403
 		global $globalTimezone, $globalDBdriver;
10404
-		$filter_query = $this->getFilter($filters,true,true);
10405
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10406
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10404
+		$filter_query = $this->getFilter($filters, true, true);
10405
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10406
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10407 10407
 		if ($globalTimezone != '') {
10408 10408
 			date_default_timezone_set($globalTimezone);
10409 10409
 			$datetime = new DateTime();
@@ -10411,24 +10411,24 @@  discard block
 block discarded – undo
10411 10411
 		} else $offset = '+00:00';
10412 10412
 
10413 10413
 		if ($globalDBdriver == 'mysql') {
10414
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10414
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10415 10415
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10416 10416
 								GROUP BY hour_name 
10417 10417
 								ORDER BY hour_name ASC";
10418 10418
 		} else {
10419
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10419
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10420 10420
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10421 10421
 								GROUP BY hour_name 
10422 10422
 								ORDER BY hour_name ASC";
10423 10423
 		}
10424 10424
 		
10425 10425
 		$sth = $this->db->prepare($query);
10426
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10426
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10427 10427
       
10428 10428
 		$hour_array = array();
10429 10429
 		$temp_array = array();
10430 10430
         
10431
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10431
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10432 10432
 		{
10433 10433
 			$temp_array['hour_name'] = $row['hour_name'];
10434 10434
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10449,8 +10449,8 @@  discard block
 block discarded – undo
10449 10449
 	public function countAllHoursByCountry($country, $filters = array())
10450 10450
 	{
10451 10451
 		global $globalTimezone, $globalDBdriver;
10452
-		$filter_query = $this->getFilter($filters,true,true);
10453
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10452
+		$filter_query = $this->getFilter($filters, true, true);
10453
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10454 10454
 		if ($globalTimezone != '') {
10455 10455
 			date_default_timezone_set($globalTimezone);
10456 10456
 			$datetime = new DateTime();
@@ -10458,24 +10458,24 @@  discard block
 block discarded – undo
10458 10458
 		} else $offset = '+00:00';
10459 10459
 
10460 10460
 		if ($globalDBdriver == 'mysql') {
10461
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10461
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10462 10462
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10463 10463
 								GROUP BY hour_name 
10464 10464
 								ORDER BY hour_name ASC";
10465 10465
 		} else {
10466
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10466
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10467 10467
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10468 10468
 								GROUP BY hour_name 
10469 10469
 								ORDER BY hour_name ASC";
10470 10470
 		}
10471 10471
 		
10472 10472
 		$sth = $this->db->prepare($query);
10473
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10473
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10474 10474
       
10475 10475
 		$hour_array = array();
10476 10476
 		$temp_array = array();
10477 10477
         
10478
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10478
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10479 10479
 		{
10480 10480
 			$temp_array['hour_name'] = $row['hour_name'];
10481 10481
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10495,29 +10495,29 @@  discard block
 block discarded – undo
10495 10495
 	* @return Integer the number of aircrafts
10496 10496
 	*
10497 10497
 	*/
10498
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10498
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10499 10499
 	{
10500 10500
 		global $globalDBdriver;
10501
-		$filter_query = $this->getFilter($filters,true,true);
10502
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10501
+		$filter_query = $this->getFilter($filters, true, true);
10502
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10503 10503
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10504 10504
 		$query_values = array();
10505 10505
 		if ($year != '') {
10506 10506
 			if ($globalDBdriver == 'mysql') {
10507 10507
 				$query .= " AND YEAR(spotter_output.date) = :year";
10508
-				$query_values = array_merge($query_values,array(':year' => $year));
10508
+				$query_values = array_merge($query_values, array(':year' => $year));
10509 10509
 			} else {
10510 10510
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10511
-				$query_values = array_merge($query_values,array(':year' => $year));
10511
+				$query_values = array_merge($query_values, array(':year' => $year));
10512 10512
 			}
10513 10513
 		}
10514 10514
 		if ($month != '') {
10515 10515
 			if ($globalDBdriver == 'mysql') {
10516 10516
 				$query .= " AND MONTH(spotter_output.date) = :month";
10517
-				$query_values = array_merge($query_values,array(':month' => $month));
10517
+				$query_values = array_merge($query_values, array(':month' => $month));
10518 10518
 			} else {
10519 10519
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10520
-				$query_values = array_merge($query_values,array(':month' => $month));
10520
+				$query_values = array_merge($query_values, array(':month' => $month));
10521 10521
 			}
10522 10522
 		}
10523 10523
 
@@ -10532,29 +10532,29 @@  discard block
 block discarded – undo
10532 10532
 	* @return Integer the number of aircrafts
10533 10533
 	*
10534 10534
 	*/
10535
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10535
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10536 10536
 	{
10537 10537
 		global $globalDBdriver;
10538
-		$filter_query = $this->getFilter($filters,true,true);
10539
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10538
+		$filter_query = $this->getFilter($filters, true, true);
10539
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10540 10540
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10541 10541
 		$query_values = array();
10542 10542
 		if ($year != '') {
10543 10543
 			if ($globalDBdriver == 'mysql') {
10544 10544
 				$query .= " AND YEAR(spotter_output.date) = :year";
10545
-				$query_values = array_merge($query_values,array(':year' => $year));
10545
+				$query_values = array_merge($query_values, array(':year' => $year));
10546 10546
 			} else {
10547 10547
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10548
-				$query_values = array_merge($query_values,array(':year' => $year));
10548
+				$query_values = array_merge($query_values, array(':year' => $year));
10549 10549
 			}
10550 10550
 		}
10551 10551
 		if ($month != '') {
10552 10552
 			if ($globalDBdriver == 'mysql') {
10553 10553
 				$query .= " AND MONTH(spotter_output.date) = :month";
10554
-				$query_values = array_merge($query_values,array(':month' => $month));
10554
+				$query_values = array_merge($query_values, array(':month' => $month));
10555 10555
 			} else {
10556 10556
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10557
-				$query_values = array_merge($query_values,array(':month' => $month));
10557
+				$query_values = array_merge($query_values, array(':month' => $month));
10558 10558
 			}
10559 10559
 		}
10560 10560
 		
@@ -10569,29 +10569,29 @@  discard block
 block discarded – undo
10569 10569
 	* @return Integer the number of pilots
10570 10570
 	*
10571 10571
 	*/
10572
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10572
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10573 10573
 	{
10574 10574
 		global $globalDBdriver;
10575
-		$filter_query = $this->getFilter($filters,true,true);
10576
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10575
+		$filter_query = $this->getFilter($filters, true, true);
10576
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10577 10577
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10578 10578
 		$query_values = array();
10579 10579
 		if ($year != '') {
10580 10580
 			if ($globalDBdriver == 'mysql') {
10581 10581
 				$query .= " AND YEAR(spotter_output.date) = :year";
10582
-				$query_values = array_merge($query_values,array(':year' => $year));
10582
+				$query_values = array_merge($query_values, array(':year' => $year));
10583 10583
 			} else {
10584 10584
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10585
-				$query_values = array_merge($query_values,array(':year' => $year));
10585
+				$query_values = array_merge($query_values, array(':year' => $year));
10586 10586
 			}
10587 10587
 		}
10588 10588
 		if ($month != '') {
10589 10589
 			if ($globalDBdriver == 'mysql') {
10590 10590
 				$query .= " AND MONTH(spotter_output.date) = :month";
10591
-				$query_values = array_merge($query_values,array(':month' => $month));
10591
+				$query_values = array_merge($query_values, array(':month' => $month));
10592 10592
 			} else {
10593 10593
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10594
-				$query_values = array_merge($query_values,array(':month' => $month));
10594
+				$query_values = array_merge($query_values, array(':month' => $month));
10595 10595
 			}
10596 10596
 		}
10597 10597
 		$sth = $this->db->prepare($query);
@@ -10605,29 +10605,29 @@  discard block
 block discarded – undo
10605 10605
 	* @return Integer the number of owners
10606 10606
 	*
10607 10607
 	*/
10608
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10608
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10609 10609
 	{
10610 10610
 		global $globalDBdriver;
10611
-		$filter_query = $this->getFilter($filters,true,true);
10612
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10611
+		$filter_query = $this->getFilter($filters, true, true);
10612
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10613 10613
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10614 10614
 		$query_values = array();
10615 10615
 		if ($year != '') {
10616 10616
 			if ($globalDBdriver == 'mysql') {
10617 10617
 				$query .= " AND YEAR(spotter_output.date) = :year";
10618
-				$query_values = array_merge($query_values,array(':year' => $year));
10618
+				$query_values = array_merge($query_values, array(':year' => $year));
10619 10619
 			} else {
10620 10620
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10621
-				$query_values = array_merge($query_values,array(':year' => $year));
10621
+				$query_values = array_merge($query_values, array(':year' => $year));
10622 10622
 			}
10623 10623
 		}
10624 10624
 		if ($month != '') {
10625 10625
 			if ($globalDBdriver == 'mysql') {
10626 10626
 				$query .= " AND MONTH(spotter_output.date) = :month";
10627
-				$query_values = array_merge($query_values,array(':month' => $month));
10627
+				$query_values = array_merge($query_values, array(':month' => $month));
10628 10628
 			} else {
10629 10629
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10630
-				$query_values = array_merge($query_values,array(':month' => $month));
10630
+				$query_values = array_merge($query_values, array(':month' => $month));
10631 10631
 			}
10632 10632
 		}
10633 10633
 		$sth = $this->db->prepare($query);
@@ -10642,32 +10642,32 @@  discard block
 block discarded – undo
10642 10642
 	* @return Integer the number of flights
10643 10643
 	*
10644 10644
 	*/
10645
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10645
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10646 10646
 	{
10647 10647
 		global $globalDBdriver;
10648
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10648
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10649 10649
 		$query_values = array();
10650 10650
 		$query = '';
10651 10651
 		if ($year != '') {
10652 10652
 			if ($globalDBdriver == 'mysql') {
10653 10653
 				$query .= " AND YEAR(spotter_output.date) = :year";
10654
-				$query_values = array_merge($query_values,array(':year' => $year));
10654
+				$query_values = array_merge($query_values, array(':year' => $year));
10655 10655
 			} else {
10656 10656
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10657
-				$query_values = array_merge($query_values,array(':year' => $year));
10657
+				$query_values = array_merge($query_values, array(':year' => $year));
10658 10658
 			}
10659 10659
 		}
10660 10660
 		if ($month != '') {
10661 10661
 			if ($globalDBdriver == 'mysql') {
10662 10662
 				$query .= " AND MONTH(spotter_output.date) = :month";
10663
-				$query_values = array_merge($query_values,array(':month' => $month));
10663
+				$query_values = array_merge($query_values, array(':month' => $month));
10664 10664
 			} else {
10665 10665
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10666
-				$query_values = array_merge($query_values,array(':month' => $month));
10666
+				$query_values = array_merge($query_values, array(':month' => $month));
10667 10667
 			}
10668 10668
 		}
10669 10669
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10670
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10670
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10671 10671
 		
10672 10672
 		//echo $query;
10673 10673
 		$sth = $this->db->prepare($queryi);
@@ -10681,29 +10681,29 @@  discard block
 block discarded – undo
10681 10681
 	* @return Integer the number of flights
10682 10682
 	*
10683 10683
 	*/
10684
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10684
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
10685 10685
 	{
10686 10686
 		global $globalDBdriver;
10687
-		$filter_query = $this->getFilter($filters,true,true);
10688
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10687
+		$filter_query = $this->getFilter($filters, true, true);
10688
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10689 10689
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
10690 10690
 		$query_values = array();
10691 10691
 		if ($year != '') {
10692 10692
 			if ($globalDBdriver == 'mysql') {
10693 10693
 				$query .= " AND YEAR(spotter_output.date) = :year";
10694
-				$query_values = array_merge($query_values,array(':year' => $year));
10694
+				$query_values = array_merge($query_values, array(':year' => $year));
10695 10695
 			} else {
10696 10696
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10697
-				$query_values = array_merge($query_values,array(':year' => $year));
10697
+				$query_values = array_merge($query_values, array(':year' => $year));
10698 10698
 			}
10699 10699
 		}
10700 10700
 		if ($month != '') {
10701 10701
 			if ($globalDBdriver == 'mysql') {
10702 10702
 				$query .= " AND MONTH(spotter_output.date) = :month";
10703
-				$query_values = array_merge($query_values,array(':month' => $month));
10703
+				$query_values = array_merge($query_values, array(':month' => $month));
10704 10704
 			} else {
10705 10705
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10706
-				$query_values = array_merge($query_values,array(':month' => $month));
10706
+				$query_values = array_merge($query_values, array(':month' => $month));
10707 10707
 			}
10708 10708
 		}
10709 10709
       
@@ -10720,10 +10720,10 @@  discard block
 block discarded – undo
10720 10720
 	* @return Integer the number of airlines
10721 10721
 	*
10722 10722
 	*/
10723
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10723
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
10724 10724
 	{
10725 10725
 		global $globalDBdriver;
10726
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10726
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10727 10727
 							FROM spotter_output";
10728 10728
       
10729 10729
 		$query_values = array();
@@ -10731,23 +10731,23 @@  discard block
 block discarded – undo
10731 10731
 		if ($year != '') {
10732 10732
 			if ($globalDBdriver == 'mysql') {
10733 10733
 				$query .= " AND YEAR(spotter_output.date) = :year";
10734
-				$query_values = array_merge($query_values,array(':year' => $year));
10734
+				$query_values = array_merge($query_values, array(':year' => $year));
10735 10735
 			} else {
10736 10736
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10737
-				$query_values = array_merge($query_values,array(':year' => $year));
10737
+				$query_values = array_merge($query_values, array(':year' => $year));
10738 10738
 			}
10739 10739
 		}
10740 10740
 		if ($month != '') {
10741 10741
 			if ($globalDBdriver == 'mysql') {
10742 10742
 				$query .= " AND MONTH(spotter_output.date) = :month";
10743
-				$query_values = array_merge($query_values,array(':month' => $month));
10743
+				$query_values = array_merge($query_values, array(':month' => $month));
10744 10744
 			} else {
10745 10745
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10746
-				$query_values = array_merge($query_values,array(':month' => $month));
10746
+				$query_values = array_merge($query_values, array(':month' => $month));
10747 10747
 			}
10748 10748
 		}
10749 10749
                 if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10750
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10751 10751
 
10752 10752
 
10753 10753
 		$sth = $this->db->prepare($queryi);
@@ -10765,7 +10765,7 @@  discard block
 block discarded – undo
10765 10765
 	public function countAllHoursFromToday($filters = array())
10766 10766
 	{
10767 10767
 		global $globalTimezone, $globalDBdriver;
10768
-		$filter_query = $this->getFilter($filters,true,true);
10768
+		$filter_query = $this->getFilter($filters, true, true);
10769 10769
 		if ($globalTimezone != '') {
10770 10770
 			date_default_timezone_set($globalTimezone);
10771 10771
 			$datetime = new DateTime();
@@ -10773,12 +10773,12 @@  discard block
 block discarded – undo
10773 10773
 		} else $offset = '+00:00';
10774 10774
 
10775 10775
 		if ($globalDBdriver == 'mysql') {
10776
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10776
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10777 10777
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
10778 10778
 								GROUP BY hour_name 
10779 10779
 								ORDER BY hour_name ASC";
10780 10780
 		} else {
10781
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10781
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10782 10782
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
10783 10783
 								GROUP BY hour_name 
10784 10784
 								ORDER BY hour_name ASC";
@@ -10790,7 +10790,7 @@  discard block
 block discarded – undo
10790 10790
 		$hour_array = array();
10791 10791
 		$temp_array = array();
10792 10792
         
10793
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10793
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10794 10794
 		{
10795 10795
 			$temp_array['hour_name'] = $row['hour_name'];
10796 10796
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10809,14 +10809,14 @@  discard block
 block discarded – undo
10809 10809
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10810 10810
 	{
10811 10811
 		global $global_query, $globalDBdriver, $globalTimezone;
10812
-		$filter_query = $this->getFilter($filters,true,true);
10812
+		$filter_query = $this->getFilter($filters, true, true);
10813 10813
 		date_default_timezone_set('UTC');
10814 10814
 		$limit_query = '';
10815 10815
 		if ($limit != "")
10816 10816
 		{
10817 10817
 			$limit_array = explode(",", $limit);
10818
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
10819
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
10818
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
10819
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
10820 10820
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
10821 10821
 			{
10822 10822
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -10869,7 +10869,7 @@  discard block
 block discarded – undo
10869 10869
 			    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')
10870 10870
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
10871 10871
 			//echo $query;
10872
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
10872
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
10873 10873
 			/*
10874 10874
 			$sth = $this->db->prepare($query);
10875 10875
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -10888,9 +10888,9 @@  discard block
 block discarded – undo
10888 10888
 	*/
10889 10889
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10890 10890
 	{
10891
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
10891
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
10892 10892
 
10893
-		$query  = "SELECT spotter_output.spotter_id
10893
+		$query = "SELECT spotter_output.spotter_id
10894 10894
 								FROM spotter_output 
10895 10895
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
10896 10896
         
@@ -10898,7 +10898,7 @@  discard block
 block discarded – undo
10898 10898
 		$sth = $this->db->prepare($query);
10899 10899
 		$sth->execute();
10900 10900
 
10901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10902 10902
 		{
10903 10903
 			return $row['spotter_id'];
10904 10904
 		}
@@ -10923,23 +10923,23 @@  discard block
 block discarded – undo
10923 10923
 		}
10924 10924
 		
10925 10925
 		$current_date = date("Y-m-d H:i:s");
10926
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
10926
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
10927 10927
 		
10928 10928
 		$diff = abs(strtotime($current_date) - strtotime($date));
10929 10929
 
10930
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
10930
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
10931 10931
 		$years = $time_array['years'];
10932 10932
 		
10933
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
10933
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
10934 10934
 		$months = $time_array['months'];
10935 10935
 		
10936
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
10936
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
10937 10937
 		$days = $time_array['days'];
10938
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
10938
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
10939 10939
 		$hours = $time_array['hours'];
10940
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
10940
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
10941 10941
 		$minutes = $time_array['minutes'];
10942
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10942
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10943 10943
 		
10944 10944
 		return $time_array;	
10945 10945
 	}	
@@ -10965,63 +10965,63 @@  discard block
 block discarded – undo
10965 10965
 			$temp_array['direction_degree'] = $direction;
10966 10966
 			$temp_array['direction_shortname'] = "N";
10967 10967
 			$temp_array['direction_fullname'] = "North";
10968
-		} elseif ($direction >= 22.5 && $direction < 45){
10968
+		} elseif ($direction >= 22.5 && $direction < 45) {
10969 10969
 			$temp_array['direction_degree'] = $direction;
10970 10970
 			$temp_array['direction_shortname'] = "NNE";
10971 10971
 			$temp_array['direction_fullname'] = "North-Northeast";
10972
-		} elseif ($direction >= 45 && $direction < 67.5){
10972
+		} elseif ($direction >= 45 && $direction < 67.5) {
10973 10973
 			$temp_array['direction_degree'] = $direction;
10974 10974
 			$temp_array['direction_shortname'] = "NE";
10975 10975
 			$temp_array['direction_fullname'] = "Northeast";
10976
-		} elseif ($direction >= 67.5 && $direction < 90){
10976
+		} elseif ($direction >= 67.5 && $direction < 90) {
10977 10977
 			$temp_array['direction_degree'] = $direction;
10978 10978
 			$temp_array['direction_shortname'] = "ENE";
10979 10979
 			$temp_array['direction_fullname'] = "East-Northeast";
10980
-		} elseif ($direction >= 90 && $direction < 112.5){
10980
+		} elseif ($direction >= 90 && $direction < 112.5) {
10981 10981
 			$temp_array['direction_degree'] = $direction;
10982 10982
 			$temp_array['direction_shortname'] = "E";
10983 10983
 			$temp_array['direction_fullname'] = "East";
10984
-		} elseif ($direction >= 112.5 && $direction < 135){
10984
+		} elseif ($direction >= 112.5 && $direction < 135) {
10985 10985
 			$temp_array['direction_degree'] = $direction;
10986 10986
 			$temp_array['direction_shortname'] = "ESE";
10987 10987
 			$temp_array['direction_fullname'] = "East-Southeast";
10988
-		} elseif ($direction >= 135 && $direction < 157.5){
10988
+		} elseif ($direction >= 135 && $direction < 157.5) {
10989 10989
 			$temp_array['direction_degree'] = $direction;
10990 10990
 			$temp_array['direction_shortname'] = "SE";
10991 10991
 			$temp_array['direction_fullname'] = "Southeast";
10992
-		} elseif ($direction >= 157.5 && $direction < 180){
10992
+		} elseif ($direction >= 157.5 && $direction < 180) {
10993 10993
 			$temp_array['direction_degree'] = $direction;
10994 10994
 			$temp_array['direction_shortname'] = "SSE";
10995 10995
 			$temp_array['direction_fullname'] = "South-Southeast";
10996
-		} elseif ($direction >= 180 && $direction < 202.5){
10996
+		} elseif ($direction >= 180 && $direction < 202.5) {
10997 10997
 			$temp_array['direction_degree'] = $direction;
10998 10998
 			$temp_array['direction_shortname'] = "S";
10999 10999
 			$temp_array['direction_fullname'] = "South";
11000
-		} elseif ($direction >= 202.5 && $direction < 225){
11000
+		} elseif ($direction >= 202.5 && $direction < 225) {
11001 11001
 			$temp_array['direction_degree'] = $direction;
11002 11002
 			$temp_array['direction_shortname'] = "SSW";
11003 11003
 			$temp_array['direction_fullname'] = "South-Southwest";
11004
-		} elseif ($direction >= 225 && $direction < 247.5){
11004
+		} elseif ($direction >= 225 && $direction < 247.5) {
11005 11005
 			$temp_array['direction_degree'] = $direction;
11006 11006
 			$temp_array['direction_shortname'] = "SW";
11007 11007
 			$temp_array['direction_fullname'] = "Southwest";
11008
-		} elseif ($direction >= 247.5 && $direction < 270){
11008
+		} elseif ($direction >= 247.5 && $direction < 270) {
11009 11009
 			$temp_array['direction_degree'] = $direction;
11010 11010
 			$temp_array['direction_shortname'] = "WSW";
11011 11011
 			$temp_array['direction_fullname'] = "West-Southwest";
11012
-		} elseif ($direction >= 270 && $direction < 292.5){
11012
+		} elseif ($direction >= 270 && $direction < 292.5) {
11013 11013
 			$temp_array['direction_degree'] = $direction;
11014 11014
 			$temp_array['direction_shortname'] = "W";
11015 11015
 			$temp_array['direction_fullname'] = "West";
11016
-		} elseif ($direction >= 292.5 && $direction < 315){
11016
+		} elseif ($direction >= 292.5 && $direction < 315) {
11017 11017
 			$temp_array['direction_degree'] = $direction;
11018 11018
 			$temp_array['direction_shortname'] = "WNW";
11019 11019
 			$temp_array['direction_fullname'] = "West-Northwest";
11020
-		} elseif ($direction >= 315 && $direction < 337.5){
11020
+		} elseif ($direction >= 315 && $direction < 337.5) {
11021 11021
 			$temp_array['direction_degree'] = $direction;
11022 11022
 			$temp_array['direction_shortname'] = "NW";
11023 11023
 			$temp_array['direction_fullname'] = "Northwest";
11024
-		} elseif ($direction >= 337.5 && $direction < 360){
11024
+		} elseif ($direction >= 337.5 && $direction < 360) {
11025 11025
 			$temp_array['direction_degree'] = $direction;
11026 11026
 			$temp_array['direction_shortname'] = "NNW";
11027 11027
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11074,9 +11074,9 @@  discard block
 block discarded – undo
11074 11074
 	*/
11075 11075
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11076 11076
 	{
11077
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11077
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11078 11078
 	
11079
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11079
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11080 11080
 		
11081 11081
 		$sth = $this->db->prepare($query);
11082 11082
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11099,9 +11099,9 @@  discard block
 block discarded – undo
11099 11099
 	*/
11100 11100
 	public function getAircraftTypeBymodeS($aircraft_modes)
11101 11101
 	{
11102
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11102
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11103 11103
 	
11104
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11104
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11105 11105
 		
11106 11106
 		$sth = $this->db->prepare($query);
11107 11107
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11122,11 +11122,11 @@  discard block
 block discarded – undo
11122 11122
 	* @param Float $longitude longitute of the flight
11123 11123
 	* @return String the countrie
11124 11124
 	*/
11125
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11125
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11126 11126
 	{
11127 11127
 		global $globalDBdriver, $globalDebug;
11128
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11129
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11128
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11129
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11130 11130
 	
11131 11131
 		$Connection = new Connection($this->db);
11132 11132
 		if (!$Connection->tableExists('countries')) return '';
@@ -11166,7 +11166,7 @@  discard block
 block discarded – undo
11166 11166
 	public function getCountryFromISO2($iso2)
11167 11167
 	{
11168 11168
 		global $globalDBdriver, $globalDebug;
11169
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11169
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11170 11170
 	
11171 11171
 		$Connection = new Connection($this->db);
11172 11172
 		if (!$Connection->tableExists('countries')) return '';
@@ -11198,19 +11198,19 @@  discard block
 block discarded – undo
11198 11198
 	*/
11199 11199
 	public function convertAircraftRegistration($registration)
11200 11200
 	{
11201
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11201
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11202 11202
 		$registration_prefix = '';
11203 11203
 		$registration_1 = substr($registration, 0, 1);
11204 11204
 		$registration_2 = substr($registration, 0, 2);
11205 11205
 
11206 11206
 		//first get the prefix based on two characters
11207
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11207
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11208 11208
       
11209 11209
 		
11210 11210
 		$sth = $this->db->prepare($query);
11211 11211
 		$sth->execute(array(':registration_2' => $registration_2));
11212 11212
         
11213
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11213
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11214 11214
 		{
11215 11215
 			$registration_prefix = $row['registration_prefix'];
11216 11216
 		}
@@ -11218,11 +11218,11 @@  discard block
 block discarded – undo
11218 11218
 		//if we didn't find a two chracter prefix lets just search the one with one character
11219 11219
 		if ($registration_prefix == '')
11220 11220
 		{
11221
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11221
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11222 11222
 			$sth = $this->db->prepare($query);
11223 11223
 			$sth->execute(array(':registration_1' => $registration_1));
11224 11224
 	        
11225
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11225
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11226 11226
 			{
11227 11227
 				$registration_prefix = $row['registration_prefix'];
11228 11228
 			}
@@ -11236,7 +11236,7 @@  discard block
 block discarded – undo
11236 11236
 			} else {
11237 11237
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11238 11238
 			}
11239
-		} else if(strlen($registration_prefix) == 2){
11239
+		} else if (strlen($registration_prefix) == 2) {
11240 11240
 			if (0 === strpos($registration, 'N')) {
11241 11241
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11242 11242
 			} else {
@@ -11255,17 +11255,17 @@  discard block
 block discarded – undo
11255 11255
 	*/
11256 11256
 	public function countryFromAircraftRegistration($registration)
11257 11257
 	{
11258
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11258
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11259 11259
 		
11260 11260
 		$registration_prefix = '';
11261
-		$registration_test = explode('-',$registration);
11261
+		$registration_test = explode('-', $registration);
11262 11262
 		$country = '';
11263 11263
 		if ($registration_test[0] != $registration) {
11264 11264
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11265 11265
 	      
11266 11266
 			$sth = $this->db->prepare($query);
11267 11267
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11268
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11268
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11269 11269
 			{
11270 11270
 				//$registration_prefix = $row['registration_prefix'];
11271 11271
 				$country = $row['country'];
@@ -11276,13 +11276,13 @@  discard block
 block discarded – undo
11276 11276
 
11277 11277
 			$country = '';
11278 11278
 			//first get the prefix based on two characters
11279
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11279
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11280 11280
       
11281 11281
 			
11282 11282
 			$sth = $this->db->prepare($query);
11283 11283
 			$sth->execute(array(':registration_2' => $registration_2));
11284 11284
         
11285
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11285
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11286 11286
 			{
11287 11287
 				$registration_prefix = $row['registration_prefix'];
11288 11288
 				$country = $row['country'];
@@ -11291,12 +11291,12 @@  discard block
 block discarded – undo
11291 11291
 			//if we didn't find a two chracter prefix lets just search the one with one character
11292 11292
 			if ($registration_prefix == "")
11293 11293
 			{
11294
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11294
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11295 11295
 	      
11296 11296
 				$sth = $this->db->prepare($query);
11297 11297
 				$sth->execute(array(':registration_1' => $registration_1));
11298 11298
 	        
11299
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11299
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11300 11300
 				{
11301 11301
 					//$registration_prefix = $row['registration_prefix'];
11302 11302
 					$country = $row['country'];
@@ -11316,17 +11316,17 @@  discard block
 block discarded – undo
11316 11316
 	*/
11317 11317
 	public function registrationPrefixFromAircraftRegistration($registration)
11318 11318
 	{
11319
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11319
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11320 11320
 		
11321 11321
 		$registration_prefix = '';
11322
-		$registration_test = explode('-',$registration);
11322
+		$registration_test = explode('-', $registration);
11323 11323
 		//$country = '';
11324 11324
 		if ($registration_test[0] != $registration) {
11325
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11325
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11326 11326
 	      
11327 11327
 			$sth = $this->db->prepare($query);
11328 11328
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11329
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11329
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11330 11330
 			{
11331 11331
 				$registration_prefix = $row['registration_prefix'];
11332 11332
 				//$country = $row['country'];
@@ -11336,13 +11336,13 @@  discard block
 block discarded – undo
11336 11336
 		        $registration_2 = substr($registration, 0, 2);
11337 11337
 
11338 11338
 			//first get the prefix based on two characters
11339
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11339
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11340 11340
       
11341 11341
 			
11342 11342
 			$sth = $this->db->prepare($query);
11343 11343
 			$sth->execute(array(':registration_2' => $registration_2));
11344 11344
         
11345
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11345
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11346 11346
 			{
11347 11347
 				$registration_prefix = $row['registration_prefix'];
11348 11348
 				//$country = $row['country'];
@@ -11351,12 +11351,12 @@  discard block
 block discarded – undo
11351 11351
 			//if we didn't find a two chracter prefix lets just search the one with one character
11352 11352
 			if ($registration_prefix == "")
11353 11353
 			{
11354
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11354
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11355 11355
 	      
11356 11356
 				$sth = $this->db->prepare($query);
11357 11357
 				$sth->execute(array(':registration_1' => $registration_1));
11358 11358
 	        
11359
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11359
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11360 11360
 				{
11361 11361
 					$registration_prefix = $row['registration_prefix'];
11362 11362
 					//$country = $row['country'];
@@ -11377,13 +11377,13 @@  discard block
 block discarded – undo
11377 11377
 	*/
11378 11378
 	public function countryFromAircraftRegistrationCode($registration)
11379 11379
 	{
11380
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11380
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11381 11381
 		
11382 11382
 		$country = '';
11383
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11383
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11384 11384
 		$sth = $this->db->prepare($query);
11385 11385
 		$sth->execute(array(':registration' => $registration));
11386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11387 11387
 		{
11388 11388
 			$country = $row['country'];
11389 11389
 		}
@@ -11396,9 +11396,9 @@  discard block
 block discarded – undo
11396 11396
 	* @param String $flightaware_id flightaware_id from spotter_output table
11397 11397
 	* @param String $highlight New highlight value
11398 11398
 	*/
11399
-	public function setHighlightFlight($flightaware_id,$highlight) {
11399
+	public function setHighlightFlight($flightaware_id, $highlight) {
11400 11400
 		
11401
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11401
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11402 11402
 		$sth = $this->db->prepare($query);
11403 11403
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11404 11404
 	}
@@ -11410,13 +11410,13 @@  discard block
 block discarded – undo
11410 11410
 	* @param String $date Date of spotted aircraft
11411 11411
 	* @param String $highlight New highlight value
11412 11412
 	*/
11413
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11413
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11414 11414
 		if ($date == '') {
11415 11415
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11416 11416
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11417 11417
 		} else {
11418 11418
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11419
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11419
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11420 11420
 		}
11421 11421
 		$sth = $this->db->prepare($query);
11422 11422
 		$sth->execute($query_values);
@@ -11446,7 +11446,7 @@  discard block
 block discarded – undo
11446 11446
 		
11447 11447
 		$bitly_data = json_decode($bitly_data);
11448 11448
 		$bitly_url = '';
11449
-		if ($bitly_data->status_txt = "OK"){
11449
+		if ($bitly_data->status_txt = "OK") {
11450 11450
 			$bitly_url = $bitly_data->data->url;
11451 11451
 		}
11452 11452
 
@@ -11456,7 +11456,7 @@  discard block
 block discarded – undo
11456 11456
 
11457 11457
 	public function getOrderBy()
11458 11458
 	{
11459
-		$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"));
11459
+		$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"));
11460 11460
 		
11461 11461
 		return $orderby;
11462 11462
 		
@@ -11590,14 +11590,14 @@  discard block
 block discarded – undo
11590 11590
 		}
11591 11591
 		$sth = $this->db->prepare($query);
11592 11592
 		$sth->execute();
11593
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11593
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11594 11594
 		{
11595 11595
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11596 11596
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11597 11597
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11598
-				$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";
11598
+				$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";
11599 11599
 				$sthu = $this->db->prepare($update_query);
11600
-				$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']));
11600
+				$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']));
11601 11601
 			}
11602 11602
 		}
11603 11603
 		
@@ -11610,7 +11610,7 @@  discard block
 block discarded – undo
11610 11610
 		}
11611 11611
 		$sth = $this->db->prepare($query);
11612 11612
 		$sth->execute();
11613
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11613
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11614 11614
 		{
11615 11615
 			if (is_numeric(substr($row['ident'], -1, 1)))
11616 11616
 			{
@@ -11619,11 +11619,11 @@  discard block
 block discarded – undo
11619 11619
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11620 11620
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11621 11621
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11622
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11622
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11623 11623
 				if (isset($airline_array[0]['name'])) {
11624
-					$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";
11624
+					$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";
11625 11625
 					$sthu = $this->db->prepare($update_query);
11626
-					$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']));
11626
+					$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']));
11627 11627
 				}
11628 11628
 			}
11629 11629
 		}
@@ -11643,18 +11643,18 @@  discard block
 block discarded – undo
11643 11643
 		}
11644 11644
 		$sth = $this->db->prepare($query);
11645 11645
 		$sth->execute();
11646
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11646
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11647 11647
 		{
11648 11648
 			if ($row['aircraft_icao'] != '') {
11649 11649
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11650
-				if ($row['registration'] != ""){
11650
+				if ($row['registration'] != "") {
11651 11651
 					$image_array = $Image->getSpotterImage($row['registration']);
11652 11652
 					if (!isset($image_array[0]['registration'])) {
11653 11653
 						$Image->addSpotterImage($row['registration']);
11654 11654
 					}
11655 11655
 				}
11656 11656
 				if (count($aircraft_name) > 0) {
11657
-					$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";
11657
+					$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";
11658 11658
 					$sthu = $this->db->prepare($update_query);
11659 11659
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11660 11660
 				}
@@ -11669,10 +11669,10 @@  discard block
 block discarded – undo
11669 11669
 		$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";
11670 11670
 		$sth = $this->db->prepare($query);
11671 11671
 		$sth->execute();
11672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11673 11673
 		{
11674 11674
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
11675
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
11675
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
11676 11676
 				$airport_icao = '';
11677 11677
 				 if (isset($closestAirports[0])) {
11678 11678
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -11686,7 +11686,7 @@  discard block
 block discarded – undo
11686 11686
 								break;
11687 11687
 							}
11688 11688
 						}
11689
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11689
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
11690 11690
 						$airport_icao = $closestAirports[0]['icao'];
11691 11691
 						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";
11692 11692
 					} else {
@@ -11697,28 +11697,28 @@  discard block
 block discarded – undo
11697 11697
 				}
11698 11698
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11699 11699
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
11700
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11700
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11701 11701
 					$sthu = $this->db->prepare($update_query);
11702
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
11702
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
11703 11703
 				}
11704 11704
 			}
11705 11705
 		}
11706 11706
 	}
11707 11707
 	
11708
-	public function closestAirports($origLat,$origLon,$dist = 10) {
11708
+	public function closestAirports($origLat, $origLon, $dist = 10) {
11709 11709
 		global $globalDBdriver;
11710
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
11710
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
11711 11711
 /*
11712 11712
 		$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 
11713 11713
                       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)) 
11714 11714
                       having distance < $dist ORDER BY distance limit 100;";
11715 11715
 */
11716 11716
 		if ($globalDBdriver == 'mysql') {
11717
-			$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 
11717
+			$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 
11718 11718
 	                      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)) 
11719 11719
 	                      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;";
11720 11720
                 } else {
11721
-			$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 
11721
+			$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 
11722 11722
 	                      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)) 
11723 11723
 	                      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;";
11724 11724
     		}
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveSpotterData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Gets Minimal Live Spotter data since xx seconds
193
-	*
194
-	* @return Array the spotter information
195
-	*
196
-	*/
192
+	 * Gets Minimal Live Spotter data since xx seconds
193
+	 *
194
+	 * @return Array the spotter information
195
+	 *
196
+	 */
197 197
 	public function getMinLastLiveSpotterData($filter = array())
198 198
 	{
199 199
 		global $globalDBdriver, $globalLiveInterval;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
212 212
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
213 213
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
214
-                } else {
214
+				} else {
215 215
 /*
216 216
 			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
217 217
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 //			echo $query;
224 224
 		}
225 225
 
226
-    		try {
226
+			try {
227 227
 			$sth = $this->db->prepare($query);
228 228
 			$sth->execute();
229 229
 		} catch(PDOException $e) {
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	/**
238
-	* Gets number of latest data entry
239
-	*
240
-	* @return String number of entry
241
-	*
242
-	*/
238
+	 * Gets number of latest data entry
239
+	 *
240
+	 * @return String number of entry
241
+	 *
242
+	 */
243 243
 	public function getLiveSpotterCount($filter = array())
244 244
 	{
245 245
 		global $globalDBdriver, $globalLiveInterval;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the latest data entry and coord
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the latest data entry and coord
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
275 275
 	{
276 276
 		global $globalDBdriver, $globalLiveInterval;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	}
296 296
 
297 297
 	/**
298
-	* Gets all the spotter information based on a user's latitude and longitude
299
-	*
300
-	* @return Array the spotter information
301
-	*
302
-	*/
298
+	 * Gets all the spotter information based on a user's latitude and longitude
299
+	 *
300
+	 * @return Array the spotter information
301
+	 *
302
+	 */
303 303
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
304 304
 	{
305 305
 		$Spotter = new Spotter($this->db);
@@ -309,145 +309,145 @@  discard block
 block discarded – undo
309 309
 				return false;
310 310
 			}
311 311
 		}
312
-        if ($lng != '')
313
-                {
314
-                        if (!is_numeric($lng))
315
-                        {
316
-                                return false;
317
-                        }
318
-                }
319
-
320
-                if ($radius != '')
321
-                {
322
-                        if (!is_numeric($radius))
323
-                        {
324
-                                return false;
325
-                        }
326
-                }
312
+		if ($lng != '')
313
+				{
314
+						if (!is_numeric($lng))
315
+						{
316
+								return false;
317
+						}
318
+				}
319
+
320
+				if ($radius != '')
321
+				{
322
+						if (!is_numeric($radius))
323
+						{
324
+								return false;
325
+						}
326
+				}
327 327
 		$additional_query = '';
328
-        if ($interval != '')
329
-                {
330
-                        if (!is_string($interval))
331
-                        {
332
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
-			        return false;
334
-                        } else {
335
-                if ($interval == '1m')
336
-                {
337
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
-                } else if ($interval == '15m'){
339
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
-                } 
341
-            }
342
-                } else {
343
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
-        }
345
-
346
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
328
+		if ($interval != '')
329
+				{
330
+						if (!is_string($interval))
331
+						{
332
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
+					return false;
334
+						} else {
335
+				if ($interval == '1m')
336
+				{
337
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
+				} else if ($interval == '15m'){
339
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
+				} 
341
+			}
342
+				} else {
343
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
+		}
345
+
346
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
347 347
                    WHERE spotter_live.latitude <> '' 
348 348
                                    AND spotter_live.longitude <> '' 
349 349
                    ".$additional_query."
350 350
                    HAVING distance < :radius  
351 351
                                    ORDER BY distance";
352 352
 
353
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
353
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
354 354
 
355
-                return $spotter_array;
356
-        }
355
+				return $spotter_array;
356
+		}
357 357
 
358 358
     
359
-        /**
360
-	* Gets all the spotter information based on a particular callsign
361
-	*
362
-	* @return Array the spotter information
363
-	*
364
-	*/
359
+		/**
360
+		 * Gets all the spotter information based on a particular callsign
361
+		 *
362
+		 * @return Array the spotter information
363
+		 *
364
+		 */
365 365
 	public function getLastLiveSpotterDataByIdent($ident)
366 366
 	{
367 367
 		$Spotter = new Spotter($this->db);
368 368
 		date_default_timezone_set('UTC');
369 369
 
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
372 372
 
373 373
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
377 377
 
378
-        /**
379
-	* Gets all the spotter information based on a particular callsign
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
378
+		/**
379
+		 * Gets all the spotter information based on a particular callsign
380
+		 *
381
+		 * @return Array the spotter information
382
+		 *
383
+		 */
384 384
 	public function getDateLiveSpotterDataByIdent($ident,$date)
385 385
 	{
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-                $date = date('c',$date);
392
+				$date = date('c',$date);
393 393
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
394 394
 
395 395
 		return $spotter_array;
396 396
 	}
397 397
 
398
-        /**
399
-	* Gets last spotter information based on a particular callsign
400
-	*
401
-	* @return Array the spotter information
402
-	*
403
-	*/
398
+		/**
399
+		 * Gets last spotter information based on a particular callsign
400
+		 *
401
+		 * @return Array the spotter information
402
+		 *
403
+		 */
404 404
 	public function getLastLiveSpotterDataById($id)
405 405
 	{
406 406
 		$Spotter = new Spotter($this->db);
407 407
 		date_default_timezone_set('UTC');
408 408
 
409 409
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
410
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
411 411
 
412 412
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
413 413
 
414 414
 		return $spotter_array;
415 415
 	}
416 416
 
417
-        /**
418
-	* Gets last spotter information based on a particular callsign
419
-	*
420
-	* @return Array the spotter information
421
-	*
422
-	*/
417
+		/**
418
+		 * Gets last spotter information based on a particular callsign
419
+		 *
420
+		 * @return Array the spotter information
421
+		 *
422
+		 */
423 423
 	public function getDateLiveSpotterDataById($id,$date)
424 424
 	{
425 425
 		$Spotter = new Spotter($this->db);
426 426
 		date_default_timezone_set('UTC');
427 427
 
428 428
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
429
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
-                $date = date('c',$date);
429
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
+				$date = date('c',$date);
431 431
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
432 432
 
433 433
 		return $spotter_array;
434 434
 	}
435 435
 
436
-        /**
437
-	* Gets altitude information based on a particular callsign
438
-	*
439
-	* @return Array the spotter information
440
-	*
441
-	*/
436
+		/**
437
+		 * Gets altitude information based on a particular callsign
438
+		 *
439
+		 * @return Array the spotter information
440
+		 *
441
+		 */
442 442
 	public function getAltitudeLiveSpotterDataByIdent($ident)
443 443
 	{
444 444
 
445 445
 		date_default_timezone_set('UTC');
446 446
 
447 447
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
448
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
448
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
449 449
 
450
-    		try {
450
+			try {
451 451
 			
452 452
 			$sth = $this->db->prepare($query);
453 453
 			$sth->execute(array(':ident' => $ident));
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 		return $spotter_array;
461 461
 	}
462 462
 
463
-        /**
464
-	* Gets all the spotter information based on a particular id
465
-	*
466
-	* @return Array the spotter information
467
-	*
468
-	*/
463
+		/**
464
+		 * Gets all the spotter information based on a particular id
465
+		 *
466
+		 * @return Array the spotter information
467
+		 *
468
+		 */
469 469
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
470 470
 	{
471 471
 		global $globalDBdriver, $globalLiveInterval;
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 		return $spotter_array;
494 494
 	}
495 495
 
496
-        /**
497
-	* Gets all the spotter information based on a particular ident
498
-	*
499
-	* @return Array the spotter information
500
-	*
501
-	*/
496
+		/**
497
+		 * Gets all the spotter information based on a particular ident
498
+		 *
499
+		 * @return Array the spotter information
500
+		 *
501
+		 */
502 502
 	public function getAllLiveSpotterDataByIdent($ident)
503 503
 	{
504 504
 		date_default_timezone_set('UTC');
505 505
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
506 506
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
507
-    		try {
507
+			try {
508 508
 			
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':ident' => $ident));
@@ -518,23 +518,23 @@  discard block
 block discarded – undo
518 518
 
519 519
 
520 520
 	/**
521
-	* Deletes all info in the table
522
-	*
523
-	* @return String success or false
524
-	*
525
-	*/
521
+	 * Deletes all info in the table
522
+	 *
523
+	 * @return String success or false
524
+	 *
525
+	 */
526 526
 	public function deleteLiveSpotterData()
527 527
 	{
528 528
 		global $globalDBdriver;
529 529
 		if ($globalDBdriver == 'mysql') {
530 530
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
531 531
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
532
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
532
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
533 533
 		} else {
534 534
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
535 535
 		}
536 536
         
537
-    		try {
537
+			try {
538 538
 			
539 539
 			$sth = $this->db->prepare($query);
540 540
 			$sth->execute();
@@ -546,18 +546,18 @@  discard block
 block discarded – undo
546 546
 	}
547 547
 
548 548
 	/**
549
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
550
-	*
551
-	* @return String success or false
552
-	*
553
-	*/
549
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
550
+	 *
551
+	 * @return String success or false
552
+	 *
553
+	 */
554 554
 	public function deleteLiveSpotterDataNotUpdated()
555 555
 	{
556 556
 		global $globalDBdriver, $globalDebug;
557 557
 		if ($globalDBdriver == 'mysql') {
558 558
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
559
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
-    			try {
559
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
+				try {
561 561
 				
562 562
 				$sth = $this->db->prepare($query);
563 563
 				$sth->execute();
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				return "error";
566 566
 			}
567 567
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
568
-                        $i = 0;
569
-                        $j =0;
568
+						$i = 0;
569
+						$j =0;
570 570
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
571 571
 			foreach($all as $row)
572 572
 			{
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
 				$j++;
575 575
 				if ($j == 30) {
576 576
 					if ($globalDebug) echo ".";
577
-				    	try {
577
+						try {
578 578
 						
579 579
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
580 580
 						$sth->execute();
581 581
 					} catch(PDOException $e) {
582 582
 						return "error";
583 583
 					}
584
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
-                                	$j = 0;
584
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
+									$j = 0;
586 586
 				}
587 587
 				$query_delete .= "'".$row['flightaware_id']."',";
588 588
 			}
589 589
 			if ($i > 0) {
590
-    				try {
590
+					try {
591 591
 					
592 592
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
593 593
 					$sth->execute();
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 			return "success";
599 599
 		} elseif ($globalDBdriver == 'pgsql') {
600 600
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
601
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
-    			try {
601
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
+				try {
604 604
 				
605 605
 				$sth = $this->db->prepare($query);
606 606
 				$sth->execute();
@@ -644,17 +644,17 @@  discard block
 block discarded – undo
644 644
 	}
645 645
 
646 646
 	/**
647
-	* Deletes all info in the table for an ident
648
-	*
649
-	* @return String success or false
650
-	*
651
-	*/
647
+	 * Deletes all info in the table for an ident
648
+	 *
649
+	 * @return String success or false
650
+	 *
651
+	 */
652 652
 	public function deleteLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
655 655
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
656 656
         
657
-    		try {
657
+			try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
 	}
667 667
 
668 668
 	/**
669
-	* Deletes all info in the table for an id
670
-	*
671
-	* @return String success or false
672
-	*
673
-	*/
669
+	 * Deletes all info in the table for an id
670
+	 *
671
+	 * @return String success or false
672
+	 *
673
+	 */
674 674
 	public function deleteLiveSpotterDataById($id)
675 675
 	{
676 676
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
677 677
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
678 678
         
679
-    		try {
679
+			try {
680 680
 			
681 681
 			$sth = $this->db->prepare($query);
682 682
 			$sth->execute(array(':id' => $id));
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 	/**
692
-	* Gets the aircraft ident within the last hour
693
-	*
694
-	* @return String the ident
695
-	*
696
-	*/
692
+	 * Gets the aircraft ident within the last hour
693
+	 *
694
+	 * @return String the ident
695
+	 *
696
+	 */
697 697
 	public function getIdentFromLastHour($ident)
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 			$ident_result = $row['ident'];
720 720
 		}
721 721
 		return $ident_result;
722
-        }
722
+		}
723 723
 
724 724
 	/**
725
-	* Check recent aircraft
726
-	*
727
-	* @return String the ident
728
-	*
729
-	*/
725
+	 * Check recent aircraft
726
+	 *
727
+	 * @return String the ident
728
+	 *
729
+	 */
730 730
 	public function checkIdentRecent($ident)
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
 			$ident_result = $row['flightaware_id'];
753 753
 		}
754 754
 		return $ident_result;
755
-        }
755
+		}
756 756
 
757 757
 	/**
758
-	* Check recent aircraft by id
759
-	*
760
-	* @return String the ident
761
-	*
762
-	*/
758
+	 * Check recent aircraft by id
759
+	 *
760
+	 * @return String the ident
761
+	 *
762
+	 */
763 763
 	public function checkIdRecent($id)
764 764
 	{
765 765
 		global $globalDBdriver, $globalTimezone;
@@ -785,14 +785,14 @@  discard block
 block discarded – undo
785 785
 			$ident_result = $row['flightaware_id'];
786 786
 		}
787 787
 		return $ident_result;
788
-        }
788
+		}
789 789
 
790 790
 	/**
791
-	* Check recent aircraft by ModeS
792
-	*
793
-	* @return String the ModeS
794
-	*
795
-	*/
791
+	 * Check recent aircraft by ModeS
792
+	 *
793
+	 * @return String the ModeS
794
+	 *
795
+	 */
796 796
 	public function checkModeSRecent($modes)
797 797
 	{
798 798
 		global $globalDBdriver, $globalTimezone;
@@ -819,19 +819,19 @@  discard block
 block discarded – undo
819 819
 			$ident_result = $row['flightaware_id'];
820 820
 		}
821 821
 		return $ident_result;
822
-        }
822
+		}
823 823
 
824 824
 	/**
825
-	* Adds a new spotter data
826
-	*
827
-	* @param String $flightaware_id the ID from flightaware
828
-	* @param String $ident the flight ident
829
-	* @param String $aircraft_icao the aircraft type
830
-	* @param String $departure_airport_icao the departure airport
831
-	* @param String $arrival_airport_icao the arrival airport
832
-	* @return String success or false
833
-	*
834
-	*/
825
+	 * Adds a new spotter data
826
+	 *
827
+	 * @param String $flightaware_id the ID from flightaware
828
+	 * @param String $ident the flight ident
829
+	 * @param String $aircraft_icao the aircraft type
830
+	 * @param String $departure_airport_icao the departure airport
831
+	 * @param String $arrival_airport_icao the arrival airport
832
+	 * @return String success or false
833
+	 *
834
+	 */
835 835
 	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
836 836
 	{
837 837
 		global $globalURL, $globalArchive, $globalDebug;
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 		$arrival_airport_country = '';
967 967
 		
968 968
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
969
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
973 973
             	
974 974
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 975
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -979,14 +979,14 @@  discard block
 block discarded – undo
979 979
 			
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-                } catch(PDOException $e) {
983
-                	return "error : ".$e->getMessage();
984
-                }
982
+				} catch(PDOException $e) {
983
+					return "error : ".$e->getMessage();
984
+				}
985 985
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986
-		    if ($globalDebug) echo '(Add to SBS archive : ';
987
-		    $SpotterArchive = new SpotterArchive($this->db);
988
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
-		    if ($globalDebug) echo $result.')';
986
+			if ($globalDebug) echo '(Add to SBS archive : ';
987
+			$SpotterArchive = new SpotterArchive($this->db);
988
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
+			if ($globalDebug) echo $result.')';
990 990
 		}
991 991
 		return "success";
992 992
 
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,45 +16,45 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 				if ($flt['airlines'][0] != '') {
35 35
 					if (isset($flt['source'])) {
36
-						$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_live.flightaware_id";
36
+						$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_live.flightaware_id";
37 37
 					} else {
38
-						$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_live.flightaware_id";
38
+						$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_live.flightaware_id";
39 39
 					}
40 40
 				}
41 41
 			}
42 42
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
43 43
 				if (isset($flt['source'])) {
44
-					$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_live.flightaware_id";
44
+					$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_live.flightaware_id";
45 45
 				} else {
46
-					$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_live.flightaware_id";
46
+					$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_live.flightaware_id";
47 47
 				}
48 48
 			}
49 49
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
50 50
 				if (isset($flt['source'])) {
51
-					$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_live.flightaware_id";
51
+					$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_live.flightaware_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
56 56
 			if ($filter['airlines'][0] != '') {
57
-				$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_live.flightaware_id";
57
+				$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_live.flightaware_id";
58 58
 			}
59 59
 		}
60 60
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
65 65
 		}
66 66
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
67
-			$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_live.flightaware_id";
67
+			$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_live.flightaware_id";
68 68
 		}
69 69
 		if (isset($filter['source']) && !empty($filter['source'])) {
70
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
70
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
71 71
 		}
72 72
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
73 73
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
74 74
 		}
75 75
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
76 76
 			if ($filter_query_where == '') {
77
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 			} else {
79
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
79
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
80 80
 			}
81 81
 		}
82 82
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
154 154
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
155 155
 */
156
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
156
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
157 157
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
158 158
 
159 159
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
169 169
 */
170 170
 
171
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
171
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
172 172
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
173 173
 
174 174
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		try {
180 180
 			$sth = $this->db->prepare($query);
181 181
 			$sth->execute();
182
-		} catch(PDOException $e) {
182
+		} catch (PDOException $e) {
183 183
 			echo $e->getMessage();
184 184
 			die;
185 185
 		}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		global $globalDBdriver, $globalLiveInterval;
200 200
 		date_default_timezone_set('UTC');
201 201
 
202
-		$filter_query = $this->getFilter($filter,true,true);
202
+		$filter_query = $this->getFilter($filter, true, true);
203 203
 
204 204
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
205 205
 		if ($globalDBdriver == 'mysql') {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
209 209
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
210 210
 */
211
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
211
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
212 212
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
213 213
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
214 214
                 } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
218 218
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
219 219
 */
220
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
220
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
221 221
 			FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
222 222
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
223 223
 //			echo $query;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     		try {
227 227
 			$sth = $this->db->prepare($query);
228 228
 			$sth->execute();
229
-		} catch(PDOException $e) {
229
+		} catch (PDOException $e) {
230 230
 			echo $e->getMessage();
231 231
 			die;
232 232
 		}
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	public function getLiveSpotterCount($filter = array())
244 244
 	{
245 245
 		global $globalDBdriver, $globalLiveInterval;
246
-		$filter_query = $this->getFilter($filter,true,true);
246
+		$filter_query = $this->getFilter($filter, true, true);
247 247
 
248 248
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
249 249
 		if ($globalDBdriver == 'mysql') {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		try {
257 257
 			$sth = $this->db->prepare($query);
258 258
 			$sth->execute();
259
-		} catch(PDOException $e) {
259
+		} catch (PDOException $e) {
260 260
 			echo $e->getMessage();
261 261
 			die;
262 262
 		}
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 		$filter_query = $this->getFilter($filter);
280 280
 
281 281
 		if (is_array($coord)) {
282
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
283
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
284
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
285
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
282
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
283
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
284
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
285
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
286 286
 		} else return array();
287 287
 		if ($globalDBdriver == 'mysql') {
288 288
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 if ($interval == '1m')
336 336
                 {
337 337
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
-                } else if ($interval == '15m'){
338
+                } else if ($interval == '15m') {
339 339
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340 340
                 } 
341 341
             }
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344 344
         }
345 345
 
346
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
346
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
347 347
                    WHERE spotter_live.latitude <> '' 
348 348
                                    AND spotter_live.longitude <> '' 
349 349
                    ".$additional_query."
350 350
                    HAVING distance < :radius  
351 351
                                    ORDER BY distance";
352 352
 
353
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
353
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
354 354
 
355 355
                 return $spotter_array;
356 356
         }
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 		date_default_timezone_set('UTC');
369 369
 
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
372 372
 
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
 	* @return Array the spotter information
382 382
 	*
383 383
 	*/
384
-	public function getDateLiveSpotterDataByIdent($ident,$date)
384
+	public function getDateLiveSpotterDataByIdent($ident, $date)
385 385
 	{
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-                $date = date('c',$date);
393
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
392
+                $date = date('c', $date);
393
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
394 394
 
395 395
 		return $spotter_array;
396 396
 	}
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 		date_default_timezone_set('UTC');
408 408
 
409 409
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
410
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
411 411
 
412
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
412
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
413 413
 
414 414
 		return $spotter_array;
415 415
 	}
@@ -420,15 +420,15 @@  discard block
 block discarded – undo
420 420
 	* @return Array the spotter information
421 421
 	*
422 422
 	*/
423
-	public function getDateLiveSpotterDataById($id,$date)
423
+	public function getDateLiveSpotterDataById($id, $date)
424 424
 	{
425 425
 		$Spotter = new Spotter($this->db);
426 426
 		date_default_timezone_set('UTC');
427 427
 
428 428
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
429
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
-                $date = date('c',$date);
431
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
429
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
+                $date = date('c', $date);
431
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
432 432
 
433 433
 		return $spotter_array;
434 434
 	}
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
 		date_default_timezone_set('UTC');
446 446
 
447 447
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
448
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
448
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
449 449
 
450 450
     		try {
451 451
 			
452 452
 			$sth = $this->db->prepare($query);
453 453
 			$sth->execute(array(':ident' => $ident));
454
-		} catch(PDOException $e) {
454
+		} catch (PDOException $e) {
455 455
 			echo $e->getMessage();
456 456
 			die;
457 457
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	* @return Array the spotter information
467 467
 	*
468 468
 	*/
469
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
469
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
470 470
 	{
471 471
 		global $globalDBdriver, $globalLiveInterval;
472 472
 		date_default_timezone_set('UTC');
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		try {
486 486
 			$sth = $this->db->prepare($query);
487 487
 			$sth->execute(array(':id' => $id));
488
-		} catch(PDOException $e) {
488
+		} catch (PDOException $e) {
489 489
 			echo $e->getMessage();
490 490
 			die;
491 491
 		}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 	{
504 504
 		date_default_timezone_set('UTC');
505 505
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
506
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
506
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
507 507
     		try {
508 508
 			
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':ident' => $ident));
511
-		} catch(PDOException $e) {
511
+		} catch (PDOException $e) {
512 512
 			echo $e->getMessage();
513 513
 			die;
514 514
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 			
539 539
 			$sth = $this->db->prepare($query);
540 540
 			$sth->execute();
541
-		} catch(PDOException $e) {
541
+		} catch (PDOException $e) {
542 542
 			return "error";
543 543
 		}
544 544
 
@@ -561,14 +561,14 @@  discard block
 block discarded – undo
561 561
 				
562 562
 				$sth = $this->db->prepare($query);
563 563
 				$sth->execute();
564
-			} catch(PDOException $e) {
564
+			} catch (PDOException $e) {
565 565
 				return "error";
566 566
 			}
567 567
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
568 568
                         $i = 0;
569
-                        $j =0;
569
+                        $j = 0;
570 570
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
571
-			foreach($all as $row)
571
+			foreach ($all as $row)
572 572
 			{
573 573
 				$i++;
574 574
 				$j++;
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 					if ($globalDebug) echo ".";
577 577
 				    	try {
578 578
 						
579
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
579
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
580 580
 						$sth->execute();
581
-					} catch(PDOException $e) {
581
+					} catch (PDOException $e) {
582 582
 						return "error";
583 583
 					}
584 584
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 			if ($i > 0) {
590 590
     				try {
591 591
 					
592
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
592
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
593 593
 					$sth->execute();
594
-				} catch(PDOException $e) {
594
+				} catch (PDOException $e) {
595 595
 					return "error";
596 596
 				}
597 597
 			}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 				
605 605
 				$sth = $this->db->prepare($query);
606 606
 				$sth->execute();
607
-			} catch(PDOException $e) {
607
+			} catch (PDOException $e) {
608 608
 				return "error";
609 609
 			}
610 610
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
 	public function deleteLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
655
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
655
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
656 656
         
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			return "error";
663 663
 		}
664 664
 
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
 	public function deleteLiveSpotterDataById($id)
675 675
 	{
676 676
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
677
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
677
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
678 678
         
679 679
     		try {
680 680
 			
681 681
 			$sth = $this->db->prepare($query);
682 682
 			$sth->execute(array(':id' => $id));
683
-		} catch(PDOException $e) {
683
+		} catch (PDOException $e) {
684 684
 			return "error";
685 685
 		}
686 686
 
@@ -698,13 +698,13 @@  discard block
 block discarded – undo
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
700 700
 		if ($globalDBdriver == 'mysql') {
701
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
701
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
702 702
 				WHERE spotter_live.ident = :ident 
703 703
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
704 704
 				AND spotter_live.date < UTC_TIMESTAMP()';
705 705
 			$query_data = array(':ident' => $ident);
706 706
 		} else {
707
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
707
+			$query = "SELECT spotter_live.ident FROM spotter_live 
708 708
 				WHERE spotter_live.ident = :ident 
709 709
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
710 710
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 		
714 714
 		$sth = $this->db->prepare($query);
715 715
 		$sth->execute($query_data);
716
-		$ident_result='';
717
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
716
+		$ident_result = '';
717
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
718 718
 		{
719 719
 			$ident_result = $row['ident'];
720 720
 		}
@@ -731,13 +731,13 @@  discard block
 block discarded – undo
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
733 733
 		if ($globalDBdriver == 'mysql') {
734
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
734
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
735 735
 				WHERE spotter_live.ident = :ident 
736 736
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
737 737
 //				AND spotter_live.date < UTC_TIMESTAMP()";
738 738
 			$query_data = array(':ident' => $ident);
739 739
 		} else {
740
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
740
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
741 741
 				WHERE spotter_live.ident = :ident 
742 742
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
743 743
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -746,8 +746,8 @@  discard block
 block discarded – undo
746 746
 		
747 747
 		$sth = $this->db->prepare($query);
748 748
 		$sth->execute($query_data);
749
-		$ident_result='';
750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
749
+		$ident_result = '';
750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
751 751
 		{
752 752
 			$ident_result = $row['flightaware_id'];
753 753
 		}
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 	{
765 765
 		global $globalDBdriver, $globalTimezone;
766 766
 		if ($globalDBdriver == 'mysql') {
767
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
767
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
768 768
 				WHERE spotter_live.flightaware_id = :id 
769 769
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
770 770
 //				AND spotter_live.date < UTC_TIMESTAMP()";
771 771
 			$query_data = array(':id' => $id);
772 772
 		} else {
773
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
773
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
774 774
 				WHERE spotter_live.flightaware_id = :id 
775 775
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
776 776
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		
780 780
 		$sth = $this->db->prepare($query);
781 781
 		$sth->execute($query_data);
782
-		$ident_result='';
783
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
782
+		$ident_result = '';
783
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
784 784
 		{
785 785
 			$ident_result = $row['flightaware_id'];
786 786
 		}
@@ -797,13 +797,13 @@  discard block
 block discarded – undo
797 797
 	{
798 798
 		global $globalDBdriver, $globalTimezone;
799 799
 		if ($globalDBdriver == 'mysql') {
800
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
800
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
801 801
 				WHERE spotter_live.ModeS = :modes 
802 802
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
803 803
 //				AND spotter_live.date < UTC_TIMESTAMP()";
804 804
 			$query_data = array(':modes' => $modes);
805 805
 		} else {
806
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
806
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
807 807
 				WHERE spotter_live.ModeS = :modes 
808 808
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
809 809
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 		
813 813
 		$sth = $this->db->prepare($query);
814 814
 		$sth->execute($query_data);
815
-		$ident_result='';
816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
815
+		$ident_result = '';
816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
817 817
 		{
818 818
 			//$ident_result = $row['spotter_live_id'];
819 819
 			$ident_result = $row['flightaware_id'];
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	* @return String success or false
833 833
 	*
834 834
 	*/
835
-	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
835
+	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
836 836
 	{
837 837
 		global $globalURL, $globalArchive, $globalDebug;
838 838
 		$Common = new Common();
@@ -925,26 +925,26 @@  discard block
 block discarded – undo
925 925
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
926 926
 
927 927
         
928
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
929
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
930
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
931
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
932
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
933
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
934
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
935
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
936
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
937
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
938
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
939
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
940
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
941
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
942
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
943
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
944
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
945
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
946
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
947
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
928
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
929
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
930
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
931
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
932
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
933
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
934
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
935
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
936
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
937
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
938
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
939
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
940
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
941
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
942
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
943
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
944
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
945
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
946
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
947
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
948 948
 
949 949
 		$airline_name = '';
950 950
 		$airline_icao = '';
@@ -966,26 +966,26 @@  discard block
 block discarded – undo
966 966
 		$arrival_airport_country = '';
967 967
 		
968 968
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
969
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
970
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
971
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
972
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
973 973
             	
974
-		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
974
+		$query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 975
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
976 976
 
977
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_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,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
977
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_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, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
978 978
 		try {
979 979
 			
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-                } catch(PDOException $e) {
982
+                } catch (PDOException $e) {
983 983
                 	return "error : ".$e->getMessage();
984 984
                 }
985 985
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986 986
 		    if ($globalDebug) echo '(Add to SBS archive : ';
987 987
 		    $SpotterArchive = new SpotterArchive($this->db);
988
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
988
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
989 989
 		    if ($globalDebug) echo $result.')';
990 990
 		}
991 991
 		return "success";
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
 	public function getOrderBy()
996 996
 	{
997
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
997
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
998 998
 		return $orderby;
999 999
 	}
1000 1000
 
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -79,8 +81,11 @@  discard block
 block discarded – undo
79 81
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
80 82
 			}
81 83
 		}
82
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
83
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
84
+		if ($filter_query_where == '' && $where) {
85
+			$filter_query_where = ' WHERE';
86
+		} elseif ($filter_query_where != '' && $and) {
87
+			$filter_query_where .= ' AND';
88
+		}
84 89
 		$filter_query = $filter_query_join.$filter_query_where;
85 90
 		return $filter_query;
86 91
 	}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
125 132
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
150 159
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -201,7 +210,9 @@  discard block
 block discarded – undo
201 210
 
202 211
 		$filter_query = $this->getFilter($filter,true,true);
203 212
 
204
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
213
+		if (!isset($globalLiveInterval)) {
214
+			$globalLiveInterval = '200';
215
+		}
205 216
 		if ($globalDBdriver == 'mysql') {
206 217
 /*
207 218
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -245,7 +256,9 @@  discard block
 block discarded – undo
245 256
 		global $globalDBdriver, $globalLiveInterval;
246 257
 		$filter_query = $this->getFilter($filter,true,true);
247 258
 
248
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
259
+		if (!isset($globalLiveInterval)) {
260
+			$globalLiveInterval = '200';
261
+		}
249 262
 		if ($globalDBdriver == 'mysql') {
250 263
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
251 264
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -275,7 +288,9 @@  discard block
 block discarded – undo
275 288
 	{
276 289
 		global $globalDBdriver, $globalLiveInterval;
277 290
 		$Spotter = new Spotter($this->db);
278
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291
+		if (!isset($globalLiveInterval)) {
292
+			$globalLiveInterval = '200';
293
+		}
279 294
 		$filter_query = $this->getFilter($filter);
280 295
 
281 296
 		if (is_array($coord)) {
@@ -283,7 +298,9 @@  discard block
 block discarded – undo
283 298
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
284 299
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
285 300
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
286
-		} else return array();
301
+		} else {
302
+			return array();
303
+		}
287 304
 		if ($globalDBdriver == 'mysql') {
288 305
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
289 306
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -474,11 +491,15 @@  discard block
 block discarded – undo
474 491
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
475 492
 		if ($globalDBdriver == 'mysql') {
476 493
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
477
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
494
+			if ($liveinterval) {
495
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
496
+			}
478 497
 			$query .= ' ORDER BY date';
479 498
 		} else {
480 499
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
481
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
500
+			if ($liveinterval) {
501
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
502
+			}
482 503
 			$query .= ' ORDER BY date';
483 504
 		}
484 505
 
@@ -573,7 +594,9 @@  discard block
 block discarded – undo
573 594
 				$i++;
574 595
 				$j++;
575 596
 				if ($j == 30) {
576
-					if ($globalDebug) echo ".";
597
+					if ($globalDebug) {
598
+						echo ".";
599
+					}
577 600
 				    	try {
578 601
 						
579 602
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -880,7 +903,9 @@  discard block
 block discarded – undo
880 903
 			{
881 904
 				return false;
882 905
 			}
883
-		} else return '';
906
+		} else {
907
+			return '';
908
+		}
884 909
 
885 910
 		if ($longitude != '')
886 911
 		{
@@ -888,7 +913,9 @@  discard block
 block discarded – undo
888 913
 			{
889 914
 				return false;
890 915
 			}
891
-		} else return '';
916
+		} else {
917
+			return '';
918
+		}
892 919
 
893 920
 		if ($waypoints != '')
894 921
 		{
@@ -904,7 +931,9 @@  discard block
 block discarded – undo
904 931
 			{
905 932
 				return false;
906 933
 			}
907
-		} else $altitude = 0;
934
+		} else {
935
+			$altitude = 0;
936
+		}
908 937
 
909 938
 		if ($heading != '')
910 939
 		{
@@ -912,7 +941,9 @@  discard block
 block discarded – undo
912 941
 			{
913 942
 				return false;
914 943
 			}
915
-		} else $heading = 0;
944
+		} else {
945
+			$heading = 0;
946
+		}
916 947
 
917 948
 		if ($groundspeed != '')
918 949
 		{
@@ -920,9 +951,13 @@  discard block
 block discarded – undo
920 951
 			{
921 952
 				return false;
922 953
 			}
923
-		} else $groundspeed = 0;
954
+		} else {
955
+			$groundspeed = 0;
956
+		}
924 957
 		date_default_timezone_set('UTC');
925
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
958
+		if ($date == '') {
959
+			$date = date("Y-m-d H:i:s", time());
960
+		}
926 961
 
927 962
         
928 963
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -966,10 +1001,18 @@  discard block
 block discarded – undo
966 1001
 		$arrival_airport_country = '';
967 1002
 		
968 1003
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1004
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1005
+            		$squawk = NULL;
1006
+            	}
1007
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1008
+            		$verticalrate = NULL;
1009
+            	}
1010
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1011
+            		$groundspeed = 0;
1012
+            	}
1013
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1014
+            		$heading = 0;
1015
+            	}
973 1016
             	
974 1017
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 1018
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -983,10 +1026,14 @@  discard block
 block discarded – undo
983 1026
                 	return "error : ".$e->getMessage();
984 1027
                 }
985 1028
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1029
+		    if ($globalDebug) {
1030
+		    	echo '(Add to SBS archive : ';
1031
+		    }
987 1032
 		    $SpotterArchive = new SpotterArchive($this->db);
988 1033
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
-		    if ($globalDebug) echo $result.')';
1034
+		    if ($globalDebug) {
1035
+		    	echo $result.')';
1036
+		    }
990 1037
 		}
991 1038
 		return "success";
992 1039
 
Please login to merge, or discard this patch.
require/libs/simple_html_dom.php 4 patches
Doc Comments   +40 added lines patch added patch discarded remove patch
@@ -125,6 +125,9 @@  discard block
 block discarded – undo
125 125
 	public $tag_start = 0;
126 126
 	private $dom = null;
127 127
 
128
+	/**
129
+	 * @param simple_html_dom $dom
130
+	 */
128 131
 	function __construct($dom)
129 132
 	{
130 133
 		$this->dom = $dom;
@@ -1501,6 +1504,11 @@  discard block
 block discarded – undo
1501 1504
 	}
1502 1505
 
1503 1506
 	// parse attributes
1507
+
1508
+	/**
1509
+	 * @param simple_html_dom_node $node
1510
+	 * @param string[] $space
1511
+	 */
1504 1512
 	protected function parse_attr($node, $name, &$space)
1505 1513
 	{
1506 1514
 		// Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037
@@ -1538,6 +1546,11 @@  discard block
 block discarded – undo
1538 1546
 	}
1539 1547
 
1540 1548
 	// link node's parent
1549
+
1550
+	/**
1551
+	 * @param simple_html_dom_node $node
1552
+	 * @param boolean $is_child
1553
+	 */
1541 1554
 	protected function link_nodes(&$node, $is_child)
1542 1555
 	{
1543 1556
 		$node->parent = $this->parent;
@@ -1549,6 +1562,10 @@  discard block
 block discarded – undo
1549 1562
 	}
1550 1563
 
1551 1564
 	// as a text node
1565
+
1566
+	/**
1567
+	 * @param string $tag
1568
+	 */
1552 1569
 	protected function as_text_node($tag)
1553 1570
 	{
1554 1571
 		$node = new simple_html_dom_node($this);
@@ -1559,12 +1576,18 @@  discard block
 block discarded – undo
1559 1576
 		return true;
1560 1577
 	}
1561 1578
 
1579
+	/**
1580
+	 * @param string $chars
1581
+	 */
1562 1582
 	protected function skip($chars)
1563 1583
 	{
1564 1584
 		$this->pos += strspn($this->doc, $chars, $this->pos);
1565 1585
 		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1566 1586
 	}
1567 1587
 
1588
+	/**
1589
+	 * @param string $chars
1590
+	 */
1568 1591
 	protected function copy_skip($chars)
1569 1592
 	{
1570 1593
 		$pos = $this->pos;
@@ -1575,6 +1598,9 @@  discard block
 block discarded – undo
1575 1598
 		return substr($this->doc, $pos, $len);
1576 1599
 	}
1577 1600
 
1601
+	/**
1602
+	 * @param string $chars
1603
+	 */
1578 1604
 	protected function copy_until($chars)
1579 1605
 	{
1580 1606
 		$pos = $this->pos;
@@ -1584,6 +1610,9 @@  discard block
 block discarded – undo
1584 1610
 		return substr($this->doc, $pos, $len);
1585 1611
 	}
1586 1612
 
1613
+	/**
1614
+	 * @param string $char
1615
+	 */
1587 1616
 	protected function copy_until_char($char)
1588 1617
 	{
1589 1618
 		if ($this->char===null) return '';
@@ -1602,6 +1631,9 @@  discard block
 block discarded – undo
1602 1631
 		return substr($this->doc, $pos_old, $pos-$pos_old);
1603 1632
 	}
1604 1633
 
1634
+	/**
1635
+	 * @param string $char
1636
+	 */
1605 1637
 	protected function copy_until_char_escape($char)
1606 1638
 	{
1607 1639
 		if ($this->char===null) return '';
@@ -1633,6 +1665,10 @@  discard block
 block discarded – undo
1633 1665
 
1634 1666
 	// remove noise from html content
1635 1667
 	// save the noise in the $this->noise array.
1668
+
1669
+	/**
1670
+	 * @param string $pattern
1671
+	 */
1636 1672
 	protected function remove_noise($pattern, $remove_tag=false)
1637 1673
 	{
1638 1674
 		global $debug_object;
@@ -1658,6 +1694,10 @@  discard block
 block discarded – undo
1658 1694
 	}
1659 1695
 
1660 1696
 	// restore noise to html content
1697
+
1698
+	/**
1699
+	 * @param string|null $text
1700
+	 */
1661 1701
 	function restore_noise($text)
1662 1702
 	{
1663 1703
 		global $debug_object;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -824,11 +824,11 @@
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Returns true if $string is valid UTF-8 and false otherwise.
828
-	*
829
-	* @param mixed $str String to be tested
830
-	* @return boolean
831
-	*/
827
+	 * Returns true if $string is valid UTF-8 and false otherwise.
828
+	 *
829
+	 * @param mixed $str String to be tested
830
+	 * @return boolean
831
+	 */
832 832
 	static function is_utf8($str)
833 833
 	{
834 834
 		$c=0; $b=0;
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
  */
46 46
 define('HDOM_TYPE_ELEMENT', 1);
47 47
 define('HDOM_TYPE_COMMENT', 2);
48
-define('HDOM_TYPE_TEXT',	3);
49
-define('HDOM_TYPE_ENDTAG',  4);
50
-define('HDOM_TYPE_ROOT',	5);
48
+define('HDOM_TYPE_TEXT', 3);
49
+define('HDOM_TYPE_ENDTAG', 4);
50
+define('HDOM_TYPE_ROOT', 5);
51 51
 define('HDOM_TYPE_UNKNOWN', 6);
52 52
 define('HDOM_QUOTE_DOUBLE', 0);
53 53
 define('HDOM_QUOTE_SINGLE', 1);
54
-define('HDOM_QUOTE_NO',	 3);
55
-define('HDOM_INFO_BEGIN',   0);
56
-define('HDOM_INFO_END',	 1);
57
-define('HDOM_INFO_QUOTE',   2);
58
-define('HDOM_INFO_SPACE',   3);
59
-define('HDOM_INFO_TEXT',	4);
60
-define('HDOM_INFO_INNER',   5);
61
-define('HDOM_INFO_OUTER',   6);
62
-define('HDOM_INFO_ENDSPACE',7);
54
+define('HDOM_QUOTE_NO', 3);
55
+define('HDOM_INFO_BEGIN', 0);
56
+define('HDOM_INFO_END', 1);
57
+define('HDOM_INFO_QUOTE', 2);
58
+define('HDOM_INFO_SPACE', 3);
59
+define('HDOM_INFO_TEXT', 4);
60
+define('HDOM_INFO_INNER', 5);
61
+define('HDOM_INFO_OUTER', 6);
62
+define('HDOM_INFO_ENDSPACE', 7);
63 63
 define('DEFAULT_TARGET_CHARSET', 'UTF-8');
64 64
 define('DEFAULT_BR_TEXT', "\r\n");
65 65
 define('DEFAULT_SPAN_TEXT', " ");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 // -----------------------------------------------------------------------------
69 69
 // get html dom from file
70 70
 // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
71
-function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
71
+function file_get_html($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
72 72
 {
73 73
 	// We DO force the tags to be terminated.
74 74
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 // get html dom from string
89
-function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
89
+function str_get_html($str, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
90 90
 {
91 91
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
92 92
 	if (empty($str) || strlen($str) > MAX_FILE_SIZE)
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 // dump html dom tree
102
-function dump_html_tree($node, $show_attr=true, $deep=0)
102
+function dump_html_tree($node, $show_attr = true, $deep = 0)
103 103
 {
104 104
 	$node->dump($node);
105 105
 }
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// dump node's tree
154
-	function dump($show_attr=true, $deep=0)
154
+	function dump($show_attr = true, $deep = 0)
155 155
 	{
156 156
 		$lead = str_repeat('	', $deep);
157 157
 
158 158
 		echo $lead.$this->tag;
159
-		if ($show_attr && count($this->attr)>0)
159
+		if ($show_attr && count($this->attr) > 0)
160 160
 		{
161 161
 			echo '(';
162 162
 			foreach ($this->attr as $k=>$v)
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		{
170 170
 			foreach ($this->nodes as $c)
171 171
 			{
172
-				$c->dump($show_attr, $deep+1);
172
+				$c->dump($show_attr, $deep + 1);
173 173
 			}
174 174
 		}
175 175
 	}
176 176
 
177 177
 
178 178
 	// Debugging function to dump a single dom node with a bunch of information about it.
179
-	function dump_node($echo=true)
179
+	function dump_node($echo = true)
180 180
 	{
181 181
 
182 182
 		$string = $this->tag;
183
-		if (count($this->attr)>0)
183
+		if (count($this->attr) > 0)
184 184
 		{
185 185
 			$string .= '(';
186 186
 			foreach ($this->attr as $k=>$v)
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			}
190 190
 			$string .= ')';
191 191
 		}
192
-		if (count($this->_)>0)
192
+		if (count($this->_) > 0)
193 193
 		{
194 194
 			$string .= ' $_ (';
195 195
 			foreach ($this->_ as $k=>$v)
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 
212 212
 		if (isset($this->text))
213 213
 		{
214
-			$string .= " text: (" . $this->text . ")";
214
+			$string .= " text: (".$this->text.")";
215 215
 		}
216 216
 
217 217
 		$string .= " HDOM_INNER_INFO: '";
218 218
 		if (isset($node->_[HDOM_INFO_INNER]))
219 219
 		{
220
-			$string .= $node->_[HDOM_INFO_INNER] . "'";
220
+			$string .= $node->_[HDOM_INFO_INNER]."'";
221 221
 		}
222 222
 		else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
226 226
 
227
-		$string .= " children: " . count($this->children);
228
-		$string .= " nodes: " . count($this->nodes);
229
-		$string .= " tag_start: " . $this->tag_start;
227
+		$string .= " children: ".count($this->children);
228
+		$string .= " nodes: ".count($this->nodes);
229
+		$string .= " tag_start: ".$this->tag_start;
230 230
 		$string .= "\n";
231 231
 
232 232
 		if ($echo)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 	// returns the parent of node
244 244
 	// If a node is passed in, it will reset the parent of the current node to that one.
245
-	function parent($parent=null)
245
+	function parent($parent = null)
246 246
 	{
247 247
 		// I am SURE that this doesn't work properly.
248 248
 		// It fails to unset the current node from it's current parents nodes or children list first.
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	}
264 264
 
265 265
 	// returns children of node
266
-	function children($idx=-1)
266
+	function children($idx = -1)
267 267
 	{
268
-		if ($idx===-1)
268
+		if ($idx === -1)
269 269
 		{
270 270
 			return $this->children;
271 271
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	// returns the first child of node
280 280
 	function first_child()
281 281
 	{
282
-		if (count($this->children)>0)
282
+		if (count($this->children) > 0)
283 283
 		{
284 284
 			return $this->children[0];
285 285
 		}
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 	// returns the last child of node
290 290
 	function last_child()
291 291
 	{
292
-		if (($count=count($this->children))>0)
292
+		if (($count = count($this->children)) > 0)
293 293
 		{
294
-			return $this->children[$count-1];
294
+			return $this->children[$count - 1];
295 295
 		}
296 296
 		return null;
297 297
 	}
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 	// returns the next sibling of node
300 300
 	function next_sibling()
301 301
 	{
302
-		if ($this->parent===null)
302
+		if ($this->parent === null)
303 303
 		{
304 304
 			return null;
305 305
 		}
306 306
 
307 307
 		$idx = 0;
308 308
 		$count = count($this->parent->children);
309
-		while ($idx<$count && $this!==$this->parent->children[$idx])
309
+		while ($idx < $count && $this !== $this->parent->children[$idx])
310 310
 		{
311 311
 			++$idx;
312 312
 		}
313
-		if (++$idx>=$count)
313
+		if (++$idx >= $count)
314 314
 		{
315 315
 			return null;
316 316
 		}
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
 	// returns the previous sibling of node
321 321
 	function prev_sibling()
322 322
 	{
323
-		if ($this->parent===null) return null;
323
+		if ($this->parent === null) return null;
324 324
 		$idx = 0;
325 325
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
326
+		while ($idx < $count && $this !== $this->parent->children[$idx])
327 327
 			++$idx;
328
-		if (--$idx<0) return null;
328
+		if (--$idx < 0) return null;
329 329
 		return $this->parent->children[$idx];
330 330
 	}
331 331
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 		while (!is_null($returnDom))
342 342
 		{
343
-			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }
343
+			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: ".$returnDom->tag); }
344 344
 
345 345
 			if ($returnDom->tag == $tag)
346 346
 			{
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
 			{
375 375
 				if (!empty($this->text))
376 376
 				{
377
-					$text = " with text: " . $this->text;
377
+					$text = " with text: ".$this->text;
378 378
 				}
379 379
 			}
380
-			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
380
+			$debug_object->debug_log(1, 'Innertext of tag: '.$this->tag.$text);
381 381
 		}
382 382
 
383
-		if ($this->tag==='root') return $this->innertext();
383
+		if ($this->tag === 'root') return $this->innertext();
384 384
 
385 385
 		// trigger callback
386
-		if ($this->dom && $this->dom->callback!==null)
386
+		if ($this->dom && $this->dom->callback !== null)
387 387
 		{
388 388
 			call_user_func_array($this->dom->callback, array($this));
389 389
 		}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		}
419 419
 
420 420
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
421
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0)
422 422
 			$ret .= '</'.$this->tag.'>';
423 423
 		return $ret;
424 424
 	}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 			case HDOM_TYPE_COMMENT: return '';
434 434
 			case HDOM_TYPE_UNKNOWN: return '';
435 435
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
436
+		if (strcasecmp($this->tag, 'script') === 0) return '';
437
+		if (strcasecmp($this->tag, 'style') === 0) return '';
438 438
 
439 439
 		$ret = '';
440 440
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 			++$i;
481 481
 
482 482
 			// skip removed attribute
483
-			if ($val===null || $val===false)
483
+			if ($val === null || $val === false)
484 484
 				continue;
485 485
 
486 486
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 487
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
488
+			if ($val === true)
489 489
 				$ret .= $key;
490 490
 			else {
491 491
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
@@ -498,34 +498,34 @@  discard block
 block discarded – undo
498 498
 			}
499 499
 		}
500 500
 		$ret = $this->dom->restore_noise($ret);
501
-		return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
501
+		return $ret.$this->_[HDOM_INFO_ENDSPACE].'>';
502 502
 	}
503 503
 
504 504
 	// find elements by css selector
505 505
 	//PaperG - added ability for find to lowercase the value of the selector.
506
-	function find($selector, $idx=null, $lowercase=false)
506
+	function find($selector, $idx = null, $lowercase = false)
507 507
 	{
508 508
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
509
+		if (($count = count($selectors)) === 0) return array();
510 510
 		$found_keys = array();
511 511
 
512 512
 		// find each selector
513
-		for ($c=0; $c<$count; ++$c)
513
+		for ($c = 0; $c < $count; ++$c)
514 514
 		{
515 515
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 516
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
517
+			if (($levle = count($selectors[$c])) === 0) return array();
518 518
 			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
519 519
 
520 520
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 521
 
522 522
 			// handle descendant selectors, no recursive!
523
-			for ($l=0; $l<$levle; ++$l)
523
+			for ($l = 0; $l < $levle; ++$l)
524 524
 			{
525 525
 				$ret = array();
526 526
 				foreach ($head as $k=>$v)
527 527
 				{
528
-					$n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
528
+					$n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k];
529 529
 					//PaperG - Pass this optional parameter on to the seek function.
530 530
 					$n->seek($selectors[$c][$l], $ret, $lowercase);
531 531
 				}
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 
551 551
 		// return nth-element or array
552 552
 		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
553
+		else if ($idx < 0) $idx = count($found) + $idx;
554 554
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 555
 	}
556 556
 
557 557
 	// seek for given conditions
558 558
 	// PaperG - added parameter to allow for case insensitive testing of the value of a selector.
559
-	protected function seek($selector, &$ret, $lowercase=false)
559
+	protected function seek($selector, &$ret, $lowercase = false)
560 560
 	{
561 561
 		global $debug_object;
562 562
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 			$count = 0;
570 570
 			foreach ($this->children as $c)
571 571
 			{
572
-				if ($tag==='*' || $tag===$c->tag) {
573
-					if (++$count==$key) {
572
+				if ($tag === '*' || $tag === $c->tag) {
573
+					if (++$count == $key) {
574 574
 						$ret[$c->_[HDOM_INFO_BEGIN]] = 1;
575 575
 						return;
576 576
 					}
@@ -580,38 +580,38 @@  discard block
 block discarded – undo
580 580
 		}
581 581
 
582 582
 		$end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
583
-		if ($end==0) {
583
+		if ($end == 0) {
584 584
 			$parent = $this->parent;
585
-			while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
585
+			while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) {
586 586
 				$end -= 1;
587 587
 				$parent = $parent->parent;
588 588
 			}
589 589
 			$end += $parent->_[HDOM_INFO_END];
590 590
 		}
591 591
 
592
-		for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
592
+		for ($i = $this->_[HDOM_INFO_BEGIN] + 1; $i < $end; ++$i) {
593 593
 			$node = $this->dom->nodes[$i];
594 594
 
595 595
 			$pass = true;
596 596
 
597
-			if ($tag==='*' && !$key) {
597
+			if ($tag === '*' && !$key) {
598 598
 				if (in_array($node, $this->children, true))
599 599
 					$ret[$i] = 1;
600 600
 				continue;
601 601
 			}
602 602
 
603 603
 			// compare tag
604
-			if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
604
+			if ($tag && $tag != $node->tag && $tag !== '*') {$pass = false; }
605 605
 			// compare key
606 606
 			if ($pass && $key) {
607 607
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
608
+					if (isset($node->attr[$key])) $pass = false;
609 609
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
610
+					if (($key != "plaintext") && !isset($node->attr[$key])) $pass = false;
611 611
 				}
612 612
 			}
613 613
 			// compare value
614
-			if ($pass && $key && $val  && $val!=='*') {
614
+			if ($pass && $key && $val && $val !== '*') {
615 615
 				// If they have told us that this is a "plaintext" search then we want the plaintext of the node - right?
616 616
 				if ($key == "plaintext") {
617 617
 					// $node->plaintext actually returns $node->text();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 					// this is a normal search, we want the value of that attribute of the tag.
621 621
 					$nodeKeyValue = $node->attr[$key];
622 622
 				}
623
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
623
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: ".$node->tag." for attribute: ".$key.$exp.$val." where nodes value is: ".$nodeKeyValue); }
624 624
 
625 625
 				//PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
626 626
 				if ($lowercase) {
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 				} else {
629 629
 					$check = $this->match($exp, $val, $nodeKeyValue);
630 630
 				}
631
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}
631
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: ".($check ? "true" : "false")); }
632 632
 
633 633
 				// handle multiple class
634
-				if (!$check && strcasecmp($key, 'class')===0) {
635
-					foreach (explode(' ',$node->attr[$key]) as $k) {
634
+				if (!$check && strcasecmp($key, 'class') === 0) {
635
+					foreach (explode(' ', $node->attr[$key]) as $k) {
636 636
 						// Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form.
637 637
 						if (!empty($k)) {
638 638
 							if ($lowercase) {
@@ -650,24 +650,24 @@  discard block
 block discarded – undo
650 650
 			unset($node);
651 651
 		}
652 652
 		// It's passed by reference so this is actually what this function returns.
653
-		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}
653
+		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret); }
654 654
 	}
655 655
 
656 656
 	protected function match($exp, $pattern, $value) {
657 657
 		global $debug_object;
658
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
658
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
659 659
 
660 660
 		switch ($exp) {
661 661
 			case '=':
662
-				return ($value===$pattern);
662
+				return ($value === $pattern);
663 663
 			case '!=':
664
-				return ($value!==$pattern);
664
+				return ($value !== $pattern);
665 665
 			case '^=':
666
-				return preg_match("/^".preg_quote($pattern,'/')."/", $value);
666
+				return preg_match("/^".preg_quote($pattern, '/')."/", $value);
667 667
 			case '$=':
668
-				return preg_match("/".preg_quote($pattern,'/')."$/", $value);
668
+				return preg_match("/".preg_quote($pattern, '/')."$/", $value);
669 669
 			case '*=':
670
-				if ($pattern[0]=='/') {
670
+				if ($pattern[0] == '/') {
671 671
 					return preg_match($pattern, $value);
672 672
 				}
673 673
 				return preg_match("/".$pattern."/i", $value);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 
678 678
 	protected function parse_selector($selector_string) {
679 679
 		global $debug_object;
680
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
680
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
681 681
 
682 682
 		// pattern of CSS selectors, modified from mootools
683 683
 		// Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 //		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
689 689
 		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
690 690
 		preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
691
-		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}
691
+		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches); }
692 692
 
693 693
 		$selectors = array();
694 694
 		$result = array();
@@ -696,29 +696,29 @@  discard block
 block discarded – undo
696 696
 
697 697
 		foreach ($matches as $m) {
698 698
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
699
+			if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') continue;
700 700
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
701
+			if ($m[1] === 'tbody') continue;
702 702
 
703 703
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704
-			if (!empty($m[2])) {$key='id'; $val=$m[2];}
705
-			if (!empty($m[3])) {$key='class'; $val=$m[3];}
706
-			if (!empty($m[4])) {$key=$m[4];}
707
-			if (!empty($m[5])) {$exp=$m[5];}
708
-			if (!empty($m[6])) {$val=$m[6];}
704
+			if (!empty($m[2])) {$key = 'id'; $val = $m[2]; }
705
+			if (!empty($m[3])) {$key = 'class'; $val = $m[3]; }
706
+			if (!empty($m[4])) {$key = $m[4]; }
707
+			if (!empty($m[5])) {$exp = $m[5]; }
708
+			if (!empty($m[6])) {$val = $m[6]; }
709 709
 
710 710
 			// convert to lowercase
711
-			if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
711
+			if ($this->dom->lowercase) {$tag = strtolower($tag); $key = strtolower($key); }
712 712
 			//elements that do NOT have the specified attribute
713
-			if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
713
+			if (isset($key[0]) && $key[0] === '!') {$key = substr($key, 1); $no_key = true; }
714 714
 
715 715
 			$result[] = array($tag, $key, $val, $exp, $no_key);
716
-			if (trim($m[7])===',') {
716
+			if (trim($m[7]) === ',') {
717 717
 				$selectors[] = $result;
718 718
 				$result = array();
719 719
 			}
720 720
 		}
721
-		if (count($result)>0)
721
+		if (count($result) > 0)
722 722
 			$selectors[] = $result;
723 723
 		return $selectors;
724 724
 	}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	function __set($name, $value)
743 743
 	{
744 744
 		global $debug_object;
745
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
745
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
746 746
 
747 747
 		switch ($name)
748 748
 		{
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	function convert_text($text)
781 781
 	{
782 782
 		global $debug_object;
783
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
783
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
784 784
 
785 785
 		$converted_text = $text;
786 786
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 			$sourceCharset = strtoupper($this->dom->_charset);
793 793
 			$targetCharset = strtoupper($this->dom->_target_charset);
794 794
 		}
795
-		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
795
+		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: ".$sourceCharset." target charaset: ".$targetCharset); }
796 796
 
797 797
 		if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
798 798
 		{
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	*/
832 832
 	static function is_utf8($str)
833 833
 	{
834
-		$c=0; $b=0;
835
-		$bits=0;
836
-		$len=strlen($str);
837
-		for($i=0; $i<$len; $i++)
834
+		$c = 0; $b = 0;
835
+		$bits = 0;
836
+		$len = strlen($str);
837
+		for ($i = 0; $i < $len; $i++)
838 838
 		{
839
-			$c=ord($str[$i]);
840
-			if($c > 128)
839
+			$c = ord($str[$i]);
840
+			if ($c > 128)
841 841
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
842
+				if (($c >= 254)) return false;
843
+				elseif ($c >= 252) $bits = 6;
844
+				elseif ($c >= 248) $bits = 5;
845
+				elseif ($c >= 240) $bits = 4;
846
+				elseif ($c >= 224) $bits = 3;
847
+				elseif ($c >= 192) $bits = 2;
848 848
 				else return false;
849
-				if(($i+$bits) > $len) return false;
850
-				while($bits > 1)
849
+				if (($i + $bits) > $len) return false;
850
+				while ($bits > 1)
851 851
 				{
852 852
 					$i++;
853
-					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
853
+					$b = ord($str[$i]);
854
+					if ($b < 128 || $b > 191) return false;
855 855
 					$bits--;
856 856
 				}
857 857
 			}
@@ -955,24 +955,24 @@  discard block
 block discarded – undo
955 955
 	}
956 956
 
957 957
 	// camel naming conventions
958
-	function getAllAttributes() {return $this->attr;}
959
-	function getAttribute($name) {return $this->__get($name);}
960
-	function setAttribute($name, $value) {$this->__set($name, $value);}
961
-	function hasAttribute($name) {return $this->__isset($name);}
962
-	function removeAttribute($name) {$this->__set($name, null);}
963
-	function getElementById($id) {return $this->find("#$id", 0);}
964
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
965
-	function getElementByTagName($name) {return $this->find($name, 0);}
966
-	function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
967
-	function parentNode() {return $this->parent();}
968
-	function childNodes($idx=-1) {return $this->children($idx);}
969
-	function firstChild() {return $this->first_child();}
970
-	function lastChild() {return $this->last_child();}
971
-	function nextSibling() {return $this->next_sibling();}
972
-	function previousSibling() {return $this->prev_sibling();}
973
-	function hasChildNodes() {return $this->has_child();}
974
-	function nodeName() {return $this->tag;}
975
-	function appendChild($node) {$node->parent($this); return $node;}
958
+	function getAllAttributes() {return $this->attr; }
959
+	function getAttribute($name) {return $this->__get($name); }
960
+	function setAttribute($name, $value) {$this->__set($name, $value); }
961
+	function hasAttribute($name) {return $this->__isset($name); }
962
+	function removeAttribute($name) {$this->__set($name, null); }
963
+	function getElementById($id) {return $this->find("#$id", 0); }
964
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
965
+	function getElementByTagName($name) {return $this->find($name, 0); }
966
+	function getElementsByTagName($name, $idx = null) {return $this->find($name, $idx); }
967
+	function parentNode() {return $this->parent(); }
968
+	function childNodes($idx = -1) {return $this->children($idx); }
969
+	function firstChild() {return $this->first_child(); }
970
+	function lastChild() {return $this->last_child(); }
971
+	function nextSibling() {return $this->next_sibling(); }
972
+	function previousSibling() {return $this->prev_sibling(); }
973
+	function hasChildNodes() {return $this->has_child(); }
974
+	function nodeName() {return $this->tag; }
975
+	function appendChild($node) {$node->parent($this); return $node; }
976 976
 
977 977
 }
978 978
 
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 		'option'=>array('option'=>1),
1029 1029
 	);
1030 1030
 
1031
-	function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1031
+	function __construct($str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1032 1032
 	{
1033 1033
 		if ($str)
1034 1034
 		{
1035
-			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1035
+			if (preg_match("/^http:\/\//i", $str) || is_file($str))
1036 1036
 			{
1037 1037
 				$this->load_file($str);
1038 1038
 			}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		}
1044 1044
 		// Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html.
1045 1045
 		if (!$forceTagsClosed) {
1046
-			$this->optional_closing_array=array();
1046
+			$this->optional_closing_array = array();
1047 1047
 		}
1048 1048
 		$this->_target_charset = $target_charset;
1049 1049
 	}
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	}
1055 1055
 
1056 1056
 	// load html from string
1057
-	function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1057
+	function load($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1058 1058
 	{
1059 1059
 		global $debug_object;
1060 1060
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 		$args = func_get_args();
1097 1097
 		$this->load(call_user_func_array('file_get_contents', $args), true);
1098 1098
 		// Throw an error if we can't properly load the dom.
1099
-		if (($error=error_get_last())!==null) {
1099
+		if (($error = error_get_last()) !== null) {
1100 1100
 			$this->clear();
1101 1101
 			return false;
1102 1102
 		}
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	// save dom as string
1118
-	function save($filepath='')
1118
+	function save($filepath = '')
1119 1119
 	{
1120 1120
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1121
+		if ($filepath !== '') file_put_contents($filepath, $ret, LOCK_EX);
1122 1122
 		return $ret;
1123 1123
 	}
1124 1124
 
1125 1125
 	// find dom node by css selector
1126 1126
 	// Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
1127
-	function find($selector, $idx=null, $lowercase=false)
1127
+	function find($selector, $idx = null, $lowercase = false)
1128 1128
 	{
1129 1129
 		return $this->root->find($selector, $idx, $lowercase);
1130 1130
 	}
@@ -1132,22 +1132,22 @@  discard block
 block discarded – undo
1132 1132
 	// clean up memory due to php5 circular references memory leak...
1133 1133
 	function clear()
1134 1134
 	{
1135
-		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1135
+		foreach ($this->nodes as $n) {$n->clear(); $n = null; }
1136 1136
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1138
-		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139
-		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1137
+		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null; }
1138
+		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent); }
1139
+		if (isset($this->root)) {$this->root->clear(); unset($this->root); }
1140 1140
 		unset($this->doc);
1141 1141
 		unset($this->noise);
1142 1142
 	}
1143 1143
 
1144
-	function dump($show_attr=true)
1144
+	function dump($show_attr = true)
1145 1145
 	{
1146 1146
 		$this->root->dump($show_attr);
1147 1147
 	}
1148 1148
 
1149 1149
 	// prepare HTML data and init everything
1150
-	protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1150
+	protected function prepare($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1151 1151
 	{
1152 1152
 		$this->clear();
1153 1153
 
@@ -1178,13 +1178,13 @@  discard block
 block discarded – undo
1178 1178
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1179
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1180
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1181
+		if ($this->size > 0) $this->char = $this->doc[0];
1182 1182
 	}
1183 1183
 
1184 1184
 	// parse html content
1185 1185
 	protected function parse()
1186 1186
 	{
1187
-		if (($s = $this->copy_until_char('<'))==='')
1187
+		if (($s = $this->copy_until_char('<')) === '')
1188 1188
 		{
1189 1189
 			return $this->read_tag();
1190 1190
 		}
@@ -1213,18 +1213,18 @@  discard block
 block discarded – undo
1213 1213
 			if ($success)
1214 1214
 			{
1215 1215
 				$charset = $matches[1];
1216
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}
1216
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: '.$charset); }
1217 1217
 			}
1218 1218
 
1219 1219
 		}
1220 1220
 
1221 1221
 		if (empty($charset))
1222 1222
 		{
1223
-			$el = $this->root->find('meta[http-equiv=Content-Type]',0, true);
1223
+			$el = $this->root->find('meta[http-equiv=Content-Type]', 0, true);
1224 1224
 			if (!empty($el))
1225 1225
 			{
1226 1226
 				$fullvalue = $el->content;
1227
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}
1227
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found'.$fullvalue); }
1228 1228
 
1229 1229
 				if (!empty($fullvalue))
1230 1230
 				{
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 					else
1237 1237
 					{
1238 1238
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239
-						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
1239
+						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.'); }
1240 1240
 						$charset = 'ISO-8859-1';
1241 1241
 					}
1242 1242
 				}
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
 			if (function_exists('mb_detect_encoding'))
1252 1252
 			{
1253 1253
 				// Have php try to detect the encoding from the text given to us.
1254
-				$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1255
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}
1254
+				$charset = mb_detect_encoding($this->root->plaintext."ascii", $encoding_list = array("UTF-8", "CP1252"));
1255
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: '.$charset); }
1256 1256
 			}
1257 1257
 
1258 1258
 			// and if this doesn't work...  then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
1259 1259
 			if ($charset === false)
1260 1260
 			{
1261
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}
1261
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8'); }
1262 1262
 				$charset = 'UTF-8';
1263 1263
 			}
1264 1264
 		}
@@ -1266,11 +1266,11 @@  discard block
 block discarded – undo
1266 1266
 		// Since CP1252 is a superset, if we get one of it's subsets, we want it instead.
1267 1267
 		if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
1268 1268
 		{
1269
-			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
1269
+			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing '.$charset.' with CP1252 as its a superset'); }
1270 1270
 			$charset = 'CP1252';
1271 1271
 		}
1272 1272
 
1273
-		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}
1273
+		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - '.$charset); }
1274 1274
 
1275 1275
 		return $this->_charset = $charset;
1276 1276
 	}
@@ -1278,41 +1278,41 @@  discard block
 block discarded – undo
1278 1278
 	// read tag info
1279 1279
 	protected function read_tag()
1280 1280
 	{
1281
-		if ($this->char!=='<')
1281
+		if ($this->char !== '<')
1282 1282
 		{
1283 1283
 			$this->root->_[HDOM_INFO_END] = $this->cursor;
1284 1284
 			return false;
1285 1285
 		}
1286 1286
 		$begin_tag_pos = $this->pos;
1287
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1287
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1288 1288
 
1289 1289
 		// end tag
1290
-		if ($this->char==='/')
1290
+		if ($this->char === '/')
1291 1291
 		{
1292
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1292
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1293 1293
 			// This represents the change in the simple_html_dom trunk from revision 180 to 181.
1294 1294
 			// $this->skip($this->token_blank_t);
1295 1295
 			$this->skip($this->token_blank);
1296 1296
 			$tag = $this->copy_until_char('>');
1297 1297
 
1298 1298
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1299
+			if (($pos = strpos($tag, ' ')) !== false)
1300 1300
 				$tag = substr($tag, 0, $pos);
1301 1301
 
1302 1302
 			$parent_lower = strtolower($this->parent->tag);
1303 1303
 			$tag_lower = strtolower($tag);
1304 1304
 
1305
-			if ($parent_lower!==$tag_lower)
1305
+			if ($parent_lower !== $tag_lower)
1306 1306
 			{
1307 1307
 				if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower]))
1308 1308
 				{
1309 1309
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1310
 					$org_parent = $this->parent;
1311 1311
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1312
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1313 1313
 						$this->parent = $this->parent->parent;
1314 1314
 
1315
-					if (strtolower($this->parent->tag)!==$tag_lower) {
1315
+					if (strtolower($this->parent->tag) !== $tag_lower) {
1316 1316
 						$this->parent = $org_parent; // restore origonal parent
1317 1317
 						if ($this->parent->parent) $this->parent = $this->parent->parent;
1318 1318
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
@@ -1324,17 +1324,17 @@  discard block
 block discarded – undo
1324 1324
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1325
 					$org_parent = $this->parent;
1326 1326
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1327
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1328 1328
 						$this->parent = $this->parent->parent;
1329 1329
 
1330
-					if (strtolower($this->parent->tag)!==$tag_lower)
1330
+					if (strtolower($this->parent->tag) !== $tag_lower)
1331 1331
 					{
1332 1332
 						$this->parent = $org_parent; // restore origonal parent
1333 1333
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1334
 						return $this->as_text_node($tag);
1335 1335
 					}
1336 1336
 				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1337
+				else if (($this->parent->parent) && strtolower($this->parent->parent->tag) === $tag_lower)
1338 1338
 				{
1339 1339
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1340
 					$this->parent = $this->parent->parent;
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347 1347
 			if ($this->parent->parent) $this->parent = $this->parent->parent;
1348 1348
 
1349
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1349
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1350 1350
 			return true;
1351 1351
 		}
1352 1352
 
@@ -1357,25 +1357,25 @@  discard block
 block discarded – undo
1357 1357
 		$node->tag_start = $begin_tag_pos;
1358 1358
 
1359 1359
 		// doctype, cdata & comments...
1360
-		if (isset($tag[0]) && $tag[0]==='!') {
1361
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1360
+		if (isset($tag[0]) && $tag[0] === '!') {
1361
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until_char('>');
1362 1362
 
1363
-			if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
1363
+			if (isset($tag[2]) && $tag[1] === '-' && $tag[2] === '-') {
1364 1364
 				$node->nodetype = HDOM_TYPE_COMMENT;
1365 1365
 				$node->tag = 'comment';
1366 1366
 			} else {
1367 1367
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1368
 				$node->tag = 'unknown';
1369 1369
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1370
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1371 1371
 			$this->link_nodes($node, true);
1372
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1372
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1373 1373
 			return true;
1374 1374
 		}
1375 1375
 
1376 1376
 		// text
1377
-		if ($pos=strpos($tag, '<')!==false) {
1378
-			$tag = '<' . substr($tag, 0, -1);
1377
+		if ($pos = strpos($tag, '<') !== false) {
1378
+			$tag = '<'.substr($tag, 0, -1);
1379 1379
 			$node->_[HDOM_INFO_TEXT] = $tag;
1380 1380
 			$this->link_nodes($node, false);
1381 1381
 			$this->char = $this->doc[--$this->pos]; // prev
@@ -1383,15 +1383,15 @@  discard block
 block discarded – undo
1383 1383
 		}
1384 1384
 
1385 1385
 		if (!preg_match("/^[\w-:]+$/", $tag)) {
1386
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1387
-			if ($this->char==='<') {
1386
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until('<>');
1387
+			if ($this->char === '<') {
1388 1388
 				$this->link_nodes($node, false);
1389 1389
 				return true;
1390 1390
 			}
1391 1391
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1392
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1393 1393
 			$this->link_nodes($node, false);
1394
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1394
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1395 1395
 			return true;
1396 1396
 		}
1397 1397
 
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 		$node->tag = ($this->lowercase) ? $tag_lower : $tag;
1402 1402
 
1403 1403
 		// handle optional closing tags
1404
-		if (isset($this->optional_closing_tags[$tag_lower]) )
1404
+		if (isset($this->optional_closing_tags[$tag_lower]))
1405 1405
 		{
1406 1406
 			while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)]))
1407 1407
 			{
@@ -1417,67 +1417,67 @@  discard block
 block discarded – undo
1417 1417
 		// attributes
1418 1418
 		do
1419 1419
 		{
1420
-			if ($this->char!==null && $space[0]==='')
1420
+			if ($this->char !== null && $space[0] === '')
1421 1421
 			{
1422 1422
 				break;
1423 1423
 			}
1424 1424
 			$name = $this->copy_until($this->token_equal);
1425
-			if ($guard===$this->pos)
1425
+			if ($guard === $this->pos)
1426 1426
 			{
1427
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1427
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1428 1428
 				continue;
1429 1429
 			}
1430 1430
 			$guard = $this->pos;
1431 1431
 
1432 1432
 			// handle endless '<'
1433
-			if ($this->pos>=$this->size-1 && $this->char!=='>') {
1433
+			if ($this->pos >= $this->size - 1 && $this->char !== '>') {
1434 1434
 				$node->nodetype = HDOM_TYPE_TEXT;
1435 1435
 				$node->_[HDOM_INFO_END] = 0;
1436
-				$node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
1436
+				$node->_[HDOM_INFO_TEXT] = '<'.$tag.$space[0].$name;
1437 1437
 				$node->tag = 'text';
1438 1438
 				$this->link_nodes($node, false);
1439 1439
 				return true;
1440 1440
 			}
1441 1441
 
1442 1442
 			// handle mismatch '<'
1443
-			if ($this->doc[$this->pos-1]=='<') {
1443
+			if ($this->doc[$this->pos - 1] == '<') {
1444 1444
 				$node->nodetype = HDOM_TYPE_TEXT;
1445 1445
 				$node->tag = 'text';
1446 1446
 				$node->attr = array();
1447 1447
 				$node->_[HDOM_INFO_END] = 0;
1448
-				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
1448
+				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos - $begin_tag_pos - 1);
1449 1449
 				$this->pos -= 2;
1450
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1450
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1451 1451
 				$this->link_nodes($node, false);
1452 1452
 				return true;
1453 1453
 			}
1454 1454
 
1455
-			if ($name!=='/' && $name!=='') {
1455
+			if ($name !== '/' && $name !== '') {
1456 1456
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1457
 				$name = $this->restore_noise($name);
1458 1458
 				if ($this->lowercase) $name = strtolower($name);
1459
-				if ($this->char==='=') {
1460
-					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1459
+				if ($this->char === '=') {
1460
+					$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1461 1461
 					$this->parse_attr($node, $name, $space);
1462 1462
 				}
1463 1463
 				else {
1464 1464
 					//no value attr: nowrap, checked selected...
1465 1465
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1466
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1467
+					if ($this->char != '>') $this->char = $this->doc[--$this->pos]; // prev
1468 1468
 				}
1469 1469
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1470
 				$space = array($this->copy_skip($this->token_blank), '', '');
1471 1471
 			}
1472 1472
 			else
1473 1473
 				break;
1474
-		} while ($this->char!=='>' && $this->char!=='/');
1474
+		} while ($this->char !== '>' && $this->char !== '/');
1475 1475
 
1476 1476
 		$this->link_nodes($node, true);
1477 1477
 		$node->_[HDOM_INFO_ENDSPACE] = $space[0];
1478 1478
 
1479 1479
 		// check self closing
1480
-		if ($this->copy_until_char_escape('>')==='/')
1480
+		if ($this->copy_until_char_escape('>') === '/')
1481 1481
 		{
1482 1482
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1483
 			$node->_[HDOM_INFO_END] = 0;
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 			// reset parent
1488 1488
 			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1489 1489
 		}
1490
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1490
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1491 1491
 
1492 1492
 		// If it's a BR tag, we need to set it's text to the default text.
1493 1493
 		// This way when we see it in plaintext, we can generate formatting that the user wants.
@@ -1514,15 +1514,15 @@  discard block
 block discarded – undo
1514 1514
 		switch ($this->char) {
1515 1515
 			case '"':
1516 1516
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
1517
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1517
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1518 1518
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
1519
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1519
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1520 1520
 				break;
1521 1521
 			case '\'':
1522 1522
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
1523
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1523
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1524 1524
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
1525
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1525
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1526 1526
 				break;
1527 1527
 			default:
1528 1528
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
@@ -1553,16 +1553,16 @@  discard block
 block discarded – undo
1553 1553
 	{
1554 1554
 		$node = new simple_html_dom_node($this);
1555 1555
 		++$this->cursor;
1556
-		$node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
1556
+		$node->_[HDOM_INFO_TEXT] = '</'.$tag.'>';
1557 1557
 		$this->link_nodes($node, false);
1558
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1558
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1559 1559
 		return true;
1560 1560
 	}
1561 1561
 
1562 1562
 	protected function skip($chars)
1563 1563
 	{
1564 1564
 		$this->pos += strspn($this->doc, $chars, $this->pos);
1565
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1565
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1566 1566
 	}
1567 1567
 
1568 1568
 	protected function copy_skip($chars)
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
 		$pos = $this->pos;
1571 1571
 		$len = strspn($this->doc, $chars, $pos);
1572 1572
 		$this->pos += $len;
1573
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1573
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1574
+		if ($len === 0) return '';
1575 1575
 		return substr($this->doc, $pos, $len);
1576 1576
 	}
1577 1577
 
@@ -1580,70 +1580,70 @@  discard block
 block discarded – undo
1580 1580
 		$pos = $this->pos;
1581 1581
 		$len = strcspn($this->doc, $chars, $pos);
1582 1582
 		$this->pos += $len;
1583
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1583
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1584 1584
 		return substr($this->doc, $pos, $len);
1585 1585
 	}
1586 1586
 
1587 1587
 	protected function copy_until_char($char)
1588 1588
 	{
1589
-		if ($this->char===null) return '';
1589
+		if ($this->char === null) return '';
1590 1590
 
1591
-		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592
-			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1591
+		if (($pos = strpos($this->doc, $char, $this->pos)) === false) {
1592
+			$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1593 1593
 			$this->char = null;
1594 1594
 			$this->pos = $this->size;
1595 1595
 			return $ret;
1596 1596
 		}
1597 1597
 
1598
-		if ($pos===$this->pos) return '';
1598
+		if ($pos === $this->pos) return '';
1599 1599
 		$pos_old = $this->pos;
1600 1600
 		$this->char = $this->doc[$pos];
1601 1601
 		$this->pos = $pos;
1602
-		return substr($this->doc, $pos_old, $pos-$pos_old);
1602
+		return substr($this->doc, $pos_old, $pos - $pos_old);
1603 1603
 	}
1604 1604
 
1605 1605
 	protected function copy_until_char_escape($char)
1606 1606
 	{
1607
-		if ($this->char===null) return '';
1607
+		if ($this->char === null) return '';
1608 1608
 
1609 1609
 		$start = $this->pos;
1610 1610
 		while (1)
1611 1611
 		{
1612
-			if (($pos = strpos($this->doc, $char, $start))===false)
1612
+			if (($pos = strpos($this->doc, $char, $start)) === false)
1613 1613
 			{
1614
-				$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1614
+				$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1615 1615
 				$this->char = null;
1616 1616
 				$this->pos = $this->size;
1617 1617
 				return $ret;
1618 1618
 			}
1619 1619
 
1620
-			if ($pos===$this->pos) return '';
1620
+			if ($pos === $this->pos) return '';
1621 1621
 
1622
-			if ($this->doc[$pos-1]==='\\') {
1623
-				$start = $pos+1;
1622
+			if ($this->doc[$pos - 1] === '\\') {
1623
+				$start = $pos + 1;
1624 1624
 				continue;
1625 1625
 			}
1626 1626
 
1627 1627
 			$pos_old = $this->pos;
1628 1628
 			$this->char = $this->doc[$pos];
1629 1629
 			$this->pos = $pos;
1630
-			return substr($this->doc, $pos_old, $pos-$pos_old);
1630
+			return substr($this->doc, $pos_old, $pos - $pos_old);
1631 1631
 		}
1632 1632
 	}
1633 1633
 
1634 1634
 	// remove noise from html content
1635 1635
 	// save the noise in the $this->noise array.
1636
-	protected function remove_noise($pattern, $remove_tag=false)
1636
+	protected function remove_noise($pattern, $remove_tag = false)
1637 1637
 	{
1638 1638
 		global $debug_object;
1639 1639
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1640 1640
 
1641 1641
 		$count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
1642 1642
 
1643
-		for ($i=$count-1; $i>-1; --$i)
1643
+		for ($i = $count - 1; $i > -1; --$i)
1644 1644
 		{
1645
-			$key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
1646
-			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }
1645
+			$key = '___noise___'.sprintf('% 5d', count($this->noise) + 1000);
1646
+			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: '.$key); }
1647 1647
 			$idx = ($remove_tag) ? 0 : 1;
1648 1648
 			$this->noise[$key] = $matches[$i][$idx][0];
1649 1649
 			$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 
1652 1652
 		// reset the length of content
1653 1653
 		$this->size = strlen($this->doc);
1654
-		if ($this->size>0)
1654
+		if ($this->size > 0)
1655 1655
 		{
1656 1656
 			$this->char = $this->doc[0];
1657 1657
 		}
@@ -1663,28 +1663,28 @@  discard block
 block discarded – undo
1663 1663
 		global $debug_object;
1664 1664
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1665 1665
 
1666
-		while (($pos=strpos($text, '___noise___'))!==false)
1666
+		while (($pos = strpos($text, '___noise___')) !== false)
1667 1667
 		{
1668 1668
 			// Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
1669
-			if (strlen($text) > $pos+15)
1669
+			if (strlen($text) > $pos + 15)
1670 1670
 			{
1671
-				$key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
1672
-				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }
1671
+				$key = '___noise___'.$text[$pos + 11].$text[$pos + 12].$text[$pos + 13].$text[$pos + 14].$text[$pos + 15];
1672
+				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: '.$key); }
1673 1673
 
1674 1674
 				if (isset($this->noise[$key]))
1675 1675
 				{
1676
-					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1676
+					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos + 16);
1677 1677
 				}
1678 1678
 				else
1679 1679
 				{
1680 1680
 					// do this to prevent an infinite loop.
1681
-					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1681
+					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key.substr($text, $pos + 16);
1682 1682
 				}
1683 1683
 			}
1684 1684
 			else
1685 1685
 			{
1686 1686
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687
-				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
1687
+				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY'.substr($text, $pos + 11);
1688 1688
 			}
1689 1689
 		}
1690 1690
 		return $text;
@@ -1696,9 +1696,9 @@  discard block
 block discarded – undo
1696 1696
 		global $debug_object;
1697 1697
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1698 1698
 
1699
-		foreach($this->noise as $noiseElement)
1699
+		foreach ($this->noise as $noiseElement)
1700 1700
 		{
1701
-			if (strpos($noiseElement, $text)!==false)
1701
+			if (strpos($noiseElement, $text) !== false)
1702 1702
 			{
1703 1703
 				return $noiseElement;
1704 1704
 			}
@@ -1727,16 +1727,16 @@  discard block
 block discarded – undo
1727 1727
 	}
1728 1728
 
1729 1729
 	// camel naming conventions
1730
-	function childNodes($idx=-1) {return $this->root->childNodes($idx);}
1731
-	function firstChild() {return $this->root->first_child();}
1732
-	function lastChild() {return $this->root->last_child();}
1733
-	function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();}
1734
-	function createTextNode($value) {return @end(str_get_html($value)->nodes);}
1735
-	function getElementById($id) {return $this->find("#$id", 0);}
1736
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
1737
-	function getElementByTagName($name) {return $this->find($name, 0);}
1738
-	function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
1739
-	function loadFile() {$args = func_get_args();$this->load_file($args);}
1730
+	function childNodes($idx = -1) {return $this->root->childNodes($idx); }
1731
+	function firstChild() {return $this->root->first_child(); }
1732
+	function lastChild() {return $this->root->last_child(); }
1733
+	function createElement($name, $value = null) {return @str_get_html("<$name>$value</$name>")->first_child(); }
1734
+	function createTextNode($value) {return @end(str_get_html($value)->nodes); }
1735
+	function getElementById($id) {return $this->find("#$id", 0); }
1736
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
1737
+	function getElementByTagName($name) {return $this->find($name, 0); }
1738
+	function getElementsByTagName($name, $idx = -1) {return $this->find($name, $idx); }
1739
+	function loadFile() {$args = func_get_args(); $this->load_file($args); }
1740 1740
 }
1741 1741
 
1742 1742
 ?>
1743 1743
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +193 added lines, -101 removed lines patch added patch discarded remove patch
@@ -159,8 +159,9 @@  discard block
 block discarded – undo
159 159
 		if ($show_attr && count($this->attr)>0)
160 160
 		{
161 161
 			echo '(';
162
-			foreach ($this->attr as $k=>$v)
163
-				echo "[$k]=>\"".$this->$k.'", ';
162
+			foreach ($this->attr as $k=>$v) {
163
+							echo "[$k]=>\"".$this->$k.'", ';
164
+			}
164 165
 			echo ')';
165 166
 		}
166 167
 		echo "\n";
@@ -218,8 +219,7 @@  discard block
 block discarded – undo
218 219
 		if (isset($node->_[HDOM_INFO_INNER]))
219 220
 		{
220 221
 			$string .= $node->_[HDOM_INFO_INNER] . "'";
221
-		}
222
-		else
222
+		} else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 		{
234 234
 			echo $string;
235 235
 			return;
236
-		}
237
-		else
236
+		} else
238 237
 		{
239 238
 			return $string;
240 239
 		}
@@ -320,12 +319,17 @@  discard block
 block discarded – undo
320 319
 	// returns the previous sibling of node
321 320
 	function prev_sibling()
322 321
 	{
323
-		if ($this->parent===null) return null;
322
+		if ($this->parent===null) {
323
+			return null;
324
+		}
324 325
 		$idx = 0;
325 326
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
327
-			++$idx;
328
-		if (--$idx<0) return null;
327
+		while ($idx<$count && $this!==$this->parent->children[$idx]) {
328
+					++$idx;
329
+		}
330
+		if (--$idx<0) {
331
+			return null;
332
+		}
329 333
 		return $this->parent->children[$idx];
330 334
 	}
331 335
 
@@ -354,12 +358,17 @@  discard block
 block discarded – undo
354 358
 	// get dom node's inner html
355 359
 	function innertext()
356 360
 	{
357
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
358
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
361
+		if (isset($this->_[HDOM_INFO_INNER])) {
362
+			return $this->_[HDOM_INFO_INNER];
363
+		}
364
+		if (isset($this->_[HDOM_INFO_TEXT])) {
365
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
366
+		}
359 367
 
360 368
 		$ret = '';
361
-		foreach ($this->nodes as $n)
362
-			$ret .= $n->outertext();
369
+		foreach ($this->nodes as $n) {
370
+					$ret .= $n->outertext();
371
+		}
363 372
 		return $ret;
364 373
 	}
365 374
 
@@ -380,7 +389,9 @@  discard block
 block discarded – undo
380 389
 			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
381 390
 		}
382 391
 
383
-		if ($this->tag==='root') return $this->innertext();
392
+		if ($this->tag==='root') {
393
+			return $this->innertext();
394
+		}
384 395
 
385 396
 		// trigger callback
386 397
 		if ($this->dom && $this->dom->callback!==null)
@@ -388,8 +399,12 @@  discard block
 block discarded – undo
388 399
 			call_user_func_array($this->dom->callback, array($this));
389 400
 		}
390 401
 
391
-		if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
392
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
402
+		if (isset($this->_[HDOM_INFO_OUTER])) {
403
+			return $this->_[HDOM_INFO_OUTER];
404
+		}
405
+		if (isset($this->_[HDOM_INFO_TEXT])) {
406
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
407
+		}
393 408
 
394 409
 		// render begin tag
395 410
 		if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]])
@@ -418,23 +433,30 @@  discard block
 block discarded – undo
418 433
 		}
419 434
 
420 435
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
422
-			$ret .= '</'.$this->tag.'>';
436
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) {
437
+					$ret .= '</'.$this->tag.'>';
438
+		}
423 439
 		return $ret;
424 440
 	}
425 441
 
426 442
 	// get dom node's plain text
427 443
 	function text()
428 444
 	{
429
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
445
+		if (isset($this->_[HDOM_INFO_INNER])) {
446
+			return $this->_[HDOM_INFO_INNER];
447
+		}
430 448
 		switch ($this->nodetype)
431 449
 		{
432 450
 			case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
433 451
 			case HDOM_TYPE_COMMENT: return '';
434 452
 			case HDOM_TYPE_UNKNOWN: return '';
435 453
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
454
+		if (strcasecmp($this->tag, 'script')===0) {
455
+			return '';
456
+		}
457
+		if (strcasecmp($this->tag, 'style')===0) {
458
+			return '';
459
+		}
438 460
 
439 461
 		$ret = '';
440 462
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -470,7 +492,9 @@  discard block
 block discarded – undo
470 492
 	function makeup()
471 493
 	{
472 494
 		// text, comment, unknown
473
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
495
+		if (isset($this->_[HDOM_INFO_TEXT])) {
496
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
497
+		}
474 498
 
475 499
 		$ret = '<'.$this->tag;
476 500
 		$i = -1;
@@ -480,14 +504,15 @@  discard block
 block discarded – undo
480 504
 			++$i;
481 505
 
482 506
 			// skip removed attribute
483
-			if ($val===null || $val===false)
484
-				continue;
507
+			if ($val===null || $val===false) {
508
+							continue;
509
+			}
485 510
 
486 511
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 512
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
489
-				$ret .= $key;
490
-			else {
513
+			if ($val===true) {
514
+							$ret .= $key;
515
+			} else {
491 516
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
492 517
 				{
493 518
 					case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
@@ -506,7 +531,9 @@  discard block
 block discarded – undo
506 531
 	function find($selector, $idx=null, $lowercase=false)
507 532
 	{
508 533
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
534
+		if (($count=count($selectors))===0) {
535
+			return array();
536
+		}
510 537
 		$found_keys = array();
511 538
 
512 539
 		// find each selector
@@ -514,8 +541,12 @@  discard block
 block discarded – undo
514 541
 		{
515 542
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 543
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
518
-			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
544
+			if (($levle=count($selectors[$c]))===0) {
545
+				return array();
546
+			}
547
+			if (!isset($this->_[HDOM_INFO_BEGIN])) {
548
+				return array();
549
+			}
519 550
 
520 551
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 552
 
@@ -545,12 +576,16 @@  discard block
 block discarded – undo
545 576
 		ksort($found_keys);
546 577
 
547 578
 		$found = array();
548
-		foreach ($found_keys as $k=>$v)
549
-			$found[] = $this->dom->nodes[$k];
579
+		foreach ($found_keys as $k=>$v) {
580
+					$found[] = $this->dom->nodes[$k];
581
+		}
550 582
 
551 583
 		// return nth-element or array
552
-		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
584
+		if (is_null($idx)) {
585
+			return $found;
586
+		} else if ($idx<0) {
587
+			$idx = count($found) + $idx;
588
+		}
554 589
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 590
 	}
556 591
 
@@ -595,8 +630,9 @@  discard block
 block discarded – undo
595 630
 			$pass = true;
596 631
 
597 632
 			if ($tag==='*' && !$key) {
598
-				if (in_array($node, $this->children, true))
599
-					$ret[$i] = 1;
633
+				if (in_array($node, $this->children, true)) {
634
+									$ret[$i] = 1;
635
+				}
600 636
 				continue;
601 637
 			}
602 638
 
@@ -605,9 +641,13 @@  discard block
 block discarded – undo
605 641
 			// compare key
606 642
 			if ($pass && $key) {
607 643
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
644
+					if (isset($node->attr[$key])) {
645
+						$pass=false;
646
+					}
609 647
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
648
+					if (($key != "plaintext") && !isset($node->attr[$key])) {
649
+						$pass=false;
650
+					}
611 651
 				}
612 652
 			}
613 653
 			// compare value
@@ -640,13 +680,19 @@  discard block
 block discarded – undo
640 680
 							} else {
641 681
 								$check = $this->match($exp, $val, $k);
642 682
 							}
643
-							if ($check) break;
683
+							if ($check) {
684
+								break;
685
+							}
644 686
 						}
645 687
 					}
646 688
 				}
647
-				if (!$check) $pass = false;
689
+				if (!$check) {
690
+					$pass = false;
691
+				}
692
+			}
693
+			if ($pass) {
694
+				$ret[$i] = 1;
648 695
 			}
649
-			if ($pass) $ret[$i] = 1;
650 696
 			unset($node);
651 697
 		}
652 698
 		// It's passed by reference so this is actually what this function returns.
@@ -696,9 +742,13 @@  discard block
 block discarded – undo
696 742
 
697 743
 		foreach ($matches as $m) {
698 744
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
745
+			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') {
746
+				continue;
747
+			}
700 748
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
749
+			if ($m[1]==='tbody') {
750
+				continue;
751
+			}
702 752
 
703 753
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704 754
 			if (!empty($m[2])) {$key='id'; $val=$m[2];}
@@ -718,8 +768,9 @@  discard block
 block discarded – undo
718 768
 				$result = array();
719 769
 			}
720 770
 		}
721
-		if (count($result)>0)
722
-			$selectors[] = $result;
771
+		if (count($result)>0) {
772
+					$selectors[] = $result;
773
+		}
723 774
 		return $selectors;
724 775
 	}
725 776
 
@@ -748,7 +799,9 @@  discard block
 block discarded – undo
748 799
 		{
749 800
 			case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
750 801
 			case 'innertext':
751
-				if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
802
+				if (isset($this->_[HDOM_INFO_TEXT])) {
803
+					return $this->_[HDOM_INFO_TEXT] = $value;
804
+				}
752 805
 				return $this->_[HDOM_INFO_INNER] = $value;
753 806
 		}
754 807
 		if (!isset($this->attr[$name]))
@@ -772,8 +825,9 @@  discard block
 block discarded – undo
772 825
 	}
773 826
 
774 827
 	function __unset($name) {
775
-		if (isset($this->attr[$name]))
776
-			unset($this->attr[$name]);
828
+		if (isset($this->attr[$name])) {
829
+					unset($this->attr[$name]);
830
+		}
777 831
 	}
778 832
 
779 833
 	// PaperG - Function to convert the text from one character set to another if the two sets are not the same.
@@ -800,8 +854,7 @@  discard block
 block discarded – undo
800 854
 			if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text)))
801 855
 			{
802 856
 				$converted_text = $text;
803
-			}
804
-			else
857
+			} else
805 858
 			{
806 859
 				$converted_text = iconv($sourceCharset, $targetCharset, $text);
807 860
 			}
@@ -839,19 +892,31 @@  discard block
 block discarded – undo
839 892
 			$c=ord($str[$i]);
840 893
 			if($c > 128)
841 894
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
848
-				else return false;
849
-				if(($i+$bits) > $len) return false;
895
+				if(($c >= 254)) {
896
+					return false;
897
+				} elseif($c >= 252) {
898
+					$bits=6;
899
+				} elseif($c >= 248) {
900
+					$bits=5;
901
+				} elseif($c >= 240) {
902
+					$bits=4;
903
+				} elseif($c >= 224) {
904
+					$bits=3;
905
+				} elseif($c >= 192) {
906
+					$bits=2;
907
+				} else {
908
+					return false;
909
+				}
910
+				if(($i+$bits) > $len) {
911
+					return false;
912
+				}
850 913
 				while($bits > 1)
851 914
 				{
852 915
 					$i++;
853 916
 					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
917
+					if($b < 128 || $b > 191) {
918
+						return false;
919
+					}
855 920
 					$bits--;
856 921
 				}
857 922
 			}
@@ -1035,8 +1100,7 @@  discard block
 block discarded – undo
1035 1100
 			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1036 1101
 			{
1037 1102
 				$this->load_file($str);
1038
-			}
1039
-			else
1103
+			} else
1040 1104
 			{
1041 1105
 				$this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1042 1106
 			}
@@ -1118,7 +1182,9 @@  discard block
 block discarded – undo
1118 1182
 	function save($filepath='')
1119 1183
 	{
1120 1184
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1185
+		if ($filepath!=='') {
1186
+			file_put_contents($filepath, $ret, LOCK_EX);
1187
+		}
1122 1188
 		return $ret;
1123 1189
 	}
1124 1190
 
@@ -1134,7 +1200,10 @@  discard block
 block discarded – undo
1134 1200
 	{
1135 1201
 		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1136 1202
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1203
+		if (isset($this->children)) {
1204
+			foreach ($this->children as $n) {$n->clear();
1205
+		}
1206
+		$n = null;}
1138 1207
 		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139 1208
 		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1140 1209
 		unset($this->doc);
@@ -1178,7 +1247,9 @@  discard block
 block discarded – undo
1178 1247
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1248
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1249
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1250
+		if ($this->size>0) {
1251
+			$this->char = $this->doc[0];
1252
+		}
1182 1253
 	}
1183 1254
 
1184 1255
 	// parse html content
@@ -1232,8 +1303,7 @@  discard block
 block discarded – undo
1232 1303
 					if ($success)
1233 1304
 					{
1234 1305
 						$charset = $matches[1];
1235
-					}
1236
-					else
1306
+					} else
1237 1307
 					{
1238 1308
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239 1309
 						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
@@ -1296,8 +1366,9 @@  discard block
 block discarded – undo
1296 1366
 			$tag = $this->copy_until_char('>');
1297 1367
 
1298 1368
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1300
-				$tag = substr($tag, 0, $pos);
1369
+			if (($pos = strpos($tag, ' '))!==false) {
1370
+							$tag = substr($tag, 0, $pos);
1371
+			}
1301 1372
 
1302 1373
 			$parent_lower = strtolower($this->parent->tag);
1303 1374
 			$tag_lower = strtolower($tag);
@@ -1309,23 +1380,26 @@  discard block
 block discarded – undo
1309 1380
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1381
 					$org_parent = $this->parent;
1311 1382
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1313
-						$this->parent = $this->parent->parent;
1383
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1384
+											$this->parent = $this->parent->parent;
1385
+					}
1314 1386
 
1315 1387
 					if (strtolower($this->parent->tag)!==$tag_lower) {
1316 1388
 						$this->parent = $org_parent; // restore origonal parent
1317
-						if ($this->parent->parent) $this->parent = $this->parent->parent;
1389
+						if ($this->parent->parent) {
1390
+							$this->parent = $this->parent->parent;
1391
+						}
1318 1392
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1319 1393
 						return $this->as_text_node($tag);
1320 1394
 					}
1321
-				}
1322
-				else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1395
+				} else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1323 1396
 				{
1324 1397
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1398
 					$org_parent = $this->parent;
1326 1399
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1328
-						$this->parent = $this->parent->parent;
1400
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1401
+											$this->parent = $this->parent->parent;
1402
+					}
1329 1403
 
1330 1404
 					if (strtolower($this->parent->tag)!==$tag_lower)
1331 1405
 					{
@@ -1333,18 +1407,19 @@  discard block
 block discarded – undo
1333 1407
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1408
 						return $this->as_text_node($tag);
1335 1409
 					}
1336
-				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1410
+				} else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1338 1411
 				{
1339 1412
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1413
 					$this->parent = $this->parent->parent;
1414
+				} else {
1415
+									return $this->as_text_node($tag);
1341 1416
 				}
1342
-				else
1343
-					return $this->as_text_node($tag);
1344 1417
 			}
1345 1418
 
1346 1419
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347
-			if ($this->parent->parent) $this->parent = $this->parent->parent;
1420
+			if ($this->parent->parent) {
1421
+				$this->parent = $this->parent->parent;
1422
+			}
1348 1423
 
1349 1424
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1350 1425
 			return true;
@@ -1367,7 +1442,9 @@  discard block
 block discarded – undo
1367 1442
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1443
 				$node->tag = 'unknown';
1369 1444
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1445
+			if ($this->char==='>') {
1446
+				$node->_[HDOM_INFO_TEXT].='>';
1447
+			}
1371 1448
 			$this->link_nodes($node, true);
1372 1449
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1373 1450
 			return true;
@@ -1389,7 +1466,9 @@  discard block
 block discarded – undo
1389 1466
 				return true;
1390 1467
 			}
1391 1468
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1469
+			if ($this->char==='>') {
1470
+				$node->_[HDOM_INFO_TEXT].='>';
1471
+			}
1393 1472
 			$this->link_nodes($node, false);
1394 1473
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1395 1474
 			return true;
@@ -1455,22 +1534,26 @@  discard block
 block discarded – undo
1455 1534
 			if ($name!=='/' && $name!=='') {
1456 1535
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1536
 				$name = $this->restore_noise($name);
1458
-				if ($this->lowercase) $name = strtolower($name);
1537
+				if ($this->lowercase) {
1538
+					$name = strtolower($name);
1539
+				}
1459 1540
 				if ($this->char==='=') {
1460 1541
 					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1461 1542
 					$this->parse_attr($node, $name, $space);
1462
-				}
1463
-				else {
1543
+				} else {
1464 1544
 					//no value attr: nowrap, checked selected...
1465 1545
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1546
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1547
+					if ($this->char!='>') {
1548
+						$this->char = $this->doc[--$this->pos];
1549
+					}
1550
+					// prev
1468 1551
 				}
1469 1552
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1553
 				$space = array($this->copy_skip($this->token_blank), '', '');
1554
+			} else {
1555
+							break;
1471 1556
 			}
1472
-			else
1473
-				break;
1474 1557
 		} while ($this->char!=='>' && $this->char!=='/');
1475 1558
 
1476 1559
 		$this->link_nodes($node, true);
@@ -1481,11 +1564,12 @@  discard block
 block discarded – undo
1481 1564
 		{
1482 1565
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1566
 			$node->_[HDOM_INFO_END] = 0;
1484
-		}
1485
-		else
1567
+		} else
1486 1568
 		{
1487 1569
 			// reset parent
1488
-			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1570
+			if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
1571
+				$this->parent = $node;
1572
+			}
1489 1573
 		}
1490 1574
 		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1491 1575
 
@@ -1571,7 +1655,9 @@  discard block
 block discarded – undo
1571 1655
 		$len = strspn($this->doc, $chars, $pos);
1572 1656
 		$this->pos += $len;
1573 1657
 		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1658
+		if ($len===0) {
1659
+			return '';
1660
+		}
1575 1661
 		return substr($this->doc, $pos, $len);
1576 1662
 	}
1577 1663
 
@@ -1586,7 +1672,9 @@  discard block
 block discarded – undo
1586 1672
 
1587 1673
 	protected function copy_until_char($char)
1588 1674
 	{
1589
-		if ($this->char===null) return '';
1675
+		if ($this->char===null) {
1676
+			return '';
1677
+		}
1590 1678
 
1591 1679
 		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592 1680
 			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
@@ -1595,7 +1683,9 @@  discard block
 block discarded – undo
1595 1683
 			return $ret;
1596 1684
 		}
1597 1685
 
1598
-		if ($pos===$this->pos) return '';
1686
+		if ($pos===$this->pos) {
1687
+			return '';
1688
+		}
1599 1689
 		$pos_old = $this->pos;
1600 1690
 		$this->char = $this->doc[$pos];
1601 1691
 		$this->pos = $pos;
@@ -1604,7 +1694,9 @@  discard block
 block discarded – undo
1604 1694
 
1605 1695
 	protected function copy_until_char_escape($char)
1606 1696
 	{
1607
-		if ($this->char===null) return '';
1697
+		if ($this->char===null) {
1698
+			return '';
1699
+		}
1608 1700
 
1609 1701
 		$start = $this->pos;
1610 1702
 		while (1)
@@ -1617,7 +1709,9 @@  discard block
 block discarded – undo
1617 1709
 				return $ret;
1618 1710
 			}
1619 1711
 
1620
-			if ($pos===$this->pos) return '';
1712
+			if ($pos===$this->pos) {
1713
+				return '';
1714
+			}
1621 1715
 
1622 1716
 			if ($this->doc[$pos-1]==='\\') {
1623 1717
 				$start = $pos+1;
@@ -1674,14 +1768,12 @@  discard block
 block discarded – undo
1674 1768
 				if (isset($this->noise[$key]))
1675 1769
 				{
1676 1770
 					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1677
-				}
1678
-				else
1771
+				} else
1679 1772
 				{
1680 1773
 					// do this to prevent an infinite loop.
1681 1774
 					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1682 1775
 				}
1683
-			}
1684
-			else
1776
+			} else
1685 1777
 			{
1686 1778
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687 1779
 				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
Please login to merge, or discard this patch.
date-statistics-manufacturer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
12
-	$title = sprintf(_("Most Common Aircraft Manufacturer on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
12
+	$title = sprintf(_("Most Common Aircraft Manufacturer on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13 13
 
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 
38 38
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByDate($date);
39 39
 	if (!empty($manufacturers_array))
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		print '</thead>';
49 49
 		print '<tbody>';
50 50
 		$i = 1;
51
-		foreach($manufacturers_array as $manufacturer_item)
51
+		foreach ($manufacturers_array as $manufacturer_item)
52 52
 		{
53 53
 			print '<tr>';
54 54
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
date-statistics-registration.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 
38 38
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByDate($date);
39 39
 	if (!empty($aircraft_array))
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		print '</thead>';
51 51
 		print '<tbody>';
52 52
 		$i = 1;
53
-		foreach($aircraft_array as $aircraft_item)
53
+		foreach ($aircraft_array as $aircraft_item)
54 54
 		{
55 55
 			print '<tr>';
56 56
 			print '<td><strong>'.$i.'</strong></td>';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 				if (isset($aircraft_item['aircraft_type'])) {
61 61
 					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
62 62
 				} else {
63
-					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
63
+					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
64 64
 				}
65 65
 				print '</td>';
66 66
 			} else {
Please login to merge, or discard this patch.
airline-statistics-manufacturer.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airline');
8 8
         die();
9 9
 }
10
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
16
+	$title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="select-item">';
19 19
 	print '<form action="'.$globalURL.'/airline" method="post">';
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24 24
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
25
-	foreach($airline_names as $airline_name)
25
+	foreach ($airline_names as $airline_name)
26 26
 	{
27
-		if($airline == $airline_name['airline_icao'])
27
+		if ($airline == $airline_name['airline_icao'])
28 28
 		{
29 29
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
30 30
 		} else {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	include('airline-sub-menu.php');
63 63
 	print '<div class="column">';
64 64
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
65
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
65
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
66 66
 
67 67
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline($airline);
68 68
 	if (!empty($manufacturers_array))
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		print '</thead>';
78 78
 		print '<tbody>';
79 79
 		$i = 1;
80
-		foreach($manufacturers_array as $manufacturer_item)
80
+		foreach ($manufacturers_array as $manufacturer_item)
81 81
 		{
82 82
 			print '<tr>';
83 83
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	print '<option></option>';
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
24
+	if (empty($airline_names)) {
25
+		$airline_names = $Spotter->getAllAirlineNames();
26
+	}
25 27
 	foreach($airline_names as $airline_name)
26 28
 	{
27 29
 		if($airline == $airline_name['airline_icao'])
@@ -43,8 +45,7 @@  discard block
 block discarded – undo
43 45
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
44 46
 			{
45 47
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
46
-			}
47
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48 49
 			{
49 50
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
50 51
 			}
Please login to merge, or discard this patch.
manufacturer-statistics-registration.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft by Registration from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Aircraft by Registration from %s"), $manufacturer);
18 18
 	require_once('header.php');
19 19
 
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByManufacturer($manufacturer);
50 50
 	if (!empty($aircraft_array))
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		print '</thead>';
62 62
 		print '<tbody>';
63 63
 		$i = 1;
64
-		foreach($aircraft_array as $aircraft_item)
64
+		foreach ($aircraft_array as $aircraft_item)
65 65
 		{
66 66
 			print '<tr>';
67 67
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.