Completed
Push — master ( cc50d0...0f8c33 )
by Yannick
09:46
created
require/class.Common.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 	//protected $cookies = array();
8 8
 	
9 9
 	/**
10
-	* Get data from form result
11
-	* @param String $url form URL
12
-	* @param String $type type of submit form method (get or post)
13
-	* @param String|Array $data values form post method
14
-	* @param Array $headers header to submit with the form
15
-	* @return String the result
16
-	*/
10
+	 * Get data from form result
11
+	 * @param String $url form URL
12
+	 * @param String $type type of submit form method (get or post)
13
+	 * @param String|Array $data values form post method
14
+	 * @param Array $headers header to submit with the form
15
+	 * @return String the result
16
+	 */
17 17
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
18 18
 		global $globalProxy, $globalForceIPv4;
19 19
 		$ch = curl_init();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
78 78
 			}
79 79
 		} else {
80
-		    return $result;
80
+			return $result;
81 81
 		}
82 82
 	}
83 83
 	
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 	
108 108
 	/**
109
-	* Convert a HTML table to an array
110
-	* @param String $data HTML page
111
-	* @return Array array of the tables in HTML page
112
-	*/
109
+	 * Convert a HTML table to an array
110
+	 * @param String $data HTML page
111
+	 * @return Array array of the tables in HTML page
112
+	 */
113 113
 	public function table2array($data) {
114 114
 		if (!is_string($data)) return array();
115 115
 		if ($data == '') return array();
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 	
145 145
 	/**
146
-	* Convert <p> part of a HTML page to an array
147
-	* @param String $data HTML page
148
-	* @return Array array of the <p> in HTML page
149
-	*/
146
+	 * Convert <p> part of a HTML page to an array
147
+	 * @param String $data HTML page
148
+	 * @return Array array of the <p> in HTML page
149
+	 */
150 150
 	public function text2array($data) {
151 151
 		$html = str_get_html($data);
152 152
 		if ($html === false) return array();
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 	}
162 162
 
163 163
 	/**
164
-	* Give distance between 2 coordonnates
165
-	* @param Float $lat latitude of first point
166
-	* @param Float $lon longitude of first point
167
-	* @param Float $latc latitude of second point
168
-	* @param Float $lonc longitude of second point
169
-	* @param String $unit km else no unit used
170
-	* @return Float Distance in $unit
171
-	*/
164
+	 * Give distance between 2 coordonnates
165
+	 * @param Float $lat latitude of first point
166
+	 * @param Float $lon longitude of first point
167
+	 * @param Float $latc latitude of second point
168
+	 * @param Float $lonc longitude of second point
169
+	 * @param String $unit km else no unit used
170
+	 * @return Float Distance in $unit
171
+	 */
172 172
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
173 173
 		if ($lat == $latc && $lon == $lonc) return 0;
174 174
 		$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;
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	}
187 187
 
188 188
 	/**
189
-	* Check is distance realistic
190
-	* @param int $timeDifference the time between the reception of both messages
191
-	* @param float $distance distance covered
192
-	* @return whether distance is realistic
193
-	*/
189
+	 * Check is distance realistic
190
+	 * @param int $timeDifference the time between the reception of both messages
191
+	 * @param float $distance distance covered
192
+	 * @return whether distance is realistic
193
+	 */
194 194
 	public function withinThreshold ($timeDifference, $distance) {
195 195
 		$x = abs($timeDifference);
196 196
 		$d = abs($distance);
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	}
209 209
 
210 210
 	public function isInteger($input){
211
-	    return(ctype_digit(strval($input)));
211
+		return(ctype_digit(strval($input)));
212 212
 	}
213 213
 
214 214
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 	
226 226
 	/**
227
-	* Copy folder contents
228
-	* @param       string   $source    Source path
229
-	* @param       string   $dest      Destination path
230
-	* @return      bool     Returns true on success, false on failure
231
-	*/
227
+	 * Copy folder contents
228
+	 * @param       string   $source    Source path
229
+	 * @param       string   $dest      Destination path
230
+	 * @return      bool     Returns true on success, false on failure
231
+	 */
232 232
 	public function xcopy($source, $dest)
233 233
 	{
234 234
 		$files = glob($source.'*.*');
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Check if an url exist
244
-	* @param	String $url url to check
245
-	* @return	bool Return true on succes false on failure
246
-	*/
243
+	 * Check if an url exist
244
+	 * @param	String $url url to check
245
+	 * @return	bool Return true on succes false on failure
246
+	 */
247 247
 	public function urlexist($url){
248 248
 		$headers=get_headers($url);
249 249
 		return stripos($headers[0],"200 OK")?true:false;
250 250
 	}
251 251
 	
252 252
 	/**
253
-	* Convert hexa to string
254
-	* @param	String $hex data in hexa
255
-	* @return	String Return result
256
-	*/
253
+	 * Convert hexa to string
254
+	 * @param	String $hex data in hexa
255
+	 * @return	String Return result
256
+	 */
257 257
 	public function hex2str($hex) {
258 258
 		$str = '';
259 259
 		$hexln = strlen($hex);
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 	}
335 335
 	
336 336
 	/**
337
-	* Returns list of available locales
338
-	*
339
-	* @return array
337
+	 * Returns list of available locales
338
+	 *
339
+	 * @return array
340 340
 	 */
341 341
 	public function listLocaleDir()
342 342
 	{
@@ -431,100 +431,100 @@  discard block
 block discarded – undo
431 431
 	public function remove_accents($string) {
432 432
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
433 433
 		$chars = array(
434
-		    // Decompositions for Latin-1 Supplement
435
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
436
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
437
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
438
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
439
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
440
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
441
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
442
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
443
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
444
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
445
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
446
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
447
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
448
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
449
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
450
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
451
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
452
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
453
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
454
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
455
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
456
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
457
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
458
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
459
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
460
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
461
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
462
-		    chr(195).chr(191) => 'y',
463
-		    // Decompositions for Latin Extended-A
464
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
465
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
466
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
467
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
468
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
469
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
470
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
471
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
472
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
473
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
474
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
475
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
476
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
477
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
478
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
479
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
480
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
481
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
482
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
483
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
484
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
485
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
486
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
487
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
488
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
489
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
490
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
491
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
492
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
493
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
494
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
495
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
496
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
497
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
498
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
499
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
500
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
501
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
502
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
503
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
504
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
505
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
506
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
507
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
508
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
509
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
510
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
511
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
512
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
513
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
514
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
515
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
516
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
517
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
518
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
519
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
520
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
521
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
522
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
523
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
524
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
525
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
526
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
527
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
434
+			// Decompositions for Latin-1 Supplement
435
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
436
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
437
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
438
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
439
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
440
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
441
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
442
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
443
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
444
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
445
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
446
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
447
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
448
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
449
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
450
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
451
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
452
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
453
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
454
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
455
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
456
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
457
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
458
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
459
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
460
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
461
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
462
+			chr(195).chr(191) => 'y',
463
+			// Decompositions for Latin Extended-A
464
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
465
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
466
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
467
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
468
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
469
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
470
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
471
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
472
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
473
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
474
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
475
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
476
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
477
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
478
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
479
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
480
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
481
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
482
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
483
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
484
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
485
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
486
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
487
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
488
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
489
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
490
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
491
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
492
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
493
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
494
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
495
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
496
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
497
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
498
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
499
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
500
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
501
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
502
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
503
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
504
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
505
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
506
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
507
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
508
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
509
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
510
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
511
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
512
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
513
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
514
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
515
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
516
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
517
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
518
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
519
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
520
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
521
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
522
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
523
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
524
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
525
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
526
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
527
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
528 528
 		);
529 529
 		$string = strtr($string, $chars);
530 530
 		return $string;
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1455 added lines, -1455 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Executes the SQL statements to get the spotter information
170
-	*
171
-	* @param String $query the SQL query
172
-	* @param Array $params parameter of the query
173
-	* @param String $limitQuery the limit query
174
-	* @return Array the spotter information
175
-	*
176
-	*/
169
+	 * Executes the SQL statements to get the spotter information
170
+	 *
171
+	 * @param String $query the SQL query
172
+	 * @param Array $params parameter of the query
173
+	 * @param String $limitQuery the limit query
174
+	 * @return Array the spotter information
175
+	 *
176
+	 */
177 177
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 343
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344 344
 					} else $temp_array['aircraft_shadow'] = 'default.png';
345
-                                } else {
346
-                            		$temp_array['aircraft_shadow'] = 'default.png';
345
+								} else {
346
+									$temp_array['aircraft_shadow'] = 'default.png';
347 347
 					$temp_array['aircraft_name'] = 'N/A';
348 348
 					$temp_array['aircraft_manufacturer'] = 'N/A';
349
-                            	}
349
+								}
350 350
 			}
351 351
 			$fromsource = NULL;
352 352
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
 	
543 543
 	
544 544
 	/**
545
-	* Gets all the spotter information
546
-	*
547
-	* @return Array the spotter information
548
-	*
549
-	*/
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550 550
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
 	
894 894
 	
895 895
 	/**
896
-	* Gets all the spotter information based on the latest data entry
897
-	*
898
-	* @return Array the spotter information
899
-	*
900
-	*/
896
+	 * Gets all the spotter information based on the latest data entry
897
+	 *
898
+	 * @return Array the spotter information
899
+	 *
900
+	 */
901 901
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
902 902
 	{
903 903
 		global $global_query;
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
 	}
937 937
     
938 938
     
939
-    /**
940
-	* Gets all the spotter information based on a user's latitude and longitude
941
-	*
942
-	* @return Array the spotter information
943
-	*
944
-	*/
939
+	/**
940
+	 * Gets all the spotter information based on a user's latitude and longitude
941
+	 *
942
+	 * @return Array the spotter information
943
+	 *
944
+	 */
945 945
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
946 946
 	{
947 947
 		date_default_timezone_set('UTC');
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 				return false;
970 970
 			}
971 971
 		}
972
-    		$additional_query = '';
972
+			$additional_query = '';
973 973
 		if ($interval != "")
974 974
 		{
975 975
 			if (!is_string($interval))
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	}
1010 1010
     
1011 1011
     
1012
-    /**
1013
-	* Gets all the spotter information sorted by the newest aircraft type
1014
-	*
1015
-	* @return Array the spotter information
1016
-	*
1017
-	*/
1012
+	/**
1013
+	 * Gets all the spotter information sorted by the newest aircraft type
1014
+	 *
1015
+	 * @return Array the spotter information
1016
+	 *
1017
+	 */
1018 1018
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
     
1056 1056
     
1057 1057
 	/**
1058
-	* Gets all the spotter information sorted by the newest aircraft registration
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1058
+	 * Gets all the spotter information sorted by the newest aircraft registration
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 	/**
1102
-	* Gets all the spotter information sorted by the newest airline
1103
-	*
1104
-	* @return Array the spotter information
1105
-	*
1106
-	*/
1102
+	 * Gets all the spotter information sorted by the newest airline
1103
+	 *
1104
+	 * @return Array the spotter information
1105
+	 *
1106
+	 */
1107 1107
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
@@ -1142,12 +1142,12 @@  discard block
 block discarded – undo
1142 1142
 	}
1143 1143
     
1144 1144
     
1145
-    /**
1146
-	* Gets all the spotter information sorted by the newest departure airport
1147
-	*
1148
-	* @return Array the spotter information
1149
-	*
1150
-	*/
1145
+	/**
1146
+	 * Gets all the spotter information sorted by the newest departure airport
1147
+	 *
1148
+	 * @return Array the spotter information
1149
+	 *
1150
+	 */
1151 1151
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1152 1152
 	{
1153 1153
 		global $global_query;
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 
1191 1191
 	/**
1192
-	* Gets all the spotter information sorted by the newest arrival airport
1193
-	*
1194
-	* @return Array the spotter information
1195
-	*
1196
-	*/
1192
+	 * Gets all the spotter information sorted by the newest arrival airport
1193
+	 *
1194
+	 * @return Array the spotter information
1195
+	 *
1196
+	 */
1197 1197
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1198 1198
 	{
1199 1199
 		global $global_query;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 
1234 1234
 	/**
1235
-	* Gets all the spotter information based on the spotter id
1236
-	*
1237
-	* @return Array the spotter information
1238
-	*
1239
-	*/
1235
+	 * Gets all the spotter information based on the spotter id
1236
+	 *
1237
+	 * @return Array the spotter information
1238
+	 *
1239
+	 */
1240 1240
 	public function getSpotterDataByID($id = '')
1241 1241
 	{
1242 1242
 		global $global_query;
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	
1259 1259
 	
1260 1260
 	/**
1261
-	* Gets all the spotter information based on the callsign
1262
-	*
1263
-	* @return Array the spotter information
1264
-	*
1265
-	*/
1261
+	 * Gets all the spotter information based on the callsign
1262
+	 *
1263
+	 * @return Array the spotter information
1264
+	 *
1265
+	 */
1266 1266
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1267 1267
 	{
1268 1268
 		global $global_query;
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
 	}
1315 1315
 	
1316 1316
 	/**
1317
-	* Gets all the spotter information based on the owner
1318
-	*
1319
-	* @return Array the spotter information
1320
-	*
1321
-	*/
1317
+	 * Gets all the spotter information based on the owner
1318
+	 *
1319
+	 * @return Array the spotter information
1320
+	 *
1321
+	 */
1322 1322
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1323 1323
 	{
1324 1324
 		global $global_query;
@@ -1371,11 +1371,11 @@  discard block
 block discarded – undo
1371 1371
 	}
1372 1372
 	
1373 1373
 	/**
1374
-	* Gets all the spotter information based on the pilot
1375
-	*
1376
-	* @return Array the spotter information
1377
-	*
1378
-	*/
1374
+	 * Gets all the spotter information based on the pilot
1375
+	 *
1376
+	 * @return Array the spotter information
1377
+	 *
1378
+	 */
1379 1379
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1380 1380
 	{
1381 1381
 		global $global_query;
@@ -1424,11 +1424,11 @@  discard block
 block discarded – undo
1424 1424
 	
1425 1425
 	
1426 1426
 	/**
1427
-	* Gets all the spotter information based on the aircraft type
1428
-	*
1429
-	* @return Array the spotter information
1430
-	*
1431
-	*/
1427
+	 * Gets all the spotter information based on the aircraft type
1428
+	 *
1429
+	 * @return Array the spotter information
1430
+	 *
1431
+	 */
1432 1432
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1433 1433
 	{
1434 1434
 		global $global_query;
@@ -1482,11 +1482,11 @@  discard block
 block discarded – undo
1482 1482
 	
1483 1483
 	
1484 1484
 	/**
1485
-	* Gets all the spotter information based on the aircraft registration
1486
-	*
1487
-	* @return Array the spotter information
1488
-	*
1489
-	*/
1485
+	 * Gets all the spotter information based on the aircraft registration
1486
+	 *
1487
+	 * @return Array the spotter information
1488
+	 *
1489
+	 */
1490 1490
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1491 1491
 	{
1492 1492
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the airline
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the airline
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
 	
1601 1601
 	
1602 1602
 	/**
1603
-	* Gets all the spotter information based on the airport
1604
-	*
1605
-	* @return Array the spotter information
1606
-	*
1607
-	*/
1603
+	 * Gets all the spotter information based on the airport
1604
+	 *
1605
+	 * @return Array the spotter information
1606
+	 *
1607
+	 */
1608 1608
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
@@ -1658,11 +1658,11 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
 
1660 1660
 	/**
1661
-	* Gets all the spotter information based on the date
1662
-	*
1663
-	* @return Array the spotter information
1664
-	*
1665
-	*/
1661
+	 * Gets all the spotter information based on the date
1662
+	 *
1663
+	 * @return Array the spotter information
1664
+	 *
1665
+	 */
1666 1666
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the country name
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the country name
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 	
1785 1785
 	
1786 1786
 	/**
1787
-	* Gets all the spotter information based on the manufacturer name
1788
-	*
1789
-	* @return Array the spotter information
1790
-	*
1791
-	*/
1787
+	 * Gets all the spotter information based on the manufacturer name
1788
+	 *
1789
+	 * @return Array the spotter information
1790
+	 *
1791
+	 */
1792 1792
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1793 1793
 	{
1794 1794
 		global $global_query;
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
   
1845 1845
   
1846 1846
 	/**
1847
-	* Gets a list of all aircraft that take a route
1848
-	*
1849
-	* @param String $departure_airport_icao ICAO code of departure airport
1850
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1851
-	* @return Array the spotter information
1852
-	*
1853
-	*/
1847
+	 * Gets a list of all aircraft that take a route
1848
+	 *
1849
+	 * @param String $departure_airport_icao ICAO code of departure airport
1850
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1851
+	 * @return Array the spotter information
1852
+	 *
1853
+	 */
1854 1854
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1855 1855
 	{
1856 1856
 		global $global_query;
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 	
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets all the spotter information based on the special column in the table
1923
-	*
1924
-	* @return Array the spotter information
1925
-	*
1926
-	*/
1922
+	 * Gets all the spotter information based on the special column in the table
1923
+	 *
1924
+	 * @return Array the spotter information
1925
+	 *
1926
+	 */
1927 1927
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1928 1928
 	{
1929 1929
 		global $global_query;
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
 	}
1963 1963
 
1964 1964
 	/**
1965
-	* Gets all the highlight based on a aircraft registration
1966
-	*
1967
-	* @return String the highlight text
1968
-	*
1969
-	*/
1965
+	 * Gets all the highlight based on a aircraft registration
1966
+	 *
1967
+	 * @return String the highlight text
1968
+	 *
1969
+	 */
1970 1970
 	public function getHighlightByRegistration($registration,$filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
@@ -1988,13 +1988,13 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 	
1990 1990
 	/**
1991
-	* Gets the squawk usage from squawk code
1992
-	*
1993
-	* @param String $squawk squawk code
1994
-	* @param String $country country
1995
-	* @return String usage
1996
-	*
1997
-	*/
1991
+	 * Gets the squawk usage from squawk code
1992
+	 *
1993
+	 * @param String $squawk squawk code
1994
+	 * @param String $country country
1995
+	 * @return String usage
1996
+	 *
1997
+	 */
1998 1998
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1999 1999
 	{
2000 2000
 		
@@ -2015,12 +2015,12 @@  discard block
 block discarded – undo
2015 2015
 	}
2016 2016
 
2017 2017
 	/**
2018
-	* Gets the airport icao from the iata
2019
-	*
2020
-	* @param String $airport_iata the iata code of the airport
2021
-	* @return String airport iata
2022
-	*
2023
-	*/
2018
+	 * Gets the airport icao from the iata
2019
+	 *
2020
+	 * @param String $airport_iata the iata code of the airport
2021
+	 * @return String airport iata
2022
+	 *
2023
+	 */
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
2043
-	* Gets the airport distance
2044
-	*
2045
-	* @param String $airport_icao the icao code of the airport
2046
-	* @param Float $latitude the latitude
2047
-	* @param Float $longitude the longitude
2048
-	* @return Float distance to the airport
2049
-	*
2050
-	*/
2043
+	 * Gets the airport distance
2044
+	 *
2045
+	 * @param String $airport_icao the icao code of the airport
2046
+	 * @param Float $latitude the latitude
2047
+	 * @param Float $longitude the longitude
2048
+	 * @return Float distance to the airport
2049
+	 *
2050
+	 */
2051 2051
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2052 2052
 	{
2053 2053
 		
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
 	}
2069 2069
 	
2070 2070
 	/**
2071
-	* Gets the airport info based on the icao
2072
-	*
2073
-	* @param String $airport the icao code of the airport
2074
-	* @return Array airport information
2075
-	*
2076
-	*/
2071
+	 * Gets the airport info based on the icao
2072
+	 *
2073
+	 * @param String $airport the icao code of the airport
2074
+	 * @return Array airport information
2075
+	 *
2076
+	 */
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the airport info based on the country
2123
-	*
2124
-	* @param Array $countries Airports countries
2125
-	* @return Array airport information
2126
-	*
2127
-	*/
2122
+	 * Gets the airport info based on the country
2123
+	 *
2124
+	 * @param Array $countries Airports countries
2125
+	 * @return Array airport information
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAirportInfobyCountry($countries)
2129 2129
 	{
2130 2130
 		$lst_countries = '';
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 	
2164 2164
 	/**
2165
-	* Gets airports info based on the coord
2166
-	*
2167
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
-	* @return Array airport information
2169
-	*
2170
-	*/
2165
+	 * Gets airports info based on the coord
2166
+	 *
2167
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
+	 * @return Array airport information
2169
+	 *
2170
+	 */
2171 2171
 	public function getAllAirportInfobyCoord($coord)
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
@@ -2198,12 +2198,12 @@  discard block
 block discarded – undo
2198 2198
 	}
2199 2199
 
2200 2200
 	/**
2201
-	* Gets waypoints info based on the coord
2202
-	*
2203
-	* @param Array $coord waypoints coord
2204
-	* @return Array airport information
2205
-	*
2206
-	*/
2201
+	 * Gets waypoints info based on the coord
2202
+	 *
2203
+	 * @param Array $coord waypoints coord
2204
+	 * @return Array airport information
2205
+	 *
2206
+	 */
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
@@ -2237,12 +2237,12 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
 	
2239 2239
 	/**
2240
-	* Gets the airline info based on the icao code or iata code
2241
-	*
2242
-	* @param String $airline_icao the iata code of the airport
2243
-	* @return Array airport information
2244
-	*
2245
-	*/
2240
+	 * Gets the airline info based on the icao code or iata code
2241
+	 *
2242
+	 * @param String $airline_icao the iata code of the airport
2243
+	 * @return Array airport information
2244
+	 *
2245
+	 */
2246 2246
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 			} else {
2274 2274
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2275 2275
 			}
2276
-                        /*
2276
+						/*
2277 2277
 			$airline_array = array();
2278 2278
 			$temp_array = array();
2279 2279
 		
@@ -2306,12 +2306,12 @@  discard block
 block discarded – undo
2306 2306
 	}
2307 2307
 	
2308 2308
 	/**
2309
-	* Gets the airline info based on the airline name
2310
-	*
2311
-	* @param String $airline_name the name of the airline
2312
-	* @return Array airline information
2313
-	*
2314
-	*/
2309
+	 * Gets the airline info based on the airline name
2310
+	 *
2311
+	 * @param String $airline_name the name of the airline
2312
+	 * @return Array airline information
2313
+	 *
2314
+	 */
2315 2315
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
@@ -2339,12 +2339,12 @@  discard block
 block discarded – undo
2339 2339
 	
2340 2340
 	
2341 2341
 	/**
2342
-	* Gets the aircraft info based on the aircraft type
2343
-	*
2344
-	* @param String $aircraft_type the aircraft type
2345
-	* @return Array aircraft information
2346
-	*
2347
-	*/
2342
+	 * Gets the aircraft info based on the aircraft type
2343
+	 *
2344
+	 * @param String $aircraft_type the aircraft type
2345
+	 * @return Array aircraft information
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350 2350
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2376,12 +2376,12 @@  discard block
 block discarded – undo
2376 2376
 	}
2377 2377
 
2378 2378
 	/**
2379
-	* Gets the aircraft icao based on the aircraft name/type
2380
-	*
2381
-	* @param String $aircraft_type the aircraft type
2382
-	* @return String aircraft information
2383
-	*
2384
-	*/
2379
+	 * Gets the aircraft icao based on the aircraft name/type
2380
+	 *
2381
+	 * @param String $aircraft_type the aircraft type
2382
+	 * @return String aircraft information
2383
+	 *
2384
+	 */
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387 2387
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 	}
2407 2407
 	
2408 2408
 	/**
2409
-	* Gets the aircraft info based on the aircraft modes
2410
-	*
2411
-	* @param String $aircraft_modes the aircraft ident (hex)
2412
-	* @return String aircraft type
2413
-	*
2414
-	*/
2409
+	 * Gets the aircraft info based on the aircraft modes
2410
+	 *
2411
+	 * @param String $aircraft_modes the aircraft ident (hex)
2412
+	 * @return String aircraft type
2413
+	 *
2414
+	 */
2415 2415
 	public function getAllAircraftType($aircraft_modes,$source_type = '')
2416 2416
 	{
2417 2417
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
 	}
2439 2439
 
2440 2440
 	/**
2441
-	* Gets the aircraft info based on the aircraft registration
2442
-	*
2443
-	* @param String $registration the aircraft registration
2444
-	* @return String aircraft type
2445
-	*
2446
-	*/
2441
+	 * Gets the aircraft info based on the aircraft registration
2442
+	 *
2443
+	 * @param String $registration the aircraft registration
2444
+	 * @return String aircraft type
2445
+	 *
2446
+	 */
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449 2449
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2461,12 +2461,12 @@  discard block
 block discarded – undo
2461 2461
 	}
2462 2462
 
2463 2463
 	/**
2464
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2465
-	*
2466
-	* @param String $registration the aircraft registration
2467
-	* @return Array spotter_id and flightaware_id
2468
-	*
2469
-	*/
2464
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2465
+	 *
2466
+	 * @param String $registration the aircraft registration
2467
+	 * @return Array spotter_id and flightaware_id
2468
+	 *
2469
+	 */
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472 2472
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
 	}
2486 2486
 
2487 2487
 	/**
2488
-	* Gets correct aircraft operator code
2489
-	*
2490
-	* @param String $operator the aircraft operator code (callsign)
2491
-	* @return String aircraft operator code
2492
-	*
2493
-	*/
2488
+	 * Gets correct aircraft operator code
2489
+	 *
2490
+	 * @param String $operator the aircraft operator code (callsign)
2491
+	 * @return String aircraft operator code
2492
+	 *
2493
+	 */
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496 2496
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2507,16 +2507,16 @@  discard block
 block discarded – undo
2507 2507
 	}
2508 2508
 
2509 2509
 	/**
2510
-	* Gets the aircraft route based on the aircraft callsign
2511
-	*
2512
-	* @param String $callsign the aircraft callsign
2513
-	* @return Array aircraft type
2514
-	*
2515
-	*/
2510
+	 * Gets the aircraft route based on the aircraft callsign
2511
+	 *
2512
+	 * @param String $callsign the aircraft callsign
2513
+	 * @return Array aircraft type
2514
+	 *
2515
+	 */
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518 2518
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2519
+				if ($callsign == '') return array();
2520 2520
 		$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";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
@@ -2530,12 +2530,12 @@  discard block
 block discarded – undo
2530 2530
 	}
2531 2531
 	
2532 2532
 	/**
2533
-	* Gets the aircraft info based on the aircraft registration
2534
-	*
2535
-	* @param String $registration the aircraft registration
2536
-	* @return Array aircraft information
2537
-	*
2538
-	*/
2533
+	 * Gets the aircraft info based on the aircraft registration
2534
+	 *
2535
+	 * @param String $registration the aircraft registration
2536
+	 * @return Array aircraft information
2537
+	 *
2538
+	 */
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541 2541
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2562,12 +2562,12 @@  discard block
 block discarded – undo
2562 2562
 	}
2563 2563
 	
2564 2564
 	/**
2565
-	* Gets the aircraft owner & base based on the aircraft registration
2566
-	*
2567
-	* @param String $registration the aircraft registration
2568
-	* @return Array aircraft information
2569
-	*
2570
-	*/
2565
+	 * Gets the aircraft owner & base based on the aircraft registration
2566
+	 *
2567
+	 * @param String $registration the aircraft registration
2568
+	 * @return Array aircraft information
2569
+	 *
2570
+	 */
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573 2573
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2584,11 +2584,11 @@  discard block
 block discarded – undo
2584 2584
 	
2585 2585
   
2586 2586
   /**
2587
-	* Gets all flights (but with only little info)
2588
-	*
2589
-	* @return Array basic flight information
2590
-	*
2591
-	*/
2587
+   * Gets all flights (but with only little info)
2588
+   *
2589
+   * @return Array basic flight information
2590
+   *
2591
+   */
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$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 ";
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
2599
-                  /*
2599
+				  /*
2600 2600
 		$flight_array = array();
2601 2601
 		$temp_array = array();
2602 2602
 		
@@ -2618,11 +2618,11 @@  discard block
 block discarded – undo
2618 2618
 	}
2619 2619
   
2620 2620
 	/**
2621
-	* Gets a list of all aircraft manufacturers
2622
-	*
2623
-	* @return Array list of aircraft types
2624
-	*
2625
-	*/
2621
+	 * Gets a list of all aircraft manufacturers
2622
+	 *
2623
+	 * @return Array list of aircraft types
2624
+	 *
2625
+	 */
2626 2626
 	public function getAllManufacturers()
2627 2627
 	{
2628 2628
 		/*
@@ -2651,11 +2651,11 @@  discard block
 block discarded – undo
2651 2651
   
2652 2652
   
2653 2653
   /**
2654
-	* Gets a list of all aircraft types
2655
-	*
2656
-	* @return Array list of aircraft types
2657
-	*
2658
-	*/
2654
+   * Gets a list of all aircraft types
2655
+   *
2656
+   * @return Array list of aircraft types
2657
+   *
2658
+   */
2659 2659
 	public function getAllAircraftTypes($filters = array())
2660 2660
 	{
2661 2661
 		/*
@@ -2690,11 +2690,11 @@  discard block
 block discarded – undo
2690 2690
 	
2691 2691
 	
2692 2692
 	/**
2693
-	* Gets a list of all aircraft registrations
2694
-	*
2695
-	* @return Array list of aircraft registrations
2696
-	*
2697
-	*/
2693
+	 * Gets a list of all aircraft registrations
2694
+	 *
2695
+	 * @return Array list of aircraft registrations
2696
+	 *
2697
+	 */
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700 2700
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2719,12 +2719,12 @@  discard block
 block discarded – undo
2719 2719
 	}
2720 2720
 
2721 2721
 	/**
2722
-	* Gets all source name
2723
-	*
2724
-	* @param String type format of source
2725
-	* @return Array list of source name
2726
-	*
2727
-	*/
2722
+	 * Gets all source name
2723
+	 *
2724
+	 * @param String type format of source
2725
+	 * @return Array list of source name
2726
+	 *
2727
+	 */
2728 2728
 	public function getAllSourceName($type = '',$filters = array())
2729 2729
 	{
2730 2730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 
2756 2756
 
2757 2757
 	/**
2758
-	* Gets a list of all airline names
2759
-	*
2760
-	* @return Array list of airline names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all airline names
2759
+	 *
2760
+	 * @return Array list of airline names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
 	}
2809 2809
 	
2810 2810
 	/**
2811
-	* Gets a list of all alliance names
2812
-	*
2813
-	* @return Array list of alliance names
2814
-	*
2815
-	*/
2811
+	 * Gets a list of all alliance names
2812
+	 *
2813
+	 * @return Array list of alliance names
2814
+	 *
2815
+	 */
2816 2816
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2817 2817
 	{
2818 2818
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
 	}
2838 2838
 	
2839 2839
 	/**
2840
-	* Gets a list of all airline countries
2841
-	*
2842
-	* @return Array list of airline countries
2843
-	*
2844
-	*/
2840
+	 * Gets a list of all airline countries
2841
+	 *
2842
+	 * @return Array list of airline countries
2843
+	 *
2844
+	 */
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847 2847
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
 	
2870 2870
 	
2871 2871
 	/**
2872
-	* Gets a list of all departure & arrival names
2873
-	*
2874
-	* @return Array list of airport names
2875
-	*
2876
-	*/
2872
+	 * Gets a list of all departure & arrival names
2873
+	 *
2874
+	 * @return Array list of airport names
2875
+	 *
2876
+	 */
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879 2879
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
 	} 
2922 2922
 
2923 2923
 	/**
2924
-	* Gets a list of all owner names
2925
-	*
2926
-	* @return Array list of owner names
2927
-	*
2928
-	*/
2924
+	 * Gets a list of all owner names
2925
+	 *
2926
+	 * @return Array list of owner names
2927
+	 *
2928
+	 */
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931 2931
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2939,11 +2939,11 @@  discard block
 block discarded – undo
2939 2939
 	} 
2940 2940
 
2941 2941
 	/**
2942
-	* Gets a list of all pilot names and pilot ids
2943
-	*
2944
-	* @return Array list of pilot names and pilot ids
2945
-	*
2946
-	*/
2942
+	 * Gets a list of all pilot names and pilot ids
2943
+	 *
2944
+	 * @return Array list of pilot names and pilot ids
2945
+	 *
2946
+	 */
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949 2949
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2958,11 +2958,11 @@  discard block
 block discarded – undo
2958 2958
 	
2959 2959
 	
2960 2960
 	/**
2961
-	* Gets a list of all departure & arrival airport countries
2962
-	*
2963
-	* @return Array list of airport countries
2964
-	*
2965
-	*/
2961
+	 * Gets a list of all departure & arrival airport countries
2962
+	 *
2963
+	 * @return Array list of airport countries
2964
+	 *
2965
+	 */
2966 2966
 	public function getAllAirportCountries($filters = array())
2967 2967
 	{
2968 2968
 		$airport_array = array();
@@ -3010,11 +3010,11 @@  discard block
 block discarded – undo
3010 3010
 	
3011 3011
 	
3012 3012
 	/**
3013
-	* Gets a list of all countries (airline, departure airport & arrival airport)
3014
-	*
3015
-	* @return Array list of countries
3016
-	*
3017
-	*/
3013
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
3014
+	 *
3015
+	 * @return Array list of countries
3016
+	 *
3017
+	 */
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020 3020
 		$Connection= new Connection($this->db);
@@ -3091,11 +3091,11 @@  discard block
 block discarded – undo
3091 3091
 	
3092 3092
 	
3093 3093
 	/**
3094
-	* Gets a list of all idents/callsigns
3095
-	*
3096
-	* @return Array list of ident/callsign names
3097
-	*
3098
-	*/
3094
+	 * Gets a list of all idents/callsigns
3095
+	 *
3096
+	 * @return Array list of ident/callsign names
3097
+	 *
3098
+	 */
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101 3101
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3119,9 +3119,9 @@  discard block
 block discarded – undo
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
3122
-	* Get a list of flights from airport since 7 days
3123
-	* @return Array number, icao, name and city of airports
3124
-	*/
3122
+	 * Get a list of flights from airport since 7 days
3123
+	 * @return Array number, icao, name and city of airports
3124
+	 */
3125 3125
 
3126 3126
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
@@ -3152,9 +3152,9 @@  discard block
 block discarded – undo
3152 3152
 	}
3153 3153
 
3154 3154
 	/**
3155
-	* Get a list of flights from airport since 7 days
3156
-	* @return Array number, icao, name and city of airports
3157
-	*/
3155
+	 * Get a list of flights from airport since 7 days
3156
+	 * @return Array number, icao, name and city of airports
3157
+	 */
3158 3158
 
3159 3159
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3160 3160
 		global $globalTimezone, $globalDBdriver;
@@ -3184,9 +3184,9 @@  discard block
 block discarded – undo
3184 3184
 	}
