Completed
Push — master ( 708bc7...3d67e6 )
by Yannick
30:22
created
statistics-registration.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
aircraft-statistics-arrival-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_type'])) {
7
-        header('Location: '.$globalURL.'/aircraft');
8
-        die();
7
+		header('Location: '.$globalURL.'/aircraft');
8
+		die();
9 9
 }
10 10
 
11 11
 $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
airport-statistics-airline-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airport'])) {
7
-        header('Location: '.$globalURL.'/airport');
8
-        die();
7
+		header('Location: '.$globalURL.'/airport');
8
+		die();
9 9
 }
10 10
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
airport-statistics-departure-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airport'])) {
7
-        header('Location: '.$globalURL.'/airport');
8
-        die();
7
+		header('Location: '.$globalURL.'/airport');
8
+		die();
9 9
 }
10 10
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
airport-statistics-arrival-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airport'])) {
7
-        header('Location: '.$globalURL.'/airport');
8
-        die();
7
+		header('Location: '.$globalURL.'/airport');
8
+		die();
9 9
 }
10 10
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Indentation   +143 added lines, -143 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();
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	
109 109
 	/**
110
-	* Convert a HTML table to an array
111
-	* @param String $data HTML page
112
-	* @return Array array of the tables in HTML page
113
-	*/
110
+	 * Convert a HTML table to an array
111
+	 * @param String $data HTML page
112
+	 * @return Array array of the tables in HTML page
113
+	 */
114 114
 	public function table2array($data) {
115 115
 		if (!is_string($data)) return array();
116 116
 		if ($data == '') return array();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 	
146 146
 	/**
147
-	* Convert <p> part of a HTML page to an array
148
-	* @param String $data HTML page
149
-	* @return Array array of the <p> in HTML page
150
-	*/
147
+	 * Convert <p> part of a HTML page to an array
148
+	 * @param String $data HTML page
149
+	 * @return Array array of the <p> in HTML page
150
+	 */
151 151
 	public function text2array($data) {
152 152
 		$html = str_get_html($data);
153 153
 		if ($html === false) return array();
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	/**
165
-	* Give distance between 2 coordonnates
166
-	* @param Float $lat latitude of first point
167
-	* @param Float $lon longitude of first point
168
-	* @param Float $latc latitude of second point
169
-	* @param Float $lonc longitude of second point
170
-	* @param String $unit km else no unit used
171
-	* @return Float Distance in $unit
172
-	*/
165
+	 * Give distance between 2 coordonnates
166
+	 * @param Float $lat latitude of first point
167
+	 * @param Float $lon longitude of first point
168
+	 * @param Float $latc latitude of second point
169
+	 * @param Float $lonc longitude of second point
170
+	 * @param String $unit km else no unit used
171
+	 * @return Float Distance in $unit
172
+	 */
173 173
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
174 174
 		if ($lat == $latc && $lon == $lonc) return 0;
175 175
 		$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;
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	/**
190
-	* Check is distance realistic
191
-	* @param int $timeDifference the time between the reception of both messages
192
-	* @param float $distance distance covered
193
-	* @return whether distance is realistic
194
-	*/
190
+	 * Check is distance realistic
191
+	 * @param int $timeDifference the time between the reception of both messages
192
+	 * @param float $distance distance covered
193
+	 * @return whether distance is realistic
194
+	 */
195 195
 	public function withinThreshold ($timeDifference, $distance) {
196 196
 		$x = abs($timeDifference);
197 197
 		$d = abs($distance);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	}
210 210
 
211 211
 	public function isInteger($input){
212
-	    return(ctype_digit(strval($input)));
212
+		return(ctype_digit(strval($input)));
213 213
 	}
214 214
 
215 215
 
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Copy folder contents
244
-	* @param       string   $source    Source path
245
-	* @param       string   $dest      Destination path
246
-	* @return      bool     Returns true on success, false on failure
247
-	*/
243
+	 * Copy folder contents
244
+	 * @param       string   $source    Source path
245
+	 * @param       string   $dest      Destination path
246
+	 * @return      bool     Returns true on success, false on failure
247
+	 */
248 248
 	public function xcopy($source, $dest)
249 249
 	{
250 250
 		$files = glob($source.'*.*');
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
 	}
257 257
 	
258 258
 	/**
259
-	* Check if an url exist
260
-	* @param	String $url url to check
261
-	* @return	bool Return true on succes false on failure
262
-	*/
259
+	 * Check if an url exist
260
+	 * @param	String $url url to check
261
+	 * @return	bool Return true on succes false on failure
262
+	 */
263 263
 	public function urlexist($url){
264 264
 		$headers=get_headers($url);
265 265
 		return stripos($headers[0],"200 OK")?true:false;
266 266
 	}
267 267
 	
268 268
 	/**
269
-	* Convert hexa to string
270
-	* @param	String $hex data in hexa
271
-	* @return	String Return result
272
-	*/
269
+	 * Convert hexa to string
270
+	 * @param	String $hex data in hexa
271
+	 * @return	String Return result
272
+	 */
273 273
 	public function hex2str($hex) {
274 274
 		$str = '';
275 275
 		$hexln = strlen($hex);
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 	
280 280
 	/**
281
-	* Convert hexa color to rgb
282
-	* @param	String $hex data in hexa
283
-	* @return	String Return result
284
-	*/
281
+	 * Convert hexa color to rgb
282
+	 * @param	String $hex data in hexa
283
+	 * @return	String Return result
284
+	 */
285 285
 	public function hex2rgb($hex) {
286 286
 		$hex = str_replace('#','',$hex);
287 287
 		return sscanf($hex, "%02x%02x%02x"); 
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 	
361 361
 	/**
362
-	* Returns list of available locales
363
-	*
364
-	* @return array
362
+	 * Returns list of available locales
363
+	 *
364
+	 * @return array
365 365
 	 */
366 366
 	public function listLocaleDir()
367 367
 	{
@@ -456,100 +456,100 @@  discard block
 block discarded – undo
456 456
 	public function remove_accents($string) {
457 457
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
458 458
 		$chars = array(
459
-		    // Decompositions for Latin-1 Supplement
460
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
-		    chr(195).chr(191) => 'y',
488
-		    // Decompositions for Latin Extended-A
489
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
459
+			// Decompositions for Latin-1 Supplement
460
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
+			chr(195).chr(191) => 'y',
488
+			// Decompositions for Latin Extended-A
489
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
553 553
 		);
554 554
 		$string = strtr($string, $chars);
555 555
 		return $string;
Please login to merge, or discard this patch.
airport-geojson.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		date_default_timezone_set('UTC');
28 28
 		//waypoint plotting
29 29
 		$output .= '{"type": "Feature",';
30
-		    $output .= '"properties": {';
30
+			$output .= '"properties": {';
31 31
 			$output .= '"name": "'.str_replace('"',"'",$spotter_item['name']).'",';
32 32
 			$output .= '"city": "'.str_replace('"',"'",$spotter_item['city']).'",';
33 33
 			$output .= '"country": "'.$spotter_item['country'].'",';
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 			$output .= '"homepage": "'.$spotter_item['home_link'].'",';
51 51
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
52 52
 //			$output .= '"photo": "'.$spotter_item['image_thumbnail'].'",';
53
-		    $output .= '},';
54
-		    $output .= '"geometry": {';
53
+			$output .= '},';
54
+			$output .= '"geometry": {';
55 55
 			$output .= '"type": "Point",';
56 56
 			$output .= '"coordinates": [';
57
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
57
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
58 58
 			$output .= ']';
59
-		    $output .= '}';
59
+			$output .= '}';
60 60
 		$output .= '},';
61 61
 	}
62 62
 	$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Gets the images based on the aircraft registration
16
-	*
17
-	* @return Array the images list
18
-	*
19
-	*/
15
+	 * Gets the images based on the aircraft registration
16
+	 *
17
+	 * @return Array the images list
18
+	 *
19
+	 */
20 20
 	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
21 21
 	{
22 22
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	/**
40
-	* Gets the images based on the ship name
41
-	*
42
-	* @return Array the images list
43
-	*
44
-	*/
40
+	 * Gets the images based on the ship name
41
+	 *
42
+	 * @return Array the images list
43
+	 *
44
+	 */
45 45
 	public function getMarineImage($mmsi,$imo = '',$name = '')
46 46
 	{
47 47
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	/**
71
-	* Gets the image copyright based on the Exif data
72
-	*
73
-	* @return String image copyright
74
-	*
75
-	*/
71
+	 * Gets the image copyright based on the Exif data
72
+	 *
73
+	 * @return String image copyright
74
+	 *
75
+	 */
76 76
 	public function getExifCopyright($url) {
77 77
 		$exif = exif_read_data($url);
78 78
 		$copyright = '';
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Adds the images based on the aircraft registration
91
-	*
92
-	* @return String either success or error
93
-	*
94
-	*/
90
+	 * Adds the images based on the aircraft registration
91
+	 *
92
+	 * @return String either success or error
93
+	 *
94
+	 */
95 95
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
96 96
 	{
97 97
 		global $globalDebug,$globalAircraftImageFetch;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	}
120 120
 
121 121
 	/**
122
-	* Adds the images based on the marine name
123
-	*
124
-	* @return String either success or error
125
-	*
126
-	*/
122
+	 * Adds the images based on the marine name
123
+	 *
124
+	 * @return String either success or error
125
+	 *
126
+	 */
127 127
 	public function addMarineImage($mmsi,$imo = '',$name = '')
128 128
 	{
129 129
 		global $globalDebug,$globalMarineImageFetch;
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 
162 162
 	/**
163
-	* Gets the aircraft image
164
-	*
165
-	* @param String $aircraft_registration the registration of the aircraft
166
-	* @return Array the aircraft thumbnail, orignal url and copyright
167
-	*
168
-	*/
163
+	 * Gets the aircraft image
164
+	 *
165
+	 * @param String $aircraft_registration the registration of the aircraft
166
+	 * @return Array the aircraft thumbnail, orignal url and copyright
167
+	 *
168
+	 */
169 169
 	public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
170 170
 	{
171 171
 		global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA;
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	}
210 210
 
211 211
 	/**
212
-	* Gets the vessel image
213
-	*
214
-	* @param String $mmsi the vessel mmsi
215
-	* @param String $imo the vessel imo
216
-	* @param String $name the vessel name
217
-	* @return Array the aircraft thumbnail, orignal url and copyright
218
-	*
219
-	*/
212
+	 * Gets the vessel image
213
+	 *
214
+	 * @param String $mmsi the vessel mmsi
215
+	 * @param String $imo the vessel imo
216
+	 * @param String $name the vessel name
217
+	 * @return Array the aircraft thumbnail, orignal url and copyright
218
+	 *
219
+	 */
220 220
 	public function findMarineImage($mmsi,$imo = '',$name = '')
221 221
 	{
222 222
 		global $globalMarineImageSources;
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	/**
253
-	* Gets the aircraft image from Planespotters
254
-	*
255
-	* @param String $aircraft_registration the registration of the aircraft
256
-	* @param String $aircraft_name type of the aircraft
257
-	* @return Array the aircraft thumbnail, orignal url and copyright
258
-	*
259
-	*/
253
+	 * Gets the aircraft image from Planespotters
254
+	 *
255
+	 * @param String $aircraft_registration the registration of the aircraft
256
+	 * @param String $aircraft_name type of the aircraft
257
+	 * @return Array the aircraft thumbnail, orignal url and copyright
258
+	 *
259
+	 */
260 260
 	public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') {
261 261
 		$Common = new Common();
262 262
 		// If aircraft registration is only number, also check with aircraft model
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
 	}
284 284
 
285 285
 	/**
286
-	* Gets the aircraft image from Deviantart
287
-	*
288
-	* @param String $registration the registration of the aircraft
289
-	* @param String $name type of the aircraft
290
-	* @return Array the aircraft thumbnail, orignal url and copyright
291
-	*
292
-	*/
286
+	 * Gets the aircraft image from Deviantart
287
+	 *
288
+	 * @param String $registration the registration of the aircraft
289
+	 * @param String $name type of the aircraft
290
+	 * @return Array the aircraft thumbnail, orignal url and copyright
291
+	 *
292
+	 */
293 293
 	public function fromDeviantart($type,$registration, $name='') {
294 294
 		$Common = new Common();
295 295
 		if ($type == 'aircraft') {
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 	}
322 322
 
323 323
 	/**
324
-	* Gets the aircraft image from JetPhotos
325
-	*
326
-	* @param String $aircraft_registration the registration of the aircraft
327
-	* @param String $aircraft_name type of the aircraft
328
-	* @return Array the aircraft thumbnail, orignal url and copyright
329
-	*
330
-	*/
324
+	 * Gets the aircraft image from JetPhotos
325
+	 *
326
+	 * @param String $aircraft_registration the registration of the aircraft
327
+	 * @param String $aircraft_name type of the aircraft
328
+	 * @return Array the aircraft thumbnail, orignal url and copyright
329
+	 *
330
+	 */
331 331
 	public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') {
332 332
 		$Common = new Common();
333 333
 		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 	}
364 364
 
365 365
 	/**
366
-	* Gets the aircraft image from PlanePictures
367
-	*
368
-	* @param String $aircraft_registration the registration of the aircraft
369
-	* @param String $aircraft_name type of the aircraft
370
-	* @return Array the aircraft thumbnail, orignal url and copyright
371
-	*
372
-	*/
366
+	 * Gets the aircraft image from PlanePictures
367
+	 *
368
+	 * @param String $aircraft_registration the registration of the aircraft
369
+	 * @param String $aircraft_name type of the aircraft
370
+	 * @return Array the aircraft thumbnail, orignal url and copyright
371
+	 *
372
+	 */
373 373
 	public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') {
374 374
 		$Common = new Common();
375 375
 		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 	}
398 398
 
399 399
 	/**
400
-	* Gets the aircraft image from Flickr
401
-	*
402
-	* @param String $registration the registration of the aircraft
403
-	* @param String $name type of the aircraft
404
-	* @return Array the aircraft thumbnail, orignal url and copyright
405
-	*
406
-	*/
400
+	 * Gets the aircraft image from Flickr
401
+	 *
402
+	 * @param String $registration the registration of the aircraft
403
+	 * @param String $name type of the aircraft
404
+	 * @return Array the aircraft thumbnail, orignal url and copyright
405
+	 *
406
+	 */
407 407
 	public function fromFlickr($type,$registration,$name='') {
408 408
 		$Common = new Common();
409 409
 		if ($type == 'aircraft') {
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
 	}
447 447
 
448 448
 	/**
449
-	* Gets the aircraft image from Bing
450
-	*
451
-	* @param String $aircraft_registration the registration of the aircraft
452
-	* @param String $aircraft_name type of the aircraft
453
-	* @return Array the aircraft thumbnail, orignal url and copyright
454
-	*
455
-	*/
449
+	 * Gets the aircraft image from Bing
450
+	 *
451
+	 * @param String $aircraft_registration the registration of the aircraft
452
+	 * @param String $aircraft_name type of the aircraft
453
+	 * @return Array the aircraft thumbnail, orignal url and copyright
454
+	 *
455
+	 */
456 456
 	public function fromBing($type,$aircraft_registration,$aircraft_name='') {
457 457
 		global $globalImageBingKey;
458 458
 		$Common = new Common();
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 	}
479 479
 
480 480
 	/**
481
-	* Gets the aircraft image from airport-data
482
-	*
483
-	* @param String $aircraft_registration the registration of the aircraft
484
-	* @param String $aircraft_name type of the aircraft
485
-	* @return Array the aircraft thumbnail, orignal url and copyright
486
-	*
487
-	*/
481
+	 * Gets the aircraft image from airport-data
482
+	 *
483
+	 * @param String $aircraft_registration the registration of the aircraft
484
+	 * @param String $aircraft_name type of the aircraft
485
+	 * @return Array the aircraft thumbnail, orignal url and copyright
486
+	 *
487
+	 */
488 488
 	public function fromAirportData($type,$aircraft_registration,$aircraft_name='') {
489 489
 		$Common = new Common();
490 490
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
 	}
504 504
 
505 505
 	/**
506
-	* Gets image from WikiMedia
507
-	*
508
-	* @param String $registration the registration of the aircraft/mmsi
509
-	* @param String $name name
510
-	* @return Array the aircraft thumbnail, orignal url and copyright
511
-	*
512
-	*/
506
+	 * Gets image from WikiMedia
507
+	 *
508
+	 * @param String $registration the registration of the aircraft/mmsi
509
+	 * @param String $name name
510
+	 * @return Array the aircraft thumbnail, orignal url and copyright
511
+	 *
512
+	 */
513 513
 	public function fromWikimedia($type,$registration,$name='') {
514 514
 		$Common = new Common();
515 515
 		if ($type == 'aircraft') {
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	/**
567
-	* Gets the aircraft image from custom url
568
-	*
569
-	* @param String $registration the registration of the aircraft
570
-	* @param String $name type of the aircraft
571
-	* @return Array the aircraft thumbnail, orignal url and copyright
572
-	*
573
-	*/
567
+	 * Gets the aircraft image from custom url
568
+	 *
569
+	 * @param String $registration the registration of the aircraft
570
+	 * @param String $name type of the aircraft
571
+	 * @return Array the aircraft thumbnail, orignal url and copyright
572
+	 *
573
+	 */
574 574
 	public function fromCustomSource($type,$registration,$name='') {
575 575
 		global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug;
576 576
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class SBS {
3
-    static $latlon = array();
3
+	static $latlon = array();
4 4
     
5
-    public function parse($buffer) {
5
+	public function parse($buffer) {
6 6
 	// Not yet finished, no CRC checks
7 7
 	//echo $buffer."\n";
8 8
 	$data = array();
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
 	$bin = gmp_strval( gmp_init($hex,16), 2);
14 14
 	//if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) {
15 15
 	if (strlen($hex) == 28) {
16
-	    $df = intval(substr($bin,0,5),2);
17
-	    //$ca = intval(substr($bin,5,3),2);
18
-	    // Only support DF17 for now
19
-	    //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
-	    if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
16
+		$df = intval(substr($bin,0,5),2);
17
+		//$ca = intval(substr($bin,5,3),2);
18
+		// Only support DF17 for now
19
+		//if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
+		if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
21 21
 		$icao = substr($hex,2,6);
22 22
 		$data['hex'] = $icao;
23 23
 		$tc = intval(substr($bin,32,5),2);
24 24
 		if ($tc >= 1 && $tc <= 4) {
25
-		    //callsign
26
-		    $csbin = substr($bin,40,56);
27
-		    $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
-		    $cs = '';
29
-		    $cs .= $charset[intval(substr($csbin,0,6),2)];
30
-		    $cs .= $charset[intval(substr($csbin,6,6),2)];
31
-		    $cs .= $charset[intval(substr($csbin,12,6),2)];
32
-		    $cs .= $charset[intval(substr($csbin,18,6),2)];
33
-		    $cs .= $charset[intval(substr($csbin,24,6),2)];
34
-		    $cs .= $charset[intval(substr($csbin,30,6),2)];
35
-		    $cs .= $charset[intval(substr($csbin,36,6),2)];
36
-		    $cs .= $charset[intval(substr($csbin,42,6),2)];
37
-		    $cs = str_replace('_','',$cs);
38
-		    $cs = str_replace('#','',$cs);
39
-		    $callsign = $cs;
40
-		    $data['ident'] = $callsign;
25
+			//callsign
26
+			$csbin = substr($bin,40,56);
27
+			$charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
+			$cs = '';
29
+			$cs .= $charset[intval(substr($csbin,0,6),2)];
30
+			$cs .= $charset[intval(substr($csbin,6,6),2)];
31
+			$cs .= $charset[intval(substr($csbin,12,6),2)];
32
+			$cs .= $charset[intval(substr($csbin,18,6),2)];
33
+			$cs .= $charset[intval(substr($csbin,24,6),2)];
34
+			$cs .= $charset[intval(substr($csbin,30,6),2)];
35
+			$cs .= $charset[intval(substr($csbin,36,6),2)];
36
+			$cs .= $charset[intval(substr($csbin,42,6),2)];
37
+			$cs = str_replace('_','',$cs);
38
+			$cs = str_replace('#','',$cs);
39
+			$callsign = $cs;
40
+			$data['ident'] = $callsign;
41 41
 		} elseif ($tc >= 9 && $tc <= 18) {
42
-		    // Check Q-bit
43
-		    $q = substr($bin,47,1);
44
-		    if ($q) {
42
+			// Check Q-bit
43
+			$q = substr($bin,47,1);
44
+			if ($q) {
45 45
 			$n = intval(substr($bin,40,7).substr($bin,48,4),2);
46 46
 			$alt = $n*25-1000;
47 47
 			$data['altitude'] = $alt;
48
-		    }
49
-		    // Check odd/even flag
50
-		    $oe = substr($bin,53,1);
51
-		    //if ($oe) => odd else even
52
-		    //  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
-		    $cprlat = intval(substr($bin,54,17),2)/131072.0;
54
-		    $cprlon = intval(substr($bin,71,17),2)/131072.0;
55
-		    if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
-		    elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
48
+			}
49
+			// Check odd/even flag
50
+			$oe = substr($bin,53,1);
51
+			//if ($oe) => odd else even
52
+			//  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
+			$cprlat = intval(substr($bin,54,17),2)/131072.0;
54
+			$cprlon = intval(substr($bin,71,17),2)/131072.0;
55
+			if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
+			elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
57 57
 			$cprlat_odd = $cprlat;
58 58
 			$cprlon_odd = $cprlon;
59 59
 			$cprlat_even = $this::$latlon[$icao]['latitude'];
@@ -66,53 +66,53 @@  discard block
 block discarded – undo
66 66
 			if ($lat_odd >= 270) $lat_odd = $lat_odd - 360;
67 67
 			// check latitude zone
68 68
 			if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) {
69
-			    if ($this::$latlon[$icao]['created'] > time()) {
69
+				if ($this::$latlon[$icao]['created'] > time()) {
70 70
 				$ni = $this->cprN($lat_even,0);
71 71
 				$m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5);
72 72
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_even);
73 73
 				$lat = $lat_even;
74 74
 				if ($lon > 180) $lon = $lon -360;
75 75
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
76
-				    //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
-				    $data['latitude'] = $lat;
78
-				    $data['longitude'] = $lon;
76
+					//if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
+					$data['latitude'] = $lat;
78
+					$data['longitude'] = $lon;
79 79
 				}
80
-			    } else {
80
+				} else {
81 81
 				$ni = $this->cprN($lat_odd,1);
82 82
 				$m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5);
83 83
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_odd);
84 84
 				$lat = $lat_odd;
85 85
 				if ($lon > 180) $lon = $lon -360;
86 86
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
87
-				    //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
-				    $data['latitude'] = $lat;
89
-				    $data['longitude'] = $lon;
87
+					//if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
+					$data['latitude'] = $lat;
89
+					$data['longitude'] = $lon;
90
+				}
90 91
 				}
91
-			    }
92 92
 			} else echo "Not cprNL";
93 93
 			unset($this::$latlon[$icao]);
94
-		    }
94
+			}
95 95
 		} elseif ($tc == 19) {
96
-		    // speed & heading
97
-		    $v_ew_dir = intval(substr($bin,45,1));
98
-		    $v_ew = intval(substr($bin,46,10),2);
99
-		    $v_ns_dir = intval(substr($bin,56,1));
100
-		    $v_ns = intval(substr($bin,57,10),2);
101
-		    if ($v_ew_dir) $v_ew = -1*$v_ew;
102
-		    if ($v_ns_dir) $v_ns = -1*$v_ns;
103
-		    $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
-		    $heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
-		    if ($heading <0) $heading = $heading+360;
106
-		    $data['speed'] = $speed;
107
-		    $data['heading'] = $heading;
96
+			// speed & heading
97
+			$v_ew_dir = intval(substr($bin,45,1));
98
+			$v_ew = intval(substr($bin,46,10),2);
99
+			$v_ns_dir = intval(substr($bin,56,1));
100
+			$v_ns = intval(substr($bin,57,10),2);
101
+			if ($v_ew_dir) $v_ew = -1*$v_ew;
102
+			if ($v_ns_dir) $v_ns = -1*$v_ns;
103
+			$speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
+			$heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
+			if ($heading <0) $heading = $heading+360;
106
+			$data['speed'] = $speed;
107
+			$data['heading'] = $heading;
108
+		}
108 109
 		}
109
-	    }
110
-	    if (isset($data)) {
110
+		if (isset($data)) {
111 111
 		//print_r($data);
112 112
 		return $data;
113
-	    }
114
-        }
115
-    }
113
+		}
114
+		}
115
+	}
116 116
 
117 117
 
118 118
 	public function cprNL($lat) {
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 	if ($lat < 86.53536998) return 3;
178 178
 	if ($lat < 87.00000000) return 2;
179 179
 	return 1;
180
-    }
180
+	}
181 181
     
