@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -51,7 +54,9 @@ discard block |
||
51 | 54 | } else { |
52 | 55 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
53 | 56 | } |
54 | - } elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
57 | + } elseif ($type != 'get' && $type != '') { |
|
58 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
59 | + } |
|
55 | 60 | if ($headers != '') { |
56 | 61 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
57 | 62 | } |
@@ -95,8 +100,9 @@ discard block |
||
95 | 100 | private function curlResponseHeaderCallback($ch, $headerLine) { |
96 | 101 | //global $cookies; |
97 | 102 | $cookies = array(); |
98 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
99 | - $cookies[] = $cookie; |
|
103 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
104 | + $cookies[] = $cookie; |
|
105 | + } |
|
100 | 106 | return strlen($headerLine); // Needed by curl |
101 | 107 | } |
102 | 108 | |
@@ -107,7 +113,9 @@ discard block |
||
107 | 113 | curl_setopt($ch, CURLOPT_URL, $url); |
108 | 114 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
109 | 115 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
110 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
116 | + if ($referer != '') { |
|
117 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
118 | + } |
|
111 | 119 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
112 | 120 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
113 | 121 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -119,7 +127,9 @@ discard block |
||
119 | 127 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
120 | 128 | curl_setopt($ch, CURLOPT_FILE, $fp); |
121 | 129 | curl_exec($ch); |
122 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
130 | + if (curl_errno($ch) && $globalDebug) { |
|
131 | + echo 'Download error: '.curl_error($ch); |
|
132 | + } |
|
123 | 133 | curl_close($ch); |
124 | 134 | fclose($fp); |
125 | 135 | } |
@@ -127,12 +137,16 @@ discard block |
||
127 | 137 | public static function gunzip($in_file,$out_file_name = '') { |
128 | 138 | //echo $in_file.' -> '.$out_file_name."\n"; |
129 | 139 | $buffer_size = 4096; // read 4kb at a time |
130 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
140 | + if ($out_file_name == '') { |
|
141 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
142 | + } |
|
131 | 143 | if ($in_file != '' && file_exists($in_file)) { |
132 | 144 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
133 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
134 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
135 | - else { |
|
145 | + if (function_exists('gzopen')) { |
|
146 | + $file = gzopen($in_file,'rb'); |
|
147 | + } elseif (function_exists('gzopen64')) { |
|
148 | + $file = gzopen64($in_file,'rb'); |
|
149 | + } else { |
|
136 | 150 | echo 'gzopen not available'; |
137 | 151 | die; |
138 | 152 | } |
@@ -148,11 +162,14 @@ discard block |
||
148 | 162 | public static function bunzip2($in_file,$out_file_name = '') { |
149 | 163 | //echo $in_file.' -> '.$out_file_name."\n"; |
150 | 164 | $buffer_size = 4096; // read 4kb at a time |
151 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
165 | + if ($out_file_name == '') { |
|
166 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
167 | + } |
|
152 | 168 | if ($in_file != '' && file_exists($in_file)) { |
153 | 169 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
154 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
155 | - else { |
|
170 | + if (function_exists('bzopen')) { |
|
171 | + $file = bzopen($in_file,'rb'); |
|
172 | + } else { |
|
156 | 173 | echo 'bzopen not available'; |
157 | 174 | die; |
158 | 175 | } |
@@ -171,10 +188,16 @@ discard block |
||
171 | 188 | * @return Array array of the tables in HTML page |
172 | 189 | */ |
173 | 190 | public function table2array($data) { |
174 | - if (!is_string($data)) return array(); |
|
175 | - if ($data == '') return array(); |
|
191 | + if (!is_string($data)) { |
|
192 | + return array(); |
|
193 | + } |
|
194 | + if ($data == '') { |
|
195 | + return array(); |
|
196 | + } |
|
176 | 197 | $html = str_get_html($data); |
177 | - if ($html === false) return array(); |
|
198 | + if ($html === false) { |
|
199 | + return array(); |
|
200 | + } |
|
178 | 201 | $tabledata=array(); |
179 | 202 | foreach($html->find('tr') as $element) |
180 | 203 | { |
@@ -209,7 +232,9 @@ discard block |
||
209 | 232 | */ |
210 | 233 | public function text2array($data) { |
211 | 234 | $html = str_get_html($data); |
212 | - if ($html === false) return array(); |
|
235 | + if ($html === false) { |
|
236 | + return array(); |
|
237 | + } |
|
213 | 238 | $tabledata=array(); |
214 | 239 | foreach($html->find('p') as $element) |
215 | 240 | { |
@@ -230,7 +255,9 @@ discard block |
||
230 | 255 | * @return Float Distance in $unit |
231 | 256 | */ |
232 | 257 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
258 | + if ($lat == $latc && $lon == $lonc) { |
|
259 | + return 0; |
|
260 | + } |
|
234 | 261 | $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; |
235 | 262 | if ($unit == "km") { |
236 | 263 | return round($dist * 1.609344); |
@@ -269,7 +296,9 @@ discard block |
||
269 | 296 | $dX = $latc - $lat; |
270 | 297 | $dY = $lonc - $lon; |
271 | 298 | $azimuth = rad2deg(atan2($dY,$dX)); |
272 | - if ($azimuth < 0) return $azimuth+360; |
|
299 | + if ($azimuth < 0) { |
|
300 | + return $azimuth+360; |
|
301 | + } |
|
273 | 302 | return $azimuth; |
274 | 303 | } |
275 | 304 | |
@@ -283,10 +312,16 @@ discard block |
||
283 | 312 | public function withinThreshold ($timeDifference, $distance) { |
284 | 313 | $x = abs($timeDifference); |
285 | 314 | $d = abs($distance); |
286 | - if ($x == 0 || $d == 0) return true; |
|
315 | + if ($x == 0 || $d == 0) { |
|
316 | + return true; |
|
317 | + } |
|
287 | 318 | // may be due to Internet jitter; distance is realistic |
288 | - if ($x < 0.7 && $d < 2000) return true; |
|
289 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
319 | + if ($x < 0.7 && $d < 2000) { |
|
320 | + return true; |
|
321 | + } else { |
|
322 | + return $d/$x < 1500*0.27778; |
|
323 | + } |
|
324 | + // 1500 km/h max |
|
290 | 325 | } |
291 | 326 | |
292 | 327 | |
@@ -314,11 +349,17 @@ discard block |
||
314 | 349 | |
315 | 350 | public function convertDM($coord,$latlong) { |
316 | 351 | if ($latlong == 'latitude') { |
317 | - if ($coord < 0) $NSEW = 'S'; |
|
318 | - else $NSEW = 'N'; |
|
352 | + if ($coord < 0) { |
|
353 | + $NSEW = 'S'; |
|
354 | + } else { |
|
355 | + $NSEW = 'N'; |
|
356 | + } |
|
319 | 357 | } else { |
320 | - if ($coord < 0) $NSEW = 'W'; |
|
321 | - else $NSEW = 'E'; |
|
358 | + if ($coord < 0) { |
|
359 | + $NSEW = 'W'; |
|
360 | + } else { |
|
361 | + $NSEW = 'E'; |
|
362 | + } |
|
322 | 363 | } |
323 | 364 | $coord = abs($coord); |
324 | 365 | $deg = floor($coord); |
@@ -361,7 +402,9 @@ discard block |
||
361 | 402 | public function hex2str($hex) { |
362 | 403 | $str = ''; |
363 | 404 | $hexln = strlen($hex); |
364 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
405 | + for($i=0;$i<$hexln;$i+=2) { |
|
406 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
407 | + } |
|
365 | 408 | return $str; |
366 | 409 | } |
367 | 410 | |
@@ -398,8 +441,11 @@ discard block |
||
398 | 441 | $b = $lat2 - $lat1; |
399 | 442 | $c = -($a*$lat1+$b*$lon1); |
400 | 443 | $d = $a*$lat3+$b*$lon3+$c; |
401 | - if ($d > -$approx && $d < $approx) return true; |
|
402 | - else return false; |
|
444 | + if ($d > -$approx && $d < $approx) { |
|
445 | + return true; |
|
446 | + } else { |
|
447 | + return false; |
|
448 | + } |
|
403 | 449 | } |
404 | 450 | |
405 | 451 | public function array_merge_noappend() { |
@@ -458,7 +504,9 @@ discard block |
||
458 | 504 | return $result; |
459 | 505 | } |
460 | 506 | $handle = @opendir('./locale'); |
461 | - if ($handle === false) return $result; |
|
507 | + if ($handle === false) { |
|
508 | + return $result; |
|
509 | + } |
|
462 | 510 | while (false !== ($file = readdir($handle))) { |
463 | 511 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
464 | 512 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -529,8 +577,9 @@ discard block |
||
529 | 577 | $error = false; |
530 | 578 | if ($fp_out = gzopen($dest, $mode)) { |
531 | 579 | if ($fp_in = fopen($source,'rb')) { |
532 | - while (!feof($fp_in)) |
|
533 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
580 | + while (!feof($fp_in)) { |
|
581 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
582 | + } |
|
534 | 583 | fclose($fp_in); |
535 | 584 | } else { |
536 | 585 | $error = true; |
@@ -539,14 +588,17 @@ discard block |
||
539 | 588 | } else { |
540 | 589 | $error = true; |
541 | 590 | } |
542 | - if ($error) |
|
543 | - return false; |
|
544 | - else |
|
545 | - return $dest; |
|
591 | + if ($error) { |
|
592 | + return false; |
|
593 | + } else { |
|
594 | + return $dest; |
|
595 | + } |
|
546 | 596 | } |
547 | 597 | |
548 | 598 | public function remove_accents($string) { |
549 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
599 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
600 | + return $string; |
|
601 | + } |
|
550 | 602 | $chars = array( |
551 | 603 | // Decompositions for Latin-1 Supplement |
552 | 604 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -670,7 +722,9 @@ discard block |
||
670 | 722 | $ip = gethostbyname($host); |
671 | 723 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
672 | 724 | $r = @socket_connect($s, $ip, $port); |
673 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
725 | + if (!socket_set_nonblock($s)) { |
|
726 | + echo "Unable to set nonblock on socket\n"; |
|
727 | + } |
|
674 | 728 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
675 | 729 | return $s; |
676 | 730 | } |
@@ -715,18 +769,22 @@ discard block |
||
715 | 769 | //NOTE: use a trailing slash for folders!!! |
716 | 770 | //see http://bugs.php.net/bug.php?id=27609 |
717 | 771 | //see http://bugs.php.net/bug.php?id=30931 |
718 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
772 | + if ($path{strlen($path)-1}=='/') { |
|
773 | + // recursively return a temporary file path |
|
719 | 774 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
720 | - else if (is_dir($path)) |
|
721 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
775 | + } else if (is_dir($path)) { |
|
776 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
777 | + } |
|
722 | 778 | // check tmp file for read/write capabilities |
723 | 779 | $rm = file_exists($path); |
724 | 780 | $f = @fopen($path, 'a'); |
725 | - if ($f===false) |
|
726 | - return false; |
|
781 | + if ($f===false) { |
|
782 | + return false; |
|
783 | + } |
|
727 | 784 | fclose($f); |
728 | - if (!$rm) |
|
729 | - unlink($path); |
|
785 | + if (!$rm) { |
|
786 | + unlink($path); |
|
787 | + } |
|
730 | 788 | return true; |
731 | 789 | } |
732 | 790 | |
@@ -742,7 +800,9 @@ discard block |
||
742 | 800 | * @return Array Coordinate of the route |
743 | 801 | */ |
744 | 802 | public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
745 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
803 | + if ($nbpts <= 2) { |
|
804 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
805 | + } |
|
746 | 806 | $sx = deg2rad($begin_lon); |
747 | 807 | $sy = deg2rad($begin_lat); |
748 | 808 | $ex = deg2rad($end_lon); |
@@ -751,7 +811,9 @@ discard block |
||
751 | 811 | $h = $sy - $ey; |
752 | 812 | $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
753 | 813 | $g = 2.0*asin(sqrt($z)); |
754 | - if ($g == pi() || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
814 | + if ($g == pi() || is_nan($g)) { |
|
815 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
816 | + } |
|
755 | 817 | $first_pass = array(); |
756 | 818 | $delta = 1.0/($nbpts-1); |
757 | 819 | for ($i =0; $i < $nbpts; ++$i) { |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,28 +59,55 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $from_archive = false; |
64 | 69 | $min = true; |
65 | 70 | $allhistory = false; |
66 | 71 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
74 | +} |
|
75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
77 | +} |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
80 | +} |
|
81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
83 | +} |
|
84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
86 | +} |
|
87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
89 | +} |
|
90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
92 | +} |
|
93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | +} |
|
96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
98 | +} |
|
99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
101 | +} |
|
102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
104 | +} |
|
78 | 105 | |
79 | 106 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 107 | $min = true; |
81 | -} else $min = false; |
|
108 | +} else { |
|
109 | + $min = false; |
|
110 | +} |
|
82 | 111 | |
83 | 112 | $spotter_array = array(); |
84 | 113 | |
@@ -189,24 +218,38 @@ discard block |
||
189 | 218 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
190 | 219 | } |
191 | 220 | } |
192 | - if ($flightcnt == '') $flightcnt = 0; |
|
193 | -} else $flightcnt = 0; |
|
221 | + if ($flightcnt == '') { |
|
222 | + $flightcnt = 0; |
|
223 | + } |
|
224 | + } else { |
|
225 | + $flightcnt = 0; |
|
226 | +} |
|
194 | 227 | |
195 | 228 | $sqltime = round(microtime(true)-$begintime,2); |
196 | 229 | |
197 | 230 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
198 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
231 | +if ($currenttime != '') { |
|
232 | + $currenttime = round($currenttime/1000); |
|
233 | +} |
|
199 | 234 | |
200 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
201 | -else $usenextlatlon = true; |
|
202 | -if ($usenextlatlon === false) $currenttime = ''; |
|
235 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
236 | + $usenextlatlon = false; |
|
237 | +} else { |
|
238 | + $usenextlatlon = true; |
|
239 | +} |
|
240 | +if ($usenextlatlon === false) { |
|
241 | + $currenttime = ''; |
|
242 | +} |
|
203 | 243 | $j = 0; |
204 | 244 | $prev_flightaware_id = ''; |
205 | 245 | $aircrafts_shadow = array(); |
206 | 246 | $output = '{'; |
207 | 247 | $output .= '"type": "FeatureCollection",'; |
208 | - if ($min) $output .= '"minimal": "true",'; |
|
209 | - else $output .= '"minimal": "false",'; |
|
248 | + if ($min) { |
|
249 | + $output .= '"minimal": "true",'; |
|
250 | + } else { |
|
251 | + $output .= '"minimal": "false",'; |
|
252 | + } |
|
210 | 253 | //$output .= '"fc": "'.$flightcnt.'",'; |
211 | 254 | $output .= '"sqt": "'.$sqltime.'",'; |
212 | 255 | |
@@ -251,18 +294,29 @@ discard block |
||
251 | 294 | } |
252 | 295 | $output .= '"properties": {'; |
253 | 296 | if (isset($spotter_item['flightaware_id'])) { |
254 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
297 | + if ($compress) { |
|
298 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
299 | + } else { |
|
300 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
301 | + } |
|
256 | 302 | } elseif (isset($spotter_item['famtrackid'])) { |
257 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
258 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
303 | + if ($compress) { |
|
304 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
305 | + } else { |
|
306 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
307 | + } |
|
259 | 308 | } elseif (isset($spotter_item['fammarine_id'])) { |
260 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
261 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
309 | + if ($compress) { |
|
310 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
311 | + } else { |
|
312 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
313 | + } |
|
262 | 314 | } |
263 | 315 | $output .= '"fc": "'.$flightcnt.'",'; |
264 | 316 | $output .= '"sqt": "'.$sqltime.'",'; |
265 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
317 | + if (isset($begindate)) { |
|
318 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
319 | + } |
|
266 | 320 | |
267 | 321 | /* |
268 | 322 | if ($min) $output .= '"minimal": "true",'; |
@@ -270,14 +324,22 @@ discard block |
||
270 | 324 | */ |
271 | 325 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 326 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
327 | + if ($compress) { |
|
328 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
329 | + } else { |
|
330 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
331 | + } |
|
275 | 332 | //" |
276 | 333 | } else { |
277 | - if ($compress) $output .= '"c": "NA",'; |
|
278 | - else $output .= '"callsign": "NA",'; |
|
334 | + if ($compress) { |
|
335 | + $output .= '"c": "NA",'; |
|
336 | + } else { |
|
337 | + $output .= '"callsign": "NA",'; |
|
338 | + } |
|
339 | + } |
|
340 | + if (isset($spotter_item['registration'])) { |
|
341 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
279 | 342 | } |
280 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
281 | 343 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 344 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | 345 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -290,16 +352,23 @@ discard block |
||
290 | 352 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
291 | 353 | } |
292 | 354 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
293 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
294 | - else { |
|
355 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
356 | + $spotter_item['aircraft_shadow'] = ''; |
|
357 | + } else { |
|
295 | 358 | $aircraft_icao = $spotter_item['aircraft_icao']; |
296 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
297 | - else { |
|
359 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
360 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
361 | + } else { |
|
298 | 362 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
299 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
300 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
301 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
302 | - else $spotter_item['aircraft_shadow'] = ''; |
|
363 | + if (count($aircraft_info) > 0) { |
|
364 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
365 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
366 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
367 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
368 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
369 | + } else { |
|
370 | + $spotter_item['aircraft_shadow'] = ''; |
|
371 | + } |
|
303 | 372 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
304 | 373 | } |
305 | 374 | } |
@@ -307,73 +376,139 @@ discard block |
||
307 | 376 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
308 | 377 | if ($tracker) { |
309 | 378 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
310 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
379 | + if ($compress) { |
|
380 | + $output .= '"as": "ambulance.png",'; |
|
381 | + } else { |
|
382 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
383 | + } |
|
312 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
313 | - if ($compress) $output .= '"as": "police.png",'; |
|
314 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
385 | + if ($compress) { |
|
386 | + $output .= '"as": "police.png",'; |
|
387 | + } else { |
|
388 | + $output .= '"aircraft_shadow": "police.png",'; |
|
389 | + } |
|
315 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "ship.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
395 | + } |
|
318 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "ship.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
401 | + } |
|
321 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
322 | - if ($compress) $output .= '"as": "ship.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
403 | + if ($compress) { |
|
404 | + $output .= '"as": "ship.png",'; |
|
405 | + } else { |
|
406 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
407 | + } |
|
324 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
325 | - if ($compress) $output .= '"as": "truck.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "truck.png",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
413 | + } |
|
327 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
328 | - if ($compress) $output .= '"as": "truck.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
415 | + if ($compress) { |
|
416 | + $output .= '"as": "truck.png",'; |
|
417 | + } else { |
|
418 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
419 | + } |
|
330 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
331 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
421 | + if ($compress) { |
|
422 | + $output .= '"as": "aircraft.png",'; |
|
423 | + } else { |
|
424 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
425 | + } |
|
333 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
334 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
427 | + if ($compress) { |
|
428 | + $output .= '"as": "aircraft.png",'; |
|
429 | + } else { |
|
430 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
431 | + } |
|
336 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
337 | - if ($compress) $output .= '"as": "helico.png",'; |
|
338 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
433 | + if ($compress) { |
|
434 | + $output .= '"as": "helico.png",'; |
|
435 | + } else { |
|
436 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
437 | + } |
|
339 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
340 | - if ($compress) $output .= '"as": "rail.png",'; |
|
341 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
439 | + if ($compress) { |
|
440 | + $output .= '"as": "rail.png",'; |
|
441 | + } else { |
|
442 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
443 | + } |
|
342 | 444 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
343 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
344 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
445 | + if ($compress) { |
|
446 | + $output .= '"as": "firetruck.png",'; |
|
447 | + } else { |
|
448 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
449 | + } |
|
345 | 450 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
346 | - if ($compress) $output .= '"as": "bus.png",'; |
|
347 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
451 | + if ($compress) { |
|
452 | + $output .= '"as": "bus.png",'; |
|
453 | + } else { |
|
454 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
455 | + } |
|
348 | 456 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
349 | - if ($compress) $output .= '"as": "phone.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
457 | + if ($compress) { |
|
458 | + $output .= '"as": "phone.png",'; |
|
459 | + } else { |
|
460 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
461 | + } |
|
351 | 462 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
352 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"as": "jogger.png",'; |
|
465 | + } else { |
|
466 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
467 | + } |
|
354 | 468 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
355 | - if ($compress) $output .= '"as": "bike.png",'; |
|
356 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
469 | + if ($compress) { |
|
470 | + $output .= '"as": "bike.png",'; |
|
471 | + } else { |
|
472 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
473 | + } |
|
357 | 474 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
358 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
359 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
475 | + if ($compress) { |
|
476 | + $output .= '"as": "motorcycle.png",'; |
|
477 | + } else { |
|
478 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
479 | + } |
|
360 | 480 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
361 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
362 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
481 | + if ($compress) { |
|
482 | + $output .= '"as": "balloon.png",'; |
|
483 | + } else { |
|
484 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
485 | + } |
|
363 | 486 | } else { |
364 | - if ($compress) $output .= '"as": "car.png",'; |
|
365 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
487 | + if ($compress) { |
|
488 | + $output .= '"as": "car.png",'; |
|
489 | + } else { |
|
490 | + $output .= '"aircraft_shadow": "car.png",'; |
|
491 | + } |
|
366 | 492 | } |
367 | 493 | } elseif ($marine) { |
368 | - if ($compress) $output .= '"as": "ship.png",'; |
|
369 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
494 | + if ($compress) { |
|
495 | + $output .= '"as": "ship.png",'; |
|
496 | + } else { |
|
497 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
498 | + } |
|
370 | 499 | } else { |
371 | - if ($compress) $output .= '"as": "default.png",'; |
|
372 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
500 | + if ($compress) { |
|
501 | + $output .= '"as": "default.png",'; |
|
502 | + } else { |
|
503 | + $output .= '"aircraft_shadow": "default.png",'; |
|
504 | + } |
|
373 | 505 | } |
374 | 506 | } else { |
375 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
376 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
507 | + if ($compress) { |
|
508 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
509 | + } else { |
|
510 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
511 | + } |
|
377 | 512 | } |
378 | 513 | if (isset($spotter_item['airline_name'])) { |
379 | 514 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -381,8 +516,11 @@ discard block |
||
381 | 516 | $output .= '"airline_name": "NA",'; |
382 | 517 | } |
383 | 518 | if (isset($spotter_item['departure_airport'])) { |
384 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
385 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
519 | + if ($compress) { |
|
520 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
521 | + } else { |
|
522 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
523 | + } |
|
386 | 524 | } |
387 | 525 | if (isset($spotter_item['departure_airport_city'])) { |
388 | 526 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -394,8 +532,11 @@ discard block |
||
394 | 532 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
395 | 533 | } |
396 | 534 | if (isset($spotter_item['arrival_airport'])) { |
397 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
398 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
535 | + if ($compress) { |
|
536 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
537 | + } else { |
|
538 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
539 | + } |
|
399 | 540 | } |
400 | 541 | if (isset($spotter_item['arrival_airport_city'])) { |
401 | 542 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -414,8 +555,11 @@ discard block |
||
414 | 555 | } |
415 | 556 | |
416 | 557 | if (isset($spotter_item['altitude'])) { |
417 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
418 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
558 | + if ($compress) { |
|
559 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
560 | + } else { |
|
561 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
562 | + } |
|
419 | 563 | } |
420 | 564 | |
421 | 565 | $heading = $spotter_item['heading']; |
@@ -439,19 +583,24 @@ discard block |
||
439 | 583 | } |
440 | 584 | } |
441 | 585 | |
442 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
443 | - else $output .= '"heading": "'.$heading.'",'; |
|
586 | + if ($compress) { |
|
587 | + $output .= '"h": "'.$heading.'",'; |
|
588 | + } else { |
|
589 | + $output .= '"heading": "'.$heading.'",'; |
|
590 | + } |
|
444 | 591 | if ($currenttime != '') { |
445 | 592 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 593 | if (isset($archivespeed)) { |
447 | 594 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
448 | 595 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
449 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
450 | - else { |
|
596 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
597 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
598 | + } else { |
|
451 | 599 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
452 | 600 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
453 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
454 | - else { |
|
601 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
602 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
603 | + } else { |
|
455 | 604 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
456 | 605 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 606 | } |
@@ -459,12 +608,14 @@ discard block |
||
459 | 608 | } elseif ($usenextlatlon) { |
460 | 609 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
461 | 610 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
462 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
463 | - else { |
|
611 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
612 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
613 | + } else { |
|
464 | 614 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
465 | 615 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
466 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
467 | - else { |
|
616 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
617 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
618 | + } else { |
|
468 | 619 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
469 | 620 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 621 | } |
@@ -503,7 +654,9 @@ discard block |
||
503 | 654 | } |
504 | 655 | } |
505 | 656 | |
506 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
657 | + if (!$min) { |
|
658 | + $output .= '"image": "'.$image.'",'; |
|
659 | + } |
|
507 | 660 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | 661 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
509 | 662 | } |
@@ -511,8 +664,11 @@ discard block |
||
511 | 664 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
512 | 665 | } |
513 | 666 | if (isset($spotter_item['squawk'])) { |
514 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
515 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
667 | + if ($compress) { |
|
668 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
669 | + } else { |
|
670 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
671 | + } |
|
516 | 672 | } |
517 | 673 | if (isset($spotter_item['squawk_usage'])) { |
518 | 674 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -531,14 +687,23 @@ discard block |
||
531 | 687 | } |
532 | 688 | // type when not aircraft ? |
533 | 689 | if (isset($spotter_item['type'])) { |
534 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
535 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
690 | + if ($compress) { |
|
691 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
692 | + } else { |
|
693 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
694 | + } |
|
536 | 695 | } elseif ($marine) { |
537 | - if ($compress) $output .= '"t": "ship"'; |
|
538 | - else $output .= '"type": "ship"'; |
|
696 | + if ($compress) { |
|
697 | + $output .= '"t": "ship"'; |
|
698 | + } else { |
|
699 | + $output .= '"type": "ship"'; |
|
700 | + } |
|
539 | 701 | } else { |
540 | - if ($compress) $output .= '"t": "aircraft"'; |
|
541 | - else $output .= '"type": "aircraft"'; |
|
702 | + if ($compress) { |
|
703 | + $output .= '"t": "aircraft"'; |
|
704 | + } else { |
|
705 | + $output .= '"type": "aircraft"'; |
|
706 | + } |
|
542 | 707 | } |
543 | 708 | $output .= '},'; |
544 | 709 | $output .= '"geometry": {'; |
@@ -546,15 +711,19 @@ discard block |
||
546 | 711 | $output .= '"coordinates": ['; |
547 | 712 | if ($currenttime != '') { |
548 | 713 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
714 | + if (!isset($archivespeed)) { |
|
715 | + $archivespeed = 1; |
|
716 | + } |
|
550 | 717 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
551 | 718 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
552 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
553 | - else { |
|
719 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
720 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
721 | + } else { |
|
554 | 722 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
555 | 723 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
556 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
557 | - else { |
|
724 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
725 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
726 | + } else { |
|
558 | 727 | $output .= $spotter_item['longitude'].', '; |
559 | 728 | $output .= $spotter_item['latitude']; |
560 | 729 | } |
@@ -632,7 +801,9 @@ discard block |
||
632 | 801 | } |
633 | 802 | */ |
634 | 803 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
635 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
804 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
805 | + $history = $_COOKIE['history']; |
|
806 | + } |
|
636 | 807 | |
637 | 808 | if ( |
638 | 809 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -702,8 +873,11 @@ discard block |
||
702 | 873 | $output_history .= ']}},'; |
703 | 874 | $output .= $output_history; |
704 | 875 | } |
705 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
706 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
876 | + if ($compress) { |
|
877 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
878 | + } else { |
|
879 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
880 | + } |
|
707 | 881 | } |
708 | 882 | $output_history .= '['; |
709 | 883 | $output_history .= $spotter_history['longitude'].', '; |
@@ -724,10 +898,15 @@ discard block |
||
724 | 898 | if ($d == false) { |
725 | 899 | if ($compress) { |
726 | 900 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
727 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
728 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
901 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
902 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
903 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
904 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
905 | + } |
|
729 | 906 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
730 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
907 | + } else { |
|
908 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
909 | + } |
|
731 | 910 | $d = true; |
732 | 911 | } |
733 | 912 | $output_history .= '['; |
@@ -750,7 +929,9 @@ discard block |
||
750 | 929 | $output_historyd = '['; |
751 | 930 | $output_historyd .= $spotter_item['longitude'].', '; |
752 | 931 | $output_historyd .= $spotter_item['latitude']; |
753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
932 | + if (isset($spotter_history['altitude'])) { |
|
933 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
934 | + } |
|
754 | 935 | $output_historyd .= '],'; |
755 | 936 | //$output_history = $output_historyd.$output_history; |
756 | 937 | $output_history = $output_history.$output_historyd; |
@@ -777,8 +958,11 @@ discard block |
||
777 | 958 | && $spotter_item['arrival_airport'] != 'NA' |
778 | 959 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
779 | 960 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
780 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + if ($compress) { |
|
962 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
963 | + } else { |
|
964 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
965 | + } |
|
782 | 966 | if (isset($spotter_item['departure_airport_latitude'])) { |
783 | 967 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
784 | 968 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -811,8 +995,11 @@ discard block |
||
811 | 995 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
812 | 996 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
813 | 997 | $havedata = false; |
814 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
998 | + if ($compress) { |
|
999 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1000 | + } else { |
|
1001 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1002 | + } |
|
816 | 1003 | |
817 | 1004 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
818 | 1005 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -837,7 +1024,9 @@ discard block |
||
837 | 1024 | $output_dest = substr($output_dest, 0, -1); |
838 | 1025 | } |
839 | 1026 | $output_dest .= ']}},'; |
840 | - if ($havedata) $output .= $output_dest; |
|
1027 | + if ($havedata) { |
|
1028 | + $output .= $output_dest; |
|
1029 | + } |
|
841 | 1030 | unset($output_dest); |
842 | 1031 | } |
843 | 1032 | } |
@@ -845,7 +1034,9 @@ discard block |
||
845 | 1034 | $output .= ']'; |
846 | 1035 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
847 | 1036 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
848 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1037 | + if (isset($begindate)) { |
|
1038 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1039 | + } |
|
849 | 1040 | $output .= '"fc": "'.$j.'"'; |
850 | 1041 | } else { |
851 | 1042 | $output .= '"features": '; |