3185 3185
 
3186 3186
 	/**
3187
-	* Get a list of flights from detected airport since 7 days
3188
-	* @return Array number, icao, name and city of airports
3189
-	*/
3187
+	 * Get a list of flights from detected airport since 7 days
3188
+	 * @return Array number, icao, name and city of airports
3189
+	 */
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
@@ -3224,9 +3224,9 @@  discard block
 block discarded – undo
3224 3224
 	}
3225 3225
 
3226 3226
 	/**
3227
-	* Get a list of flights from detected airport since 7 days
3228
-	* @return Array number, icao, name and city of airports
3229
-	*/
3227
+	 * Get a list of flights from detected airport since 7 days
3228
+	 * @return Array number, icao, name and city of airports
3229
+	 */
3230 3230
 
3231 3231
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3232 3232
 		global $globalTimezone, $globalDBdriver;
@@ -3268,9 +3268,9 @@  discard block
 block discarded – undo
3268 3268
 
3269 3269
 
3270 3270
 	/**
3271
-	* Get a list of flights to airport since 7 days
3272
-	* @return Array number, icao, name and city of airports
3273
-	*/
3271
+	 * Get a list of flights to airport since 7 days
3272
+	 * @return Array number, icao, name and city of airports
3273
+	 */
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
@@ -3303,9 +3303,9 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 
3305 3305
 	/**
3306
-	* Get a list of flights detected to airport since 7 days
3307
-	* @return Array number, icao, name and city of airports
3308
-	*/
3306
+	 * Get a list of flights detected to airport since 7 days
3307
+	 * @return Array number, icao, name and city of airports
3308
+	 */
3309 3309
 
3310 3310
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
@@ -3346,9 +3346,9 @@  discard block
 block discarded – undo
3346 3346
 
3347 3347
 
3348 3348
 	/**
3349
-	* Get a list of flights to airport since 7 days
3350
-	* @return Array number, icao, name and city of airports
3351
-	*/
3349
+	 * Get a list of flights to airport since 7 days
3350
+	 * @return Array number, icao, name and city of airports
3351
+	 */
3352 3352
 
3353 3353
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3354 3354
 		global $globalTimezone, $globalDBdriver;
@@ -3380,9 +3380,9 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
 
3382 3382
 	/**
3383
-	* Get a list of flights detected to airport since 7 days
3384
-	* @return Array number, icao, name and city of airports
3385
-	*/
3383
+	 * Get a list of flights detected to airport since 7 days
3384
+	 * @return Array number, icao, name and city of airports
3385
+	 */
3386 3386
 
3387 3387
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3388 3388
 		global $globalTimezone, $globalDBdriver;
@@ -3426,11 +3426,11 @@  discard block
 block discarded – undo
3426 3426
 
3427 3427
 
3428 3428
 	/**
3429
-	* Gets a list of all dates
3430
-	*
3431
-	* @return Array list of date names
3432
-	*
3433
-	*/
3429
+	 * Gets a list of all dates
3430
+	 *
3431
+	 * @return Array list of date names
3432
+	 *
3433
+	 */
3434 3434
 	public function getAllDates()
3435 3435
 	{
3436 3436
 		global $globalTimezone, $globalDBdriver;
@@ -3471,11 +3471,11 @@  discard block
 block discarded – undo
3471 3471
 	
3472 3472
 	
3473 3473
 	/**
3474
-	* Gets all route combinations
3475
-	*
3476
-	* @return Array the route list
3477
-	*
3478
-	*/
3474
+	 * Gets all route combinations
3475
+	 *
3476
+	 * @return Array the route list
3477
+	 *
3478
+	 */
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481 3481
 		$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 
@@ -3501,13 +3501,13 @@  discard block
 block discarded – undo
3501 3501
 	}
3502 3502
 
3503 3503
 	/**
3504
-	* Update ident spotter data
3505
-	*
3506
-	* @param String $flightaware_id the ID from flightaware
3507
-	* @param String $ident the flight ident
3508
-	* @return String success or false
3509
-	*
3510
-	*/	
3504
+	 * Update ident spotter data
3505
+	 *
3506
+	 * @param String $flightaware_id the ID from flightaware
3507
+	 * @param String $ident the flight ident
3508
+	 * @return String success or false
3509
+	 *
3510
+	 */	
3511 3511
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3528,14 +3528,14 @@  discard block
 block discarded – undo
3528 3528
 		} else {
3529 3529
 			$airline_array = $this->getAllAirlineInfo("NA");
3530 3530
 		}
3531
-                $airline_name = $airline_array[0]['name'];
3532
-                $airline_icao = $airline_array[0]['icao'];
3533
-                $airline_country = $airline_array[0]['country'];
3534
-                $airline_type = $airline_array[0]['type'];
3531
+				$airline_name = $airline_array[0]['name'];
3532
+				$airline_icao = $airline_array[0]['icao'];
3533
+				$airline_country = $airline_array[0]['country'];
3534
+				$airline_type = $airline_array[0]['type'];
3535 3535
 
3536 3536
 
3537 3537
 		$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';
3538
-                $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);
3538
+				$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);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3548,19 +3548,19 @@  discard block
 block discarded – undo
3548 3548
 
3549 3549
 	}
3550 3550
 	/**
3551
-	* Update latest spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $arrival_airport_icao the arrival airport
3556
-	* @return String success or false
3557
-	*
3558
-	*/	
3551
+	 * Update latest spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $arrival_airport_icao the arrival airport
3556
+	 * @return String success or false
3557
+	 *
3558
+	 */	
3559 3559
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$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';
3563
-                $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);
3563
+				$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);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3574,32 +3574,32 @@  discard block
 block discarded – undo
3574 3574
 	}
3575 3575
 
3576 3576
 	/**
3577
-	* Adds a new spotter data
3578
-	*
3579
-	* @param String $flightaware_id the ID from flightaware
3580
-	* @param String $ident the flight ident
3581
-	* @param String $aircraft_icao the aircraft type
3582
-	* @param String $departure_airport_icao the departure airport
3583
-	* @param String $arrival_airport_icao the arrival airport
3584
-	* @param String $latitude latitude of flight
3585
-	* @param String $longitude latitude of flight
3586
-	* @param String $waypoints waypoints of flight
3587
-	* @param String $altitude altitude of flight
3588
-	* @param String $heading heading of flight
3589
-	* @param String $groundspeed speed of flight
3590
-	* @param String $date date of flight
3591
-	* @param String $departure_airport_time departure time of flight
3592
-	* @param String $arrival_airport_time arrival time of flight
3593
-	* @param String $squawk squawk code of flight
3594
-	* @param String $route_stop route stop of flight
3595
-	* @param String $highlight highlight or not
3596
-	* @param String $ModeS ModesS code of flight
3597
-	* @param String $registration registration code of flight
3598
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3599
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3600
-	* @param String $verticalrate vertival rate of flight
3601
-	* @return String success or false
3602
-	*/
3577
+	 * Adds a new spotter data
3578
+	 *
3579
+	 * @param String $flightaware_id the ID from flightaware
3580
+	 * @param String $ident the flight ident
3581
+	 * @param String $aircraft_icao the aircraft type
3582
+	 * @param String $departure_airport_icao the departure airport
3583
+	 * @param String $arrival_airport_icao the arrival airport
3584
+	 * @param String $latitude latitude of flight
3585
+	 * @param String $longitude latitude of flight
3586
+	 * @param String $waypoints waypoints of flight
3587
+	 * @param String $altitude altitude of flight
3588
+	 * @param String $heading heading of flight
3589
+	 * @param String $groundspeed speed of flight
3590
+	 * @param String $date date of flight
3591
+	 * @param String $departure_airport_time departure time of flight
3592
+	 * @param String $arrival_airport_time arrival time of flight
3593
+	 * @param String $squawk squawk code of flight
3594
+	 * @param String $route_stop route stop of flight
3595
+	 * @param String $highlight highlight or not
3596
+	 * @param String $ModeS ModesS code of flight
3597
+	 * @param String $registration registration code of flight
3598
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3599
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3600
+	 * @param String $verticalrate vertival rate of flight
3601
+	 * @return String success or false
3602
+	 */
3603 3603
 	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 = '',$source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3814,8 +3814,8 @@  discard block
 block discarded – undo
3814 3814
     
3815 3815
 		if ($globalIVAO && $aircraft_icao != '')
3816 3816
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
3817
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
+					else $airline_icao = '';
3819 3819
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
@@ -3846,53 +3846,53 @@  discard block
 block discarded – undo
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
3849
-                        $airline_array = $this->getAllAirlineInfo('NA');
3850
-                }
3851
-                if (count($aircraft_array) == 0) 
3852
-                {
3853
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3854
-                }
3855
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
-                {
3857
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3858
-                }
3859
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
-                {
3861
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3862
-                }
3863
-                if ($registration == '') $registration = 'NA';
3864
-                if ($latitude == '' && $longitude == '') {
3865
-            		$latitude = 0;
3866
-            		$longitude = 0;
3867
-            	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $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) 
3849
+						$airline_array = $this->getAllAirlineInfo('NA');
3850
+				}
3851
+				if (count($aircraft_array) == 0) 
3852
+				{
3853
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3854
+				}
3855
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
+				{
3857
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3858
+				}
3859
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
+				{
3861
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3862
+				}
3863
+				if ($registration == '') $registration = 'NA';
3864
+				if ($latitude == '' && $longitude == '') {
3865
+					$latitude = 0;
3866
+					$longitude = 0;
3867
+				}
3868
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
+				$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) 
3874 3874
                 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)";
3875 3875
 
3876
-                $airline_name = $airline_array[0]['name'];
3877
-                $airline_icao = $airline_array[0]['icao'];
3878
-                $airline_country = $airline_array[0]['country'];
3879
-                $airline_type = $airline_array[0]['type'];
3876
+				$airline_name = $airline_array[0]['name'];
3877
+				$airline_icao = $airline_array[0]['icao'];
3878
+				$airline_country = $airline_array[0]['country'];
3879
+				$airline_type = $airline_array[0]['type'];
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883 3883
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886
-                $aircraft_type = $aircraft_array[0]['type'];
3887
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
-                $departure_airport_name = $departure_airport_array[0]['name'];
3889
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3890
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3886
+				$aircraft_type = $aircraft_array[0]['type'];
3887
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
+				$departure_airport_name = $departure_airport_array[0]['name'];
3889
+			$departure_airport_city = $departure_airport_array[0]['city'];
3890
+				$departure_airport_country = $departure_airport_array[0]['country'];
3891 3891
                 
3892
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3893
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3894
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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);
3892
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3893
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3894
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3895
+				$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);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
 			$sth->execute($query_values);
3901 3901
 			$this->db = null;
3902 3902
 		} catch (PDOException $e) {
3903
-		    return "error : ".$e->getMessage();
3903
+			return "error : ".$e->getMessage();
3904 3904
 		}
3905 3905
 		
3906 3906
 		return "success";
@@ -3909,11 +3909,11 @@  discard block
 block discarded – undo
3909 3909
 	
3910 3910
   
3911 3911
 	/**
3912
-	* Gets the aircraft ident within the last hour
3913
-	*
3914
-	* @return String the ident
3915
-	*
3916
-	*/
3912
+	 * Gets the aircraft ident within the last hour
3913
+	 *
3914
+	 * @return String the ident
3915
+	 *
3916
+	 */
3917 3917
 	public function getIdentFromLastHour($ident)
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
@@ -3929,11 +3929,11 @@  discard block
 block discarded – undo
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3931 3931
 			$query_data = array(':ident' => $ident);
3932
-    		}
3932
+			}
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3936
+			$ident_result='';
3937 3937
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	
3945 3945
 	
3946 3946
 	/**
3947
-	* Gets the aircraft data from the last 20 seconds
3948
-	*
3949
-	* @return Array the spotter data
3950
-	*
3951
-	*/
3947
+	 * Gets the aircraft data from the last 20 seconds
3948
+	 *
3949
+	 * @return Array the spotter data
3950
+	 *
3951
+	 */
3952 3952
 	public function getRealTimeData($q = '')
3953 3953
 	{
3954 3954
 		global $globalDBdriver;
@@ -3992,11 +3992,11 @@  discard block
 block discarded – undo
3992 3992
 	
3993 3993
 	
3994 3994
 	 /**
3995
-	* Gets all airlines that have flown over
3996
-	*
3997
-	* @return Array the airline list
3998
-	*
3999
-	*/
3995
+	  * Gets all airlines that have flown over
3996
+	  *
3997
+	  * @return Array the airline list
3998
+	  *
3999
+	  */
4000 4000
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
@@ -4010,7 +4010,7 @@  discard block
 block discarded – undo
4010 4010
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4011 4011
 			}
4012 4012
 		}
