@@ -18,82 +18,82 @@ discard block |
||
| 18 | 18 | public function parse($buffer) { |
| 19 | 19 | // Not yet finished, no CRC checks |
| 20 | 20 | $data = array(); |
| 21 | - $typehex = substr($buffer,0,1); |
|
| 22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
| 23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
| 24 | - else $hex = substr($buffer,1,-1); |
|
| 25 | - $bin = gmp_strval( gmp_init($hex,16), 2); |
|
| 21 | + $typehex = substr($buffer, 0, 1); |
|
| 22 | + if ($typehex == '*' || $typehex == ':') $hex = substr($buffer, 1, -1); |
|
| 23 | + elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer, 13, -13); |
|
| 24 | + else $hex = substr($buffer, 1, -1); |
|
| 25 | + $bin = gmp_strval(gmp_init($hex, 16), 2); |
|
| 26 | 26 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
| 27 | 27 | if (strlen($hex) == 28) { |
| 28 | - $df = intval(substr($bin,0,5),2); |
|
| 28 | + $df = intval(substr($bin, 0, 5), 2); |
|
| 29 | 29 | //$ca = intval(substr($bin,5,3),2); |
| 30 | 30 | // Only support DF17 for now |
| 31 | 31 | //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) { |
| 32 | - if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) { |
|
| 33 | - $icao = substr($hex,2,6); |
|
| 32 | + if (($df == 17 || $df == 18) && ($this->parityCheck($hex, $bin) || $typehex == '@')) { |
|
| 33 | + $icao = substr($hex, 2, 6); |
|
| 34 | 34 | $data['hex'] = $icao; |
| 35 | - $tc = intval(substr($bin,32,5),2); |
|
| 35 | + $tc = intval(substr($bin, 32, 5), 2); |
|
| 36 | 36 | if ($tc >= 1 && $tc <= 4) { |
| 37 | 37 | //callsign |
| 38 | - $csbin = substr($bin,40,56); |
|
| 38 | + $csbin = substr($bin, 40, 56); |
|
| 39 | 39 | $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'); |
| 40 | 40 | $cs = ''; |
| 41 | - $cs .= $charset[intval(substr($csbin,0,6),2)]; |
|
| 42 | - $cs .= $charset[intval(substr($csbin,6,6),2)]; |
|
| 43 | - $cs .= $charset[intval(substr($csbin,12,6),2)]; |
|
| 44 | - $cs .= $charset[intval(substr($csbin,18,6),2)]; |
|
| 45 | - $cs .= $charset[intval(substr($csbin,24,6),2)]; |
|
| 46 | - $cs .= $charset[intval(substr($csbin,30,6),2)]; |
|
| 47 | - $cs .= $charset[intval(substr($csbin,36,6),2)]; |
|
| 48 | - $cs .= $charset[intval(substr($csbin,42,6),2)]; |
|
| 49 | - $cs = str_replace('_','',$cs); |
|
| 50 | - $cs = str_replace('#','',$cs); |
|
| 41 | + $cs .= $charset[intval(substr($csbin, 0, 6), 2)]; |
|
| 42 | + $cs .= $charset[intval(substr($csbin, 6, 6), 2)]; |
|
| 43 | + $cs .= $charset[intval(substr($csbin, 12, 6), 2)]; |
|
| 44 | + $cs .= $charset[intval(substr($csbin, 18, 6), 2)]; |
|
| 45 | + $cs .= $charset[intval(substr($csbin, 24, 6), 2)]; |
|
| 46 | + $cs .= $charset[intval(substr($csbin, 30, 6), 2)]; |
|
| 47 | + $cs .= $charset[intval(substr($csbin, 36, 6), 2)]; |
|
| 48 | + $cs .= $charset[intval(substr($csbin, 42, 6), 2)]; |
|
| 49 | + $cs = str_replace('_', '', $cs); |
|
| 50 | + $cs = str_replace('#', '', $cs); |
|
| 51 | 51 | $callsign = $cs; |
| 52 | 52 | $data['ident'] = $callsign; |
| 53 | 53 | } elseif ($tc >= 9 && $tc <= 18) { |
| 54 | 54 | // Check Q-bit |
| 55 | - $q = substr($bin,47,1); |
|
| 55 | + $q = substr($bin, 47, 1); |
|
| 56 | 56 | if ($q) { |
| 57 | - $n = intval(substr($bin,40,7).substr($bin,48,4),2); |
|
| 58 | - $alt = $n*25-1000; |
|
| 57 | + $n = intval(substr($bin, 40, 7).substr($bin, 48, 4), 2); |
|
| 58 | + $alt = $n*25 - 1000; |
|
| 59 | 59 | $data['altitude'] = $alt; |
| 60 | 60 | } |
| 61 | 61 | // Check odd/even flag |
| 62 | - $oe = substr($bin,53,1); |
|
| 62 | + $oe = substr($bin, 53, 1); |
|
| 63 | 63 | //if ($oe) => odd else even |
| 64 | 64 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
| 65 | - $cprlat = intval(substr($bin,54,17),2)/131072.0; |
|
| 66 | - $cprlon = intval(substr($bin,71,17),2)/131072.0; |
|
| 67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
| 65 | + $cprlat = intval(substr($bin, 54, 17), 2)/131072.0; |
|
| 66 | + $cprlon = intval(substr($bin, 71, 17), 2)/131072.0; |
|
| 67 | + if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat, 'longitude' => $cprlon, 'created' => time()); |
|
| 68 | 68 | elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
| 69 | 69 | $cprlat_odd = $cprlat; |
| 70 | 70 | $cprlon_odd = $cprlon; |
| 71 | 71 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
| 72 | 72 | $cprlon_even = $this::$latlon[$icao]['longitude']; |
| 73 | - $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
|
| 74 | - $lat_even = (360.0/60)*($j%60+$cprlat_even); |
|
| 75 | - $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
|
| 73 | + $j = 59*$cprlat_even - 60*$cprlat_odd + 0.5; |
|
| 74 | + $lat_even = (360.0/60)*($j%60 + $cprlat_even); |
|
| 75 | + $lat_odd = (360.0/59)*($j%59 + $cprlat_odd); |
|
| 76 | 76 | if ($lat_even >= 270) $lat_even = $lat_even - 360; |
| 77 | 77 | if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
| 78 | 78 | // check latitude zone |
| 79 | 79 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
| 80 | 80 | if ($this::$latlon[$icao]['created'] > time()) { |
| 81 | - $ni = $this->cprN($lat_even,0); |
|
| 82 | - $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
|
| 83 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
|
| 81 | + $ni = $this->cprN($lat_even, 0); |
|
| 82 | + $m = floor($cprlon_even*($this->cprNL($lat_even) - 1) - $cprlon_odd*$this->cprNL($lat_even) + 0.5); |
|
| 83 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_even); |
|
| 84 | 84 | $lat = $lat_even; |
| 85 | - if ($lon > 180) $lon = $lon -360; |
|
| 85 | + if ($lon > 180) $lon = $lon - 360; |
|
| 86 | 86 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
| 87 | 87 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
| 88 | 88 | $data['latitude'] = $lat; |
| 89 | 89 | $data['longitude'] = $lon; |
| 90 | 90 | } |
| 91 | 91 | } else { |
| 92 | - $ni = $this->cprN($lat_odd,1); |
|
| 93 | - $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
|
| 94 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
|
| 92 | + $ni = $this->cprN($lat_odd, 1); |
|
| 93 | + $m = floor($cprlon_even*($this->cprNL($lat_odd) - 1) - $cprlon_odd*$this->cprNL($lat_odd) + 0.5); |
|
| 94 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_odd); |
|
| 95 | 95 | $lat = $lat_odd; |
| 96 | - if ($lon > 180) $lon = $lon -360; |
|
| 96 | + if ($lon > 180) $lon = $lon - 360; |
|
| 97 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
| 98 | 98 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
| 99 | 99 | $data['latitude'] = $lat; |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } elseif ($tc == 19) { |
| 107 | 107 | // speed & heading |
| 108 | - $v_ew_dir = intval(substr($bin,45,1)); |
|
| 109 | - $v_ew = intval(substr($bin,46,10),2); |
|
| 110 | - $v_ns_dir = intval(substr($bin,56,1)); |
|
| 111 | - $v_ns = intval(substr($bin,57,10),2); |
|
| 108 | + $v_ew_dir = intval(substr($bin, 45, 1)); |
|
| 109 | + $v_ew = intval(substr($bin, 46, 10), 2); |
|
| 110 | + $v_ns_dir = intval(substr($bin, 56, 1)); |
|
| 111 | + $v_ns = intval(substr($bin, 57, 10), 2); |
|
| 112 | 112 | if ($v_ew_dir) $v_ew = -1*$v_ew; |
| 113 | 113 | if ($v_ns_dir) $v_ns = -1*$v_ns; |
| 114 | - $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
|
| 115 | - $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
|
| 116 | - if ($heading <0) $heading = $heading+360; |
|
| 114 | + $speed = sqrt($v_ns*$v_ns + $v_ew*$v_ew); |
|
| 115 | + $heading = atan2($v_ew, $v_ns)*360.0/(2*pi()); |
|
| 116 | + if ($heading < 0) $heading = $heading + 360; |
|
| 117 | 117 | $data['speed'] = $speed; |
| 118 | 118 | $data['heading'] = $heading; |
| 119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * Lookup table to convert the latitude to index. |
| 129 | 129 | */ |
| 130 | 130 | private function cprNL($lat) { |
| 131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
| 131 | + if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
| 132 | 132 | if ($lat < 10.47047130) return 59; |
| 133 | 133 | if ($lat < 14.82817437) return 58; |
| 134 | 134 | if ($lat < 18.18626357) return 57; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return 1; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - private function cprN($lat,$isodd) { |
|
| 193 | + private function cprN($lat, $isodd) { |
|
| 194 | 194 | $nl = $this->cprNL($lat) - $isodd; |
| 195 | 195 | if ($nl > 1) return $nl; |
| 196 | 196 | else return 1; |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
| 215 | 215 | ); |
| 216 | 216 | $crc = 0; |
| 217 | - $checksum = intval(substr($msg,22,6),16); |
|
| 217 | + $checksum = intval(substr($msg, 22, 6), 16); |
|
| 218 | 218 | for ($j = 0; $j < strlen($bin); $j++) { |
| 219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
| 219 | + if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j], 0); |
|
| 220 | 220 | } |
| 221 | 221 | if ($crc == $checksum) return true; |
| 222 | 222 | else { |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | $msg['aircraftid'] = hexdec($data['address']); |
| 239 | 239 | $msg['hex'] = $data['address']; |
| 240 | 240 | $msg['flightid'] = hexdec($data['address']); |
| 241 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
| 242 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
| 243 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
| 244 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
| 241 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
| 242 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
| 243 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
| 244 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
| 245 | 245 | $msg['callsign'] = $data['ident']; |
| 246 | 246 | $msg['altitude'] = ''; |
| 247 | 247 | $msg['speed'] = ''; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $msg['emergency'] = ''; |
| 255 | 255 | $msg['SPI'] = ''; |
| 256 | 256 | $msg['ground'] = ''; |
| 257 | - $result[] = implode(',',$msg); |
|
| 257 | + $result[] = implode(',', $msg); |
|
| 258 | 258 | } |
| 259 | 259 | if (isset($data['latitude']) && $data['latitude'] != 0) { |
| 260 | 260 | $msg = array(); |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | $msg['aircraftid'] = hexdec($data['address']); |
| 265 | 265 | $msg['hex'] = $data['address']; |
| 266 | 266 | $msg['flightid'] = hexdec($data['address']); |
| 267 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
| 268 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
| 269 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
| 270 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
| 267 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
| 268 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
| 269 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
| 270 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
| 271 | 271 | $msg['callsign'] = ''; |
| 272 | 272 | if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
| 273 | 273 | else $msg['altitude'] = ''; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $msg['SPI'] = 0; |
| 286 | 286 | if (isset($data['ground'])) $msg['ground'] = 1; |
| 287 | 287 | else $msg['ground'] = 0; |
| 288 | - $result[] = implode(',',$msg); |
|
| 288 | + $result[] = implode(',', $msg); |
|
| 289 | 289 | } |
| 290 | 290 | return $result; |
| 291 | 291 | } |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | $min = true; |
| 65 | 65 | $allhistory = false; |
| 66 | 66 | $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); |
|
| 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); |
|
| 78 | 78 | |
| 79 | 79 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 80 | 80 | $min = true; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $spotter_array = array(); |
| 84 | 84 | |
| 85 | 85 | if (isset($_GET['ident'])) { |
| 86 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 86 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 87 | 87 | if ($tracker) { |
| 88 | 88 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
| 89 | 89 | } elseif ($marine) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $allhistory = true; |
| 99 | 99 | } elseif (isset($_GET['flightaware_id'])) { |
| 100 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 100 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 101 | 101 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 102 | 102 | if (empty($spotter_array)) { |
| 103 | 103 | $from_archive = true; |
@@ -105,38 +105,38 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | $allhistory = true; |
| 107 | 107 | } elseif (isset($_GET['famtrack_id'])) { |
| 108 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
| 108 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
| 109 | 109 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
| 110 | 110 | $allhistory = true; |
| 111 | 111 | } elseif (isset($_GET['fammarine_id'])) { |
| 112 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
| 112 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
| 113 | 113 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
| 114 | 114 | $allhistory = true; |
| 115 | 115 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
| 116 | 116 | //} elseif (isset($_GET['coord'])) { |
| 117 | 117 | $usecoord = true; |
| 118 | - $coord = explode(',',$_GET['coord']); |
|
| 119 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 118 | + $coord = explode(',', $_GET['coord']); |
|
| 119 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 120 | 120 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
| 121 | 121 | if ($tracker) { |
| 122 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
| 122 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
| 123 | 123 | } elseif ($marine) { |
| 124 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
| 124 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
| 125 | 125 | } else { |
| 126 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
| 126 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
| 130 | 130 | $usecoord = true; |
| 131 | - $coord = explode(',',$_GET['coord']); |
|
| 132 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 131 | + $coord = explode(',', $_GET['coord']); |
|
| 132 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 133 | 133 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
| 134 | 134 | if ($tracker) { |
| 135 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
| 135 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
| 136 | 136 | } elseif ($marine) { |
| 137 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
| 137 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
| 138 | 138 | } else { |
| 139 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
| 139 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
| 140 | 140 | } |
| 141 | 141 | } else { |
| 142 | 142 | if ($tracker) { |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | $from_archive = true; |
| 152 | 152 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 153 | 153 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 154 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 155 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 156 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 157 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 158 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 159 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 154 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 155 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 156 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 157 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 158 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 159 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 160 | 160 | } elseif ($min) { |
| 161 | 161 | if ($tracker) { |
| 162 | 162 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | # $min = true; |
| 169 | 169 | } else { |
| 170 | 170 | if ($tracker) { |
| 171 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
| 171 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
| 172 | 172 | } elseif ($marine) { |
| 173 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
| 173 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
| 174 | 174 | } else { |
| 175 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
| 175 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if ($usecoord) { |
| 180 | 180 | if (isset($_GET['archive'])) { |
| 181 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 181 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 182 | 182 | } else { |
| 183 | 183 | if ($tracker) { |
| 184 | 184 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | if ($flightcnt == '') $flightcnt = 0; |
| 192 | 192 | } else $flightcnt = 0; |
| 193 | 193 | |
| 194 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 194 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 195 | 195 | |
| 196 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 196 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 197 | 197 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
| 198 | 198 | |
| 199 | 199 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 213 | 213 | { |
| 214 | 214 | $output .= '"features": ['; |
| 215 | - foreach($spotter_array as $spotter_item) |
|
| 215 | + foreach ($spotter_array as $spotter_item) |
|
| 216 | 216 | { |
| 217 | 217 | $j++; |
| 218 | 218 | unset($idistance); |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 271 | 271 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 272 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 273 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 272 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 273 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 274 | 274 | //" |
| 275 | 275 | } else { |
| 276 | 276 | if ($compress) $output .= '"c": "NA",'; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 280 | 280 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 281 | 281 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 282 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 282 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 283 | 283 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 284 | 284 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 285 | 285 | } elseif (!$min) { |
@@ -422,15 +422,15 @@ discard block |
||
| 422 | 422 | if (isset($archivespeed) || $usenextlatlon) { |
| 423 | 423 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
| 424 | 424 | if (isset($spotter_item['arrival_airport_latitude'])) { |
| 425 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
| 426 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
| 425 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
| 426 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
| 427 | 427 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
| 428 | 428 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
| 429 | 429 | } else { |
| 430 | 430 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 431 | 431 | if (isset($aairport[0]['latitude'])) { |
| 432 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
| 433 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
| 432 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
| 433 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
| 434 | 434 | $farr_lat = $aairport[0]['latitude']; |
| 435 | 435 | $farr_lon = $aairport[0]['longitude']; |
| 436 | 436 | } |
@@ -443,59 +443,59 @@ discard block |
||
| 443 | 443 | if ($currenttime != '') { |
| 444 | 444 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 445 | 445 | if (isset($archivespeed)) { |
| 446 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 447 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 446 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 447 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 448 | 448 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 449 | 449 | else { |
| 450 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 451 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 450 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 451 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 452 | 452 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 453 | 453 | else { |
| 454 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 454 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 455 | 455 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } elseif ($usenextlatlon) { |
| 459 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 460 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 459 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 460 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 461 | 461 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 462 | 462 | else { |
| 463 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 464 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 463 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 464 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 465 | 465 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 466 | 466 | else { |
| 467 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 467 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 468 | 468 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | } else { |
| 473 | 473 | if (isset($archivespeed)) { |
| 474 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 474 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 475 | 475 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 476 | 476 | } elseif ($usenextlatlon) { |
| 477 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 477 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 478 | 478 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } else { |
| 482 | 482 | if (isset($archivespeed)) { |
| 483 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 484 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 483 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 484 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 485 | 485 | if (!isset($idistance) || $fdistance < $idistance) { |
| 486 | 486 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 487 | 487 | } else { |
| 488 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
| 488 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
| 489 | 489 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 490 | 490 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 491 | 491 | } |
| 492 | 492 | } elseif ($usenextlatlon) { |
| 493 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 494 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 493 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 494 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 495 | 495 | if (!isset($idistance) || $fdistance < $idistance) { |
| 496 | 496 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 497 | 497 | } else { |
| 498 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
| 498 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
| 499 | 499 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 500 | 500 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 501 | 501 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 506 | 506 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 507 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 507 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 508 | 508 | } |
| 509 | 509 | if (isset($spotter_item['image_source_website'])) { |
| 510 | 510 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 527 | 527 | } |
| 528 | 528 | if (isset($spotter_item['acars'])) { |
| 529 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 529 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 530 | 530 | } |
| 531 | 531 | // type when not aircraft ? |
| 532 | 532 | if (isset($spotter_item['type'])) { |
@@ -546,12 +546,12 @@ discard block |
||
| 546 | 546 | if ($currenttime != '') { |
| 547 | 547 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 548 | 548 | if (!isset($archivespeed)) $archivespeed = 1; |
| 549 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
| 550 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 549 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
| 550 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 551 | 551 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 552 | 552 | else { |
| 553 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
| 554 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 553 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
| 554 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 555 | 555 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 556 | 556 | else { |
| 557 | 557 | $output .= $spotter_item['longitude'].', '; |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | } |
| 632 | 632 | */ |
| 633 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
| 633 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
| 634 | 634 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 635 | 635 | |
| 636 | 636 | if ( |
@@ -638,11 +638,11 @@ discard block |
||
| 638 | 638 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
| 639 | 639 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
| 640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
| 641 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 641 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 642 | 642 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
| 643 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 643 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
| 644 | 644 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
| 645 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 645 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
| 646 | 646 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
| 647 | 647 | ) { |
| 648 | 648 | if ($tracker) { |
@@ -698,9 +698,9 @@ discard block |
||
| 698 | 698 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
| 699 | 699 | } |
| 700 | 700 | $output_history .= '['; |
| 701 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 702 | - $output_history .= $spotter_history['latitude'].', '; |
|
| 703 | - $output_history .= $spotter_history['altitude']*30.48; |
|
| 701 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 702 | + $output_history .= $spotter_history['latitude'].', '; |
|
| 703 | + $output_history .= $spotter_history['altitude']*30.48; |
|
| 704 | 704 | $output_history .= '],'; |
| 705 | 705 | /* |
| 706 | 706 | if ($from_archive === false) { |
@@ -719,8 +719,8 @@ discard block |
||
| 719 | 719 | $d = true; |
| 720 | 720 | } |
| 721 | 721 | $output_history .= '['; |
| 722 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 723 | - $output_history .= $spotter_history['latitude']; |
|
| 722 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 723 | + $output_history .= $spotter_history['latitude']; |
|
| 724 | 724 | $output_history .= '],'; |
| 725 | 725 | /* |
| 726 | 726 | if ($from_archive === false) { |
@@ -736,9 +736,9 @@ discard block |
||
| 736 | 736 | //echo $output_history; |
| 737 | 737 | if ($from_archive === false) { |
| 738 | 738 | $output_historyd = '['; |
| 739 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
| 740 | - $output_historyd .= $spotter_item['latitude']; |
|
| 741 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 739 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
| 740 | + $output_historyd .= $spotter_item['latitude']; |
|
| 741 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 742 | 742 | $output_historyd .= '],'; |
| 743 | 743 | //$output_history = $output_historyd.$output_history; |
| 744 | 744 | $output_history = $output_history.$output_historyd; |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 755 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 756 | 756 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 757 | 757 | && (isset($spotter_item['departure_airport']) |
| 758 | 758 | && $spotter_item['departure_airport'] != 'NA' |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 788 | 788 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 789 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 789 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 790 | 790 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 791 | 791 | && (isset($spotter_item['arrival_airport']) |
| 792 | 792 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $output = substr($output, 0, -1); |
| 818 | 818 | $output .= ']'; |
| 819 | 819 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 820 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 820 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 821 | 821 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 822 | 822 | $output .= '"fc": "'.$j.'"'; |
| 823 | 823 | } else { |