182
-    public function cprN($lat,$isodd) {
182
+	public function cprN($lat,$isodd) {
183 183
 	$nl = $this->cprNL($lat) - $isodd;
184 184
 	if ($nl > 1) return $nl;
185 185
 	else return 1;
186
-    }
186
+	}
187 187
 
188 188
 
189
-    function parityCheck($msg, $bin) {
189
+	function parityCheck($msg, $bin) {
190 190
 $modes_checksum_table = array(
191 191
 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
192 192
 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
@@ -208,75 +208,75 @@  discard block
 block discarded – undo
208 208
 	$checksum = intval(substr($msg,22,6),16);
209 209
 
210 210
 	for ($j = 0; $j < strlen($bin); $j++) {
211
-	    if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
211
+		if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
212 212
 	}
213 213
 	if ($crc == $checksum) return true;
214 214
 	else {
215
-	    //echo "**** CRC ERROR ****\n";
216
-	    return false;
215
+		//echo "**** CRC ERROR ****\n";
216
+		return false;
217
+	}
217 218
 	}
218
-    }
219 219
     
220
-    public function famaprs_to_basestation($data) {
220
+	public function famaprs_to_basestation($data) {
221 221
 	$result = array();
222
-        if (isset($data['ident']) && $data['ident'] != '') {
223
-	    $msg = array();
224
-	    $msg['msg_type'] = 'MSG';
225
-	    $msg['transmission_type'] = 1;
226
-	    $msg['session_id'] = 5;
227
-	    $msg['aircraftid'] = hexdec($data['address']);
228
-	    $msg['hex'] = $data['address'];
229
-	    $msg['flightid'] = hexdec($data['address']);
230
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
-	    $msg['callsign'] = $data['ident'];
235
-	    $msg['altitude'] = '';
236
-	    $msg['speed'] = '';
237
-	    $msg['track'] = '';
238
-	    $msg['latitude'] = '';
239
-	    $msg['longitude'] = '';
240
-	    $msg['verticalrate'] = '';
241
-	    $msg['squawk'] = '';
242
-	    $msg['alert'] = '';
243
-	    $msg['emergency'] = '';
244
-	    $msg['SPI'] = '';
245
-	    $msg['ground'] = '';
246
-    	    $result[] = implode(',',$msg);
247
-    	}
248
-    	if (isset($data['latitude']) && $data['latitude'] != 0) {
249
-	    $msg = array();
250
-	    $msg['msg_type'] = 'MSG';
251
-	    $msg['transmission_type'] = 2;
252
-	    $msg['session_id'] = 5;
253
-	    $msg['aircraftid'] = hexdec($data['address']);
254
-	    $msg['hex'] = $data['address'];
255
-	    $msg['flightid'] = hexdec($data['address']);
256
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
-	    $msg['callsign'] = '';
261
-	    if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
-	    else $msg['altitude'] = '';
263
-	    $msg['speed'] = $data['speed'];
264
-	    if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
-	    else $msg['track'] = '';
266
-	    $msg['latitude'] = $data['latitude'];
267
-	    $msg['longitude'] = $data['longitude'];
268
-	    if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
-	    else $msg['verticalrate'] = '';
270
-	    if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
-	    else $msg['squawk'] = 0;
272
-	    $msg['alert'] = 0;
273
-	    $msg['emergency'] = 0;
274
-	    $msg['SPI'] = 0;
275
-	    if (isset($data['ground'])) $msg['ground'] = 1;
276
-	    else $msg['ground'] = 0;
277
-    	    $result[] = implode(',',$msg);
278
-        }
279
-        return $result;
280
-    }
222
+		if (isset($data['ident']) && $data['ident'] != '') {
223
+		$msg = array();
224
+		$msg['msg_type'] = 'MSG';
225
+		$msg['transmission_type'] = 1;
226
+		$msg['session_id'] = 5;
227
+		$msg['aircraftid'] = hexdec($data['address']);
228
+		$msg['hex'] = $data['address'];
229
+		$msg['flightid'] = hexdec($data['address']);
230
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
+		$msg['callsign'] = $data['ident'];
235
+		$msg['altitude'] = '';
236
+		$msg['speed'] = '';
237
+		$msg['track'] = '';
238
+		$msg['latitude'] = '';
239
+		$msg['longitude'] = '';
240
+		$msg['verticalrate'] = '';
241
+		$msg['squawk'] = '';
242
+		$msg['alert'] = '';
243
+		$msg['emergency'] = '';
244
+		$msg['SPI'] = '';
245
+		$msg['ground'] = '';
246
+			$result[] = implode(',',$msg);
247
+		}
248
+		if (isset($data['latitude']) && $data['latitude'] != 0) {
249
+		$msg = array();
250
+		$msg['msg_type'] = 'MSG';
251
+		$msg['transmission_type'] = 2;
252
+		$msg['session_id'] = 5;
253
+		$msg['aircraftid'] = hexdec($data['address']);
254
+		$msg['hex'] = $data['address'];
255
+		$msg['flightid'] = hexdec($data['address']);
256
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
+		$msg['callsign'] = '';
261
+		if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
+		else $msg['altitude'] = '';
263
+		$msg['speed'] = $data['speed'];
264
+		if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
+		else $msg['track'] = '';
266
+		$msg['latitude'] = $data['latitude'];
267
+		$msg['longitude'] = $data['longitude'];
268
+		if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
+		else $msg['verticalrate'] = '';
270
+		if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
+		else $msg['squawk'] = 0;
272
+		$msg['alert'] = 0;
273
+		$msg['emergency'] = 0;
274
+		$msg['SPI'] = 0;
275
+		if (isset($data['ground'])) $msg['ground'] = 1;
276
+		else $msg['ground'] = 0;
277
+			$result[] = implode(',',$msg);
278
+		}
279
+		return $result;
280
+	}
281 281
 }
282 282
 ?>
Please login to merge, or discard this patch.