4013
-                if ($sincedate != '') {
4013
+				if ($sincedate != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4016 4016
 			} else {
@@ -4064,26 +4064,26 @@  discard block
 block discarded – undo
4064 4064
 	}
4065 4065
 
4066 4066
 	 /**
4067
-	* Gets all pilots that have flown over
4068
-	*
4069
-	* @return Array the pilots list
4070
-	*
4071
-	*/
4067
+	  * Gets all pilots that have flown over
4068
+	  *
4069
+	  * @return Array the pilots list
4070
+	  *
4071
+	  */
4072 4072
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075 4075
 		$filter_query = $this->getFilter($filters,true,true);
4076 4076
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078
-                if ($olderthanmonths > 0) {
4079
-            		if ($globalDBdriver == 'mysql') {
4078
+				if ($olderthanmonths > 0) {
4079
+					if ($globalDBdriver == 'mysql') {
4080 4080
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4081 4081
 			} else {
4082 4082
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4083 4083
 			}
4084 4084
 		}
4085
-                if ($sincedate != '') {
4086
-            		if ($globalDBdriver == 'mysql') {
4085
+				if ($sincedate != '') {
4086
+					if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4088 4088
 			} else {
4089 4089
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4138,25 +4138,25 @@  discard block
 block discarded – undo
4138 4138
 	}
4139 4139
 	
4140 4140
 	/**
4141
-	* Gets all pilots that have flown over
4142
-	*
4143
-	* @return Array the pilots list
4144
-	*
4145
-	*/
4141
+	 * Gets all pilots that have flown over
4142
+	 *
4143
+	 * @return Array the pilots list
4144
+	 *
4145
+	 */
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149 4149
 		$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
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151
-                if ($olderthanmonths > 0) {
4152
-            		if ($globalDBdriver == 'mysql') {
4151
+				if ($olderthanmonths > 0) {
4152
+					if ($globalDBdriver == 'mysql') {
4153 4153
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4154 4154
 			} else {
4155 4155
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4156 4156
 			}
4157 4157
 		}
4158
-                if ($sincedate != '') {
4159
-            		if ($globalDBdriver == 'mysql') {
4158
+				if ($sincedate != '') {
4159
+					if ($globalDBdriver == 'mysql') {
4160 4160
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4161 4161
 			} else {
4162 4162
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4185,26 +4185,26 @@  discard block
 block discarded – undo
4185 4185
 	}
4186 4186
 	
4187 4187
 	 /**
4188
-	* Gets all owner that have flown over
4189
-	*
4190
-	* @return Array the pilots list
4191
-	*
4192
-	*/
4188
+	  * Gets all owner that have flown over
4189
+	  *
4190
+	  * @return Array the pilots list
4191
+	  *
4192
+	  */
4193 4193
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196 4196
 		$filter_query = $this->getFilter($filters,true,true);
4197 4197
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199
-                if ($olderthanmonths > 0) {
4200
-            		if ($globalDBdriver == 'mysql') {
4199
+				if ($olderthanmonths > 0) {
4200
+					if ($globalDBdriver == 'mysql') {
4201 4201
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4202 4202
 			} else {
4203 4203
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4204 4204
 			}
4205 4205
 		}
4206
-                if ($sincedate != '') {
4207
-            		if ($globalDBdriver == 'mysql') {
4206
+				if ($sincedate != '') {
4207
+					if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4209 4209
 			} else {
4210 4210
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4255,26 +4255,26 @@  discard block
 block discarded – undo
4255 4255
 	}
4256 4256
 	
4257 4257
 	 /**
4258
-	* Gets all owner that have flown over
4259
-	*
4260
-	* @return Array the pilots list
4261
-	*
4262
-	*/
4258
+	  * Gets all owner that have flown over
4259
+	  *
4260
+	  * @return Array the pilots list
4261
+	  *
4262
+	  */
4263 4263
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266 4266
 		$filter_query = $this->getFilter($filters,true,true);
4267 4267
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269
-                if ($olderthanmonths > 0) {
4270
-            		if ($globalDBdriver == 'mysql') {
4269
+				if ($olderthanmonths > 0) {
4270
+					if ($globalDBdriver == 'mysql') {
4271 4271
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4272 4272
 			} else {
4273 4273
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4274 4274
 			}
4275 4275
 		}
4276
-                if ($sincedate != '') {
4277
-            		if ($globalDBdriver == 'mysql') {
4276
+				if ($sincedate != '') {
4277
+					if ($globalDBdriver == 'mysql') {
4278 4278
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4279 4279
 			} else {
4280 4280
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4301,11 +4301,11 @@  discard block
 block discarded – undo
4301 4301
 	}
4302 4302
 
4303 4303
 	/**
4304
-	* Gets all airlines that have flown over by aircraft
4305
-	*
4306
-	* @return Array the airline list
4307
-	*
4308
-	*/
4304
+	 * Gets all airlines that have flown over by aircraft
4305
+	 *
4306
+	 * @return Array the airline list
4307
+	 *
4308
+	 */
4309 4309
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4310 4310
 	{
4311 4311
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 
4338 4338
 
4339 4339
 	/**
4340
-	* Gets all airline countries that have flown over by aircraft
4341
-	*
4342
-	* @return Array the airline country list
4343
-	*
4344
-	*/
4340
+	 * Gets all airline countries that have flown over by aircraft
4341
+	 *
4342
+	 * @return Array the airline country list
4343
+	 *
4344
+	 */
4345 4345
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4346 4346
 	{
4347 4347
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all airlines that have flown over by airport
4377
-	*
4378
-	* @return Array the airline list
4379
-	*
4380
-	*/
4376
+	 * Gets all airlines that have flown over by airport
4377
+	 *
4378
+	 * @return Array the airline list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4382 4382
 	{
4383 4383
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4408,11 +4408,11 @@  discard block
 block discarded – undo
4408 4408
 
4409 4409
 
4410 4410
 	/**
4411
-	* Gets all airline countries that have flown over by airport icao
4412
-	*
4413
-	* @return Array the airline country list
4414
-	*
4415
-	*/
4411
+	 * Gets all airline countries that have flown over by airport icao
4412
+	 *
4413
+	 * @return Array the airline country list
4414
+	 *
4415
+	 */
4416 4416
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4417 4417
 	{
4418 4418
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4442,11 +4442,11 @@  discard block
 block discarded – undo
4442 4442
 
4443 4443
 
4444 4444
 	/**
4445
-	* Gets all airlines that have flown over by aircraft manufacturer
4446
-	*
4447
-	* @return Array the airline list
4448
-	*
4449
-	*/
4445
+	 * Gets all airlines that have flown over by aircraft manufacturer
4446
+	 *
4447
+	 * @return Array the airline list
4448
+	 *
4449
+	 */
4450 4450
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4451 4451
 	{
4452 4452
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4477,11 +4477,11 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
 
4479 4479
 	/**
4480
-	* Gets all airline countries that have flown over by aircraft manufacturer
4481
-	*
4482
-	* @return Array the airline country list
4483
-	*
4484
-	*/
4480
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4481
+	 *
4482
+	 * @return Array the airline country list
4483
+	 *
4484
+	 */
4485 4485
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4486 4486
 	{
4487 4487
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 
4511 4511
 
4512 4512
 	/**
4513
-	* Gets all airlines that have flown over by date
4514
-	*
4515
-	* @return Array the airline list
4516
-	*
4517
-	*/
4513
+	 * Gets all airlines that have flown over by date
4514
+	 *
4515
+	 * @return Array the airline list
4516
+	 *
4517
+	 */
4518 4518
 	public function countAllAirlinesByDate($date,$filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
@@ -4558,11 +4558,11 @@  discard block
 block discarded – undo
4558 4558
 	
4559 4559
 	
4560 4560
 	/**
4561
-	* Gets all airline countries that have flown over by date
4562
-	*
4563
-	* @return Array the airline country list
4564
-	*
4565
-	*/
4561
+	 * Gets all airline countries that have flown over by date
4562
+	 *
4563
+	 * @return Array the airline country list
4564
+	 *
4565
+	 */
4566 4566
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 
4606 4606
 
4607 4607
 	/**
4608
-	* Gets all airlines that have flown over by ident/callsign
4609
-	*
4610
-	* @return Array the airline list
4611
-	*
4612
-	*/
4608
+	 * Gets all airlines that have flown over by ident/callsign
4609
+	 *
4610
+	 * @return Array the airline list
4611
+	 *
4612
+	 */
4613 4613
 	public function countAllAirlinesByIdent($ident,$filters = array())
4614 4614
 	{
4615 4615
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4626,11 +4626,11 @@  discard block
 block discarded – undo
4626 4626
 	}
4627 4627
 
4628 4628
 	/**
4629
-	* Gets all airlines by owner
4630
-	*
4631
-	* @return Array the airline list
4632
-	*
4633
-	*/
4629
+	 * Gets all airlines by owner
4630
+	 *
4631
+	 * @return Array the airline list
4632
+	 *
4633
+	 */
4634 4634
 	public function countAllAirlinesByOwner($owner,$filters = array())
4635 4635
 	{
4636 4636
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4647,11 +4647,11 @@  discard block
 block discarded – undo
4647 4647
 	}
4648 4648
 
4649 4649
 	/**
4650
-	* Gets flight duration by owner
4651
-	*
4652
-	* @return String Duration of all flights
4653
-	*
4654
-	*/
4650
+	 * Gets flight duration by owner
4651
+	 *
4652
+	 * @return String Duration of all flights
4653
+	 *
4654
+	 */
4655 4655
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
@@ -4698,11 +4698,11 @@  discard block
 block discarded – undo
4698 4698
 	}
4699 4699
 
4700 4700
 	/**
4701
-	* Count flights by owner
4702
-	*
4703
-	* @return String Duration of all flights
4704
-	*
4705
-	*/
4701
+	 * Count flights by owner
4702
+	 *
4703
+	 * @return String Duration of all flights
4704
+	 *
4705
+	 */
4706 4706
 	public function countFlightsByOwner($owner,$filters = array())
4707 4707
 	{
4708 4708
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 	}
4719 4719
 
4720 4720
 	/**
4721
-	* Count flights by pilot
4722
-	*
4723
-	* @return String Duration of all flights
4724
-	*
4725
-	*/
4721
+	 * Count flights by pilot
4722
+	 *
4723
+	 * @return String Duration of all flights
4724
+	 *
4725
+	 */
4726 4726
 	public function countFlightsByPilot($pilot,$filters = array())
4727 4727
 	{
4728 4728
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4738,11 +4738,11 @@  discard block
 block discarded – undo
4738 4738
 	}
4739 4739
 
4740 4740
 	/**
4741
-	* Gets flight duration by pilot
4742
-	*
4743
-	* @return String Duration of all flights
4744
-	*
4745
-	*/
4741
+	 * Gets flight duration by pilot
4742
+	 *
4743
+	 * @return String Duration of all flights
4744
+	 *
4745
+	 */
4746 4746
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 	}
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all airlines used by pilot
4792
-	*
4793
-	* @return Array the airline list
4794
-	*
4795
-	*/
4791
+	 * Gets all airlines used by pilot
4792
+	 *
4793
+	 * @return Array the airline list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4797 4797
 	{
4798 4798
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4809,11 +4809,11 @@  discard block
 block discarded – undo
4809 4809
 	}
4810 4810
 
4811 4811
 	/**
4812
-	* Gets all airlines that have flown over by route
4813
-	*
4814
-	* @return Array the airline list
4815
-	*
4816
-	*/
4812
+	 * Gets all airlines that have flown over by route
4813
+	 *
4814
+	 * @return Array the airline list
4815
+	 *
4816
+	 */
4817 4817
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4818 4818
 	{
4819 4819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4845,11 +4845,11 @@  discard block
 block discarded – undo
4845 4845
 	}
4846 4846
 
4847 4847
 	/**
4848
-	* Gets all airline countries that have flown over by route
4849
-	*
4850
-	* @return Array the airline country list
4851
-	*
4852
-	*/
4848
+	 * Gets all airline countries that have flown over by route
4849
+	 *
4850
+	 * @return Array the airline country list
4851
+	 *
4852
+	 */
4853 4853
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4854 4854
 	{
4855 4855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4881,11 +4881,11 @@  discard block
 block discarded – undo
4881 4881
 
4882 4882
 
4883 4883
 	/**
4884
-	* Gets all airlines that have flown over by country
4885
-	*
4886
-	* @return Array the airline list
4887
-	*
4888
-	*/
4884
+	 * Gets all airlines that have flown over by country
4885
+	 *
4886
+	 * @return Array the airline list
4887
+	 *
4888
+	 */
4889 4889
 	public function countAllAirlinesByCountry($country,$filters = array())
4890 4890
 	{
4891 4891
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
 
4916 4916
 
4917 4917
 	/**
4918
-	* Gets all airline countries that have flown over by country
4919
-	*
4920
-	* @return Array the airline country list
4921
-	*
4922
-	*/
4918
+	 * Gets all airline countries that have flown over by country
4919
+	 *
4920
+	 * @return Array the airline country list
4921
+	 *
4922
+	 */
4923 4923
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4924 4924
 	{
4925 4925
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4948,11 +4948,11 @@  discard block
 block discarded – undo
4948 4948
 
4949 4949
 
4950 4950
 	/**
4951
-	* Gets all airlines countries
4952
-	*
4953
-	* @return Array the airline country list
4954
-	*
4955
-	*/
4951
+	 * Gets all airlines countries
4952
+	 *
4953
+	 * @return Array the airline country list
4954
+	 *
4955
+	 */
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
@@ -5007,11 +5007,11 @@  discard block
 block discarded – undo
5007 5007
 	}
5008 5008
 
5009 5009
 	/**
5010
-	* Gets all number of flight over countries
5011
-	*
5012
-	* @return Array the airline country list
5013
-	*
5014
-	*/
5010
+	 * Gets all number of flight over countries
5011
+	 *
5012
+	 * @return Array the airline country list
5013
+	 *
5014
+	 */
5015 5015
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5016 5016
 	{
5017 5017
 		global $globalDBdriver;
@@ -5033,15 +5033,15 @@  discard block
 block discarded – undo
5033 5033
 		$SpotterLive = new SpotterLive();
5034 5034
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5035 5035
 		$filter_query .= ' over_country IS NOT NULL';
5036
-                if ($olderthanmonths > 0) {
5036
+				if ($olderthanmonths > 0) {
5037 5037
 			if ($globalDBdriver == 'mysql') {
5038 5038
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5039 5039
 			} else {
5040 5040
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5041 5041
 			}
5042 5042
 		}
5043
-                if ($sincedate != '') {
5044
-            		if ($globalDBdriver == 'mysql') {
5043
+				if ($sincedate != '') {
5044
+					if ($globalDBdriver == 'mysql') {
5045 5045
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5046 5046
 			} else {
5047 5047
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5071,11 +5071,11 @@  discard block
 block discarded – undo
5071 5071
 	
5072 5072
 	
5073 5073
 	/**
5074
-	* Gets all aircraft types that have flown over
5075
-	*
5076
-	* @return Array the aircraft list
5077
-	*
5078
-	*/
5074
+	 * Gets all aircraft types that have flown over
5075
+	 *
5076
+	 * @return Array the aircraft list
5077
+	 *
5078
+	 */
5079 5079
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5080 5080
 	{
5081 5081
 		global $globalDBdriver;
@@ -5145,11 +5145,11 @@  discard block
 block discarded – undo
5145 5145
 	}
5146 5146
 
5147 5147
 	/**
5148
-	* Gets all aircraft types that have flown over by airline
5149
-	*
5150
-	* @return Array the aircraft list
5151
-	*
5152
-	*/
5148
+	 * Gets all aircraft types that have flown over by airline
5149
+	 *
5150
+	 * @return Array the aircraft list
5151
+	 *
5152
+	 */
5153 5153
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5154 5154
 	{
5155 5155
 		global $globalDBdriver;
@@ -5220,11 +5220,11 @@  discard block
 block discarded – undo
5220 5220
 	}
5221 5221
 
5222 5222
 	/**
5223
-	* Gets all aircraft types that have flown over by months
5224
-	*
5225
-	* @return Array the aircraft list
5226
-	*
5227
-	*/
5223
+	 * Gets all aircraft types that have flown over by months
5224
+	 *
5225
+	 * @return Array the aircraft list
5226
+	 *
5227
+	 */
5228 5228
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5229 5229
 	{
5230 5230
 		global $globalDBdriver;
@@ -5268,11 +5268,11 @@  discard block
 block discarded – undo
5268 5268
 
5269 5269
 
5270 5270
 	/**
5271
-	* Gets all aircraft registration that have flown over by aircaft icao
5272
-	*
5273
-	* @return Array the aircraft list
5274
-	*
5275
-	*/
5271
+	 * Gets all aircraft registration that have flown over by aircaft icao
5272
+	 *
5273
+	 * @return Array the aircraft list
5274
+	 *
5275
+	 */
5276 5276
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5277 5277
 	{
5278 5278
 		$Image = new Image($this->db);
@@ -5311,11 +5311,11 @@  discard block
 block discarded – undo
5311 5311
 
5312 5312
 
5313 5313
 	/**
5314
-	* Gets all aircraft types that have flown over by airline icao
5315
-	*
5316
-	* @return Array the aircraft list
5317
-	*
5318
-	*/
5314
+	 * Gets all aircraft types that have flown over by airline icao
5315
+	 *
5316
+	 * @return Array the aircraft list
5317
+	 *
5318
+	 */
5319 5319
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5320 5320
 	{
5321 5321
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5344,11 +5344,11 @@  discard block
 block discarded – undo
5344 5344
 
5345 5345
 
5346 5346
 	/**
5347
-	* Gets all aircraft registration that have flown over by airline icao
5348
-	*
5349
-	* @return Array the aircraft list
5350
-	*
5351
-	*/
5347
+	 * Gets all aircraft registration that have flown over by airline icao
5348
+	 *
5349
+	 * @return Array the aircraft list
5350
+	 *
5351
+	 */
5352 5352
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5353 5353
 	{
5354 5354
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5386,11 +5386,11 @@  discard block
 block discarded – undo
5386 5386
 
5387 5387
 
5388 5388
 	/**
5389
-	* Gets all aircraft manufacturer that have flown over by airline icao
5390
-	*
5391
-	* @return Array the aircraft list
5392
-	*
5393
-	*/
5389
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5390
+	 *
5391
+	 * @return Array the aircraft list
5392
+	 *
5393
+	 */
5394 5394
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5395 5395
 	{
5396 5396
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5418,11 +5418,11 @@  discard block
 block discarded – undo
5418 5418
 
5419 5419
 
5420 5420
 	/**
5421
-	* Gets all aircraft types that have flown over by airline icao
5422
-	*
5423
-	* @return Array the aircraft list
5424
-	*
5425
-	*/
5421
+	 * Gets all aircraft types that have flown over by airline icao
5422
+	 *
5423
+	 * @return Array the aircraft list
5424
+	 *
5425
+	 */
5426 5426
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5427 5427
 	{
5428 5428
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5451,11 +5451,11 @@  discard block
 block discarded – undo
5451 5451
 
5452 5452
 
5453 5453
 	/**
5454
-	* Gets all aircraft registration that have flown over by airport icao
5455
-	*
5456
-	* @return Array the aircraft list
5457
-	*
5458
-	*/
5454
+	 * Gets all aircraft registration that have flown over by airport icao
5455
+	 *
5456
+	 * @return Array the aircraft list
5457
+	 *
5458
+	 */
5459 5459
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5460 5460
 	{
5461 5461
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5492,11 +5492,11 @@  discard block
 block discarded – undo
5492 5492
 	
5493 5493
 	
5494 5494
 	/**
5495
-	* Gets all aircraft manufacturer that have flown over by airport icao
5496
-	*
5497
-	* @return Array the aircraft list
5498
-	*
5499
-	*/
5495
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5496
+	 *
5497
+	 * @return Array the aircraft list
5498
+	 *
5499
+	 */
5500 5500
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5501 5501
 	{
5502 5502
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5522,11 +5522,11 @@  discard block
 block discarded – undo
5522 5522
 	}
5523 5523
 
5524 5524
 	/**
5525
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5526
-	*
5527
-	* @return Array the aircraft list
5528
-	*
5529
-	*/
5525
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5526
+	 *
5527
+	 * @return Array the aircraft list
5528
+	 *
5529
+	 */
5530 5530
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5531 5531
 	{
5532 5532
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5553,11 +5553,11 @@  discard block
 block discarded – undo
5553 5553
 
5554 5554
 
5555 5555
 	/**
5556
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5557
-	*
5558
-	* @return Array the aircraft list
5559
-	*
5560
-	*/
5556
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5557
+	 *
5558
+	 * @return Array the aircraft list
5559
+	 *
5560
+	 */
5561 5561
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5562 5562
 	{
5563 5563
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5593,11 +5593,11 @@  discard block
 block discarded – undo
5593 5593
 	}
5594 5594
 
5595 5595
 	/**
5596
-	* Gets all aircraft types that have flown over by date
5597
-	*
5598
-	* @return Array the aircraft list
5599
-	*
5600
-	*/
5596
+	 * Gets all aircraft types that have flown over by date
5597
+	 *
5598
+	 * @return Array the aircraft list
5599
+	 *
5600
+	 */
5601 5601
 	public function countAllAircraftTypesByDate($date,$filters = array())
5602 5602
 	{
5603 5603
 		global $globalTimezone, $globalDBdriver;
@@ -5639,11 +5639,11 @@  discard block
 block discarded – undo
5639 5639
 
5640 5640
 
5641 5641
 	/**
5642
-	* Gets all aircraft registration that have flown over by date
5643
-	*
5644
-	* @return Array the aircraft list
5645
-	*
5646
-	*/
5642
+	 * Gets all aircraft registration that have flown over by date
5643
+	 *
5644
+	 * @return Array the aircraft list
5645
+	 *
5646
+	 */
5647 5647
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5648 5648
 	{
5649 5649
 		global $globalTimezone, $globalDBdriver;
@@ -5694,11 +5694,11 @@  discard block
 block discarded – undo
5694 5694
 
5695 5695
 
5696 5696
 	/**
5697
-	* Gets all aircraft manufacturer that have flown over by date
5698
-	*
5699
-	* @return Array the aircraft manufacturer list
5700
-	*
5701
-	*/
5697
+	 * Gets all aircraft manufacturer that have flown over by date
5698
+	 *
5699
+	 * @return Array the aircraft manufacturer list
5700
+	 *
5701
+	 */
5702 5702
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5703 5703
 	{
5704 5704
 		global $globalTimezone, $globalDBdriver;
@@ -5740,11 +5740,11 @@  discard block
 block discarded – undo
5740 5740
 
5741 5741
 
5742 5742
 	/**
5743
-	* Gets all aircraft types that have flown over by ident/callsign
5744
-	*
5745
-	* @return Array the aircraft list
5746
-	*
5747
-	*/
5743
+	 * Gets all aircraft types that have flown over by ident/callsign
5744
+	 *
5745
+	 * @return Array the aircraft list
5746
+	 *
5747
+	 */
5748 5748
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5749 5749
 	{
5750 5750
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5772,11 +5772,11 @@  discard block
 block discarded – undo
5772 5772
 	}
5773 5773
 
5774 5774
 	/**
5775
-	* Gets all aircraft types that have flown over by pilot
5776
-	*
5777
-	* @return Array the aircraft list
5778
-	*
5779
-	*/
5775
+	 * Gets all aircraft types that have flown over by pilot
5776
+	 *
5777
+	 * @return Array the aircraft list
5778
+	 *
5779
+	 */
5780 5780
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5781 5781
 	{
5782 5782
 		global $globalDBdriver;
@@ -5822,11 +5822,11 @@  discard block
 block discarded – undo
5822 5822
 	}
5823 5823
 
5824 5824
 	/**
5825
-	* Gets all aircraft types that have flown over by owner
5826
-	*
5827
-	* @return Array the aircraft list
5828
-	*
5829
-	*/
5825
+	 * Gets all aircraft types that have flown over by owner
5826
+	 *
5827
+	 * @return Array the aircraft list
5828
+	 *
5829
+	 */
5830 5830
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5831 5831
 	{
5832 5832
 		global $globalDBdriver;
@@ -5871,11 +5871,11 @@  discard block
 block discarded – undo
5871 5871
 	}
5872 5872
 
5873 5873
 	/**
5874
-	* Gets all aircraft registration that have flown over by ident/callsign
5875
-	*
5876
-	* @return Array the aircraft list
5877
-	*
5878
-	*/
5874
+	 * Gets all aircraft registration that have flown over by ident/callsign
5875
+	 *
5876
+	 * @return Array the aircraft list
5877
+	 *
5878
+	 */
5879 5879
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5880 5880
 	{
5881 5881
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5914,11 +5914,11 @@  discard block
 block discarded – undo
5914 5914
 	}
5915 5915
 
5916 5916
 	/**
5917
-	* Gets all aircraft registration that have flown over by owner
5918
-	*
5919
-	* @return Array the aircraft list
5920
-	*
5921
-	*/
5917
+	 * Gets all aircraft registration that have flown over by owner
5918
+	 *
5919
+	 * @return Array the aircraft list
5920
+	 *
5921
+	 */
5922 5922
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5923 5923
 	{
5924 5924
 		global $globalDBdriver;
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	}
5990 5990
 
5991 5991
 	/**
5992
-	* Gets all aircraft registration that have flown over by pilot
5993
-	*
5994
-	* @return Array the aircraft list
5995
-	*
5996
-	*/
5992
+	 * Gets all aircraft registration that have flown over by pilot
5993
+	 *
5994
+	 * @return Array the aircraft list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5998 5998
 	{
5999 5999
 		global $globalDBdriver;
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 
6066 6066
 
6067 6067
 	/**
6068
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6069
-	*
6070
-	* @return Array the aircraft manufacturer list
6071
-	*
6072
-	*/
6068
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6069
+	 *
6070
+	 * @return Array the aircraft manufacturer list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6074 6074
 	{
6075 6075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6094,11 +6094,11 @@  discard block
 block discarded – undo
6094 6094
 	}
6095 6095
 
6096 6096
 	/**
6097
-	* Gets all aircraft manufacturer that have flown over by owner
6098
-	*
6099
-	* @return Array the aircraft manufacturer list
6100
-	*
6101
-	*/
6097
+	 * Gets all aircraft manufacturer that have flown over by owner
6098
+	 *
6099
+	 * @return Array the aircraft manufacturer list
6100
+	 *
6101
+	 */
6102 6102
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6103 6103
 	{
6104 6104
 		global $globalDBdriver;
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	}
6147 6147
 
6148 6148
 	/**
6149
-	* Gets all aircraft manufacturer that have flown over by pilot
6150
-	*
6151
-	* @return Array the aircraft manufacturer list
6152
-	*
6153
-	*/
6149
+	 * Gets all aircraft manufacturer that have flown over by pilot
6150
+	 *
6151
+	 * @return Array the aircraft manufacturer list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6155 6155
 	{
6156 6156
 		global $globalDBdriver;
@@ -6199,11 +6199,11 @@  discard block
 block discarded – undo
6199 6199
 
6200 6200
 
6201 6201
 	/**
6202
-	* Gets all aircraft types that have flown over by route
6203
-	*
6204
-	* @return Array the aircraft list
6205
-	*
6206
-	*/
6202
+	 * Gets all aircraft types that have flown over by route
6203
+	 *
6204
+	 * @return Array the aircraft list
6205
+	 *
6206
+	 */
6207 6207
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6208 6208
 	{
6209 6209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6232,11 +6232,11 @@  discard block
 block discarded – undo
6232 6232
 	}
6233 6233
 
6234 6234
 	/**
6235
-	* Gets all aircraft registration that have flown over by route
6236
-	*
6237
-	* @return Array the aircraft list
6238
-	*
6239
-	*/
6235
+	 * Gets all aircraft registration that have flown over by route
6236
+	 *
6237
+	 * @return Array the aircraft list
6238
+	 *
6239
+	 */
6240 6240
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6241 6241
 	{
6242 6242
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6278,11 +6278,11 @@  discard block
 block discarded – undo
6278 6278
 	
6279 6279
 	
6280 6280
 	/**
6281
-	* Gets all aircraft manufacturer that have flown over by route
6282
-	*
6283
-	* @return Array the aircraft manufacturer list
6284
-	*
6285
-	*/
6281
+	 * Gets all aircraft manufacturer that have flown over by route
6282
+	 *
6283
+	 * @return Array the aircraft manufacturer list
6284
+	 *
6285
+	 */
6286 6286
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6287 6287
 	{
6288 6288
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6316,11 +6316,11 @@  discard block
 block discarded – undo
6316 6316
 	
6317 6317
 	
6318 6318
 	/**
6319
-	* Gets all aircraft types that have flown over by country
6320
-	*
6321
-	* @return Array the aircraft list
6322
-	*
6323
-	*/
6319
+	 * Gets all aircraft types that have flown over by country
6320
+	 *
6321
+	 * @return Array the aircraft list
6322
+	 *
6323
+	 */
6324 6324
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6325 6325
 	{
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6351,11 +6351,11 @@  discard block
 block discarded – undo
6351 6351
 
6352 6352
 
6353 6353
 	/**
6354
-	* Gets all aircraft registration that have flown over by country
6355
-	*
6356
-	* @return Array the aircraft list
6357
-	*
6358
-	*/
6354
+	 * Gets all aircraft registration that have flown over by country
6355
+	 *
6356
+	 * @return Array the aircraft list
6357
+	 *
6358
+	 */
6359 6359
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6360 6360
 	{
6361 6361
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6395,11 +6395,11 @@  discard block
 block discarded – undo
6395 6395
 	
6396 6396
 	
6397 6397
 	/**
6398
-	* Gets all aircraft manufacturer that have flown over by country
6399
-	*
6400
-	* @return Array the aircraft manufacturer list
6401
-	*
6402
-	*/
6398
+	 * Gets all aircraft manufacturer that have flown over by country
6399
+	 *
6400
+	 * @return Array the aircraft manufacturer list
6401
+	 *
6402
+	 */
6403 6403
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6404 6404
 	{
6405 6405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6430,18 +6430,18 @@  discard block
 block discarded – undo
6430 6430
 	
6431 6431
 	
6432 6432
 	/**
6433
-	* Gets all aircraft manufacturers that have flown over
6434
-	*
6435
-	* @return Array the aircraft list
6436
-	*
6437
-	*/
6433
+	 * Gets all aircraft manufacturers that have flown over
6434
+	 *
6435
+	 * @return Array the aircraft list
6436
+	 *
6437
+	 */
6438 6438
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6439 6439
 	{
6440 6440
 		global $globalDBdriver;
6441 6441
 		$filter_query = $this->getFilter($filters,true,true);
6442 6442
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6443 6443
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6444
-                $query_values = array();
6444
+				$query_values = array();
6445 6445
 		if ($year != '') {
6446 6446
 			if ($globalDBdriver == 'mysql') {
6447 6447
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6494,11 +6494,11 @@  discard block
 block discarded – undo
6494 6494
 	
6495 6495
 	
6496 6496
 	/**
6497
-	* Gets all aircraft registrations that have flown over
6498
-	*
6499
-	* @return Array the aircraft list
6500
-	*
6501
-	*/
6497
+	 * Gets all aircraft registrations that have flown over
6498
+	 *
6499
+	 * @return Array the aircraft list
6500
+	 *
6501
+	 */
6502 6502
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6503 6503
 	{
6504 6504
 		global $globalDBdriver;
@@ -6506,15 +6506,15 @@  discard block
 block discarded – undo
6506 6506
 		$filter_query = $this->getFilter($filters,true,true);
6507 6507
 		$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    
6508 6508
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6509
-                if ($olderthanmonths > 0) {
6510
-            		if ($globalDBdriver == 'mysql') {
6509
+				if ($olderthanmonths > 0) {
6510
+					if ($globalDBdriver == 'mysql') {
6511 6511
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6512 6512
 			} else {
6513 6513
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6514 6514
 			}
6515 6515
 		}
6516
-                if ($sincedate != '') {
6517
-            		if ($globalDBdriver == 'mysql') {
6516
+				if ($sincedate != '') {
6517
+					if ($globalDBdriver == 'mysql') {
6518 6518
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6519 6519
 			} else {
6520 6520
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6579,11 +6579,11 @@  discard block
 block discarded – undo
6579 6579
 
6580 6580
 
6581 6581
 	/**
6582
-	* Gets all aircraft registrations that have flown over
6583
-	*
6584
-	* @return Array the aircraft list
6585
-	*
6586
-	*/
6582
+	 * Gets all aircraft registrations that have flown over
6583
+	 *
6584
+	 * @return Array the aircraft list
6585
+	 *
6586
+	 */
6587 6587
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6588 6588
 	{
6589 6589
 		global $globalDBdriver;
@@ -6591,15 +6591,15 @@  discard block
 block discarded – undo
6591 6591
 		$Image = new Image($this->db);
6592 6592
 		$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    
6593 6593
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6594
-                if ($olderthanmonths > 0) {
6595
-            		if ($globalDBdriver == 'mysql') {
6594
+				if ($olderthanmonths > 0) {
6595
+					if ($globalDBdriver == 'mysql') {
6596 6596
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6597 6597
 			} else {
6598 6598
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6599 6599
 			}
6600 6600
 		}
6601
-                if ($sincedate != '') {
6602
-            		if ($globalDBdriver == 'mysql') {
6601
+				if ($sincedate != '') {
6602
+					if ($globalDBdriver == 'mysql') {
6603 6603
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6604 6604
 			} else {
6605 6605
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6608,7 +6608,7 @@  discard block
 block discarded – undo
6608 6608
 
6609 6609
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6610 6610
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6611
-                $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";
6611
+				$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";
6612 6612
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6613 6613
 		
6614 6614
 		$sth = $this->db->prepare($query);
@@ -6640,26 +6640,26 @@  discard block
 block discarded – undo
6640 6640
 	
6641 6641
 	
6642 6642
 	/**
6643
-	* Gets all departure airports of the airplanes that have flown over
6644
-	*
6645
-	* @return Array the airport list
6646
-	*
6647
-	*/
6643
+	 * Gets all departure airports of the airplanes that have flown over
6644
+	 *
6645
+	 * @return Array the airport list
6646
+	 *
6647
+	 */
6648 6648
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6649 6649
 	{
6650 6650
 		global $globalDBdriver;
6651 6651
 		$filter_query = $this->getFilter($filters,true,true);
6652 6652
 		$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 
6653 6653
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6654
-                if ($olderthanmonths > 0) {
6655
-            		if ($globalDBdriver == 'mysql') {
6654
+				if ($olderthanmonths > 0) {
6655
+					if ($globalDBdriver == 'mysql') {
6656 6656
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6657 6657
 			} else {
6658 6658
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6659 6659
 			}
6660
-                }
6661
-                if ($sincedate != '') {
6662
-            		if ($globalDBdriver == 'mysql') {
6660
+				}
6661
+				if ($sincedate != '') {
6662
+					if ($globalDBdriver == 'mysql') {
6663 6663
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6664 6664
 			} else {
6665 6665
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6693,7 +6693,7 @@  discard block
 block discarded – undo
6693 6693
 				$query_values = array_merge($query_values,array(':day' => $day));
6694 6694
 			}
6695 6695
 		}
6696
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6696
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6697 6697
 				ORDER BY airport_departure_icao_count DESC";
6698 6698
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6699 6699
 
@@ -6716,35 +6716,35 @@  discard block
 block discarded – undo
6716 6716
 	}
6717 6717
 
6718 6718
 	/**
6719
-	* Gets all departure airports of the airplanes that have flown over
6720
-	*
6721
-	* @return Array the airport list
6722
-	*
6723
-	*/
6719
+	 * Gets all departure airports of the airplanes that have flown over
6720
+	 *
6721
+	 * @return Array the airport list
6722
+	 *
6723
+	 */
6724 6724
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6725 6725
 	{
6726 6726
 		global $globalDBdriver;
6727 6727
 		$filter_query = $this->getFilter($filters,true,true);
6728 6728
 		$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 
6729 6729
 			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 <> '' ";
6730
-                if ($olderthanmonths > 0) {
6731
-            		if ($globalDBdriver == 'mysql') {
6730
+				if ($olderthanmonths > 0) {
6731
+					if ($globalDBdriver == 'mysql') {
6732 6732
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6733 6733
 			} else {
6734 6734
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6735 6735
 			}
6736
-                }
6737
-                if ($sincedate != '') {
6738
-            		if ($globalDBdriver == 'mysql') {
6736
+				}
6737
+				if ($sincedate != '') {
6738
+					if ($globalDBdriver == 'mysql') {
6739 6739
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6740 6740
 			} else {
6741 6741
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6742 6742
 			}
6743 6743
 		}
6744 6744
 
6745
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
-                $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
6745
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6746
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6747
+				$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
6748 6748
 				ORDER BY airport_departure_icao_count DESC";
6749 6749
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6750 6750
       
@@ -6769,26 +6769,26 @@  discard block
 block discarded – undo
6769 6769
 	}
6770 6770
 
6771 6771
 	/**
6772
-	* Gets all detected departure airports of the airplanes that have flown over
6773
-	*
6774
-	* @return Array the airport list
6775
-	*
6776
-	*/
6772
+	 * Gets all detected departure airports of the airplanes that have flown over
6773
+	 *
6774
+	 * @return Array the airport list
6775
+	 *
6776
+	 */
6777 6777
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6778 6778
 	{
6779 6779
 		global $globalDBdriver;
6780 6780
 		$filter_query = $this->getFilter($filters,true,true);
6781 6781
 		$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
6782 6782
 				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";
6783
-                if ($olderthanmonths > 0) {
6784
-            		if ($globalDBdriver == 'mysql') {
6783
+				if ($olderthanmonths > 0) {
6784
+					if ($globalDBdriver == 'mysql') {
6785 6785
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6786 6786
 			} else {
6787 6787
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6788 6788
 			}
6789
-                }
6790
-                if ($sincedate != '') {
6791
-            		if ($globalDBdriver == 'mysql') {
6789
+				}
6790
+				if ($sincedate != '') {
6791
+					if ($globalDBdriver == 'mysql') {
6792 6792
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6793 6793
 			} else {
6794 6794
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6822,10 +6822,10 @@  discard block
 block discarded – undo
6822 6822
 				$query_values = array_merge($query_values,array(':day' => $day));
6823 6823
 			}
6824 6824
 		}
6825
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6825
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6826 6826
 				ORDER BY airport_departure_icao_count DESC";
6827 6827
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6828
-    		//echo $query;
6828
+			//echo $query;
6829 6829
 		$sth = $this->db->prepare($query);
6830 6830
 		$sth->execute($query_values);
6831 6831
       
@@ -6846,35 +6846,35 @@  discard block
 block discarded – undo
6846 6846
 	}
6847 6847
 	
6848 6848
 	/**
6849
-	* Gets all detected departure airports of the airplanes that have flown over
6850
-	*
6851
-	* @return Array the airport list
6852
-	*
6853
-	*/
6849
+	 * Gets all detected departure airports of the airplanes that have flown over
6850
+	 *
6851
+	 * @return Array the airport list
6852
+	 *
6853
+	 */
6854 6854
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6855 6855
 	{
6856 6856
 		global $globalDBdriver;
6857 6857
 		$filter_query = $this->getFilter($filters,true,true);
6858 6858
 		$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
6859 6859
 				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 ";
6860
-                if ($olderthanmonths > 0) {
6861
-            		if ($globalDBdriver == 'mysql') {
6860
+				if ($olderthanmonths > 0) {
6861
+					if ($globalDBdriver == 'mysql') {
6862 6862
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6863 6863
 			} else {
6864 6864
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6865 6865
 			}
6866
-                }
6867
-                if ($sincedate != '') {
6868
-            		if ($globalDBdriver == 'mysql') {
6866
+				}
6867
+				if ($sincedate != '') {
6868
+					if ($globalDBdriver == 'mysql') {
6869 6869
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6870 6870
 			} else {
6871 6871
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6872 6872
 			}
6873 6873
 		}
6874 6874
 
6875
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6875
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6876
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6877
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6878 6878
 				ORDER BY airport_departure_icao_count DESC";
6879 6879
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6880 6880
       
@@ -6899,11 +6899,11 @@  discard block
 block discarded – undo
6899 6899
 	}	
6900 6900
 	
6901 6901
 	/**
6902
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
-	*
6904
-	* @return Array the airport list
6905
-	*
6906
-	*/
6902
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6903
+	 *
6904
+	 * @return Array the airport list
6905
+	 *
6906
+	 */
6907 6907
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6908 6908
 	{
6909 6909
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6937,11 +6937,11 @@  discard block
 block discarded – undo
6937 6937
 	
6938 6938
 	
6939 6939
 	/**
6940
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
-	*
6942
-	* @return Array the airport list
6943
-	*
6944
-	*/
6940
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6941
+	 *
6942
+	 * @return Array the airport list
6943
+	 *
6944
+	 */
6945 6945
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6946 6946
 	{
6947 6947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	
6973 6973
 	
6974 6974
 	/**
6975
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
-	*
6977
-	* @return Array the airport list
6978
-	*
6979
-	*/
6975
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6976
+	 *
6977
+	 * @return Array the airport list
6978
+	 *
6979
+	 */
6980 6980
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6981 6981
 	{
6982 6982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7018 7018
 	{
7019 7019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7043,11 +7043,11 @@  discard block
 block discarded – undo
7043 7043
 	
7044 7044
 	
7045 7045
 	/**
7046
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
-	*
7048
-	* @return Array the airport list
7049
-	*
7050
-	*/
7046
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7047
+	 *
7048
+	 * @return Array the airport list
7049
+	 *
7050
+	 */
7051 7051
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7052 7052
 	{
7053 7053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7080,11 +7080,11 @@  discard block
 block discarded – undo
7080 7080
 	
7081 7081
 	
7082 7082
 	/**
7083
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
-	*
7085
-	* @return Array the airport list
7086
-	*
7087
-	*/
7083
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7084
+	 *
7085
+	 * @return Array the airport list
7086
+	 *
7087
+	 */
7088 7088
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7089 7089
 	{
7090 7090
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7114,11 +7114,11 @@  discard block
 block discarded – undo
7114 7114
 	
7115 7115
 	
7116 7116
 	/**
7117
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
-	*
7119
-	* @return Array the airport list
7120
-	*
7121
-	*/
7117
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7118
+	 *
7119
+	 * @return Array the airport list
7120
+	 *
7121
+	 */
7122 7122
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7123 7123
 	{
7124 7124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7151,11 +7151,11 @@  discard block
 block discarded – undo
7151 7151
 	
7152 7152
 	
7153 7153
 	/**
7154
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
-	*
7156
-	* @return Array the airport list
7157
-	*
7158
-	*/
7154
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7155
+	 *
7156
+	 * @return Array the airport list
7157
+	 *
7158
+	 */
7159 7159
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7160 7160
 	{
7161 7161
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7186,11 +7186,11 @@  discard block
 block discarded – undo
7186 7186
 	
7187 7187
 	
7188 7188
 	/**
7189
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
-	*
7191
-	* @return Array the airport list
7192
-	*
7193
-	*/
7189
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7190
+	 *
7191
+	 * @return Array the airport list
7192
+	 *
7193
+	 */
7194 7194
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7195 7195
 	{
7196 7196
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7223,11 +7223,11 @@  discard block
 block discarded – undo
7223 7223
 	
7224 7224
 	
7225 7225
 	/**
7226
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
-	*
7228
-	* @return Array the airport list
7229
-	*
7230
-	*/
7226
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7227
+	 *
7228
+	 * @return Array the airport list
7229
+	 *
7230
+	 */
7231 7231
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7232 7232
 	{
7233 7233
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7257,11 +7257,11 @@  discard block
 block discarded – undo
7257 7257
 	
7258 7258
 	
7259 7259
 	/**
7260
-	* Gets all departure airports of the airplanes that have flown over based on a date
7261
-	*
7262
-	* @return Array the airport list
7263
-	*
7264
-	*/
7260
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7261
+	 *
7262
+	 * @return Array the airport list
7263
+	 *
7264
+	 */
7265 7265
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7266 7266
 	{
7267 7267
 		global $globalTimezone, $globalDBdriver;
@@ -7307,11 +7307,11 @@  discard block
 block discarded – undo
7307 7307
 	
7308 7308
 	
7309 7309
 	/**
7310
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7311
-	*
7312
-	* @return Array the airport list
7313
-	*
7314
-	*/
7310
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7311
+	 *
7312
+	 * @return Array the airport list
7313
+	 *
7314
+	 */
7315 7315
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7316 7316
 	{
7317 7317
 		global $globalTimezone, $globalDBdriver;
@@ -7354,11 +7354,11 @@  discard block
 block discarded – undo
7354 7354
 	
7355 7355
 	
7356 7356
 	/**
7357
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
-	*
7359
-	* @return Array the airport list
7360
-	*
7361
-	*/
7357
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7358
+	 *
7359
+	 * @return Array the airport list
7360
+	 *
7361
+	 */
7362 7362
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7363 7363
 	{
7364 7364
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	}
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7394
-	*
7395
-	* @return Array the airport list
7396
-	*
7397
-	*/
7393
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7394
+	 *
7395
+	 * @return Array the airport list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7426,11 +7426,11 @@  discard block
 block discarded – undo
7426 7426
 	}
7427 7427
 	
7428 7428
 	/**
7429
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7430
-	*
7431
-	* @return Array the airport list
7432
-	*
7433
-	*/
7429
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7430
+	 *
7431
+	 * @return Array the airport list
7432
+	 *
7433
+	 */
7434 7434
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7435 7435
 	{
7436 7436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7463,11 +7463,11 @@  discard block
 block discarded – undo
7463 7463
 	
7464 7464
 	
7465 7465
 	/**
7466
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
-	*
7468
-	* @return Array the airport list
7469
-	*
7470
-	*/
7466
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7467
+	 *
7468
+	 * @return Array the airport list
7469
+	 *
7470
+	 */
7471 7471
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7472 7472
 	{
7473 7473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7496,11 +7496,11 @@  discard block
 block discarded – undo
7496 7496
 	}
7497 7497
 	
7498 7498
 	/**
7499
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7500
-	*
7501
-	* @return Array the airport list
7502
-	*
7503
-	*/
7499
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7500
+	 *
7501
+	 * @return Array the airport list
7502
+	 *
7503
+	 */
7504 7504
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7505 7505
 	{
7506 7506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7516,11 +7516,11 @@  discard block
 block discarded – undo
7516 7516
 	}
7517 7517
 	
7518 7518
 	/**
7519
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
-	*
7521
-	* @return Array the airport list
7522
-	*
7523
-	*/
7519
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7520
+	 *
7521
+	 * @return Array the airport list
7522
+	 *
7523
+	 */
7524 7524
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7525 7525
 	{
7526 7526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7538,11 +7538,11 @@  discard block
 block discarded – undo
7538 7538
 	
7539 7539
 	
7540 7540
 	/**
7541
-	* Gets all departure airports of the airplanes that have flown over based on a country
7542
-	*
7543
-	* @return Array the airport list
7544
-	*
7545
-	*/
7541
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7542
+	 *
7543
+	 * @return Array the airport list
7544
+	 *
7545
+	 */
7546 7546
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7547 7547
 	{
7548 7548
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7576,11 +7576,11 @@  discard block
 block discarded – undo
7576 7576
 
7577 7577
 
7578 7578
 	/**
7579
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
-	*
7581
-	* @return Array the airport list
7582
-	*
7583
-	*/
7579
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7580
+	 *
7581
+	 * @return Array the airport list
7582
+	 *
7583
+	 */
7584 7584
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7585 7585
 	{
7586 7586
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7610,31 +7610,31 @@  discard block
 block discarded – undo
7610 7610
 	
7611 7611
 
7612 7612
 	/**
7613
-	* Gets all arrival airports of the airplanes that have flown over
7614
-	*
7615
-	* @param Boolean $limit Limit result to 10 or not
7616
-	* @param Integer $olderthanmonths Only show result older than x months
7617
-	* @param String $sincedate Only show result since x date
7618
-	* @param Boolean $icaoaskey Show result by ICAO
7619
-	* @param Array $filters Filter used here
7620
-	* @return Array the airport list
7621
-	*
7622
-	*/
7613
+	 * Gets all arrival airports of the airplanes that have flown over
7614
+	 *
7615
+	 * @param Boolean $limit Limit result to 10 or not
7616
+	 * @param Integer $olderthanmonths Only show result older than x months
7617
+	 * @param String $sincedate Only show result since x date
7618
+	 * @param Boolean $icaoaskey Show result by ICAO
7619
+	 * @param Array $filters Filter used here
7620
+	 * @return Array the airport list
7621
+	 *
7622
+	 */
7623 7623
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7624 7624
 	{
7625 7625
 		global $globalDBdriver;
7626 7626
 		$filter_query = $this->getFilter($filters,true,true);
7627 7627
 		$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 
7628 7628
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7629
-                if ($olderthanmonths > 0) {
7630
-            		if ($globalDBdriver == 'mysql') {
7629
+				if ($olderthanmonths > 0) {
7630
+					if ($globalDBdriver == 'mysql') {
7631 7631
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7632 7632
 			} else {
7633 7633
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7634 7634
 			}
7635 7635
 		}
7636
-                if ($sincedate != '') {
7637
-            		if ($globalDBdriver == 'mysql') {
7636
+				if ($sincedate != '') {
7637
+					if ($globalDBdriver == 'mysql') {
7638 7638
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7639 7639
 			} else {
7640 7640
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7668,7 +7668,7 @@  discard block
 block discarded – undo
7668 7668
 				$query_values = array_merge($query_values,array(':day' => $day));
7669 7669
 			}
7670 7670
 		}
7671
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7671
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7672 7672
 					ORDER BY airport_arrival_icao_count DESC";
7673 7673
 		if ($limit) $query .= " LIMIT 10";
7674 7674
       
@@ -7697,35 +7697,35 @@  discard block
 block discarded – undo
7697 7697
 	}
7698 7698
 
7699 7699
 	/**
7700
-	* Gets all arrival airports of the airplanes that have flown over
7701
-	*
7702
-	* @return Array the airport list
7703
-	*
7704
-	*/
7700
+	 * Gets all arrival airports of the airplanes that have flown over
7701
+	 *
7702
+	 * @return Array the airport list
7703
+	 *
7704
+	 */
7705 7705
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7706 7706
 	{
7707 7707
 		global $globalDBdriver;
7708 7708
 		$filter_query = $this->getFilter($filters,true,true);
7709 7709
 		$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 
7710 7710
 			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 <> '' ";
7711
-                if ($olderthanmonths > 0) {
7712
-            		if ($globalDBdriver == 'mysql') {
7711
+				if ($olderthanmonths > 0) {
7712
+					if ($globalDBdriver == 'mysql') {
7713 7713
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7714 7714
 			} else {
7715 7715
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7716 7716
 			}
7717 7717
 		}
7718
-                if ($sincedate != '') {
7719
-            		if ($globalDBdriver == 'mysql') {
7718
+				if ($sincedate != '') {
7719
+					if ($globalDBdriver == 'mysql') {
7720 7720
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7721 7721
 			} else {
7722 7722
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7723 7723
 			}
7724 7724
 		}
7725 7725
 
7726
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
-                $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
7726
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7727
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7728
+				$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
7729 7729
 					ORDER BY airport_arrival_icao_count DESC";
7730 7730
 		if ($limit) $query .= " LIMIT 10";
7731 7731
       
@@ -7756,26 +7756,26 @@  discard block
 block discarded – undo
7756 7756
 
7757 7757
 
7758 7758
 	/**
7759
-	* Gets all detected arrival airports of the airplanes that have flown over
7760
-	*
7761
-	* @return Array the airport list
7762
-	*
7763
-	*/
7759
+	 * Gets all detected arrival airports of the airplanes that have flown over
7760
+	 *
7761
+	 * @return Array the airport list
7762
+	 *
7763
+	 */
7764 7764
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7765 7765
 	{
7766 7766
 		global $globalDBdriver;
7767 7767
 		$filter_query = $this->getFilter($filters,true,true);
7768 7768
 		$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 
7769 7769
 			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";
7770
-                if ($olderthanmonths > 0) {
7771
-            		if ($globalDBdriver == 'mysql') {
7770
+				if ($olderthanmonths > 0) {
7771
+					if ($globalDBdriver == 'mysql') {
7772 7772
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7773 7773
 			} else {
7774 7774
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7775 7775
 			}
7776 7776
 		}
7777
-                if ($sincedate != '') {
7778
-            		if ($globalDBdriver == 'mysql') {
7777
+				if ($sincedate != '') {
7778
+					if ($globalDBdriver == 'mysql') {
7779 7779
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7780 7780
 			} else {
7781 7781
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7809,7 +7809,7 @@  discard block
 block discarded – undo
7809 7809
 				$query_values = array_merge($query_values,array(':day' => $day));
7810 7810
 			}
7811 7811
 		}
7812
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7812
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7813 7813
 					ORDER BY airport_arrival_icao_count DESC";
7814 7814
 		if ($limit) $query .= " LIMIT 10";
7815 7815
       
@@ -7837,35 +7837,35 @@  discard block
 block discarded – undo
7837 7837
 	}
7838 7838
 	
7839 7839
 	/**
7840
-	* Gets all detected arrival airports of the airplanes that have flown over
7841
-	*
7842
-	* @return Array the airport list
7843
-	*
7844
-	*/
7840
+	 * Gets all detected arrival airports of the airplanes that have flown over
7841
+	 *
7842
+	 * @return Array the airport list
7843
+	 *
7844
+	 */
7845 7845
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7846 7846
 	{
7847 7847
 		global $globalDBdriver;
7848 7848
 		$filter_query = $this->getFilter($filters,true,true);
7849 7849
 		$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 
7850 7850
 			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 ";
7851
-                if ($olderthanmonths > 0) {
7852
-            		if ($globalDBdriver == 'mysql') {
7851
+				if ($olderthanmonths > 0) {
7852
+					if ($globalDBdriver == 'mysql') {
7853 7853
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7854 7854
 			} else {
7855 7855
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7856 7856
 			}
7857 7857
 		}
7858
-                if ($sincedate != '') {
7859
-            		if ($globalDBdriver == 'mysql') {
7858
+				if ($sincedate != '') {
7859
+					if ($globalDBdriver == 'mysql') {
7860 7860
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7861 7861
 			} else {
7862 7862
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7863 7863
 			}
7864 7864
 		}
7865 7865
 
7866
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7866
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7867
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7868
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7869 7869
 					ORDER BY airport_arrival_icao_count DESC";
7870 7870
 		if ($limit) $query .= " LIMIT 10";
7871 7871
       
@@ -7895,11 +7895,11 @@  discard block
 block discarded – undo
7895 7895
 	}	
7896 7896
 	
7897 7897
 	/**
7898
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
-	*
7900
-	* @return Array the airport list
7901
-	*
7902
-	*/
7898
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7899
+	 *
7900
+	 * @return Array the airport list
7901
+	 *
7902
+	 */
7903 7903
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7904 7904
 	{
7905 7905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -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 an airline icao
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 an airline icao
7935
+	 *
7936
+	 * @return Array the airport list
7937
+	 *
7938
+	 */
7939 7939
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7940 7940
 	{
7941 7941
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7966,11 +7966,11 @@  discard block
 block discarded – undo
7966 7966
 	
7967 7967
 	
7968 7968
 	/**
7969
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
-	*
7971
-	* @return Array the airport list
7972
-	*
7973
-	*/
7969
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7970
+	 *
7971
+	 * @return Array the airport list
7972
+	 *
7973
+	 */
7974 7974
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7975 7975
 	{
7976 7976
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8004,11 +8004,11 @@  discard block
 block discarded – undo
8004 8004
 	
8005 8005
 	
8006 8006
 	/**
8007
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
-	*
8009
-	* @return Array the airport list
8010
-	*
8011
-	*/
8007
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8008
+	 *
8009
+	 * @return Array the airport list
8010
+	 *
8011
+	 */
8012 8012
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8013 8013
 	{
8014 8014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8038,11 +8038,11 @@  discard block
 block discarded – undo
8038 8038
 	
8039 8039
 	
8040 8040
 	/**
8041
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
-	*
8043
-	* @return Array the airport list
8044
-	*
8045
-	*/
8041
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8042
+	 *
8043
+	 * @return Array the airport list
8044
+	 *
8045
+	 */
8046 8046
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8047 8047
 	{
8048 8048
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8076,11 +8076,11 @@  discard block
 block discarded – undo
8076 8076
 	
8077 8077
 	
8078 8078
 	/**
8079
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
-	*
8081
-	* @return Array the airport list
8082
-	*
8083
-	*/
8079
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8080
+	 *
8081
+	 * @return Array the airport list
8082
+	 *
8083
+	 */
8084 8084
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8085 8085
 	{
8086 8086
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8111,11 +8111,11 @@  discard block
 block discarded – undo
8111 8111
 	
8112 8112
 	
8113 8113
 	/**
8114
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
-	*
8116
-	* @return Array the airport list
8117
-	*
8118
-	*/
8114
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8115
+	 *
8116
+	 * @return Array the airport list
8117
+	 *
8118
+	 */
8119 8119
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8120 8120
 	{
8121 8121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8148,11 +8148,11 @@  discard block
 block discarded – undo
8148 8148
 	
8149 8149
 	
8150 8150
 	/**
8151
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
-	*
8153
-	* @return Array the airport list
8154
-	*
8155
-	*/
8151
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8152
+	 *
8153
+	 * @return Array the airport list
8154
+	 *
8155
+	 */
8156 8156
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8157 8157
 	{
8158 8158
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8182,11 +8182,11 @@  discard block
 block discarded – undo
8182 8182
 	
8183 8183
 	
8184 8184
 	/**
8185
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
-	*
8187
-	* @return Array the airport list
8188
-	*
8189
-	*/
8185
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8186
+	 *
8187
+	 * @return Array the airport list
8188
+	 *
8189
+	 */
8190 8190
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8191 8191
 	{
8192 8192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8220,11 +8220,11 @@  discard block
 block discarded – undo
8220 8220
 	
8221 8221
 	
8222 8222
 	/**
8223
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
-	*
8225
-	* @return Array the airport list
8226
-	*
8227
-	*/
8223
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8224
+	 *
8225
+	 * @return Array the airport list
8226
+	 *
8227
+	 */
8228 8228
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8229 8229
 	{
8230 8230
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8255,11 +8255,11 @@  discard block
 block discarded – undo
8255 8255
 	
8256 8256
 	
8257 8257
 	/**
8258
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8259
-	*
8260
-	* @return Array the airport list
8261
-	*
8262
-	*/
8258
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8259
+	 *
8260
+	 * @return Array the airport list
8261
+	 *
8262
+	 */
8263 8263
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8264 8264
 	{
8265 8265
 		global $globalTimezone, $globalDBdriver;
@@ -8305,11 +8305,11 @@  discard block
 block discarded – undo
8305 8305
 	
8306 8306
 	
8307 8307
 	/**
8308
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
-	*
8310
-	* @return Array the airport list
8311
-	*
8312
-	*/
8308
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8309
+	 *
8310
+	 * @return Array the airport list
8311
+	 *
8312
+	 */
8313 8313
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8314 8314
 	{
8315 8315
 		global $globalTimezone, $globalDBdriver;
@@ -8352,11 +8352,11 @@  discard block
 block discarded – undo
8352 8352
 	
8353 8353
 	
8354 8354
 	/**
8355
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
-	*
8357
-	* @return Array the airport list
8358
-	*
8359
-	*/
8355
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8356
+	 *
8357
+	 * @return Array the airport list
8358
+	 *
8359
+	 */
8360 8360
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8361 8361
 	{
8362 8362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8388,11 +8388,11 @@  discard block
 block discarded – undo
8388 8388
 	}
8389 8389
 	
8390 8390
 	/**
8391
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8392
-	*
8393
-	* @return Array the airport list
8394
-	*
8395
-	*/
8391
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8392
+	 *
8393
+	 * @return Array the airport list
8394
+	 *
8395
+	 */
8396 8396
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8397 8397
 	{
8398 8398
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8423,11 +8423,11 @@  discard block
 block discarded – undo
8423 8423
 	}
8424 8424
 
8425 8425
 	/**
8426
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
-	*
8428
-	* @return Array the airport list
8429
-	*
8430
-	*/
8426
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8427
+	 *
8428
+	 * @return Array the airport list
8429
+	 *
8430
+	 */
8431 8431
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8432 8432
 	{
8433 8433
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8458,11 +8458,11 @@  discard block
 block discarded – undo
8458 8458
 	}
8459 8459
 	
8460 8460
 	/**
8461
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
-	*
8463
-	* @return Array the airport list
8464
-	*
8465
-	*/
8461
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8462
+	 *
8463
+	 * @return Array the airport list
8464
+	 *
8465
+	 */
8466 8466
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8467 8467
 	{
8468 8468
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8491,11 +8491,11 @@  discard block
 block discarded – undo
8491 8491
 	}
8492 8492
 	
8493 8493
 	/**
8494
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
-	*
8496
-	* @return Array the airport list
8497
-	*
8498
-	*/
8494
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8495
+	 *
8496
+	 * @return Array the airport list
8497
+	 *
8498
+	 */
8499 8499
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8500 8500
 	{
8501 8501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8511,11 +8511,11 @@  discard block
 block discarded – undo
8511 8511
 	}
8512 8512
 	
8513 8513
 	/**
8514
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
-	*
8516
-	* @return Array the airport list
8517
-	*
8518
-	*/
8514
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8515
+	 *
8516
+	 * @return Array the airport list
8517
+	 *
8518
+	 */
8519 8519
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8520 8520
 	{
8521 8521
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8533,11 +8533,11 @@  discard block
 block discarded – undo
8533 8533
 	
8534 8534
 	
8535 8535
 	/**
8536
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8537
-	*
8538
-	* @return Array the airport list
8539
-	*
8540
-	*/
8536
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8537
+	 *
8538
+	 * @return Array the airport list
8539
+	 *
8540
+	 */
8541 8541
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8542 8542
 	{
8543 8543
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8570,11 +8570,11 @@  discard block
 block discarded – undo
8570 8570
 	
8571 8571
 	
8572 8572
 	/**
8573
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
-	*
8575
-	* @return Array the airport list
8576
-	*
8577
-	*/
8573
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8574
+	 *
8575
+	 * @return Array the airport list
8576
+	 *
8577
+	 */
8578 8578
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8579 8579
 	{
8580 8580
 		global $globalDBdriver;
@@ -8606,11 +8606,11 @@  discard block
 block discarded – undo
8606 8606
 
8607 8607
 
8608 8608
 	/**
8609
-	* Counts all airport departure countries
8610
-	*
8611
-	* @return Array the airport departure list
8612
-	*
8613
-	*/
8609
+	 * Counts all airport departure countries
8610
+	 *
8611
+	 * @return Array the airport departure list
8612
+	 *
8613
+	 */
8614 8614
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8615 8615
 	{
8616 8616
 		global $globalDBdriver;
@@ -8669,11 +8669,11 @@  discard block
 block discarded – undo
8669 8669
 	
8670 8670
 	
8671 8671
 	/**
8672
-	* Counts all airport arrival countries
8673
-	*
8674
-	* @return Array the airport arrival list
8675
-	*
8676
-	*/
8672
+	 * Counts all airport arrival countries
8673
+	 *
8674
+	 * @return Array the airport arrival list
8675
+	 *
8676
+	 */
8677 8677
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8678 8678
 	{
8679 8679
 		global $globalDBdriver;
@@ -8735,11 +8735,11 @@  discard block
 block discarded – undo
8735 8735
 
8736 8736
 
8737 8737
 	/**
8738
-	* Gets all route combinations
8739
-	*
8740
-	* @return Array the route list
8741
-	*
8742
-	*/
8738
+	 * Gets all route combinations
8739
+	 *
8740
+	 * @return Array the route list
8741
+	 *
8742
+	 */
8743 8743
 	public function countAllRoutes($filters = array())
8744 8744
 	{
8745 8745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8778,11 +8778,11 @@  discard block
 block discarded – undo
8778 8778
 	
8779 8779
 	
8780 8780
 	/**
8781
-	* Gets all route combinations based on an aircraft
8782
-	*
8783
-	* @return Array the route list
8784
-	*
8785
-	*/
8781
+	 * Gets all route combinations based on an aircraft
8782
+	 *
8783
+	 * @return Array the route list
8784
+	 *
8785
+	 */
8786 8786
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8787 8787
 	{
8788 8788
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8818,11 +8818,11 @@  discard block
 block discarded – undo
8818 8818
 	
8819 8819
 	
8820 8820
 	/**
8821
-	* Gets all route combinations based on an aircraft registration
8822
-	*
8823
-	* @return Array the route list
8824
-	*
8825
-	*/
8821
+	 * Gets all route combinations based on an aircraft registration
8822
+	 *
8823
+	 * @return Array the route list
8824
+	 *
8825
+	 */
8826 8826
 	public function countAllRoutesByRegistration($registration, $filters = array())
8827 8827
 	{
8828 8828
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8860,11 +8860,11 @@  discard block
 block discarded – undo
8860 8860
 	
8861 8861
 	
8862 8862
 	/**
8863
-	* Gets all route combinations based on an airline
8864
-	*
8865
-	* @return Array the route list
8866
-	*
8867
-	*/
8863
+	 * Gets all route combinations based on an airline
8864
+	 *
8865
+	 * @return Array the route list
8866
+	 *
8867
+	 */
8868 8868
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8869 8869
 	{
8870 8870
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8902,11 +8902,11 @@  discard block
 block discarded – undo
8902 8902
 	
8903 8903
 	
8904 8904
 	/**
8905
-	* Gets all route combinations based on an airport
8906
-	*
8907
-	* @return Array the route list
8908
-	*
8909
-	*/
8905
+	 * Gets all route combinations based on an airport
8906
+	 *
8907
+	 * @return Array the route list
8908
+	 *
8909
+	 */
8910 8910
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8911 8911
 	{
8912 8912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8943,11 +8943,11 @@  discard block
 block discarded – undo
8943 8943
 	
8944 8944
 	
8945 8945
 	/**
8946
-	* Gets all route combinations based on an country
8947
-	*
8948
-	* @return Array the route list
8949
-	*
8950
-	*/
8946
+	 * Gets all route combinations based on an country
8947
+	 *
8948
+	 * @return Array the route list
8949
+	 *
8950
+	 */
8951 8951
 	public function countAllRoutesByCountry($country, $filters = array())
8952 8952
 	{
8953 8953
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8983,11 +8983,11 @@  discard block
 block discarded – undo
8983 8983
 
8984 8984
 
8985 8985
 	/**
8986
-	* Gets all route combinations based on an date
8987
-	*
8988
-	* @return Array the route list
8989
-	*
8990
-	*/
8986
+	 * Gets all route combinations based on an date
8987
+	 *
8988
+	 * @return Array the route list
8989
+	 *
8990
+	 */
8991 8991
 	public function countAllRoutesByDate($date, $filters = array())
8992 8992
 	{
8993 8993
 		global $globalTimezone, $globalDBdriver;
@@ -9037,11 +9037,11 @@  discard block
 block discarded – undo
9037 9037
 	
9038 9038
 	
9039 9039
 	/**
9040
-	* Gets all route combinations based on an ident/callsign
9041
-	*
9042
-	* @return Array the route list
9043
-	*
9044
-	*/
9040
+	 * Gets all route combinations based on an ident/callsign
9041
+	 *
9042
+	 * @return Array the route list
9043
+	 *
9044
+	 */
9045 9045
 	public function countAllRoutesByIdent($ident, $filters = array())
9046 9046
 	{
9047 9047
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9077,11 +9077,11 @@  discard block
 block discarded – undo
9077 9077
 	}
9078 9078
 	
9079 9079
 	/**
9080
-	* Gets all route combinations based on an owner
9081
-	*
9082
-	* @return Array the route list
9083
-	*
9084
-	*/
9080
+	 * Gets all route combinations based on an owner
9081
+	 *
9082
+	 * @return Array the route list
9083
+	 *
9084
+	 */
9085 9085
 	public function countAllRoutesByOwner($owner,$filters = array())
9086 9086
 	{
9087 9087
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9117,11 +9117,11 @@  discard block
 block discarded – undo
9117 9117
 	}
9118 9118
 	
9119 9119
 	/**
9120
-	* Gets all route combinations based on a pilot
9121
-	*
9122
-	* @return Array the route list
9123
-	*
9124
-	*/
9120
+	 * Gets all route combinations based on a pilot
9121
+	 *
9122
+	 * @return Array the route list
9123
+	 *
9124
+	 */
9125 9125
 	public function countAllRoutesByPilot($pilot,$filters = array())
9126 9126
 	{
9127 9127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9158,11 +9158,11 @@  discard block
 block discarded – undo
9158 9158
 	
9159 9159
 	
9160 9160
 	/**
9161
-	* Gets all route combinations based on an manufacturer
9162
-	*
9163
-	* @return Array the route list
9164
-	*
9165
-	*/
9161
+	 * Gets all route combinations based on an manufacturer
9162
+	 *
9163
+	 * @return Array the route list
9164
+	 *
9165
+	 */
9166 9166
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9167 9167
 	{
9168 9168
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9200,11 +9200,11 @@  discard block
 block discarded – undo
9200 9200
 	
9201 9201
 	
9202 9202
 	/**
9203
-	* Gets all route combinations with waypoints
9204
-	*
9205
-	* @return Array the route list
9206
-	*
9207
-	*/
9203
+	 * Gets all route combinations with waypoints
9204
+	 *
9205
+	 * @return Array the route list
9206
+	 *
9207
+	 */
9208 9208
 	public function countAllRoutesWithWaypoints($filters = array())
9209 9209
 	{
9210 9210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9241,11 +9241,11 @@  discard block
 block discarded – undo
9241 9241
 	}
9242 9242
 	
9243 9243
 	/**
9244
-	* Gets all callsigns that have flown over
9245
-	*
9246
-	* @return Array the callsign list
9247
-	*
9248
-	*/
9244
+	 * Gets all callsigns that have flown over
9245
+	 *
9246
+	 * @return Array the callsign list
9247
+	 *
9248
+	 */
9249 9249
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9250 9250
 	{
9251 9251
 		global $globalDBdriver;
@@ -9311,11 +9311,11 @@  discard block
 block discarded – undo
9311 9311
 	}
9312 9312
 
9313 9313
 	/**
9314
-	* Gets all callsigns that have flown over
9315
-	*
9316
-	* @return Array the callsign list
9317
-	*
9318
-	*/
9314
+	 * Gets all callsigns that have flown over
9315
+	 *
9316
+	 * @return Array the callsign list
9317
+	 *
9318
+	 */
9319 9319
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9320 9320
 	{
9321 9321
 		global $globalDBdriver;
@@ -9356,11 +9356,11 @@  discard block
 block discarded – undo
9356 9356
 
9357 9357
 
9358 9358
 	/**
9359
-	* Counts all dates
9360
-	*
9361
-	* @return Array the date list
9362
-	*
9363
-	*/
9359
+	 * Counts all dates
9360
+	 *
9361
+	 * @return Array the date list
9362
+	 *
9363
+	 */
9364 9364
 	public function countAllDates($filters = array())
9365 9365
 	{
9366 9366
 		global $globalTimezone, $globalDBdriver;
@@ -9405,11 +9405,11 @@  discard block
 block discarded – undo
9405 9405
 	}
9406 9406
 	
9407 9407
 	/**
9408
-	* Counts all dates
9409
-	*
9410
-	* @return Array the date list
9411
-	*
9412
-	*/
9408
+	 * Counts all dates
9409
+	 *
9410
+	 * @return Array the date list
9411
+	 *
9412
+	 */
9413 9413
 	public function countAllDatesByAirlines($filters = array())
9414 9414
 	{
9415 9415
 		global $globalTimezone, $globalDBdriver;
@@ -9454,11 +9454,11 @@  discard block
 block discarded – undo
9454 9454
 	}	
9455 9455
 	
9456 9456
 	/**
9457
-	* Counts all dates during the last 7 days
9458
-	*
9459
-	* @return Array the date list
9460
-	*
9461
-	*/
9457
+	 * Counts all dates during the last 7 days
9458
+	 *
9459
+	 * @return Array the date list
9460
+	 *
9461
+	 */
9462 9462
 	public function countAllDatesLast7Days($filters = array())
9463 9463
 	{
9464 9464
 		global $globalTimezone, $globalDBdriver;
@@ -9480,7 +9480,7 @@  discard block
 block discarded – undo
9480 9480
 			$query .= " GROUP BY date_name 
9481 9481
 								ORDER BY date_name ASC";
9482 9482
 			$query_data = array(':offset' => $offset);
9483
-    		}
9483
+			}
9484 9484
 		
9485 9485
 		$sth = $this->db->prepare($query);
9486 9486
 		$sth->execute($query_data);
@@ -9500,11 +9500,11 @@  discard block
 block discarded – undo
9500 9500
 	}
9501 9501
 
9502 9502
 	/**
9503
-	* Counts all dates during the last month
9504
-	*
9505
-	* @return Array the date list
9506
-	*
9507
-	*/
9503
+	 * Counts all dates during the last month
9504
+	 *
9505
+	 * @return Array the date list
9506
+	 *
9507
+	 */
9508 9508
 	public function countAllDatesLastMonth($filters = array())
9509 9509
 	{
9510 9510
 		global $globalTimezone, $globalDBdriver;
@@ -9526,7 +9526,7 @@  discard block
 block discarded – undo
9526 9526
 			$query .= " GROUP BY date_name 
9527 9527
 								ORDER BY date_name ASC";
9528 9528
 			$query_data = array(':offset' => $offset);
9529
-    		}
9529
+			}
9530 9530
 		
9531 9531
 		$sth = $this->db->prepare($query);
9532 9532
 		$sth->execute($query_data);
@@ -9547,11 +9547,11 @@  discard block
 block discarded – undo
9547 9547
 
9548 9548
 
9549 9549
 	/**
9550
-	* Counts all dates during the last month
9551
-	*
9552
-	* @return Array the date list
9553
-	*
9554
-	*/
9550
+	 * Counts all dates during the last month
9551
+	 *
9552
+	 * @return Array the date list
9553
+	 *
9554
+	 */
9555 9555
 	public function countAllDatesLastMonthByAirlines($filters = array())
9556 9556
 	{
9557 9557
 		global $globalTimezone, $globalDBdriver;
@@ -9574,7 +9574,7 @@  discard block
 block discarded – undo
9574 9574
 								GROUP BY spotter_output.airline_icao, date_name 
9575 9575
 								ORDER BY date_name ASC";
9576 9576
 			$query_data = array(':offset' => $offset);
9577
-    		}
9577
+			}
9578 9578
 		
9579 9579
 		$sth = $this->db->prepare($query);
9580 9580
 		$sth->execute($query_data);
@@ -9596,11 +9596,11 @@  discard block
 block discarded – undo
9596 9596
 	
9597 9597
 
9598 9598
 	/**
9599
-	* Counts all month
9600
-	*
9601
-	* @return Array the month list
9602
-	*
9603
-	*/
9599
+	 * Counts all month
9600
+	 *
9601
+	 * @return Array the month list
9602
+	 *
9603
+	 */
9604 9604
 	public function countAllMonths($filters = array())
9605 9605
 	{
9606 9606
 		global $globalTimezone, $globalDBdriver;
@@ -9642,11 +9642,11 @@  discard block
 block discarded – undo
9642 9642
 	}
9643 9643
 
9644 9644
 	/**
9645
-	* Counts all month
9646
-	*
9647
-	* @return Array the month list
9648
-	*
9649
-	*/
9645
+	 * Counts all month
9646
+	 *
9647
+	 * @return Array the month list
9648
+	 *
9649
+	 */
9650 9650
 	public function countAllMonthsByAirlines($filters = array())
9651 9651
 	{
9652 9652
 		global $globalTimezone, $globalDBdriver;
@@ -9691,11 +9691,11 @@  discard block
 block discarded – undo
9691 9691
 	}
9692 9692
 
9693 9693
 	/**
9694
-	* Counts all military month
9695
-	*
9696
-	* @return Array the month list
9697
-	*
9698
-	*/
9694
+	 * Counts all military month
9695
+	 *
9696
+	 * @return Array the month list
9697
+	 *
9698
+	 */
9699 9699
 	public function countAllMilitaryMonths($filters = array())
9700 9700
 	{
9701 9701
 		global $globalTimezone, $globalDBdriver;
@@ -9736,11 +9736,11 @@  discard block
 block discarded – undo
9736 9736
 	}
9737 9737
 	
9738 9738
 	/**
9739
-	* Counts all month owners
9740
-	*
9741
-	* @return Array the month list
9742
-	*
9743
-	*/
9739
+	 * Counts all month owners
9740
+	 *
9741
+	 * @return Array the month list
9742
+	 *
9743
+	 */
9744 9744
 	public function countAllMonthsOwners($filters = array())
9745 9745
 	{
9746 9746
 		global $globalTimezone, $globalDBdriver;
@@ -9782,11 +9782,11 @@  discard block
 block discarded – undo
9782 9782
 	}
9783 9783
 	
9784 9784
 	/**
9785
-	* Counts all month owners
9786
-	*
9787
-	* @return Array the month list
9788
-	*
9789
-	*/
9785
+	 * Counts all month owners
9786
+	 *
9787
+	 * @return Array the month list
9788
+	 *
9789
+	 */
9790 9790
 	public function countAllMonthsOwnersByAirlines($filters = array())
9791 9791
 	{
9792 9792
 		global $globalTimezone, $globalDBdriver;
@@ -9829,11 +9829,11 @@  discard block
 block discarded – undo
9829 9829
 	}
9830 9830
 
9831 9831
 	/**
9832
-	* Counts all month pilot
9833
-	*
9834
-	* @return Array the month list
9835
-	*
9836
-	*/
9832
+	 * Counts all month pilot
9833
+	 *
9834
+	 * @return Array the month list
9835
+	 *
9836
+	 */
9837 9837
 	public function countAllMonthsPilots($filters = array())
9838 9838
 	{
9839 9839
 		global $globalTimezone, $globalDBdriver;
@@ -9875,11 +9875,11 @@  discard block
 block discarded – undo
9875 9875
 	}
9876 9876
 	
9877 9877
 	/**
9878
-	* Counts all month pilot
9879
-	*
9880
-	* @return Array the month list
9881
-	*
9882
-	*/
9878
+	 * Counts all month pilot
9879
+	 *
9880
+	 * @return Array the month list
9881
+	 *
9882
+	 */
9883 9883
 	public function countAllMonthsPilotsByAirlines($filters = array())
9884 9884
 	{
9885 9885
 		global $globalTimezone, $globalDBdriver;
@@ -9922,11 +9922,11 @@  discard block
 block discarded – undo
9922 9922
 	}
9923 9923
 
9924 9924
 	/**
9925
-	* Counts all month airline
9926
-	*
9927
-	* @return Array the month list
9928
-	*
9929
-	*/
9925
+	 * Counts all month airline
9926
+	 *
9927
+	 * @return Array the month list
9928
+	 *
9929
+	 */
9930 9930
 	public function countAllMonthsAirlines($filters = array())
9931 9931
 	{
9932 9932
 		global $globalTimezone, $globalDBdriver;
@@ -9968,11 +9968,11 @@  discard block
 block discarded – undo
9968 9968
 	}
9969 9969
 	
9970 9970
 	/**
9971
-	* Counts all month aircraft
9972
-	*
9973
-	* @return Array the month list
9974
-	*
9975
-	*/
9971
+	 * Counts all month aircraft
9972
+	 *
9973
+	 * @return Array the month list
9974
+	 *
9975
+	 */
9976 9976
 	public function countAllMonthsAircrafts($filters = array())
9977 9977
 	{
9978 9978
 		global $globalTimezone, $globalDBdriver;
@@ -10015,11 +10015,11 @@  discard block
 block discarded – undo
10015 10015
 	
10016 10016
 
10017 10017
 	/**
10018
-	* Counts all month aircraft
10019
-	*
10020
-	* @return Array the month list
10021
-	*
10022
-	*/
10018
+	 * Counts all month aircraft
10019
+	 *
10020
+	 * @return Array the month list
10021
+	 *
10022
+	 */
10023 10023
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10024 10024
 	{
10025 10025
 		global $globalTimezone, $globalDBdriver;
@@ -10062,11 +10062,11 @@  discard block
 block discarded – undo
10062 10062
 	}
10063 10063
 
10064 10064
 	/**
10065
-	* Counts all month real arrival
10066
-	*
10067
-	* @return Array the month list
10068
-	*
10069
-	*/
10065
+	 * Counts all month real arrival
10066
+	 *
10067
+	 * @return Array the month list
10068
+	 *
10069
+	 */
10070 10070
 	public function countAllMonthsRealArrivals($filters = array())
10071 10071
 	{
10072 10072
 		global $globalTimezone, $globalDBdriver;
@@ -10109,11 +10109,11 @@  discard block
 block discarded – undo
10109 10109
 	
10110 10110
 
10111 10111
 	/**
10112
-	* Counts all month real arrival
10113
-	*
10114
-	* @return Array the month list
10115
-	*
10116
-	*/
10112
+	 * Counts all month real arrival
10113
+	 *
10114
+	 * @return Array the month list
10115
+	 *
10116
+	 */
10117 10117
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10118 10118
 	{
10119 10119
 		global $globalTimezone, $globalDBdriver;
@@ -10157,11 +10157,11 @@  discard block
 block discarded – undo
10157 10157
 	
10158 10158
 
10159 10159
 	/**
10160
-	* Counts all dates during the last year
10161
-	*
10162
-	* @return Array the date list
10163
-	*
10164
-	*/
10160
+	 * Counts all dates during the last year
10161
+	 *
10162
+	 * @return Array the date list
10163
+	 *
10164
+	 */
10165 10165
 	public function countAllMonthsLastYear($filters)
10166 10166
 	{
10167 10167
 		global $globalTimezone, $globalDBdriver;
@@ -10183,7 +10183,7 @@  discard block
 block discarded – undo
10183 10183
 			$query .= " GROUP BY year_name, month_name
10184 10184
 								ORDER BY year_name, month_name ASC";
10185 10185
 			$query_data = array(':offset' => $offset);
10186
-    		}
10186
+			}
10187 10187
 		
10188 10188
 		$sth = $this->db->prepare($query);
10189 10189
 		$sth->execute($query_data);
@@ -10206,11 +10206,11 @@  discard block
 block discarded – undo
10206 10206
 	
10207 10207
 	
10208 10208
 	/**
10209
-	* Counts all hours
10210
-	*
10211
-	* @return Array the hour list
10212
-	*
10213
-	*/
10209
+	 * Counts all hours
10210
+	 *
10211
+	 * @return Array the hour list
10212
+	 *
10213
+	 */
10214 10214
 	public function countAllHours($orderby,$filters = array())
10215 10215
 	{
10216 10216
 		global $globalTimezone, $globalDBdriver;
@@ -10271,11 +10271,11 @@  discard block
 block discarded – undo
10271 10271
 	}
10272 10272
 	
10273 10273
 	/**
10274
-	* Counts all hours
10275
-	*
10276
-	* @return Array the hour list
10277
-	*
10278
-	*/
10274
+	 * Counts all hours
10275
+	 *
10276
+	 * @return Array the hour list
10277
+	 *
10278
+	 */
10279 10279
 	public function countAllHoursByAirlines($orderby, $filters = array())
10280 10280
 	{
10281 10281
 		global $globalTimezone, $globalDBdriver;
@@ -10338,11 +10338,11 @@  discard block
 block discarded – undo
10338 10338
 
10339 10339
 
10340 10340
 	/**
10341
-	* Counts all hours by airline
10342
-	*
10343
-	* @return Array the hour list
10344
-	*
10345
-	*/
10341
+	 * Counts all hours by airline
10342
+	 *
10343
+	 * @return Array the hour list
10344
+	 *
10345
+	 */
10346 10346
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10347 10347
 	{
10348 10348
 		global $globalTimezone, $globalDBdriver;
@@ -10388,11 +10388,11 @@  discard block
 block discarded – undo
10388 10388
 	
10389 10389
 	
10390 10390
 	/**
10391
-	* Counts all hours by aircraft
10392
-	*
10393
-	* @return Array the hour list
10394
-	*
10395
-	*/
10391
+	 * Counts all hours by aircraft
10392
+	 *
10393
+	 * @return Array the hour list
10394
+	 *
10395
+	 */
10396 10396
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10397 10397
 	{
10398 10398
 		global $globalTimezone, $globalDBdriver;
@@ -10435,11 +10435,11 @@  discard block
 block discarded – undo
10435 10435
 	
10436 10436
 	
10437 10437
 	/**
10438
-	* Counts all hours by aircraft registration
10439
-	*
10440
-	* @return Array the hour list
10441
-	*
10442
-	*/
10438
+	 * Counts all hours by aircraft registration
10439
+	 *
10440
+	 * @return Array the hour list
10441
+	 *
10442
+	 */
10443 10443
 	public function countAllHoursByRegistration($registration, $filters = array())
10444 10444
 	{
10445 10445
 		global $globalTimezone, $globalDBdriver;
@@ -10482,11 +10482,11 @@  discard block
 block discarded – undo
10482 10482
 	
10483 10483
 	
10484 10484
 	/**
10485
-	* Counts all hours by airport
10486
-	*
10487
-	* @return Array the hour list
10488
-	*
10489
-	*/
10485
+	 * Counts all hours by airport
10486
+	 *
10487
+	 * @return Array the hour list
10488
+	 *
10489
+	 */
10490 10490
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10491 10491
 	{
10492 10492
 		global $globalTimezone, $globalDBdriver;
@@ -10530,11 +10530,11 @@  discard block
 block discarded – undo
10530 10530
 	
10531 10531
 	
10532 10532
 	/**
10533
-	* Counts all hours by manufacturer
10534
-	*
10535
-	* @return Array the hour list
10536
-	*
10537
-	*/
10533
+	 * Counts all hours by manufacturer
10534
+	 *
10535
+	 * @return Array the hour list
10536
+	 *
10537
+	 */
10538 10538
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10539 10539
 	{
10540 10540
 		global $globalTimezone, $globalDBdriver;
@@ -10578,11 +10578,11 @@  discard block
 block discarded – undo
10578 10578
 	
10579 10579
 	
10580 10580
 	/**
10581
-	* Counts all hours by date
10582
-	*
10583
-	* @return Array the hour list
10584
-	*
10585
-	*/
10581
+	 * Counts all hours by date
10582
+	 *
10583
+	 * @return Array the hour list
10584
+	 *
10585
+	 */
10586 10586
 	public function countAllHoursByDate($date, $filters = array())
10587 10587
 	{
10588 10588
 		global $globalTimezone, $globalDBdriver;
@@ -10626,11 +10626,11 @@  discard block
 block discarded – undo
10626 10626
 	
10627 10627
 	
10628 10628
 	/**
10629
-	* Counts all hours by a ident/callsign
10630
-	*
10631
-	* @return Array the hour list
10632
-	*
10633
-	*/
10629
+	 * Counts all hours by a ident/callsign
10630
+	 *
10631
+	 * @return Array the hour list
10632
+	 *
10633
+	 */
10634 10634
 	public function countAllHoursByIdent($ident, $filters = array())
10635 10635
 	{
10636 10636
 		global $globalTimezone, $globalDBdriver;
@@ -10673,11 +10673,11 @@  discard block
 block discarded – undo
10673 10673
 	}
10674 10674
 	
10675 10675
 	/**
10676
-	* Counts all hours by a owner
10677
-	*
10678
-	* @return Array the hour list
10679
-	*
10680
-	*/
10676
+	 * Counts all hours by a owner
10677
+	 *
10678
+	 * @return Array the hour list
10679
+	 *
10680
+	 */
10681 10681
 	public function countAllHoursByOwner($owner, $filters = array())
10682 10682
 	{
10683 10683
 		global $globalTimezone, $globalDBdriver;
@@ -10720,11 +10720,11 @@  discard block
 block discarded – undo
10720 10720
 	}
10721 10721
 	
10722 10722
 	/**
10723
-	* Counts all hours by a pilot
10724
-	*
10725
-	* @return Array the hour list
10726
-	*
10727
-	*/
10723
+	 * Counts all hours by a pilot
10724
+	 *
10725
+	 * @return Array the hour list
10726
+	 *
10727
+	 */
10728 10728
 	public function countAllHoursByPilot($pilot, $filters = array())
10729 10729
 	{
10730 10730
 		global $globalTimezone, $globalDBdriver;
@@ -10769,11 +10769,11 @@  discard block
 block discarded – undo
10769 10769
 	
10770 10770
 	
10771 10771
 	/**
10772
-	* Counts all hours by route
10773
-	*
10774
-	* @return Array the hour list
10775
-	*
10776
-	*/
10772
+	 * Counts all hours by route
10773
+	 *
10774
+	 * @return Array the hour list
10775
+	 *
10776
+	 */
10777 10777
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10778 10778
 	{
10779 10779
 		global $globalTimezone, $globalDBdriver;
@@ -10817,11 +10817,11 @@  discard block
 block discarded – undo
10817 10817
 	
10818 10818
 	
10819 10819
 	/**
10820
-	* Counts all hours by country
10821
-	*
10822
-	* @return Array the hour list
10823
-	*
10824
-	*/
10820
+	 * Counts all hours by country
10821
+	 *
10822
+	 * @return Array the hour list
10823
+	 *
10824
+	 */
10825 10825
 	public function countAllHoursByCountry($country, $filters = array())
10826 10826
 	{
10827 10827
 		global $globalTimezone, $globalDBdriver;
@@ -10866,11 +10866,11 @@  discard block
 block discarded – undo
10866 10866
 
10867 10867
 
10868 10868
 	/**
10869
-	* Counts all aircraft that have flown over
10870
-	*
10871
-	* @return Integer the number of aircrafts
10872
-	*
10873
-	*/
10869
+	 * Counts all aircraft that have flown over
10870
+	 *
10871
+	 * @return Integer the number of aircrafts
10872
+	 *
10873
+	 */
10874 10874
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10875 10875
 	{
10876 10876
 		global $globalDBdriver;
@@ -10903,11 +10903,11 @@  discard block
 block discarded – undo
10903 10903
 	}
10904 10904
 
10905 10905
 	/**
10906
-	* Counts all flight that really arrival
10907
-	*
10908
-	* @return Integer the number of aircrafts
10909
-	*
10910
-	*/
10906
+	 * Counts all flight that really arrival
10907
+	 *
10908
+	 * @return Integer the number of aircrafts
10909
+	 *
10910
+	 */
10911 10911
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10912 10912
 	{
10913 10913
 		global $globalDBdriver;
@@ -10940,11 +10940,11 @@  discard block
 block discarded – undo
10940 10940
 	}
10941 10941
 
10942 10942
 	/**
10943
-	* Counts all pilots that have flown over
10944
-	*
10945
-	* @return Integer the number of pilots
10946
-	*
10947
-	*/
10943
+	 * Counts all pilots that have flown over
10944
+	 *
10945
+	 * @return Integer the number of pilots
10946
+	 *
10947
+	 */
10948 10948
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10949 10949
 	{
10950 10950
 		global $globalDBdriver;
@@ -10976,11 +10976,11 @@  discard block
 block discarded – undo
10976 10976
 	}
10977 10977
 
10978 10978
 	/**
10979
-	* Counts all owners that have flown over
10980
-	*
10981
-	* @return Integer the number of owners
10982
-	*
10983
-	*/
10979
+	 * Counts all owners that have flown over
10980
+	 *
10981
+	 * @return Integer the number of owners
10982
+	 *
10983
+	 */
10984 10984
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10985 10985
 	{
10986 10986
 		global $globalDBdriver;
@@ -11013,11 +11013,11 @@  discard block
 block discarded – undo
11013 11013
 	
11014 11014
 	
11015 11015
 	/**
11016
-	* Counts all flights that have flown over
11017
-	*
11018
-	* @return Integer the number of flights
11019
-	*
11020
-	*/
11016
+	 * Counts all flights that have flown over
11017
+	 *
11018
+	 * @return Integer the number of flights
11019
+	 *
11020
+	 */
11021 11021
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11022 11022
 	{
11023 11023
 		global $globalDBdriver;
@@ -11051,11 +11051,11 @@  discard block
 block discarded – undo
11051 11051
 	}
11052 11052
 	
11053 11053
 	/**
11054
-	* Counts all military flights that have flown over
11055
-	*
11056
-	* @return Integer the number of flights
11057
-	*
11058
-	*/
11054
+	 * Counts all military flights that have flown over
11055
+	 *
11056
+	 * @return Integer the number of flights
11057
+	 *
11058
+	 */
11059 11059
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11060 11060
 	{
11061 11061
 		global $globalDBdriver;
@@ -11090,11 +11090,11 @@  discard block
 block discarded – undo
11090 11090
 	
11091 11091
 	
11092 11092
 	/**
11093
-	* Counts all airlines that have flown over
11094
-	*
11095
-	* @return Integer the number of airlines
11096
-	*
11097
-	*/
11093
+	 * Counts all airlines that have flown over
11094
+	 *
11095
+	 * @return Integer the number of airlines
11096
+	 *
11097
+	 */
11098 11098
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11099 11099
 	{
11100 11100
 		global $globalDBdriver;
@@ -11121,8 +11121,8 @@  discard block
 block discarded – undo
11121 11121
 				$query_values = array_merge($query_values,array(':month' => $month));
11122 11122
 			}
11123 11123
 		}
11124
-                if ($query == '') $queryi .= $this->getFilter($filters);
11125
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11124
+				if ($query == '') $queryi .= $this->getFilter($filters);
11125
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11126 11126
 
11127 11127
 
11128 11128
 		$sth = $this->db->prepare($queryi);
@@ -11132,11 +11132,11 @@  discard block
 block discarded – undo
11132 11132
 
11133 11133
   
11134 11134
 	/**
11135
-	* Counts all hours of today
11136
-	*
11137
-	* @return Array the hour list
11138
-	*
11139
-	*/
11135
+	 * Counts all hours of today
11136
+	 *
11137
+	 * @return Array the hour list
11138
+	 *
11139
+	 */
11140 11140
 	public function countAllHoursFromToday($filters = array())
11141 11141
 	{
11142 11142
 		global $globalTimezone, $globalDBdriver;
@@ -11176,11 +11176,11 @@  discard block
 block discarded – undo
11176 11176
 	}
11177 11177
     
11178 11178
 	/**
11179
-	* Gets all the spotter information based on calculated upcoming flights
11180
-	*
11181
-	* @return Array the spotter information
11182
-	*
11183
-	*/
11179
+	 * Gets all the spotter information based on calculated upcoming flights
11180
+	 *
11181
+	 * @return Array the spotter information
11182
+	 *
11183
+	 */
11184 11184
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11185 11185
 	{
11186 11186
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11255,12 +11255,12 @@  discard block
 block discarded – undo
11255 11255
 	}
11256 11256
     
11257 11257
     
11258
-     /**
11259
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11260
-	*
11261
-	* @return Integer the Barrie Spotter ID
11258
+	 /**
11259
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11260
+	  *
11261
+	  * @return Integer the Barrie Spotter ID
11262 11262
 q	*
11263
-	*/
11263
+	  */
11264 11264
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11265 11265
 	{
11266 11266
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11281,13 +11281,13 @@  discard block
 block discarded – undo
11281 11281
   
11282 11282
  
11283 11283
 	/**
11284
-	* Parses a date string
11285
-	*
11286
-	* @param String $dateString the date string
11287
-	* @param String $timezone the timezone of a user
11288
-	* @return Array the time information
11289
-	*
11290
-	*/
11284
+	 * Parses a date string
11285
+	 *
11286
+	 * @param String $dateString the date string
11287
+	 * @param String $timezone the timezone of a user
11288
+	 * @return Array the time information
11289
+	 *
11290
+	 */
11291 11291
 	public function parseDateString($dateString, $timezone = '')
11292 11292
 	{
11293 11293
 		$time_array = array();
@@ -11323,12 +11323,12 @@  discard block
 block discarded – undo
11323 11323
 	
11324 11324
 	
11325 11325
 	/**
11326
-	* Parses the direction degrees to working
11327
-	*
11328
-	* @param Float $direction the direction in degrees
11329
-	* @return Array the direction information
11330
-	*
11331
-	*/
11326
+	 * Parses the direction degrees to working
11327
+	 *
11328
+	 * @param Float $direction the direction in degrees
11329
+	 * @return Array the direction information
11330
+	 *
11331
+	 */
11332 11332
 	public function parseDirection($direction = 0)
11333 11333
 	{
11334 11334
 		if ($direction == '') $direction = 0;
@@ -11407,12 +11407,12 @@  discard block
 block discarded – undo
11407 11407
 	
11408 11408
 	
11409 11409
 	/**
11410
-	* Gets the aircraft registration
11411
-	*
11412
-	* @param String $flightaware_id the flight aware id
11413
-	* @return String the aircraft registration
11414
-	*
11415
-	*/
11410
+	 * Gets the aircraft registration
11411
+	 *
11412
+	 * @param String $flightaware_id the flight aware id
11413
+	 * @return String the aircraft registration
11414
+	 *
11415
+	 */
11416 11416
 	
11417 11417
 	public function getAircraftRegistration($flightaware_id)
11418 11418
 	{
@@ -11441,12 +11441,12 @@  discard block
 block discarded – undo
11441 11441
 
11442 11442
 
11443 11443
 	/**
11444
-	* Gets the aircraft registration from ModeS
11445
-	*
11446
-	* @param String $aircraft_modes the flight ModeS in hex
11447
-	* @return String the aircraft registration
11448
-	*
11449
-	*/
11444
+	 * Gets the aircraft registration from ModeS
11445
+	 *
11446
+	 * @param String $aircraft_modes the flight ModeS in hex
11447
+	 * @return String the aircraft registration
11448
+	 *
11449
+	 */
11450 11450
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11451 11451
 	{
11452 11452
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11462,8 +11462,8 @@  discard block
 block discarded – undo
11462 11462
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11463 11463
 		$sth->closeCursor();
11464 11464
 		if (count($row) > 0) {
11465
-		    //return $row['Registration'];
11466
-		    return $row['registration'];
11465
+			//return $row['Registration'];
11466
+			return $row['registration'];
11467 11467
 		} elseif ($source_type == 'flarm') {
11468 11468
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11469 11469
 		} else return '';
@@ -11471,12 +11471,12 @@  discard block
 block discarded – undo
11471 11471
 	}
11472 11472
 
11473 11473
 	/**
11474
-	* Gets the aircraft type from ModeS
11475
-	*
11476
-	* @param String $aircraft_modes the flight ModeS in hex
11477
-	* @return String the aircraft type
11478
-	*
11479
-	*/
11474
+	 * Gets the aircraft type from ModeS
11475
+	 *
11476
+	 * @param String $aircraft_modes the flight ModeS in hex
11477
+	 * @return String the aircraft type
11478
+	 *
11479
+	 */
11480 11480
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11481 11481
 	{
11482 11482
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11502,12 +11502,12 @@  discard block
 block discarded – undo
11502 11502
 	}
11503 11503
 
11504 11504
 	/**
11505
-	* Gets Country from latitude/longitude
11506
-	*
11507
-	* @param Float $latitude latitute of the flight
11508
-	* @param Float $longitude longitute of the flight
11509
-	* @return String the countrie
11510
-	*/
11505
+	 * Gets Country from latitude/longitude
11506
+	 *
11507
+	 * @param Float $latitude latitute of the flight
11508
+	 * @param Float $longitude longitute of the flight
11509
+	 * @return String the countrie
11510
+	 */
11511 11511
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11512 11512
 	{
11513 11513
 		global $globalDBdriver, $globalDebug;
@@ -11544,11 +11544,11 @@  discard block
 block discarded – undo
11544 11544
 	}
11545 11545
 
11546 11546
 	/**
11547
-	* Gets Country from iso2
11548
-	*
11549
-	* @param String $iso2 ISO2 country code
11550
-	* @return String the countrie
11551
-	*/
11547
+	 * Gets Country from iso2
11548
+	 *
11549
+	 * @param String $iso2 ISO2 country code
11550
+	 * @return String the countrie
11551
+	 */
11552 11552
 	public function getCountryFromISO2($iso2)
11553 11553
 	{
11554 11554
 		global $globalDBdriver, $globalDebug;
@@ -11576,12 +11576,12 @@  discard block
 block discarded – undo
11576 11576
 	}
11577 11577
 
11578 11578
 	/**
11579
-	* converts the registration code using the country prefix
11580
-	*
11581
-	* @param String $registration the aircraft registration
11582
-	* @return String the aircraft registration
11583
-	*
11584
-	*/
11579
+	 * converts the registration code using the country prefix
11580
+	 *
11581
+	 * @param String $registration the aircraft registration
11582
+	 * @return String the aircraft registration
11583
+	 *
11584
+	 */
11585 11585
 	public function convertAircraftRegistration($registration)
11586 11586
 	{
11587 11587
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11633,12 +11633,12 @@  discard block
 block discarded – undo
11633 11633
 	}
11634 11634
 
11635 11635
 	/**
11636
-	* Country from the registration code
11637
-	*
11638
-	* @param String $registration the aircraft registration
11639
-	* @return String the country
11640
-	*
11641
-	*/
11636
+	 * Country from the registration code
11637
+	 *
11638
+	 * @param String $registration the aircraft registration
11639
+	 * @return String the country
11640
+	 *
11641
+	 */
11642 11642
 	public function countryFromAircraftRegistration($registration)
11643 11643
 	{
11644 11644
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11657,8 +11657,8 @@  discard block
 block discarded – undo
11657 11657
 				$country = $row['country'];
11658 11658
 			}
11659 11659
 		} else {
11660
-    			$registration_1 = substr($registration, 0, 1);
11661
-		        $registration_2 = substr($registration, 0, 2);
11660
+				$registration_1 = substr($registration, 0, 1);
11661
+				$registration_2 = substr($registration, 0, 2);
11662 11662
 
11663 11663
 			$country = '';
11664 11664
 			//first get the prefix based on two characters
@@ -11694,12 +11694,12 @@  discard block
 block discarded – undo
11694 11694
 	}
11695 11695
 
11696 11696
 	/**
11697
-	* Registration prefix from the registration code
11698
-	*
11699
-	* @param String $registration the aircraft registration
11700
-	* @return String the registration prefix
11701
-	*
11702
-	*/
11697
+	 * Registration prefix from the registration code
11698
+	 *
11699
+	 * @param String $registration the aircraft registration
11700
+	 * @return String the registration prefix
11701
+	 *
11702
+	 */
11703 11703
 	public function registrationPrefixFromAircraftRegistration($registration)
11704 11704
 	{
11705 11705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11718,8 +11718,8 @@  discard block
 block discarded – undo
11718 11718
 				//$country = $row['country'];
11719 11719
 			}
11720 11720
 		} else {
11721
-    			$registration_1 = substr($registration, 0, 1);
11722
-		        $registration_2 = substr($registration, 0, 2);
11721
+				$registration_1 = substr($registration, 0, 1);
11722
+				$registration_2 = substr($registration, 0, 2);
11723 11723
 
11724 11724
 			//first get the prefix based on two characters
11725 11725
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11755,12 +11755,12 @@  discard block
 block discarded – undo
11755 11755
 
11756 11756
 
11757 11757
 	/**
11758
-	* Country from the registration code
11759
-	*
11760
-	* @param String $registration the aircraft registration
11761
-	* @return String the country
11762
-	*
11763
-	*/
11758
+	 * Country from the registration code
11759
+	 *
11760
+	 * @param String $registration the aircraft registration
11761
+	 * @return String the country
11762
+	 *
11763
+	 */
11764 11764
 	public function countryFromAircraftRegistrationCode($registration)
11765 11765
 	{
11766 11766
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11777,11 +11777,11 @@  discard block
 block discarded – undo
11777 11777
 	}
11778 11778
 	
11779 11779
 	/**
11780
-	* Set a new highlight value for a flight
11781
-	*
11782
-	* @param String $flightaware_id flightaware_id from spotter_output table
11783
-	* @param String $highlight New highlight value
11784
-	*/
11780
+	 * Set a new highlight value for a flight
11781
+	 *
11782
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11783
+	 * @param String $highlight New highlight value
11784
+	 */
11785 11785
 	public function setHighlightFlight($flightaware_id,$highlight) {
11786 11786
 		
11787 11787
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11790,12 +11790,12 @@  discard block
 block discarded – undo
11790 11790
 	}
11791 11791
 
11792 11792
 	/**
11793
-	* Set a new highlight value for a flight by Registration
11794
-	*
11795
-	* @param String $registration Registration of the aircraft
11796
-	* @param String $date Date of spotted aircraft
11797
-	* @param String $highlight New highlight value
11798
-	*/
11793
+	 * Set a new highlight value for a flight by Registration
11794
+	 *
11795
+	 * @param String $registration Registration of the aircraft
11796
+	 * @param String $date Date of spotted aircraft
11797
+	 * @param String $highlight New highlight value
11798
+	 */
11799 11799
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11800 11800
 		if ($date == '') {
11801 11801
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11809,12 +11809,12 @@  discard block
 block discarded – undo
11809 11809
 	}
11810 11810
 	
11811 11811
 	/**
11812
-	* Gets the short url from bit.ly
11813
-	*
11814
-	* @param String $url the full url
11815
-	* @return String the bit.ly url
11816
-	*
11817
-	*/
11812
+	 * Gets the short url from bit.ly
11813
+	 *
11814
+	 * @param String $url the full url
11815
+	 * @return String the bit.ly url
11816
+	 *
11817
+	 */
11818 11818
 	public function getBitlyURL($url)
11819 11819
 	{
11820 11820
 		global $globalBitlyAccessToken;
@@ -12103,11 +12103,11 @@  discard block
 block discarded – undo
12103 12103
 			$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 
12104 12104
 	                      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)) 
12105 12105
 	                      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;";
12106
-                } else {
12106
+				} else {
12107 12107
 			$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 
12108 12108
 	                      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)) 
12109 12109
 	                      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;";
12110
-    		}
12110
+			}
12111 12111
 		$sth = $this->db->prepare($query);
12112 12112
 		$sth->execute();
12113 12113
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return ($dec);
58 58
 	}
59 59
 	
60
-    /*
60
+	/*
61 61
     $ais_map64 = array(
62 62
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48
63 63
        ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C',
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		//  ' ' --- '?', // 0x20 - 0x3F
98 98
 		//  '@' --- '_', // 0x40 - 0x5F
99 99
 		$ais_chars = array(
100
-		    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
-		    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
-		    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
-		    '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
-		    '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
-		    '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
-		    '<', '=', '>', '?'
100
+			'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
+			'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
+			'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
+			'^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
+			'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
+			'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
+			'<', '=', '>', '?'
107 107
 		);
108 108
 		$rv = '';
109 109
 		if ($_size % 6 == 0) {
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				}
270 270
 				if ($num_seq > 1) { // for multipart messages
271 271
 					if ($cmsg_sid != $msg_sid // different msg_sid
272
-					    || $msg_sid == -1 // invalid initial msg_sid
273
-					    || ($seq - $pseq) != 1 // not insequence
272
+						|| $msg_sid == -1 // invalid initial msg_sid
273
+						|| ($seq - $pseq) != 1 // not insequence
274 274
 					) {  // invalid for multipart message
275 275
 						$msg_sid = -1;
276 276
 						$cmsg_sid = -1;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 				$itu = $itu.$pcs[5]; // get itu message
284 284
 				$filler += (int)$pcs[6][0]; // get filler
285 285
 				if ($num_seq == 1 // valid single message
286
-				    || $num_seq == $pseq // valid multi-part message
286
+					|| $num_seq == $pseq // valid multi-part message
287 287
 				) {
288 288
 					if ($num_seq != 1) { // test
289 289
 						//echo $rawdata;
@@ -366,13 +366,13 @@  discard block
 block discarded – undo
366 366
 		else $pad = '';
367 367
 		$rv = '';
368 368
 		$ais_chars = array(
369
-		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
370
-		    'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
371
-		    'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
372
-		    '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
373
-		    '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
374
-		    '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
375
-		    '<'=>60, '='=>61, '>'=>62, '?'=>63
369
+			'@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
370
+			'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
371
+			'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
372
+			'^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
373
+			'('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
374
+			'2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
375
+			'<'=>60, '='=>61, '>'=>62, '?'=>63
376 376
 		);
377 377
 		$_a = str_split($name);
378 378
 		if ($_a) foreach ($_a as $_1) {
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	
200 200
 	
201 201
 	/**
202
-	* Gets all the spotter information based on the latest data entry
203
-	*
204
-	* @return Array the spotter information
205
-	*
206
-	*/
202
+	 * Gets all the spotter information based on the latest data entry
203
+	 *
204
+	 * @return Array the spotter information
205
+	 *
206
+	 */
207 207
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
208 208
 	{
209 209
 		global $global_query;
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	/**
264
-	* Gets all the spotter information based on the callsign
265
-	*
266
-	* @return Array the spotter information
267
-	*
268
-	*/
264
+	 * Gets all the spotter information based on the callsign
265
+	 *
266
+	 * @return Array the spotter information
267
+	 *
268
+	 */
269 269
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
270 270
 	{
271 271
 		global $global_query;
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
 
377 377
 
378 378
 	/**
379
-	* Gets all source name
380
-	*
381
-	* @param String type format of source
382
-	* @return Array list of source name
383
-	*
384
-	*/
379
+	 * Gets all source name
380
+	 *
381
+	 * @param String type format of source
382
+	 * @return Array list of source name
383
+	 *
384
+	 */
385 385
 	public function getAllSourceName($type = '',$filters = array())
386 386
 	{
387 387
 		$filter_query = $this->getFilter($filters,true,true);
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 
412 412
 
413 413
 	/**
414
-	* Gets a list of all idents/callsigns
415
-	*
416
-	* @return Array list of ident/callsign names
417
-	*
418
-	*/
414
+	 * Gets a list of all idents/callsigns
415
+	 *
416
+	 * @return Array list of ident/callsign names
417
+	 *
418
+	 */
419 419
 	public function getAllIdents($filters = array())
420 420
 	{
421 421
 		$filter_query = $this->getFilter($filters,true,true);
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
 	}
440 440
 
441 441
 	/**
442
-	* Gets all info from a mmsi
443
-	*
444
-	* @return Array list of mmsi info
445
-	*
446
-	*/
442
+	 * Gets all info from a mmsi
443
+	 *
444
+	 * @return Array list of mmsi info
445
+	 *
446
+	 */
447 447
 	public function getIdentity($mmsi)
448 448
 	{
449 449
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Update ident spotter data
504
-	*
505
-	* @param String $flightaware_id the ID from flightaware
506
-	* @param String $ident the flight ident
507
-	* @return String success or false
508
-	*
509
-	*/	
503
+	 * Update ident spotter data
504
+	 *
505
+	 * @param String $flightaware_id the ID from flightaware
506
+	 * @param String $ident the flight ident
507
+	 * @return String success or false
508
+	 *
509
+	 */	
510 510
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
511 511
 	{
512 512
 
513 513
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
514
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
514
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
515 515
 
516 516
 		try {
517 517
 			$sth = $this->db->prepare($query);
@@ -524,18 +524,18 @@  discard block
 block discarded – undo
524 524
 
525 525
 	}
526 526
 	/**
527
-	* Update latest spotter data
528
-	*
529
-	* @param String $flightaware_id the ID from flightaware
530
-	* @param String $ident the flight ident
531
-	* @param String $arrival_airport_icao the arrival airport
532
-	* @return String success or false
533
-	*
534
-	*/	
527
+	 * Update latest spotter data
528
+	 *
529
+	 * @param String $flightaware_id the ID from flightaware
530
+	 * @param String $ident the flight ident
531
+	 * @param String $arrival_airport_icao the arrival airport
532
+	 * @return String success or false
533
+	 *
534
+	 */	
535 535
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
536 536
 	{
537 537
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
538
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
538
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
539 539
 
540 540
 		try {
541 541
 			$sth = $this->db->prepare($query);
@@ -549,31 +549,31 @@  discard block
 block discarded – undo
549 549
 	}
550 550
 
551 551
 	/**
552
-	* Adds a new spotter data
553
-	*
554
-	* @param String $flightaware_id the ID from flightaware
555
-	* @param String $ident the flight ident
556
-	* @param String $aircraft_icao the aircraft type
557
-	* @param String $departure_airport_icao the departure airport
558
-	* @param String $arrival_airport_icao the arrival airport
559
-	* @param String $latitude latitude of flight
560
-	* @param String $longitude latitude of flight
561
-	* @param String $waypoints waypoints of flight
562
-	* @param String $heading heading of flight
563
-	* @param String $groundspeed speed of flight
564
-	* @param String $date date of flight
565
-	* @param String $departure_airport_time departure time of flight
566
-	* @param String $arrival_airport_time arrival time of flight
567
-	* @param String $squawk squawk code of flight
568
-	* @param String $route_stop route stop of flight
569
-	* @param String $highlight highlight or not
570
-	* @param String $ModeS ModesS code of flight
571
-	* @param String $registration registration code of flight
572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
574
-	* @param String $verticalrate vertival rate of flight
575
-	* @return String success or false
576
-	*/
552
+	 * Adds a new spotter data
553
+	 *
554
+	 * @param String $flightaware_id the ID from flightaware
555
+	 * @param String $ident the flight ident
556
+	 * @param String $aircraft_icao the aircraft type
557
+	 * @param String $departure_airport_icao the departure airport
558
+	 * @param String $arrival_airport_icao the arrival airport
559
+	 * @param String $latitude latitude of flight
560
+	 * @param String $longitude latitude of flight
561
+	 * @param String $waypoints waypoints of flight
562
+	 * @param String $heading heading of flight
563
+	 * @param String $groundspeed speed of flight
564
+	 * @param String $date date of flight
565
+	 * @param String $departure_airport_time departure time of flight
566
+	 * @param String $arrival_airport_time arrival time of flight
567
+	 * @param String $squawk squawk code of flight
568
+	 * @param String $route_stop route stop of flight
569
+	 * @param String $highlight highlight or not
570
+	 * @param String $ModeS ModesS code of flight
571
+	 * @param String $registration registration code of flight
572
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
573
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
574
+	 * @param String $verticalrate vertival rate of flight
575
+	 * @return String success or false
576
+	 */
577 577
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$status = '',$format_source = '', $source_name = '')
578 578
 	{
579 579
 		global $globalURL;
@@ -657,16 +657,16 @@  discard block
 block discarded – undo
657 657
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
658 658
 		$status = filter_var($status,FILTER_SANITIZE_STRING);
659 659
 	
660
-                if ($latitude == '' && $longitude == '') {
661
-            		$latitude = 0;
662
-            		$longitude = 0;
663
-            	}
664
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
665
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
666
-                $query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status) 
660
+				if ($latitude == '' && $longitude == '') {
661
+					$latitude = 0;
662
+					$longitude = 0;
663
+				}
664
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
665
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
666
+				$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status) 
667 667
                 VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status)";
668 668
 
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status);
669
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status);
670 670
 
671 671
 		try {
672 672
 		        
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 			$sth->execute($query_values);
675 675
 			$this->db = null;
676 676
 		} catch (PDOException $e) {
677
-		    return "error : ".$e->getMessage();
677
+			return "error : ".$e->getMessage();
678 678
 		}
679 679
 		
680 680
 		return "success";
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 	
684 684
   
685 685
 	/**
686
-	* Gets the aircraft ident within the last hour
687
-	*
688
-	* @return String the ident
689
-	*
690
-	*/
686
+	 * Gets the aircraft ident within the last hour
687
+	 *
688
+	 * @return String the ident
689
+	 *
690
+	 */
691 691
 	public function getIdentFromLastHour($ident)
692 692
 	{
693 693
 		global $globalDBdriver, $globalTimezone;
@@ -703,11 +703,11 @@  discard block
 block discarded – undo
703 703
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
704 704
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
705 705
 			$query_data = array(':ident' => $ident);
706
-    		}
706
+			}
707 707
 		
708 708
 		$sth = $this->db->prepare($query);
709 709
 		$sth->execute($query_data);
710
-    		$ident_result='';
710
+			$ident_result='';
711 711
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
712 712
 		{
713 713
 			$ident_result = $row['ident'];
@@ -718,11 +718,11 @@  discard block
 block discarded – undo
718 718
 	
719 719
 	
720 720
 	/**
721
-	* Gets the aircraft data from the last 20 seconds
722
-	*
723
-	* @return Array the spotter data
724
-	*
725
-	*/
721
+	 * Gets the aircraft data from the last 20 seconds
722
+	 *
723
+	 * @return Array the spotter data
724
+	 *
725
+	 */
726 726
 	public function getRealTimeData($q = '')
727 727
 	{
728 728
 		global $globalDBdriver;
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	
761 761
 
762 762
 	/**
763
-	* Gets all number of flight over countries
764
-	*
765
-	* @return Array the airline country list
766
-	*
767
-	*/
763
+	 * Gets all number of flight over countries
764
+	 *
765
+	 * @return Array the airline country list
766
+	 *
767
+	 */
768 768
 /*
769 769
 	public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
770 770
 	{
@@ -815,11 +815,11 @@  discard block
 block discarded – undo
815 815
 	
816 816
 	
817 817
 	/**
818
-	* Gets all callsigns that have flown over
819
-	*
820
-	* @return Array the callsign list
821
-	*
822
-	*/
818
+	 * Gets all callsigns that have flown over
819
+	 *
820
+	 * @return Array the callsign list
821
+	 *
822
+	 */
823 823
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
824 824
 	{
825 825
 		global $globalDBdriver;
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
 
887 887
 
888 888
 	/**
889
-	* Counts all dates
890
-	*
891
-	* @return Array the date list
892
-	*
893
-	*/
889
+	 * Counts all dates
890
+	 *
891
+	 * @return Array the date list
892
+	 *
893
+	 */
894 894
 	public function countAllDates($filters = array())
895 895
 	{
896 896
 		global $globalTimezone, $globalDBdriver;
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
 	
937 937
 	
938 938
 	/**
939
-	* Counts all dates during the last 7 days
940
-	*
941
-	* @return Array the date list
942
-	*
943
-	*/
939
+	 * Counts all dates during the last 7 days
940
+	 *
941
+	 * @return Array the date list
942
+	 *
943
+	 */
944 944
 	public function countAllDatesLast7Days($filters = array())
945 945
 	{
946 946
 		global $globalTimezone, $globalDBdriver;
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 			$query .= " GROUP BY date_name 
963 963
 								ORDER BY date_name ASC";
964 964
 			$query_data = array(':offset' => $offset);
965
-    		}
965
+			}
966 966
 		
967 967
 		$sth = $this->db->prepare($query);
968 968
 		$sth->execute($query_data);
@@ -982,11 +982,11 @@  discard block
 block discarded – undo
982 982
 	}
983 983
 
984 984
 	/**
985
-	* Counts all dates during the last month
986
-	*
987
-	* @return Array the date list
988
-	*
989
-	*/
985
+	 * Counts all dates during the last month
986
+	 *
987
+	 * @return Array the date list
988
+	 *
989
+	 */
990 990
 	public function countAllDatesLastMonth($filters = array())
991 991
 	{
992 992
 		global $globalTimezone, $globalDBdriver;
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 			$query .= " GROUP BY date_name 
1009 1009
 								ORDER BY date_name ASC";
1010 1010
 			$query_data = array(':offset' => $offset);
1011
-    		}
1011
+			}
1012 1012
 		
1013 1013
 		$sth = $this->db->prepare($query);
1014 1014
 		$sth->execute($query_data);
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
 
1032 1032
 	/**
1033
-	* Counts all month
1034
-	*
1035
-	* @return Array the month list
1036
-	*
1037
-	*/
1033
+	 * Counts all month
1034
+	 *
1035
+	 * @return Array the month list
1036
+	 *
1037
+	 */
1038 1038
 	public function countAllMonths($filters = array())
1039 1039
 	{
1040 1040
 		global $globalTimezone, $globalDBdriver;
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
 	
1080 1080
 
1081 1081
 	/**
1082
-	* Counts all dates during the last year
1083
-	*
1084
-	* @return Array the date list
1085
-	*
1086
-	*/
1082
+	 * Counts all dates during the last year
1083
+	 *
1084
+	 * @return Array the date list
1085
+	 *
1086
+	 */
1087 1087
 	public function countAllMonthsLastYear($filters)
1088 1088
 	{
1089 1089
 		global $globalTimezone, $globalDBdriver;
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			$query .= " GROUP BY year_name, month_name
1106 1106
 								ORDER BY year_name, month_name ASC";
1107 1107
 			$query_data = array(':offset' => $offset);
1108
-    		}
1108
+			}
1109 1109
 		
1110 1110
 		$sth = $this->db->prepare($query);
1111 1111
 		$sth->execute($query_data);
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
 	
1129 1129
 	
1130 1130
 	/**
1131
-	* Counts all hours
1132
-	*
1133
-	* @return Array the hour list
1134
-	*
1135
-	*/
1131
+	 * Counts all hours
1132
+	 *
1133
+	 * @return Array the hour list
1134
+	 *
1135
+	 */
1136 1136
 	public function countAllHours($orderby,$filters = array())
1137 1137
 	{
1138 1138
 		global $globalTimezone, $globalDBdriver;
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
 	
1196 1196
 	
1197 1197
 	/**
1198
-	* Counts all hours by date
1199
-	*
1200
-	* @return Array the hour list
1201
-	*
1202
-	*/
1198
+	 * Counts all hours by date
1199
+	 *
1200
+	 * @return Array the hour list
1201
+	 *
1202
+	 */
1203 1203
 	public function countAllHoursByDate($date, $filters = array())
1204 1204
 	{
1205 1205
 		global $globalTimezone, $globalDBdriver;
@@ -1243,11 +1243,11 @@  discard block
 block discarded – undo
1243 1243
 	
1244 1244
 	
1245 1245
 	/**
1246
-	* Counts all hours by a ident/callsign
1247
-	*
1248
-	* @return Array the hour list
1249
-	*
1250
-	*/
1246
+	 * Counts all hours by a ident/callsign
1247
+	 *
1248
+	 * @return Array the hour list
1249
+	 *
1250
+	 */
1251 1251
 	public function countAllHoursByIdent($ident, $filters = array())
1252 1252
 	{
1253 1253
 		global $globalTimezone, $globalDBdriver;
@@ -1292,11 +1292,11 @@  discard block
 block discarded – undo
1292 1292
 	
1293 1293
 	
1294 1294
 	/**
1295
-	* Counts all flights that have flown over
1296
-	*
1297
-	* @return Integer the number of flights
1298
-	*
1299
-	*/
1295
+	 * Counts all flights that have flown over
1296
+	 *
1297
+	 * @return Integer the number of flights
1298
+	 *
1299
+	 */
1300 1300
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1301 1301
 	{
1302 1302
 		global $globalDBdriver;
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
 	
1332 1332
   
1333 1333
 	/**
1334
-	* Counts all hours of today
1335
-	*
1336
-	* @return Array the hour list
1337
-	*
1338
-	*/
1334
+	 * Counts all hours of today
1335
+	 *
1336
+	 * @return Array the hour list
1337
+	 *
1338
+	 */
1339 1339
 	public function countAllHoursFromToday($filters = array())
1340 1340
 	{
1341 1341
 		global $globalTimezone, $globalDBdriver;
@@ -1375,12 +1375,12 @@  discard block
 block discarded – undo
1375 1375
 	}
1376 1376
     
1377 1377
     
1378
-     /**
1379
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1380
-	*
1381
-	* @return Integer the Barrie Spotter ID
1378
+	 /**
1379
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1380
+	  *
1381
+	  * @return Integer the Barrie Spotter ID
1382 1382
 q	*
1383
-	*/
1383
+	  */
1384 1384
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1385 1385
 	{
1386 1386
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1401,13 +1401,13 @@  discard block
 block discarded – undo
1401 1401
   
1402 1402
  
1403 1403
 	/**
1404
-	* Parses a date string
1405
-	*
1406
-	* @param String $dateString the date string
1407
-	* @param String $timezone the timezone of a user
1408
-	* @return Array the time information
1409
-	*
1410
-	*/
1404
+	 * Parses a date string
1405
+	 *
1406
+	 * @param String $dateString the date string
1407
+	 * @param String $timezone the timezone of a user
1408
+	 * @return Array the time information
1409
+	 *
1410
+	 */
1411 1411
 	public function parseDateString($dateString, $timezone = '')
1412 1412
 	{
1413 1413
 		$time_array = array();
@@ -1440,12 +1440,12 @@  discard block
 block discarded – undo
1440 1440
 	}
1441 1441
 	
1442 1442
 	/**
1443
-	* Parses the direction degrees to working
1444
-	*
1445
-	* @param Float $direction the direction in degrees
1446
-	* @return Array the direction information
1447
-	*
1448
-	*/
1443
+	 * Parses the direction degrees to working
1444
+	 *
1445
+	 * @param Float $direction the direction in degrees
1446
+	 * @return Array the direction information
1447
+	 *
1448
+	 */
1449 1449
 	public function parseDirection($direction = 0)
1450 1450
 	{
1451 1451
 		if ($direction == '') $direction = 0;
@@ -1524,12 +1524,12 @@  discard block
 block discarded – undo
1524 1524
 	
1525 1525
 	
1526 1526
 	/**
1527
-	* Gets Country from latitude/longitude
1528
-	*
1529
-	* @param Float $latitude latitute of the flight
1530
-	* @param Float $longitude longitute of the flight
1531
-	* @return String the countrie
1532
-	*/
1527
+	 * Gets Country from latitude/longitude
1528
+	 *
1529
+	 * @param Float $latitude latitute of the flight
1530
+	 * @param Float $longitude longitute of the flight
1531
+	 * @return String the countrie
1532
+	 */
1533 1533
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1534 1534
 	{
1535 1535
 		global $globalDBdriver, $globalDebug;
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
 	}
1567 1567
 
1568 1568
 	/**
1569
-	* Gets Country from iso2
1570
-	*
1571
-	* @param String $iso2 ISO2 country code
1572
-	* @return String the countrie
1573
-	*/
1569
+	 * Gets Country from iso2
1570
+	 *
1571
+	 * @param String $iso2 ISO2 country code
1572
+	 * @return String the countrie
1573
+	 */
1574 1574
 	public function getCountryFromISO2($iso2)
1575 1575
 	{
1576 1576
 		global $globalDBdriver, $globalDebug;
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 	
1601 1601
 	/**
1602
-	* Gets the short url from bit.ly
1603
-	*
1604
-	* @param String $url the full url
1605
-	* @return String the bit.ly url
1606
-	*
1607
-	*/
1602
+	 * Gets the short url from bit.ly
1603
+	 *
1604
+	 * @param String $url the full url
1605
+	 * @return String the bit.ly url
1606
+	 *
1607
+	 */
1608 1608
 	public function getBitlyURL($url)
1609 1609
 	{
1610 1610
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.MarineImport.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 
11 11
 class MarineImport {
12
-    private $all_tracked = array();
13
-    private $last_delete_hourly = 0;
14
-    private $last_delete = 0;
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_location = array();
18
-    public $db = null;
19
-    public $nb = 0;
12
+	private $all_tracked = array();
13
+	private $last_delete_hourly = 0;
14
+	private $last_delete = 0;
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_location = array();
18
+	public $db = null;
19
+	public $nb = 0;
20 20
 
21
-    public function __construct($dbc = null) {
21
+	public function __construct($dbc = null) {
22 22
 	global $globalBeta;
23 23
 	$Connection = new Connection($dbc);
24 24
 	$this->db = $Connection->db();
@@ -40,50 +40,50 @@  discard block
 block discarded – undo
40 40
 	    }
41 41
 	}
42 42
 	*/
43
-    }
43
+	}
44 44
 
45
-    public function checkAll() {
45
+	public function checkAll() {
46 46
 	global $globalDebug;
47 47
 	if ($globalDebug) echo "Update last seen tracked data...\n";
48 48
 	foreach ($this->all_tracked as $key => $flight) {
49
-	    if (isset($this->all_tracked[$key]['id'])) {
49
+		if (isset($this->all_tracked[$key]['id'])) {
50 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
51
-    		$Marine = new Marine($this->db);
52
-        	$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
53
-            }
51
+			$Marine = new Marine($this->db);
52
+			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
53
+			}
54
+	}
54 55
 	}
55
-    }
56 56
 
57
-    public function del() {
57
+	public function del() {
58 58
 	global $globalDebug;
59 59
 	// Delete old infos
60 60
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
61 61
 	foreach ($this->all_tracked as $key => $flight) {
62
-    	    if (isset($flight['lastupdate'])) {
63
-        	if ($flight['lastupdate'] < (time()-3000)) {
64
-            	    if (isset($this->all_tracked[$key]['id'])) {
65
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
62
+			if (isset($flight['lastupdate'])) {
63
+			if ($flight['lastupdate'] < (time()-3000)) {
64
+					if (isset($this->all_tracked[$key]['id'])) {
65
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
66 66
 			/*
67 67
 			$MarineLive = new MarineLive();
68 68
             		$MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
69 69
 			$MarineLive->db = null;
70 70
 			*/
71
-            		//$real_arrival = $this->arrival($key);
72
-            		$Marine = new Marine($this->db);
73
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
71
+					//$real_arrival = $this->arrival($key);
72
+					$Marine = new Marine($this->db);
73
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
74 74
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed']);
75 75
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
76 76
 			}
77 77
 			// Put in archive
78 78
 //			$Marine->db = null;
79
-            	    }
80
-            	    unset($this->all_tracked[$key]);
81
-    	        }
82
-	    }
83
-        }
84
-    }
79
+					}
80
+					unset($this->all_tracked[$key]);
81
+				}
82
+		}
83
+		}
84
+	}
85 85
 
86
-    public function add($line) {
86
+	public function add($line) {
87 87
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
88 88
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
89 89
 	date_default_timezone_set('UTC');
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	
93 93
 	// SBS format is CSV format
94 94
 	if(is_array($line) && isset($line['mmsi'])) {
95
-	    //print_r($line);
96
-  	    if (isset($line['mmsi'])) {
95
+		//print_r($line);
96
+  		if (isset($line['mmsi'])) {
97 97
 
98 98
 		/*
99 99
 		// Increment message number
@@ -109,69 +109,69 @@  discard block
 block discarded – undo
109 109
 		*/
110 110
 		
111 111
 		$Common = new Common();
112
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
113
-	        else $id = trim($line['id']);
112
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
113
+			else $id = trim($line['id']);
114 114
 		
115 115
 		if (!isset($this->all_tracked[$id])) {
116
-		    $this->all_tracked[$id] = array();
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','type' => '','status' => ''));
119
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120
-		    if (!isset($line['id'])) {
116
+			$this->all_tracked[$id] = array();
117
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
118
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','type' => '','status' => ''));
119
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120
+			if (!isset($line['id'])) {
121 121
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
122 122
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
123
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
123
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
+			if ($globalAllTracked !== FALSE) $dataFound = true;
125 125
 		}
126 126
 		
127 127
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
128
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
129
-		    $Marine = new Marine($this->db);
130
-		    $identity = $Marine->getIdentity($line['mmsi']);
131
-		    if (!empty($identity)) {
128
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
129
+			$Marine = new Marine($this->db);
130
+			$identity = $Marine->getIdentity($line['mmsi']);
131
+			if (!empty($identity)) {
132 132
 			$this->all_tracked[$id]['ident'] = $identity['ship_name'];
133 133
 			$this->all_tracked[$id]['type'] = $identity['type'];
134
-		    }
135
-		    //print_r($identity);
136
-		    unset($Marine);
137
-		    //$dataFound = true;
134
+			}
135
+			//print_r($identity);
136
+			unset($Marine);
137
+			//$dataFound = true;
138 138
 		}
139 139
 
140 140
 
141 141
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
142 142
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
143
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
144
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
143
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
144
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
145 145
 			$timeelapsed = microtime(true);
146
-            		$Marine = new Marine($this->db);
147
-            		$fromsource = NULL;
148
-            		$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
146
+					$Marine = new Marine($this->db);
147
+					$fromsource = NULL;
148
+					$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
149 149
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
150 150
 			$Marine->db = null;
151 151
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
152
-		    }
153
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
152
+			}
153
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
154 154
 		}
155 155
 
156 156
 		if (isset($line['speed']) && $line['speed'] != '') {
157
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
158
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
157
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
158
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
159 159
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
160
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
161
-		    if ($distance > 1000 && $distance < 10000) {
160
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
161
+			if ($distance > 1000 && $distance < 10000) {
162 162
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
163 163
 			$speed = $speed*3.6;
164 164
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
165 165
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
166
-		    }
166
+			}
167 167
 		}
168 168
 
169
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
170
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
171
-	    	    else unset($timediff);
172
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
169
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
170
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
171
+				else unset($timediff);
172
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
173 173
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
174
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
174
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
175 175
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
176 176
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
177 177
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -185,76 +185,76 @@  discard block
 block discarded – undo
185 185
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
186 186
 				$this->tmd = 0;
187 187
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
188
-			    }
188
+				}
189 189
 			}
190 190
 
191 191
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
192 192
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
193 193
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
194
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
195
-				    $dataFound = true;
196
-				    $this->all_tracked[$id]['time_last_coord'] = time();
194
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
195
+					$dataFound = true;
196
+					$this->all_tracked[$id]['time_last_coord'] = time();
197 197
 				}
198 198
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
199 199
 			}
200 200
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
201
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
201
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
202 202
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
203 203
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
204
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
205
-				    $dataFound = true;
206
-				    $this->all_tracked[$id]['time_last_coord'] = time();
204
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
205
+					$dataFound = true;
206
+					$this->all_tracked[$id]['time_last_coord'] = time();
207 207
 				}
208 208
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
209 209
 			}
210 210
 
211
-		    } else if ($globalDebug && $timediff > 20) {
211
+			} else if ($globalDebug && $timediff > 20) {
212 212
 			$this->tmd = $this->tmd + 1;
213 213
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
214 214
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
215 215
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
216 216
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
217
-		    }
217
+			}
218 218
 		}
219 219
 		if (isset($line['last_update']) && $line['last_update'] != '') {
220
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
221
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
220
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
221
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
222 222
 		}
223 223
 		if (isset($line['format_source']) && $line['format_source'] != '') {
224
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
224
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
225 225
 		}
226 226
 		if (isset($line['source_name']) && $line['source_name'] != '') {
227
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
227
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
228 228
 		}
229 229
 		if (isset($line['status']) && $line['status'] != '') {
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
230
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
231 231
 		}
232 232
 
233 233
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
234
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
234
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
235 235
 		}
236 236
 		
237 237
 		if (isset($line['heading']) && $line['heading'] != '') {
238
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
239
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
240
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
241
-		    //$dataFound = true;
238
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
239
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
240
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
241
+			//$dataFound = true;
242 242
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
243
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
244
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
245
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
246
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
243
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
244
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
245
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
246
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
247 247
   		}
248 248
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
249 249
 
250 250
 		if (isset($line['datetime'])) {
251
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
251
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
252 252
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
253
-		    } else {
253
+			} else {
254 254
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
255 255
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
256 256
 				return '';
257
-		    }
257
+			}
258 258
 		} else {
259 259
 			date_default_timezone_set('UTC');
260 260
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
@@ -262,45 +262,45 @@  discard block
 block discarded – undo
262 262
 
263 263
 
264 264
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
265
-		    $this->all_tracked[$id]['lastupdate'] = time();
266
-		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
267
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
268
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
265
+			$this->all_tracked[$id]['lastupdate'] = time();
266
+			if ($this->all_tracked[$id]['addedMarine'] == 0) {
267
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
268
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
269 269
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
270 270
 				$timeelapsed = microtime(true);
271 271
 				$MarineLive = new MarineLive($this->db);
272 272
 				if (isset($line['id'])) {
273
-				    $recent_ident = $MarineLive->checkIdRecent($line['id']);
274
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
273
+					$recent_ident = $MarineLive->checkIdRecent($line['id']);
274
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
275 275
 				} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
276
-				    $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
277
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
276
+					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
277
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
278 278
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
279
-				    $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
280
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
279
+					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
280
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
281 281
 				} else $recent_ident = '';
282 282
 				$MarineLive->db=null;
283 283
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
284 284
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
285
-			    } else {
285
+				} else {
286 286
 				$recent_ident = '';
287 287
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
288
-			    }
289
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
290
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
291
-			    {
288
+				}
289
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
290
+				if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
291
+				{
292 292
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
293 293
 				//adds the spotter data for the archive
294
-				    $highlight = '';
295
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
296
-				    $timeelapsed = microtime(true);
297
-				    $Marine = new Marine($this->db);
298
-				    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['status'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
299
-				    $Marine->db = null;
300
-				    if ($globalDebug && isset($result)) echo $result."\n";
301
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
294
+					$highlight = '';
295
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
296
+					$timeelapsed = microtime(true);
297
+					$Marine = new Marine($this->db);
298
+					$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['status'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
299
+					$Marine->db = null;
300
+					if ($globalDebug && isset($result)) echo $result."\n";
301
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
302 302
 				    
303
-				    /*
303
+					/*
304 304
 				    // Add source stat in DB
305 305
 				    $Stats = new Stats($this->db);
306 306
 				    if (!empty($this->stats)) {
@@ -327,20 +327,20 @@  discard block
 block discarded – undo
327 327
 				    }
328 328
 				    $Stats->db = null;
329 329
 				    */
330
-				    $this->del();
330
+					$this->del();
331 331
 				//$ignoreImport = false;
332 332
 				$this->all_tracked[$id]['addedMarine'] = 1;
333 333
 				//print_r($this->all_tracked[$id]);
334 334
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
335
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
336
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
337
-				    $MarineLive = new MarineLive($this->db);
338
-				    $MarineLive->deleteLiveMarineData();
339
-				    $MarineLive->db=null;
340
-				    if ($globalDebug) echo " Done\n";
341
-				    $this->last_delete = time();
335
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
336
+					//MarineLive->deleteLiveMarineDataNotUpdated();
337
+					$MarineLive = new MarineLive($this->db);
338
+					$MarineLive->deleteLiveMarineData();
339
+					$MarineLive->db=null;
340
+					if ($globalDebug) echo " Done\n";
341
+					$this->last_delete = time();
342 342
 				}
343
-			    } elseif ($recent_ident != '') {
343
+				} elseif ($recent_ident != '') {
344 344
 				$this->all_tracked[$id]['id'] = $recent_ident;
345 345
 				$this->all_tracked[$id]['addedMarine'] = 1;
346 346
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -349,16 +349,16 @@  discard block
 block discarded – undo
349 349
 					$Marine->db = null;
350 350
 				}
351 351
 				
352
-			    }
352
+				}
353
+			}
353 354
 			}
354
-		    }
355
-		    //adds the spotter LIVE data
356
-		    if ($globalDebug) {
355
+			//adds the spotter LIVE data
356
+			if ($globalDebug) {
357 357
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
358
-		    }
359
-		    $ignoreImport = false;
358
+			}
359
+			$ignoreImport = false;
360 360
 
361
-		    if (!$ignoreImport) {
361
+			if (!$ignoreImport) {
362 362
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
363 363
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
364 364
 				$timeelapsed = microtime(true);
@@ -430,22 +430,22 @@  discard block
 block discarded – undo
430 430
 			
431 431
 			
432 432
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
433
-			    if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
434
-			    $MarineLive = new MarineLive($this->db);
435
-			    $MarineLive->deleteLiveMarineDataNotUpdated();
436
-			    $MarineLive->db = null;
437
-			    //MarineLive->deleteLiveMarineData();
438
-			    if ($globalDebug) echo " Done\n";
439
-			    $this->last_delete_hourly = time();
433
+				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
434
+				$MarineLive = new MarineLive($this->db);
435
+				$MarineLive->deleteLiveMarineDataNotUpdated();
436
+				$MarineLive->db = null;
437
+				//MarineLive->deleteLiveMarineData();
438
+				if ($globalDebug) echo " Done\n";
439
+				$this->last_delete_hourly = time();
440 440
 			}
441 441
 			
442
-		    }
443
-		    //$ignoreImport = false;
442
+			}
443
+			//$ignoreImport = false;
444 444
 		}
445 445
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
446 446
 		if ($send) return $this->all_tracked[$id];
447
-	    }
447
+		}
448
+	}
448 449
 	}
449
-    }
450 450
 }
451 451
 ?>
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	
201 201
 	
202 202
 	/**
203
-	* Gets all the spotter information based on the latest data entry
204
-	*
205
-	* @return Array the spotter information
206
-	*
207
-	*/
203
+	 * Gets all the spotter information based on the latest data entry
204
+	 *
205
+	 * @return Array the spotter information
206
+	 *
207
+	 */
208 208
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
209 209
 	{
210 210
 		global $global_query;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the callsign
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the callsign
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
271 271
 	{
272 272
 		global $global_query;
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
 
379 379
 	/**
380
-	* Gets all source name
381
-	*
382
-	* @param String type format of source
383
-	* @return Array list of source name
384
-	*
385
-	*/
380
+	 * Gets all source name
381
+	 *
382
+	 * @param String type format of source
383
+	 * @return Array list of source name
384
+	 *
385
+	 */
386 386
 	public function getAllSourceName($type = '',$filters = array())
387 387
 	{
388 388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 
414 414
 	/**
415
-	* Gets a list of all idents/callsigns
416
-	*
417
-	* @return Array list of ident/callsign names
418
-	*
419
-	*/
415
+	 * Gets a list of all idents/callsigns
416
+	 *
417
+	 * @return Array list of ident/callsign names
418
+	 *
419
+	 */
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422 422
 		$filter_query = $this->getFilter($filters,true,true);
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	
485 485
 	
486 486
 	/**
487
-	* Update ident spotter data
488
-	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492
-	*
493
-	*/	
487
+	 * Update ident spotter data
488
+	 *
489
+	 * @param String $flightaware_id the ID from flightaware
490
+	 * @param String $ident the flight ident
491
+	 * @return String success or false
492
+	 *
493
+	 */	
494 494
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -508,18 +508,18 @@  discard block
 block discarded – undo
508 508
 
509 509
 	}
510 510
 	/**
511
-	* Update latest spotter data
512
-	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517
-	*
518
-	*/	
511
+	 * Update latest spotter data
512
+	 *
513
+	 * @param String $flightaware_id the ID from flightaware
514
+	 * @param String $ident the flight ident
515
+	 * @param String $arrival_airport_icao the arrival airport
516
+	 * @return String success or false
517
+	 *
518
+	 */	
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Adds a new spotter data
537
-	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561
-	*/
536
+	 * Adds a new spotter data
537
+	 *
538
+	 * @param String $flightaware_id the ID from flightaware
539
+	 * @param String $ident the flight ident
540
+	 * @param String $aircraft_icao the aircraft type
541
+	 * @param String $departure_airport_icao the departure airport
542
+	 * @param String $arrival_airport_icao the arrival airport
543
+	 * @param String $latitude latitude of flight
544
+	 * @param String $longitude latitude of flight
545
+	 * @param String $waypoints waypoints of flight
546
+	 * @param String $altitude altitude of flight
547
+	 * @param String $heading heading of flight
548
+	 * @param String $groundspeed speed of flight
549
+	 * @param String $date date of flight
550
+	 * @param String $departure_airport_time departure time of flight
551
+	 * @param String $arrival_airport_time arrival time of flight
552
+	 * @param String $squawk squawk code of flight
553
+	 * @param String $route_stop route stop of flight
554
+	 * @param String $highlight highlight or not
555
+	 * @param String $ModeS ModesS code of flight
556
+	 * @param String $registration registration code of flight
557
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
558
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
559
+	 * @param String $verticalrate vertival rate of flight
560
+	 * @return String success or false
561
+	 */
562 562
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644 644
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
645 645
 	
646
-                if ($latitude == '' && $longitude == '') {
647
-            		$latitude = 0;
648
-            		$longitude = 0;
649
-            	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
646
+				if ($latitude == '' && $longitude == '') {
647
+					$latitude = 0;
648
+					$longitude = 0;
649
+				}
650
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			$sth->execute($query_values);
661 661
 			$this->db = null;
662 662
 		} catch (PDOException $e) {
663
-		    return "error : ".$e->getMessage();
663
+			return "error : ".$e->getMessage();
664 664
 		}
665 665
 		
666 666
 		return "success";
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	
670 670
   
671 671
 	/**
672
-	* Gets the aircraft ident within the last hour
673
-	*
674
-	* @return String the ident
675
-	*
676
-	*/
672
+	 * Gets the aircraft ident within the last hour
673
+	 *
674
+	 * @return String the ident
675
+	 *
676
+	 */
677 677
 	public function getIdentFromLastHour($ident)
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
691 691
 			$query_data = array(':ident' => $ident);
692
-    		}
692
+			}
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
696
+			$ident_result='';
697 697
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	
706 706
 	/**
707
-	* Gets the aircraft data from the last 20 seconds
708
-	*
709
-	* @return Array the spotter data
710
-	*
711
-	*/
707
+	 * Gets the aircraft data from the last 20 seconds
708
+	 *
709
+	 * @return Array the spotter data
710
+	 *
711
+	 */
712 712
 	public function getRealTimeData($q = '')
713 713
 	{
714 714
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 /*
755 755
 	public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
 	
802 802
 	
803 803
 	/**
804
-	* Gets all callsigns that have flown over
805
-	*
806
-	* @return Array the callsign list
807
-	*
808
-	*/
804
+	 * Gets all callsigns that have flown over
805
+	 *
806
+	 * @return Array the callsign list
807
+	 *
808
+	 */
809 809
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
810 810
 	{
811 811
 		global $globalDBdriver;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 
874 874
 	/**
875
-	* Counts all dates
876
-	*
877
-	* @return Array the date list
878
-	*
879
-	*/
875
+	 * Counts all dates
876
+	 *
877
+	 * @return Array the date list
878
+	 *
879
+	 */
880 880
 	public function countAllDates($filters = array())
881 881
 	{
882 882
 		global $globalTimezone, $globalDBdriver;
@@ -922,11 +922,11 @@  discard block
 block discarded – undo
922 922
 	
923 923
 	
924 924
 	/**
925
-	* Counts all dates during the last 7 days
926
-	*
927
-	* @return Array the date list
928
-	*
929
-	*/
925
+	 * Counts all dates during the last 7 days
926
+	 *
927
+	 * @return Array the date list
928
+	 *
929
+	 */
930 930
 	public function countAllDatesLast7Days($filters = array())
931 931
 	{
932 932
 		global $globalTimezone, $globalDBdriver;
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 			$query .= " GROUP BY date_name 
949 949
 								ORDER BY date_name ASC";
950 950
 			$query_data = array(':offset' => $offset);
951
-    		}
951
+			}
952 952
 		
953 953
 		$sth = $this->db->prepare($query);
954 954
 		$sth->execute($query_data);
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
 	}
969 969
 
970 970
 	/**
971
-	* Counts all dates during the last month
972
-	*
973
-	* @return Array the date list
974
-	*
975
-	*/
971
+	 * Counts all dates during the last month
972
+	 *
973
+	 * @return Array the date list
974
+	 *
975
+	 */
976 976
 	public function countAllDatesLastMonth($filters = array())
977 977
 	{
978 978
 		global $globalTimezone, $globalDBdriver;
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			$query .= " GROUP BY date_name 
995 995
 								ORDER BY date_name ASC";
996 996
 			$query_data = array(':offset' => $offset);
997
-    		}
997
+			}
998 998
 		
999 999
 		$sth = $this->db->prepare($query);
1000 1000
 		$sth->execute($query_data);
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 
1018 1018
 	/**
1019
-	* Counts all month
1020
-	*
1021
-	* @return Array the month list
1022
-	*
1023
-	*/
1019
+	 * Counts all month
1020
+	 *
1021
+	 * @return Array the month list
1022
+	 *
1023
+	 */
1024 1024
 	public function countAllMonths($filters = array())
1025 1025
 	{
1026 1026
 		global $globalTimezone, $globalDBdriver;
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
 	
1066 1066
 
1067 1067
 	/**
1068
-	* Counts all dates during the last year
1069
-	*
1070
-	* @return Array the date list
1071
-	*
1072
-	*/
1068
+	 * Counts all dates during the last year
1069
+	 *
1070
+	 * @return Array the date list
1071
+	 *
1072
+	 */
1073 1073
 	public function countAllMonthsLastYear($filters)
1074 1074
 	{
1075 1075
 		global $globalTimezone, $globalDBdriver;
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			$query .= " GROUP BY year_name, month_name
1092 1092
 								ORDER BY year_name, month_name ASC";
1093 1093
 			$query_data = array(':offset' => $offset);
1094
-    		}
1094
+			}
1095 1095
 		
1096 1096
 		$sth = $this->db->prepare($query);
1097 1097
 		$sth->execute($query_data);
@@ -1114,11 +1114,11 @@  discard block
 block discarded – undo
1114 1114
 	
1115 1115
 	
1116 1116
 	/**
1117
-	* Counts all hours
1118
-	*
1119
-	* @return Array the hour list
1120
-	*
1121
-	*/
1117
+	 * Counts all hours
1118
+	 *
1119
+	 * @return Array the hour list
1120
+	 *
1121
+	 */
1122 1122
 	public function countAllHours($orderby,$filters = array())
1123 1123
 	{
1124 1124
 		global $globalTimezone, $globalDBdriver;
@@ -1181,11 +1181,11 @@  discard block
 block discarded – undo
1181 1181
 	
1182 1182
 	
1183 1183
 	/**
1184
-	* Counts all hours by date
1185
-	*
1186
-	* @return Array the hour list
1187
-	*
1188
-	*/
1184
+	 * Counts all hours by date
1185
+	 *
1186
+	 * @return Array the hour list
1187
+	 *
1188
+	 */
1189 1189
 	public function countAllHoursByDate($date, $filters = array())
1190 1190
 	{
1191 1191
 		global $globalTimezone, $globalDBdriver;
@@ -1229,11 +1229,11 @@  discard block
 block discarded – undo
1229 1229
 	
1230 1230
 	
1231 1231
 	/**
1232
-	* Counts all hours by a ident/callsign
1233
-	*
1234
-	* @return Array the hour list
1235
-	*
1236
-	*/
1232
+	 * Counts all hours by a ident/callsign
1233
+	 *
1234
+	 * @return Array the hour list
1235
+	 *
1236
+	 */
1237 1237
 	public function countAllHoursByIdent($ident, $filters = array())
1238 1238
 	{
1239 1239
 		global $globalTimezone, $globalDBdriver;
@@ -1278,11 +1278,11 @@  discard block
 block discarded – undo
1278 1278
 	
1279 1279
 	
1280 1280
 	/**
1281
-	* Counts all flights that have flown over
1282
-	*
1283
-	* @return Integer the number of flights
1284
-	*
1285
-	*/
1281
+	 * Counts all flights that have flown over
1282
+	 *
1283
+	 * @return Integer the number of flights
1284
+	 *
1285
+	 */
1286 1286
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1287 1287
 	{
1288 1288
 		global $globalDBdriver;
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
 	
1318 1318
   
1319 1319
 	/**
1320
-	* Counts all hours of today
1321
-	*
1322
-	* @return Array the hour list
1323
-	*
1324
-	*/
1320
+	 * Counts all hours of today
1321
+	 *
1322
+	 * @return Array the hour list
1323
+	 *
1324
+	 */
1325 1325
 	public function countAllHoursFromToday($filters = array())
1326 1326
 	{
1327 1327
 		global $globalTimezone, $globalDBdriver;
@@ -1361,12 +1361,12 @@  discard block
 block discarded – undo
1361 1361
 	}
1362 1362
     
1363 1363
     
1364
-     /**
1365
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1366
-	*
1367
-	* @return Integer the Barrie Spotter ID
1364
+	 /**
1365
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1366
+	  *
1367
+	  * @return Integer the Barrie Spotter ID
1368 1368
 q	*
1369
-	*/
1369
+	  */
1370 1370
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1371 1371
 	{
1372 1372
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1387,13 +1387,13 @@  discard block
 block discarded – undo
1387 1387
   
1388 1388
  
1389 1389
 	/**
1390
-	* Parses a date string
1391
-	*
1392
-	* @param String $dateString the date string
1393
-	* @param String $timezone the timezone of a user
1394
-	* @return Array the time information
1395
-	*
1396
-	*/
1390
+	 * Parses a date string
1391
+	 *
1392
+	 * @param String $dateString the date string
1393
+	 * @param String $timezone the timezone of a user
1394
+	 * @return Array the time information
1395
+	 *
1396
+	 */
1397 1397
 	public function parseDateString($dateString, $timezone = '')
1398 1398
 	{
1399 1399
 		$time_array = array();
@@ -1426,12 +1426,12 @@  discard block
 block discarded – undo
1426 1426
 	}
1427 1427
 	
1428 1428
 	/**
1429
-	* Parses the direction degrees to working
1430
-	*
1431
-	* @param Float $direction the direction in degrees
1432
-	* @return Array the direction information
1433
-	*
1434
-	*/
1429
+	 * Parses the direction degrees to working
1430
+	 *
1431
+	 * @param Float $direction the direction in degrees
1432
+	 * @return Array the direction information
1433
+	 *
1434
+	 */
1435 1435
 	public function parseDirection($direction = 0)
1436 1436
 	{
1437 1437
 		if ($direction == '') $direction = 0;
@@ -1510,12 +1510,12 @@  discard block
 block discarded – undo
1510 1510
 	
1511 1511
 	
1512 1512
 	/**
1513
-	* Gets Country from latitude/longitude
1514
-	*
1515
-	* @param Float $latitude latitute of the flight
1516
-	* @param Float $longitude longitute of the flight
1517
-	* @return String the countrie
1518
-	*/
1513
+	 * Gets Country from latitude/longitude
1514
+	 *
1515
+	 * @param Float $latitude latitute of the flight
1516
+	 * @param Float $longitude longitute of the flight
1517
+	 * @return String the countrie
1518
+	 */
1519 1519
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1520 1520
 	{
1521 1521
 		global $globalDBdriver, $globalDebug;
@@ -1552,11 +1552,11 @@  discard block
 block discarded – undo
1552 1552
 	}
1553 1553
 
1554 1554
 	/**
1555
-	* Gets Country from iso2
1556
-	*
1557
-	* @param String $iso2 ISO2 country code
1558
-	* @return String the countrie
1559
-	*/
1555
+	 * Gets Country from iso2
1556
+	 *
1557
+	 * @param String $iso2 ISO2 country code
1558
+	 * @return String the countrie
1559
+	 */
1560 1560
 	public function getCountryFromISO2($iso2)
1561 1561
 	{
1562 1562
 		global $globalDBdriver, $globalDebug;
@@ -1585,12 +1585,12 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets the short url from bit.ly
1589
-	*
1590
-	* @param String $url the full url
1591
-	* @return String the bit.ly url
1592
-	*
1593
-	*/
1588
+	 * Gets the short url from bit.ly
1589
+	 *
1590
+	 * @param String $url the full url
1591
+	 * @return String the bit.ly url
1592
+	 *
1593
+	 */
1594 1594
 	public function getBitlyURL($url)
1595 1595
 	{
1596 1596
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +353 added lines, -353 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 
11 11
 class SpotterImport {
12
-    private $all_flights = array();
13
-    private $last_delete_hourly = 0;
14
-    private $last_delete = 0;
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_location = array();
18
-    public $db = null;
19
-    public $nb = 0;
20
-
21
-    public function __construct($dbc = null) {
12
+	private $all_flights = array();
13
+	private $last_delete_hourly = 0;
14
+	private $last_delete = 0;
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_location = array();
18
+	public $db = null;
19
+	public $nb = 0;
20
+
21
+	public function __construct($dbc = null) {
22 22
 	global $globalBeta;
23 23
 	$Connection = new Connection($dbc);
24 24
 	$this->db = $Connection->db();
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	$currentdate = date('Y-m-d');
30 30
 	$sourcestat = $Stats->getStatsSource($currentdate);
31 31
 	if (!empty($sourcestat)) {
32
-	    foreach($sourcestat as $srcst) {
33
-	    	$type = $srcst['stats_type'];
32
+		foreach($sourcestat as $srcst) {
33
+			$type = $srcst['stats_type'];
34 34
 		if ($type == 'polar' || $type == 'hist') {
35
-		    $source = $srcst['source_name'];
36
-		    $data = $srcst['source_data'];
37
-		    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
-	        }
39
-	    }
35
+			$source = $srcst['source_name'];
36
+			$data = $srcst['source_data'];
37
+			$this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
+			}
39
+		}
40
+	}
40 41
 	}
41
-    }
42 42
 
43
-    public function get_Schedule($id,$ident) {
43
+	public function get_Schedule($id,$ident) {
44 44
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
45 45
 	// Get schedule here, so it's done only one time
46 46
 	
@@ -60,42 +60,42 @@  discard block
 block discarded – undo
60 60
 	$operator = $Spotter->getOperator($ident);
61 61
 	$scheduleexist = false;
62 62
 	if ($Schedule->checkSchedule($operator) == 0) {
63
-	    $operator = $Translation->checkTranslation($ident);
64
-	    if ($Schedule->checkSchedule($operator) == 0) {
63
+		$operator = $Translation->checkTranslation($ident);
64
+		if ($Schedule->checkSchedule($operator) == 0) {
65 65
 		$schedule = $Schedule->fetchSchedule($operator);
66 66
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
67
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
68
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
69
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
70
-		    // Should also check if route schedule = route from DB
71
-		    if ($schedule['DepartureAirportIATA'] != '') {
67
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
68
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
69
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
70
+			// Should also check if route schedule = route from DB
71
+			if ($schedule['DepartureAirportIATA'] != '') {
72 72
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
73
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
74
-			    if (trim($airport_icao) != '') {
73
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
74
+				if (trim($airport_icao) != '') {
75 75
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
76 76
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
77
-			    }
77
+				}
78
+			}
78 79
 			}
79
-		    }
80
-		    if ($schedule['ArrivalAirportIATA'] != '') {
80
+			if ($schedule['ArrivalAirportIATA'] != '') {
81 81
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
82
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
83
-			    if (trim($airport_icao) != '') {
82
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
83
+				if (trim($airport_icao) != '') {
84 84
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
85 85
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
86
-			    }
86
+				}
87
+			}
87 88
 			}
88
-		    }
89
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
89
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
90 90
 		}
91
-	    } else $scheduleexist = true;
91
+		} else $scheduleexist = true;
92 92
 	} else $scheduleexist = true;
93 93
 	// close connection, at least one way will work ?
94
-       if ($scheduleexist) {
94
+	   if ($scheduleexist) {
95 95
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
96
-    		$sch = $Schedule->getSchedule($operator);
96
+			$sch = $Schedule->getSchedule($operator);
97 97
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
98
-       }
98
+	   }
99 99
 	$Spotter->db = null;
100 100
 	$Schedule->db = null;
101 101
 	$Translation->db = null;
@@ -110,92 +110,92 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 	  */
112 112
 	}
113
-    }
113
+	}
114 114
 
115
-    public function checkAll() {
115
+	public function checkAll() {
116 116
 	global $globalDebug;
117 117
 	if ($globalDebug) echo "Update last seen flights data...\n";
118 118
 	foreach ($this->all_flights as $key => $flight) {
119
-	    if (isset($this->all_flights[$key]['id'])) {
119
+		if (isset($this->all_flights[$key]['id'])) {
120 120
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
121
-    		$Spotter = new Spotter($this->db);
122
-        	$real_arrival = $this->arrival($key);
123
-        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
124
-            }
121
+			$Spotter = new Spotter($this->db);
122
+			$real_arrival = $this->arrival($key);
123
+			$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
124
+			}
125
+	}
125 126
 	}
126
-    }
127 127
 
128
-    public function arrival($key) {
128
+	public function arrival($key) {
129 129
 	global $globalClosestMinDist, $globalDebug;
130 130
 	if ($globalDebug) echo 'Update arrival...'."\n";
131 131
 	$Spotter = new Spotter($this->db);
132
-        $airport_icao = '';
133
-        $airport_time = '';
134
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
132
+		$airport_icao = '';
133
+		$airport_time = '';
134
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
135 135
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
136
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
137
-    	    if (isset($closestAirports[0])) {
138
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
139
-        	    $airport_icao = $closestAirports[0]['icao'];
140
-        	    $airport_time = $this->all_flights[$key]['datetime'];
141
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
142
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
143
-        	    foreach ($closestAirports as $airport) {
144
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
145
-        		    $airport_icao = $airport['icao'];
146
-        		    $airport_time = $this->all_flights[$key]['datetime'];
147
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
148
-        		    break;
149
-        		}
150
-        	    }
151
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
152
-        		$airport_icao = $closestAirports[0]['icao'];
153
-        		$airport_time = $this->all_flights[$key]['datetime'];
154
-        	} else {
155
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
156
-        	}
157
-    	    } else {
158
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
159
-    	    }
160
-
161
-        } else {
162
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
163
-        }
164
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
165
-    }
166
-
167
-
168
-
169
-    public function del() {
136
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
137
+			if (isset($closestAirports[0])) {
138
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
139
+				$airport_icao = $closestAirports[0]['icao'];
140
+				$airport_time = $this->all_flights[$key]['datetime'];
141
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
142
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
143
+				foreach ($closestAirports as $airport) {
144
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
145
+					$airport_icao = $airport['icao'];
146
+					$airport_time = $this->all_flights[$key]['datetime'];
147
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
148
+					break;
149
+				}
150
+				}
151
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
152
+				$airport_icao = $closestAirports[0]['icao'];
153
+				$airport_time = $this->all_flights[$key]['datetime'];
154
+			} else {
155
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
156
+			}
157
+			} else {
158
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
159
+			}
160
+
161
+		} else {
162
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
163
+		}
164
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
165
+	}
166
+
167
+
168
+
169
+	public function del() {
170 170
 	global $globalDebug;
171 171
 	// Delete old infos
172 172
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
173 173
 	foreach ($this->all_flights as $key => $flight) {
174
-    	    if (isset($flight['lastupdate'])) {
175
-        	if ($flight['lastupdate'] < (time()-3000)) {
176
-            	    if (isset($this->all_flights[$key]['id'])) {
177
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
174
+			if (isset($flight['lastupdate'])) {
175
+			if ($flight['lastupdate'] < (time()-3000)) {
176
+					if (isset($this->all_flights[$key]['id'])) {
177
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
178 178
 			/*
179 179
 			$SpotterLive = new SpotterLive();
180 180
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
181 181
 			$SpotterLive->db = null;
182 182
 			*/
183
-            		$real_arrival = $this->arrival($key);
184
-            		$Spotter = new Spotter($this->db);
185
-            		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
183
+					$real_arrival = $this->arrival($key);
184
+					$Spotter = new Spotter($this->db);
185
+					if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
186 186
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
187 187
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
188 188
 			}
189 189
 			// Put in archive
190 190
 //			$Spotter->db = null;
191
-            	    }
192
-            	    unset($this->all_flights[$key]);
193
-    	        }
194
-	    }
195
-        }
196
-    }
197
-
198
-    public function add($line) {
191
+					}
192
+					unset($this->all_flights[$key]);
193
+				}
194
+		}
195
+		}
196
+	}
197
+
198
+	public function add($line) {
199 199
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights;
200 200
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
201 201
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
 	
221 221
 	// SBS format is CSV format
222 222
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
223
-	    //print_r($line);
224
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
223
+		//print_r($line);
224
+  		if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
225 225
 
226 226
 		// Increment message number
227 227
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
228
-		    $current_date = date('Y-m-d');
229
-		    $source = $line['source_name'];
230
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
231
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
232
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
233
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
234
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
228
+			$current_date = date('Y-m-d');
229
+			$source = $line['source_name'];
230
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
231
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
232
+				$this->stats[$current_date][$source]['msg']['date'] = time();
233
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
234
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
235 235
 		}
236 236
 		
237 237
 		/*
@@ -247,34 +247,34 @@  discard block
 block discarded – undo
247 247
 		//$this->db = $dbc;
248 248
 
249 249
 		//$hex = trim($line['hex']);
250
-	        if (!isset($line['id'])) $id = trim($line['hex']);
251
-	        else $id = trim($line['id']);
250
+			if (!isset($line['id'])) $id = trim($line['hex']);
251
+			else $id = trim($line['id']);
252 252
 		
253 253
 		if (!isset($this->all_flights[$id])) {
254
-		    $this->all_flights[$id] = array();
255
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
256
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
257
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
258
-		    if (!isset($line['id'])) {
254
+			$this->all_flights[$id] = array();
255
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
256
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
257
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
258
+			if (!isset($line['id'])) {
259 259
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
260 260
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
261 261
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
262 262
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
263
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
264
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
265
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
263
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
264
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
265
+			if ($globalAllFlights !== FALSE) $dataFound = true;
266 266
 		}
267 267
 		if (isset($line['source_type']) && $line['source_type'] != '') {
268
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
268
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
269 269
 		}
270 270
 		
271 271
 		//print_r($this->all_flights);
272 272
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
273
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
274
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
273
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
274
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
275 275
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
276
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
277
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
276
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
277
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
278 278
 			$timeelapsed = microtime(true);
279 279
 			$Spotter = new Spotter($this->db);
280 280
 			if (isset($this->all_flights[$id]['source_type'])) {
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			$Spotter->db = null;
286 286
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
287 287
 			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
288
-		    }
289
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
290
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
288
+			}
289
+			if ($globalAllFlights !== FALSE) $dataFound = true;
290
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
291 291
 		}
292 292
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
293 293
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 		}
312 312
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
313 313
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) {
314
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
314
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
315 315
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
316
-		    } else {
316
+			} else {
317 317
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
318 318
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
319 319
 				/*
@@ -322,41 +322,41 @@  discard block
 block discarded – undo
322 322
 				print_r($line);
323 323
 				*/
324 324
 				return '';
325
-		    }
325
+			}
326 326
 		} else {
327 327
 			date_default_timezone_set('UTC');
328 328
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
329 329
 		}
330 330
 
331 331
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
332
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
332
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
333 333
 		}
334 334
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
335
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
335
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
336 336
 		}
337 337
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
338
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
338
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
339 339
 		}
340 340
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
341
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
341
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
342 342
 		}
343 343
  
344 344
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
345
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
346
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
345
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
346
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
347 347
 			$timeelapsed = microtime(true);
348
-            		$Spotter = new Spotter($this->db);
349
-            		$fromsource = NULL;
350
-            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
351
-            		elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
348
+					$Spotter = new Spotter($this->db);
349
+					$fromsource = NULL;
350
+					if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
351
+					elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
352 352
 			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
353 353
 			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
354 354
 			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
355
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
355
+					$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
356 356
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
357 357
 			$Spotter->db = null;
358 358
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
359
-		    }
359
+			}
360 360
 
361 361
 /*
362 362
 		    if (!isset($line['id'])) {
@@ -366,26 +366,26 @@  discard block
 block discarded – undo
366 366
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
367 367
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
368 368
   */
369
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
369
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
370 370
 
371
-		    //$putinarchive = true;
372
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
371
+			//$putinarchive = true;
372
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
373 373
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
374
-		    }
375
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
374
+			}
375
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
376 376
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
377
-		    }
378
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
379
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
380
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
377
+			}
378
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
379
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
380
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
381 381
 				$timeelapsed = microtime(true);
382 382
 				$Spotter = new Spotter($this->db);
383 383
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
384 384
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
385
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
385
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
386 386
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
387 387
 
388
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
388
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
389 389
 			$timeelapsed = microtime(true);
390 390
 			$Spotter = new Spotter($this->db);
391 391
 			$route = $Spotter->getRouteInfo(trim($line['ident']));
@@ -399,43 +399,43 @@  discard block
 block discarded – undo
399 399
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
400 400
 
401 401
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
402
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
403
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
402
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
403
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
404 404
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
405
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
406
-		    	    }
405
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
406
+					}
407 407
 			}
408 408
 			if (!isset($globalFork)) $globalFork = TRUE;
409 409
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
410 410
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
411 411
 			}
412
-		    }
412
+			}
413 413
 		}
414 414
 
415 415
 		if (isset($line['speed']) && $line['speed'] != '') {
416 416
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
417
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
418
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
419
-		    //$dataFound = true;
417
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
418
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
419
+			//$dataFound = true;
420 420
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
421
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
422
-		    if ($distance > 1000 && $distance < 10000) {
423
-		    // use datetime
421
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
422
+			if ($distance > 1000 && $distance < 10000) {
423
+			// use datetime
424 424
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
425 425
 			$speed = $speed*3.6;
426 426
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
427 427
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
428
-		    }
428
+			}
429 429
 		}
430 430
 
431 431
 
432 432
 
433
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
434
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
435
-	    	    else unset($timediff);
436
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
433
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
434
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
435
+				else unset($timediff);
436
+				if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
437 437
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
438
-			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
438
+				if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
439 439
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
440 440
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
441 441
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -449,16 +449,16 @@  discard block
 block discarded – undo
449 449
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
450 450
 				$this->tmd = 0;
451 451
 				if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
452
-			    }
452
+				}
453 453
 			}
454 454
 
455 455
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
456
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
456
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
457 457
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
458 458
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
459
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
460
-				    $dataFound = true;
461
-				    $this->all_flights[$id]['time_last_coord'] = time();
459
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
460
+					$dataFound = true;
461
+					$this->all_flights[$id]['time_last_coord'] = time();
462 462
 				}
463 463
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
464 464
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -469,20 +469,20 @@  discard block
 block discarded – undo
469 469
 				    //$putinarchive = true;
470 470
 				}
471 471
 				*/
472
-			    /*
472
+				/*
473 473
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
474 474
 				if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n";
475 475
 			    }
476 476
 			    */
477 477
 			}
478 478
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
479
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
480
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
479
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
480
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
481 481
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
482 482
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
483
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
484
-				    $dataFound = true;
485
-				    $this->all_flights[$id]['time_last_coord'] = time();
483
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
484
+					$dataFound = true;
485
+					$this->all_flights[$id]['time_last_coord'] = time();
486 486
 				}
487 487
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
488 488
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -500,54 +500,54 @@  discard block
 block discarded – undo
500 500
 			    */
501 501
 			}
502 502
 
503
-		    } else if ($globalDebug && $timediff > 20) {
503
+			} else if ($globalDebug && $timediff > 20) {
504 504
 			$this->tmd = $this->tmd + 1;
505 505
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
506 506
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
507 507
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
508 508
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
509
-		    }
509
+			}
510 510
 		}
511 511
 		if (isset($line['last_update']) && $line['last_update'] != '') {
512
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
513
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
512
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
513
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
514 514
 		}
515 515
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
516
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
517
-		    //$dataFound = true;
516
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
517
+			//$dataFound = true;
518 518
 		}
519 519
 		if (isset($line['format_source']) && $line['format_source'] != '') {
520
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
520
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
521 521
 		}
522 522
 		if (isset($line['source_name']) && $line['source_name'] != '') {
523
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
523
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
524 524
 		}
525 525
 		if (isset($line['emergency']) && $line['emergency'] != '') {
526
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
527
-		    //$dataFound = true;
526
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
527
+			//$dataFound = true;
528 528
 		}
529 529
 		if (isset($line['ground']) && $line['ground'] != '') {
530
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
530
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
531 531
 			// Here we force archive of flight because after ground it's a new one (or should be)
532 532
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
533 533
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
534 534
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
535
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
535
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
536 536
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
537
-		    }
538
-		    if ($line['ground'] != 1) $line['ground'] = 0;
539
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
540
-		    //$dataFound = true;
537
+			}
538
+			if ($line['ground'] != 1) $line['ground'] = 0;
539
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
540
+			//$dataFound = true;
541 541
 		}
542 542
 		if (isset($line['squawk']) && $line['squawk'] != '') {
543
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
544
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
545
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
546
-			    $highlight = '';
547
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
548
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
549
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
550
-			    if ($highlight != '') {
543
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
544
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
545
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
546
+				$highlight = '';
547
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
548
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
549
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
550
+				if ($highlight != '') {
551 551
 				$timeelapsed = microtime(true);
552 552
 				$Spotter = new Spotter($this->db);
553 553
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
@@ -556,38 +556,38 @@  discard block
 block discarded – undo
556 556
 
557 557
 				//$putinarchive = true;
558 558
 				//$highlight = '';
559
-			    }
559
+				}
560 560
 			    
561
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
562
-		    //$dataFound = true;
561
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
562
+			//$dataFound = true;
563 563
 		}
564 564
 
565 565
 		if (isset($line['altitude']) && $line['altitude'] != '') {
566
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
566
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
567 567
 			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
568 568
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
569 569
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
570 570
 			//$dataFound = true;
571
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
571
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
572 572
   		}
573 573
 
574 574
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
575
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
575
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
576 576
 		}
577 577
 		
578 578
 		if (isset($line['heading']) && $line['heading'] != '') {
579
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
580
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
581
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
582
-		    //$dataFound = true;
579
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
580
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
581
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
582
+			//$dataFound = true;
583 583
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
584
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
585
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
586
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
587
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
584
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
585
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
586
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
587
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
588 588
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
589
-  		    // If not enough messages and ACARS set heading to 0
590
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
589
+  			// If not enough messages and ACARS set heading to 0
590
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
591 591
   		}
592 592
 		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
593 593
 		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -598,119 +598,119 @@  discard block
 block discarded – undo
598 598
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
599 599
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
600 600
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
601
-		    $this->all_flights[$id]['lastupdate'] = time();
602
-		    if ($this->all_flights[$id]['addedSpotter'] == 0) {
603
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
604
-			    //print_r($this->all_flights);
605
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
606
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
607
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
601
+			$this->all_flights[$id]['lastupdate'] = time();
602
+			if ($this->all_flights[$id]['addedSpotter'] == 0) {
603
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
604
+				//print_r($this->all_flights);
605
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
606
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
607
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
608 608
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
609 609
 				$timeelapsed = microtime(true);
610 610
 				$SpotterLive = new SpotterLive($this->db);
611 611
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
612
-				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
613
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
612
+					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
613
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
614 614
 				} elseif (isset($line['id'])) {
615
-				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
616
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
615
+					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
616
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
617 617
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
618
-				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
619
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
618
+					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
619
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
620 620
 				} else $recent_ident = '';
621 621
 				$SpotterLive->db=null;
622 622
 
623 623
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
624 624
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
625
-			    } else {
625
+				} else {
626 626
 				$recent_ident = '';
627 627
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
628
-			    }
629
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
630
-			    if($recent_ident == "")
631
-			    {
628
+				}
629
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
630
+				if($recent_ident == "")
631
+				{
632 632
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
633 633
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
634 634
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
635 635
 				//adds the spotter data for the archive
636 636
 				$ignoreImport = false;
637 637
 				foreach($globalAirportIgnore as $airportIgnore) {
638
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
638
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
639 639
 					$ignoreImport = true;
640
-				    }
640
+					}
641 641
 				}
642 642
 				if (count($globalAirportAccept) > 0) {
643
-				    $ignoreImport = true;
644
-				    foreach($globalAirportIgnore as $airportIgnore) {
643
+					$ignoreImport = true;
644
+					foreach($globalAirportIgnore as $airportIgnore) {
645 645
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
646
-					    $ignoreImport = false;
646
+						$ignoreImport = false;
647
+					}
647 648
 					}
648
-				    }
649 649
 				}
650 650
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
651
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
651
+					foreach($globalAirlineIgnore as $airlineIgnore) {
652 652
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
653
-					    $ignoreImport = true;
653
+						$ignoreImport = true;
654
+					}
654 655
 					}
655
-				    }
656 656
 				}
657 657
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
658
-				    $ignoreImport = true;
659
-				    foreach($globalAirlineAccept as $airlineAccept) {
658
+					$ignoreImport = true;
659
+					foreach($globalAirlineAccept as $airlineAccept) {
660 660
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
661
-					    $ignoreImport = false;
661
+						$ignoreImport = false;
662
+					}
662 663
 					}
663
-				    }
664 664
 				}
665 665
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
666
-				    $ignoreImport = true;
667
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
666
+					$ignoreImport = true;
667
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
668 668
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
669
-					    $ignoreImport = false;
669
+						$ignoreImport = false;
670
+					}
670 671
 					}
671
-				    }
672 672
 				}
673 673
 				
674 674
 				if (!$ignoreImport) {
675
-				    $highlight = '';
676
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
677
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
678
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
679
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
680
-				    $timeelapsed = microtime(true);
681
-				    $Spotter = new Spotter($this->db);
682
-				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
683
-				    $Spotter->db = null;
684
-				    if ($globalDebug && isset($result)) echo $result."\n";
685
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
675
+					$highlight = '';
676
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
677
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
678
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
679
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
680
+					$timeelapsed = microtime(true);
681
+					$Spotter = new Spotter($this->db);
682
+					$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
683
+					$Spotter->db = null;
684
+					if ($globalDebug && isset($result)) echo $result."\n";
685
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
686 686
 				    
687
-				    // Add source stat in DB
688
-				    $Stats = new Stats($this->db);
689
-				    if (!empty($this->stats)) {
687
+					// Add source stat in DB
688
+					$Stats = new Stats($this->db);
689
+					if (!empty($this->stats)) {
690 690
 					if ($globalDebug) echo 'Add source stats : ';
691
-				        foreach($this->stats as $date => $data) {
692
-					    foreach($data as $source => $sourced) {
693
-					        //print_r($sourced);
694
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
695
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
696
-				    		if (isset($sourced['msg'])) {
697
-				    		    if (time() - $sourced['msg']['date'] > 10) {
698
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
699
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
700
-			    			        unset($this->stats[$date][$source]['msg']);
701
-			    			    }
702
-			    			}
703
-			    		    }
704
-			    		    if ($date != date('Y-m-d')) {
705
-			    			unset($this->stats[$date]);
706
-			    		    }
707
-				    	}
708
-				    	if ($globalDebug) echo 'Done'."\n";
709
-
710
-				    }
711
-				    $Stats->db = null;
691
+						foreach($this->stats as $date => $data) {
692
+						foreach($data as $source => $sourced) {
693
+							//print_r($sourced);
694
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
695
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
696
+							if (isset($sourced['msg'])) {
697
+								if (time() - $sourced['msg']['date'] > 10) {
698
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
699
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
700
+									unset($this->stats[$date][$source]['msg']);
701
+								}
702
+							}
703
+							}
704
+							if ($date != date('Y-m-d')) {
705
+							unset($this->stats[$date]);
706
+							}
707
+						}
708
+						if ($globalDebug) echo 'Done'."\n";
709
+
710
+					}
711
+					$Stats->db = null;
712 712
 				    
713
-				    $this->del();
713
+					$this->del();
714 714
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
715 715
 				//$ignoreImport = false;
716 716
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -728,18 +728,18 @@  discard block
 block discarded – undo
728 728
 			*/
729 729
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
730 730
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
731
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
732
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
733
-				    $SpotterLive = new SpotterLive($this->db);
734
-				    $SpotterLive->deleteLiveSpotterData();
735
-				    $SpotterLive->db=null;
736
-				    if ($globalDebug) echo " Done\n";
737
-				    $this->last_delete = time();
731
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
732
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
733
+					$SpotterLive = new SpotterLive($this->db);
734
+					$SpotterLive->deleteLiveSpotterData();
735
+					$SpotterLive->db=null;
736
+					if ($globalDebug) echo " Done\n";
737
+					$this->last_delete = time();
738 738
 				}
739
-			    } else {
739
+				} else {
740 740
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
741
-				    $this->all_flights[$id]['id'] = $recent_ident;
742
-				    $this->all_flights[$id]['addedSpotter'] = 1;
741
+					$this->all_flights[$id]['id'] = $recent_ident;
742
+					$this->all_flights[$id]['addedSpotter'] = 1;
743 743
 				}
744 744
 				if (isset($globalDaemon) && !$globalDaemon) {
745 745
 					$Spotter = new Spotter($this->db);
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 					$Spotter->db = null;
748 748
 				}
749 749
 				
750
-			    }
750
+				}
751 751
 			}
752
-		    }
753
-		    //adds the spotter LIVE data
754
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
755
-		    //echo "\nAdd in Live !! \n";
756
-		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
757
-		    if ($globalDebug) {
752
+			}
753
+			//adds the spotter LIVE data
754
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
755
+			//echo "\nAdd in Live !! \n";
756
+			//echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
757
+			if ($globalDebug) {
758 758
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
759 759
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
760 760
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
@@ -762,49 +762,49 @@  discard block
 block discarded – undo
762 762
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
763 763
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
764 764
 			}
765
-		    }
766
-		    $ignoreImport = false;
767
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
768
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
765
+			}
766
+			$ignoreImport = false;
767
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
768
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
769 769
 
770
-		    foreach($globalAirportIgnore as $airportIgnore) {
771
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
772
-			    $ignoreImport = true;
770
+			foreach($globalAirportIgnore as $airportIgnore) {
771
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
772
+				$ignoreImport = true;
773
+			}
773 774
 			}
774
-		    }
775
-		    if (count($globalAirportAccept) > 0) {
776
-		        $ignoreImport = true;
777
-		        foreach($globalAirportIgnore as $airportIgnore) {
778
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
775
+			if (count($globalAirportAccept) > 0) {
776
+				$ignoreImport = true;
777
+				foreach($globalAirportIgnore as $airportIgnore) {
778
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
779 779
 				$ignoreImport = false;
780
-			    }
780
+				}
781 781
 			}
782
-		    }
783
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
782
+			}
783
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
784 784
 			foreach($globalAirlineIgnore as $airlineIgnore) {
785
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
785
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
786 786
 				$ignoreImport = true;
787
-			    }
787
+				}
788 788
 			}
789
-		    }
790
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
789
+			}
790
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
791 791
 			$ignoreImport = true;
792 792
 			foreach($globalAirlineAccept as $airlineAccept) {
793
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
793
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
794 794
 				$ignoreImport = false;
795
-			    }
795
+				}
796 796
 			}
797
-		    }
798
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
797
+			}
798
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
799 799
 			$ignoreImport = true;
800 800
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
801
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
802
-			        $ignoreImport = false;
803
-			    }
801
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
802
+					$ignoreImport = false;
803
+				}
804
+			}
804 805
 			}
805
-		    }
806 806
 
807
-		    if (!$ignoreImport) {
807
+			if (!$ignoreImport) {
808 808
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
809 809
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
810 810
 				$timeelapsed = microtime(true);
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 					if ($stats_heading == 16) $stats_heading = 0;
844 844
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
845 845
 						for ($i=0;$i<=15;$i++) {
846
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
846
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
847 847
 						}
848 848
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
849 849
 					} else {
@@ -856,11 +856,11 @@  discard block
 block discarded – undo
856 856
 					//var_dump($this->stats);
857 857
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
858 858
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
859
-						    end($this->stats[$current_date][$source]['hist']);
860
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
859
+							end($this->stats[$current_date][$source]['hist']);
860
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
861 861
 						} else $mini = 0;
862 862
 						for ($i=$mini;$i<=$distance;$i+=10) {
863
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
863
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
864 864
 						}
865 865
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
866 866
 					} else {
@@ -877,22 +877,22 @@  discard block
 block discarded – undo
877 877
 			
878 878
 			
879 879
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
880
-			    if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
881
-			    $SpotterLive = new SpotterLive($this->db);
882
-			    $SpotterLive->deleteLiveSpotterDataNotUpdated();
883
-			    $SpotterLive->db = null;
884
-			    //SpotterLive->deleteLiveSpotterData();
885
-			    if ($globalDebug) echo " Done\n";
886
-			    $this->last_delete_hourly = time();
880
+				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
881
+				$SpotterLive = new SpotterLive($this->db);
882
+				$SpotterLive->deleteLiveSpotterDataNotUpdated();
883
+				$SpotterLive->db = null;
884
+				//SpotterLive->deleteLiveSpotterData();
885
+				if ($globalDebug) echo " Done\n";
886
+				$this->last_delete_hourly = time();
887 887
 			}
888 888
 			
889
-		    }
890
-		    //$ignoreImport = false;
889
+			}
890
+			//$ignoreImport = false;
891 891
 		}
892 892
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
893 893
 		if ($send) return $this->all_flights[$id];
894
-	    }
894
+		}
895
+	}
895 896
 	}
896
-    }
897 897
 }
898 898
 ?>
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Indentation   +188 added lines, -188 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, $globalDBdriver;
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 getLiveTrackerData($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 getMinLiveTrackerData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Gets Minimal Live Spotter data since xx seconds
174
-	*
175
-	* @return Array the spotter information
176
-	*
177
-	*/
173
+	 * Gets Minimal Live Spotter data since xx seconds
174
+	 *
175
+	 * @return Array the spotter information
176
+	 *
177
+	 */
178 178
 	public function getMinLastLiveTrackerData($filter = array())
179 179
 	{
180 180
 		global $globalDBdriver, $globalLiveInterval;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 188
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190
-                } else {
190
+				} else {
191 191
 			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
192 192
 			FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
195 195
 
196
-    		try {
196
+			try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199 199
 		} catch(PDOException $e) {
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	/**
208
-	* Gets number of latest data entry
209
-	*
210
-	* @return String number of entry
211
-	*
212
-	*/
208
+	 * Gets number of latest data entry
209
+	 *
210
+	 * @return String number of entry
211
+	 *
212
+	 */
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	* Gets all the spotter information based on the latest data entry and coord
238
-	*
239
-	* @return Array the spotter information
240
-	*
241
-	*/
237
+	 * Gets all the spotter information based on the latest data entry and coord
238
+	 *
239
+	 * @return Array the spotter information
240
+	 *
241
+	 */
242 242
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
243 243
 	{
244 244
 		global $globalDBdriver, $globalLiveInterval;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on a user's latitude and longitude
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on a user's latitude and longitude
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
271 271
 	{
272 272
 		$Tracker = new Tracker($this->db);
@@ -279,142 +279,142 @@  discard block
 block discarded – undo
279 279
 		if ($lng != '')
280 280
 		{
281 281
 			if (!is_numeric($lng))
282
-                        {
283
-                                return false;
284
-                        }
285
-                }
286
-
287
-                if ($radius != '')
288
-                {
289
-                        if (!is_numeric($radius))
290
-                        {
291
-                                return false;
292
-                        }
293
-                }
282
+						{
283
+								return false;
284
+						}
285
+				}
286
+
287
+				if ($radius != '')
288
+				{
289
+						if (!is_numeric($radius))
290
+						{
291
+								return false;
292
+						}
293
+				}
294 294
 		$additional_query = '';
295 295
 		if ($interval != '')
296
-                {
297
-                        if (!is_string($interval))
298
-                        {
299
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
300
-			        return false;
301
-                        } else {
302
-                if ($interval == '1m')
303
-                {
304
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
305
-                } else if ($interval == '15m'){
306
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
307
-                } 
308
-            }
309
-                } else {
310
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
311
-        }
312
-
313
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
296
+				{
297
+						if (!is_string($interval))
298
+						{
299
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
300
+					return false;
301
+						} else {
302
+				if ($interval == '1m')
303
+				{
304
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
305
+				} else if ($interval == '15m'){
306
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
307
+				} 
308
+			}
309
+				} else {
310
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
311
+		}
312
+
313
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
314 314
                    WHERE tracker_live.latitude <> '' 
315 315
                                    AND tracker_live.longitude <> '' 
316 316
                    ".$additional_query."
317 317
                    HAVING distance < :radius  
318 318
                                    ORDER BY distance";
319 319
 
320
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
320
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
321 321
 
322
-                return $spotter_array;
323
-        }
322
+				return $spotter_array;
323
+		}
324 324
 
325 325
     
326
-        /**
327
-	* Gets all the spotter information based on a particular callsign
328
-	*
329
-	* @return Array the spotter information
330
-	*
331
-	*/
326
+		/**
327
+		 * Gets all the spotter information based on a particular callsign
328
+		 *
329
+		 * @return Array the spotter information
330
+		 *
331
+		 */
332 332
 	public function getLastLiveTrackerDataByIdent($ident)
333 333
 	{
334 334
 		$Tracker = new Tracker($this->db);
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
338
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
339 339
 
340 340
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
341 341
 
342 342
 		return $spotter_array;
343 343
 	}
344 344
 
345
-        /**
346
-	* Gets all the spotter information based on a particular callsign
347
-	*
348
-	* @return Array the spotter information
349
-	*
350
-	*/
345
+		/**
346
+		 * Gets all the spotter information based on a particular callsign
347
+		 *
348
+		 * @return Array the spotter information
349
+		 *
350
+		 */
351 351
 	public function getDateLiveTrackerDataByIdent($ident,$date)
352 352
 	{
353 353
 		$Tracker = new Tracker($this->db);
354 354
 		date_default_timezone_set('UTC');
355 355
 
356 356
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
357
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
357
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
358 358
 
359
-                $date = date('c',$date);
359
+				$date = date('c',$date);
360 360
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
364 364
 
365
-        /**
366
-	* Gets last spotter information based on a particular callsign
367
-	*
368
-	* @return Array the spotter information
369
-	*
370
-	*/
365
+		/**
366
+		 * Gets last spotter information based on a particular callsign
367
+		 *
368
+		 * @return Array the spotter information
369
+		 *
370
+		 */
371 371
 	public function getLastLiveTrackerDataById($id)
372 372
 	{
373 373
 		$Tracker = new Tracker($this->db);
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
377
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
378 378
 
379 379
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
383 383
 
384
-        /**
385
-	* Gets last spotter information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets last spotter information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getDateLiveTrackerDataById($id,$date)
391 391
 	{
392 392
 		$Tracker = new Tracker($this->db);
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
396
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
397
-                $date = date('c',$date);
396
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
397
+				$date = date('c',$date);
398 398
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
399 399
 
400 400
 		return $spotter_array;
401 401
 	}
402 402
 
403
-        /**
404
-	* Gets altitude information based on a particular callsign
405
-	*
406
-	* @return Array the spotter information
407
-	*
408
-	*/
403
+		/**
404
+		 * Gets altitude information based on a particular callsign
405
+		 *
406
+		 * @return Array the spotter information
407
+		 *
408
+		 */
409 409
 	public function getAltitudeLiveTrackerDataByIdent($ident)
410 410
 	{
411 411
 
412 412
 		date_default_timezone_set('UTC');
413 413
 
414 414
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
415
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
415
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
416 416
 
417
-    		try {
417
+			try {
418 418
 			
419 419
 			$sth = $this->db->prepare($query);
420 420
 			$sth->execute(array(':ident' => $ident));
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		return $spotter_array;
428 428
 	}
429 429
 
430
-        /**
431
-	* Gets all the spotter information based on a particular id
432
-	*
433
-	* @return Array the spotter information
434
-	*
435
-	*/
430
+		/**
431
+		 * Gets all the spotter information based on a particular id
432
+		 *
433
+		 * @return Array the spotter information
434
+		 *
435
+		 */
436 436
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
437 437
 	{
438 438
 		global $globalDBdriver, $globalLiveInterval;
@@ -460,18 +460,18 @@  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 ident
465
-	*
466
-	* @return Array the spotter information
467
-	*
468
-	*/
463
+		/**
464
+		 * Gets all the spotter information based on a particular ident
465
+		 *
466
+		 * @return Array the spotter information
467
+		 *
468
+		 */
469 469
 	public function getAllLiveTrackerDataByIdent($ident)
470 470
 	{
471 471
 		date_default_timezone_set('UTC');
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473 473
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
474
-    		try {
474
+			try {
475 475
 			
476 476
 			$sth = $this->db->prepare($query);
477 477
 			$sth->execute(array(':ident' => $ident));
@@ -485,23 +485,23 @@  discard block
 block discarded – undo
485 485
 
486 486
 
487 487
 	/**
488
-	* Deletes all info in the table
489
-	*
490
-	* @return String success or false
491
-	*
492
-	*/
488
+	 * Deletes all info in the table
489
+	 *
490
+	 * @return String success or false
491
+	 *
492
+	 */
493 493
 	public function deleteLiveTrackerData()
494 494
 	{
495 495
 		global $globalDBdriver;
496 496
 		if ($globalDBdriver == 'mysql') {
497 497
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
498 498
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
499
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
499
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
500 500
 		} else {
501 501
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
502 502
 		}
503 503
         
504
-    		try {
504
+			try {
505 505
 			
506 506
 			$sth = $this->db->prepare($query);
507 507
 			$sth->execute();
@@ -513,18 +513,18 @@  discard block
 block discarded – undo
513 513
 	}
514 514
 
515 515
 	/**
516
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
517
-	*
518
-	* @return String success or false
519
-	*
520
-	*/
516
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
517
+	 *
518
+	 * @return String success or false
519
+	 *
520
+	 */
521 521
 	public function deleteLiveTrackerDataNotUpdated()
522 522
 	{
523 523
 		global $globalDBdriver, $globalDebug;
524 524
 		if ($globalDBdriver == 'mysql') {
525 525
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
526
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
527
-    			try {
526
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
527
+				try {
528 528
 				
529 529
 				$sth = $this->db->prepare($query);
530 530
 				$sth->execute();
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
 				return "error";
533 533
 			}
534 534
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
535
-                        $i = 0;
536
-                        $j =0;
535
+						$i = 0;
536
+						$j =0;
537 537
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
538 538
 			foreach($all as $row)
539 539
 			{
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 				$j++;
542 542
 				if ($j == 30) {
543 543
 					if ($globalDebug) echo ".";
544
-				    	try {
544
+						try {
545 545
 						
546 546
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
547 547
 						$sth->execute();
548 548
 					} catch(PDOException $e) {
549 549
 						return "error";
550 550
 					}
551
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
552
-                                	$j = 0;
551
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
552
+									$j = 0;
553 553
 				}
554 554
 				$query_delete .= "'".$row['famtrackid']."',";
555 555
 			}
556 556
 			if ($i > 0) {
557
-    				try {
557
+					try {
558 558
 					
559 559
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
560 560
 					$sth->execute();
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 			return "success";
566 566
 		} elseif ($globalDBdriver == 'pgsql') {
567 567
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
568
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
569
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
570
-    			try {
568
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
569
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
570
+				try {
571 571
 				
572 572
 				$sth = $this->db->prepare($query);
573 573
 				$sth->execute();
@@ -611,17 +611,17 @@  discard block
 block discarded – undo
611 611
 	}
612 612
 
613 613
 	/**
614
-	* Deletes all info in the table for an ident
615
-	*
616
-	* @return String success or false
617
-	*
618
-	*/
614
+	 * Deletes all info in the table for an ident
615
+	 *
616
+	 * @return String success or false
617
+	 *
618
+	 */
619 619
 	public function deleteLiveTrackerDataByIdent($ident)
620 620
 	{
621 621
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
622 622
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
623 623
         
624
-    		try {
624
+			try {
625 625
 			
626 626
 			$sth = $this->db->prepare($query);
627 627
 			$sth->execute(array(':ident' => $ident));
@@ -633,17 +633,17 @@  discard block
 block discarded – undo
633 633
 	}
634 634
 
635 635
 	/**
636
-	* Deletes all info in the table for an id
637
-	*
638
-	* @return String success or false
639
-	*
640
-	*/
636
+	 * Deletes all info in the table for an id
637
+	 *
638
+	 * @return String success or false
639
+	 *
640
+	 */
641 641
 	public function deleteLiveTrackerDataById($id)
642 642
 	{
643 643
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
644 644
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
645 645
         
646
-    		try {
646
+			try {
647 647
 			
648 648
 			$sth = $this->db->prepare($query);
649 649
 			$sth->execute(array(':id' => $id));
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 
657 657
 
658 658
 	/**
659
-	* Gets the aircraft ident within the last hour
660
-	*
661
-	* @return String the ident
662
-	*
663
-	*/
659
+	 * Gets the aircraft ident within the last hour
660
+	 *
661
+	 * @return String the ident
662
+	 *
663
+	 */
664 664
 	public function getIdentFromLastHour($ident)
665 665
 	{
666 666
 		global $globalDBdriver, $globalTimezone;
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 			$ident_result = $row['ident'];
687 687
 		}
688 688
 		return $ident_result;
689
-        }
689
+		}
690 690
 
691 691
 	/**
692
-	* Check recent aircraft
693
-	*
694
-	* @return String the ident
695
-	*
696
-	*/
692
+	 * Check recent aircraft
693
+	 *
694
+	 * @return String the ident
695
+	 *
696
+	 */
697 697
 	public function checkIdentRecent($ident)
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 			$ident_result = $row['famtrackid'];
720 720
 		}
721 721
 		return $ident_result;
722
-        }
722
+		}
723 723
 
724 724
 	/**
725
-	* Check recent aircraft by id
726
-	*
727
-	* @return String the ident
728
-	*
729
-	*/
725
+	 * Check recent aircraft by id
726
+	 *
727
+	 * @return String the ident
728
+	 *
729
+	 */
730 730
 	public function checkIdRecent($id)
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
@@ -752,19 +752,19 @@  discard block
 block discarded – undo
752 752
 			$ident_result = $row['famtrackid'];
753 753
 		}
754 754
 		return $ident_result;
755
-        }
755
+		}
756 756
 
757 757
 	/**
758
-	* Adds a new spotter data
759
-	*
760
-	* @param String $famtrackid the ID from flightaware
761
-	* @param String $ident the flight ident
762
-	* @param String $aircraft_icao the aircraft type
763
-	* @param String $departure_airport_icao the departure airport
764
-	* @param String $arrival_airport_icao the arrival airport
765
-	* @return String success or false
766
-	*
767
-	*/
758
+	 * Adds a new spotter data
759
+	 *
760
+	 * @param String $famtrackid the ID from flightaware
761
+	 * @param String $ident the flight ident
762
+	 * @param String $aircraft_icao the aircraft type
763
+	 * @param String $departure_airport_icao the departure airport
764
+	 * @param String $arrival_airport_icao the arrival airport
765
+	 * @return String success or false
766
+	 *
767
+	 */
768 768
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
769 769
 	{
770 770
 		global $globalURL, $globalArchive, $globalDebug;
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
838 838
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
839 839
 
840
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
840
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
842 842
             	
843 843
 		$query  = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
844 844
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 			
849 849
 			$sth = $this->db->prepare($query);
850 850
 			$sth->execute($query_values);
851
-                } catch(PDOException $e) {
852
-                	return "error : ".$e->getMessage();
853
-                }
851
+				} catch(PDOException $e) {
852
+					return "error : ".$e->getMessage();
853
+				}
854 854
 		/*
855 855
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
856 856
 		    if ($globalDebug) echo '(Add to SBS archive : ';
Please login to merge, or discard this patch.
require/class.Connection.php 1 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 = 37;
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; 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 		$version = 0;
277 277
 		if ($this->tableExists('aircraft')) {
278 278
 			if (!$this->tableExists('config')) {
279
-	    			$version = '1';
280
-	    			return $version;
279
+					$version = '1';
280
+					return $version;
281 281
 			} else {
282 282
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
283 283
 				try {
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	* @return Boolean if latest version or not
299 299
 	*/
300 300
 	public function latest() {
301
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
302
-	    else return false;
301
+		if ($this->check_schema_version() == $this->latest_schema) return true;
302
+		else return false;
303 303
 	}
304 304
 
305 305
 }
Please login to merge, or discard this patch.