@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false) { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '', $sizelimit = false, $async = false) { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //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'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($sizelimit === true) { |
69 | 69 | curl_setopt($ch, CURLOPT_BUFFERSIZE, 128); |
70 | 70 | curl_setopt($ch, CURLOPT_NOPROGRESS, false); |
71 | - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr,$downloadsize, $downloaded, $uploadsize, $uploaded){ |
|
71 | + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr, $downloadsize, $downloaded, $uploadsize, $uploaded) { |
|
72 | 72 | return ($downloaded > (3*1024)) ? 1 : 0; |
73 | 73 | }); |
74 | 74 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | $result = curl_exec($ch); |
80 | 80 | $info = curl_getinfo($ch); |
81 | 81 | curl_close($ch); |
82 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
82 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
83 | 83 | echo "Cloudflare Detected\n"; |
84 | 84 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
85 | 85 | $useragent = UAgent::random(); |
86 | 86 | cloudflare::useUserAgent($useragent); |
87 | 87 | if ($clearanceCookie = cloudflare::bypass($url)) { |
88 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
88 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | return $result; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
110 | 110 | if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
111 | 111 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
112 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
112 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
113 | 113 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
114 | 114 | } |
115 | 115 | } |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | fclose($fp); |
125 | 125 | } |
126 | 126 | |
127 | - public static function gunzip($in_file,$out_file_name = '') { |
|
127 | + public static function gunzip($in_file, $out_file_name = '') { |
|
128 | 128 | //echo $in_file.' -> '.$out_file_name."\n"; |
129 | 129 | $buffer_size = 4096; // read 4kb at a time |
130 | 130 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
131 | 131 | if ($in_file != '' && file_exists($in_file)) { |
132 | 132 | // 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'); |
|
133 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
134 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
135 | 135 | else { |
136 | 136 | echo 'gzopen not available'; |
137 | 137 | die; |
138 | 138 | } |
139 | 139 | $out_file = fopen($out_file_name, 'wb'); |
140 | - while(!gzeof($file)) { |
|
140 | + while (!gzeof($file)) { |
|
141 | 141 | fwrite($out_file, gzread($file, $buffer_size)); |
142 | 142 | } |
143 | 143 | fclose($out_file); |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
148 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
149 | 149 | //echo $in_file.' -> '.$out_file_name."\n"; |
150 | 150 | $buffer_size = 4096; // read 4kb at a time |
151 | 151 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
152 | 152 | if ($in_file != '' && file_exists($in_file)) { |
153 | 153 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
154 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
154 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
155 | 155 | else { |
156 | 156 | echo 'bzopen not available'; |
157 | 157 | die; |
158 | 158 | } |
159 | 159 | $out_file = fopen($out_file_name, 'wb'); |
160 | - while(!feof($file)) { |
|
160 | + while (!feof($file)) { |
|
161 | 161 | fwrite($out_file, bzread($file, $buffer_size)); |
162 | 162 | } |
163 | 163 | fclose($out_file); |
@@ -175,27 +175,27 @@ discard block |
||
175 | 175 | if ($data == '') return array(); |
176 | 176 | $html = str_get_html($data); |
177 | 177 | if ($html === false) return array(); |
178 | - $tabledata=array(); |
|
179 | - foreach($html->find('tr') as $element) |
|
178 | + $tabledata = array(); |
|
179 | + foreach ($html->find('tr') as $element) |
|
180 | 180 | { |
181 | 181 | $td = array(); |
182 | - foreach( $element->find('th') as $row) |
|
182 | + foreach ($element->find('th') as $row) |
|
183 | 183 | { |
184 | 184 | $td [] = trim($row->plaintext); |
185 | 185 | } |
186 | - $td=array_filter($td); |
|
186 | + $td = array_filter($td); |
|
187 | 187 | $tabledata[] = $td; |
188 | 188 | |
189 | 189 | $td = array(); |
190 | 190 | $tdi = array(); |
191 | - foreach( $element->find('td') as $row) |
|
191 | + foreach ($element->find('td') as $row) |
|
192 | 192 | { |
193 | 193 | $td [] = trim($row->plaintext); |
194 | 194 | $tdi [] = trim($row->innertext); |
195 | 195 | } |
196 | - $td=array_filter($td); |
|
197 | - $tdi=array_filter($tdi); |
|
198 | - $tabledata[]=array_merge($td,$tdi); |
|
196 | + $td = array_filter($td); |
|
197 | + $tdi = array_filter($tdi); |
|
198 | + $tabledata[] = array_merge($td, $tdi); |
|
199 | 199 | } |
200 | 200 | $html->clear(); |
201 | 201 | unset($html); |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | public function text2array($data) { |
211 | 211 | $html = str_get_html($data); |
212 | 212 | if ($html === false) return array(); |
213 | - $tabledata=array(); |
|
214 | - foreach($html->find('p') as $element) |
|
213 | + $tabledata = array(); |
|
214 | + foreach ($html->find('p') as $element) |
|
215 | 215 | { |
216 | 216 | $tabledata [] = trim($element->plaintext); |
217 | 217 | } |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | 233 | if ($lat == $latc && $lon == $lonc) return 0; |
234 | - $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; |
|
234 | + $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 | 235 | if ($unit == "km") { |
236 | - return round($dist * 1.609344); |
|
236 | + return round($dist*1.609344); |
|
237 | 237 | } elseif ($unit == "m") { |
238 | - return round($dist * 1.609344 * 1000); |
|
238 | + return round($dist*1.609344*1000); |
|
239 | 239 | } elseif ($unit == "mile" || $unit == "mi") { |
240 | 240 | return round($dist); |
241 | 241 | } elseif ($unit == "nm") { |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * @param String $distance distance between two points in m |
253 | 253 | * @return Float plunge |
254 | 254 | */ |
255 | - public function plunge($initial_altitude,$final_altitude,$distance) { |
|
256 | - $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
|
255 | + public function plunge($initial_altitude, $final_altitude, $distance) { |
|
256 | + $plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance)); |
|
257 | 257 | return $plunge; |
258 | 258 | } |
259 | 259 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | public function azimuth($lat, $lon, $latc, $lonc) { |
269 | 269 | $dX = $latc - $lat; |
270 | 270 | $dY = $lonc - $lon; |
271 | - $azimuth = rad2deg(atan2($dY,$dX)); |
|
272 | - if ($azimuth < 0) return $azimuth+360; |
|
271 | + $azimuth = rad2deg(atan2($dY, $dX)); |
|
272 | + if ($azimuth < 0) return $azimuth + 360; |
|
273 | 273 | return $azimuth; |
274 | 274 | } |
275 | 275 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param float $distance distance covered |
281 | 281 | * @return whether distance is realistic |
282 | 282 | */ |
283 | - public function withinThreshold ($timeDifference, $distance) { |
|
283 | + public function withinThreshold($timeDifference, $distance) { |
|
284 | 284 | $x = abs($timeDifference); |
285 | 285 | $d = abs($distance); |
286 | 286 | if ($x == 0 || $d == 0) return true; |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | return ($array !== array_values($array)); |
297 | 297 | } |
298 | 298 | |
299 | - public function isInteger($input){ |
|
299 | + public function isInteger($input) { |
|
300 | 300 | return(ctype_digit(strval($input))); |
301 | 301 | } |
302 | 302 | |
303 | 303 | |
304 | - public function convertDec($dms,$latlong) { |
|
304 | + public function convertDec($dms, $latlong) { |
|
305 | 305 | if ($latlong == 'latitude') { |
306 | 306 | $deg = substr($dms, 0, 2); |
307 | 307 | $min = substr($dms, 2, 4); |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | $deg = substr($dms, 0, 3); |
310 | 310 | $min = substr($dms, 3, 5); |
311 | 311 | } |
312 | - return $deg+(($min*60)/3600); |
|
312 | + return $deg + (($min*60)/3600); |
|
313 | 313 | } |
314 | 314 | |
315 | - public function convertDM($coord,$latlong) { |
|
315 | + public function convertDM($coord, $latlong) { |
|
316 | 316 | if ($latlong == 'latitude') { |
317 | 317 | if ($coord < 0) $NSEW = 'S'; |
318 | 318 | else $NSEW = 'N'; |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | } |
323 | 323 | $coord = abs($coord); |
324 | 324 | $deg = floor($coord); |
325 | - $coord = ($coord-$deg)*60; |
|
325 | + $coord = ($coord - $deg)*60; |
|
326 | 326 | $min = $coord; |
327 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
327 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | public function xcopy($source, $dest) |
337 | 337 | { |
338 | 338 | $files = glob($source.'*.*'); |
339 | - foreach($files as $file){ |
|
340 | - $file_to_go = str_replace($source,$dest,$file); |
|
339 | + foreach ($files as $file) { |
|
340 | + $file_to_go = str_replace($source, $dest, $file); |
|
341 | 341 | copy($file, $file_to_go); |
342 | 342 | } |
343 | 343 | return true; |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | * @param String $url url to check |
349 | 349 | * @return bool Return true on succes false on failure |
350 | 350 | */ |
351 | - public function urlexist($url){ |
|
352 | - $headers=get_headers($url); |
|
353 | - return stripos($headers[0],"200 OK")?true:false; |
|
351 | + public function urlexist($url) { |
|
352 | + $headers = get_headers($url); |
|
353 | + return stripos($headers[0], "200 OK") ?true:false; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | public function hex2str($hex) { |
362 | 362 | $str = ''; |
363 | 363 | $hexln = strlen($hex); |
364 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
364 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
365 | 365 | return $str; |
366 | 366 | } |
367 | 367 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * @return String Return result |
372 | 372 | */ |
373 | 373 | public function hex2rgb($hex) { |
374 | - $hex = str_replace('#','',$hex); |
|
374 | + $hex = str_replace('#', '', $hex); |
|
375 | 375 | return sscanf($hex, "%02x%02x%02x"); |
376 | 376 | } |
377 | 377 | |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | //difference in longitudinal coordinates |
380 | 380 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
381 | 381 | //difference in the phi of latitudinal coordinates |
382 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
382 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
383 | 383 | //we need to recalculate $dLon if it is greater than pi |
384 | - if(abs($dLon) > pi()) { |
|
385 | - if($dLon > 0) { |
|
386 | - $dLon = (2 * pi() - $dLon) * -1; |
|
384 | + if (abs($dLon) > pi()) { |
|
385 | + if ($dLon > 0) { |
|
386 | + $dLon = (2*pi() - $dLon)*-1; |
|
387 | 387 | } else { |
388 | - $dLon = 2 * pi() + $dLon; |
|
388 | + $dLon = 2*pi() + $dLon; |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | //return the angle, normalized |
392 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
392 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
393 | 393 | } |
394 | 394 | |
395 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) { |
|
395 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) { |
|
396 | 396 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
397 | - $a = -($lon2-$lon1); |
|
397 | + $a = -($lon2 - $lon1); |
|
398 | 398 | $b = $lat2 - $lat1; |
399 | - $c = -($a*$lat1+$b*$lon1); |
|
400 | - $d = $a*$lat3+$b*$lon3+$c; |
|
399 | + $c = -($a*$lat1 + $b*$lon1); |
|
400 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
401 | 401 | if ($d > -$approx && $d < $approx) return true; |
402 | 402 | else return false; |
403 | 403 | } |
404 | 404 | |
405 | 405 | public function array_merge_noappend() { |
406 | 406 | $output = array(); |
407 | - foreach(func_get_args() as $array) { |
|
408 | - foreach($array as $key => $value) { |
|
407 | + foreach (func_get_args() as $array) { |
|
408 | + foreach ($array as $key => $value) { |
|
409 | 409 | $output[$key] = isset($output[$key]) ? |
410 | 410 | array_merge($output[$key], $value) : $value; |
411 | 411 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | return $result; |
470 | 470 | } |
471 | 471 | |
472 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){ |
|
472 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') { |
|
473 | 473 | global $globalMapRefresh; |
474 | 474 | if ($seconds == '') { |
475 | 475 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $latitude = deg2rad($latitude); |
481 | 481 | $longitude = deg2rad($longitude); |
482 | 482 | $bearing = deg2rad($heading); |
483 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
484 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
485 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
483 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
484 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
485 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
486 | 486 | } |
487 | 487 | |
488 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
488 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
489 | 489 | // distance in meter |
490 | 490 | $R = 6378.14; |
491 | - $latitude1 = $latitude * (M_PI/180); |
|
492 | - $longitude1 = $longitude * (M_PI/180); |
|
493 | - $brng = $bearing * (M_PI/180); |
|
491 | + $latitude1 = $latitude*(M_PI/180); |
|
492 | + $longitude1 = $longitude*(M_PI/180); |
|
493 | + $brng = $bearing*(M_PI/180); |
|
494 | 494 | $d = $distance; |
495 | 495 | |
496 | 496 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
497 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
497 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
498 | 498 | |
499 | - $latitude2 = $latitude2 * (180/M_PI); |
|
500 | - $longitude2 = $longitude2 * (180/M_PI); |
|
499 | + $latitude2 = $latitude2*(180/M_PI); |
|
500 | + $longitude2 = $longitude2*(180/M_PI); |
|
501 | 501 | |
502 | - $flat = round ($latitude2,6); |
|
503 | - $flong = round ($longitude2,6); |
|
502 | + $flat = round($latitude2, 6); |
|
503 | + $flong = round($longitude2, 6); |
|
504 | 504 | /* |
505 | 505 | $dx = $distance*cos($bearing); |
506 | 506 | $dy = $distance*sin($bearing); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $flong = $longitude + $dlong; |
510 | 510 | $flat = $latitude + $dlat; |
511 | 511 | */ |
512 | - return array('latitude' => $flat,'longitude' => $flong); |
|
512 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -523,14 +523,14 @@ discard block |
||
523 | 523 | * @param integer $level GZIP compression level (default: 9) |
524 | 524 | * @return string New filename (with .gz appended) if success, or false if operation fails |
525 | 525 | */ |
526 | - public function gzCompressFile($source, $level = 9){ |
|
527 | - $dest = $source . '.gz'; |
|
528 | - $mode = 'wb' . $level; |
|
526 | + public function gzCompressFile($source, $level = 9) { |
|
527 | + $dest = $source.'.gz'; |
|
528 | + $mode = 'wb'.$level; |
|
529 | 529 | $error = false; |
530 | 530 | if ($fp_out = gzopen($dest, $mode)) { |
531 | - if ($fp_in = fopen($source,'rb')) { |
|
531 | + if ($fp_in = fopen($source, 'rb')) { |
|
532 | 532 | while (!feof($fp_in)) |
533 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
533 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
534 | 534 | fclose($fp_in); |
535 | 535 | } else { |
536 | 536 | $error = true; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | } |
547 | 547 | |
548 | 548 | public function remove_accents($string) { |
549 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
549 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
550 | 550 | $chars = array( |
551 | 551 | // Decompositions for Latin-1 Supplement |
552 | 552 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
604 | 604 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
605 | 605 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
606 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
606 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
607 | 607 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
608 | 608 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
609 | 609 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
620 | 620 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
621 | 621 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
622 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
623 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
624 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
625 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
626 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
627 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
628 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
622 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
623 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
624 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
625 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
626 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
627 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
628 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
629 | 629 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
630 | 630 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
631 | 631 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
660 | 660 | if (is_numeric($string[$i]) && $concat_flag) { |
661 | 661 | $int .= $string[$i]; |
662 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
662 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
663 | 663 | $concat_flag = false; |
664 | 664 | } |
665 | 665 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $slice = array_slice($arr, $offset + 1, $length); |
706 | 706 | return implode("", $slice); |
707 | 707 | } else { |
708 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
708 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | //NOTE: use a trailing slash for folders!!! |
716 | 716 | //see http://bugs.php.net/bug.php?id=27609 |
717 | 717 | //see http://bugs.php.net/bug.php?id=30931 |
718 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
718 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
719 | 719 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
720 | 720 | else if (is_dir($path)) |
721 | 721 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
722 | 722 | // check tmp file for read/write capabilities |
723 | 723 | $rm = file_exists($path); |
724 | 724 | $f = @fopen($path, 'a'); |
725 | - if ($f===false) |
|
725 | + if ($f === false) |
|
726 | 726 | return false; |
727 | 727 | fclose($f); |
728 | 728 | if (!$rm) |
@@ -741,29 +741,29 @@ discard block |
||
741 | 741 | * @param Integer $offset Controls the likelyhood that lines will be split which cross the dateline |
742 | 742 | * @return Array Coordinate of the route |
743 | 743 | */ |
744 | - 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)); |
|
744 | + 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)); |
|
746 | 746 | $sx = deg2rad($begin_lon); |
747 | 747 | $sy = deg2rad($begin_lat); |
748 | 748 | $ex = deg2rad($end_lon); |
749 | 749 | $ey = deg2rad($end_lat); |
750 | 750 | $w = $sx - $ex; |
751 | 751 | $h = $sy - $ey; |
752 | - $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
|
752 | + $z = pow(sin($h/2.0), 2) + cos($sy)*cos($ey)*pow(sin($w/2.0), 2); |
|
753 | 753 | $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)); |
|
754 | + if ($g == pi() || is_nan($g)) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat)); |
|
755 | 755 | $first_pass = array(); |
756 | - $delta = 1.0/($nbpts-1); |
|
757 | - for ($i =0; $i < $nbpts; ++$i) { |
|
756 | + $delta = 1.0/($nbpts - 1); |
|
757 | + for ($i = 0; $i < $nbpts; ++$i) { |
|
758 | 758 | $step = $delta*$i; |
759 | - $A = sin((1 - $step) * $g) / sin($g); |
|
760 | - $B = sin($step * $g) / sin($g); |
|
761 | - $x = $A * cos($sy) * cos($sx) + $B * cos($ey) * cos($ex); |
|
762 | - $y = $A * cos($sy) * sin($sx) + $B * cos($ey) * sin($ex); |
|
763 | - $z = $A * sin($sy) + $B * sin($ey); |
|
759 | + $A = sin((1 - $step)*$g)/sin($g); |
|
760 | + $B = sin($step*$g)/sin($g); |
|
761 | + $x = $A*cos($sy)*cos($sx) + $B*cos($ey)*cos($ex); |
|
762 | + $y = $A*cos($sy)*sin($sx) + $B*cos($ey)*sin($ex); |
|
763 | + $z = $A*sin($sy) + $B*sin($ey); |
|
764 | 764 | $lat = rad2deg(atan2($z, sqrt(pow($x, 2) + pow($y, 2)))); |
765 | 765 | $lon = rad2deg(atan2($y, $x)); |
766 | - $first_pass[] = array($lon,$lat); |
|
766 | + $first_pass[] = array($lon, $lat); |
|
767 | 767 | } |
768 | 768 | $bHasBigDiff = false; |
769 | 769 | $dfMaxSmallDiffLong = 0; |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | |
778 | 778 | // https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342 |
779 | 779 | for ($j = 1; $j < count($first_pass); ++$j) { |
780 | - $dfPrevX = $first_pass[$j-1][0]; |
|
780 | + $dfPrevX = $first_pass[$j - 1][0]; |
|
781 | 781 | $dfX = $first_pass[$j][0]; |
782 | 782 | $dfDiffLong = abs($dfX - $dfPrevX); |
783 | 783 | if ($dfDiffLong > $dfDiffSpace && |
@@ -794,14 +794,14 @@ discard block |
||
794 | 794 | //$poMulti[] = $poNewLS; |
795 | 795 | for ($k = 0; $k < count($first_pass); ++$k) { |
796 | 796 | $dfX0 = floatval($first_pass[$k][0]); |
797 | - if ($k > 0 && abs($dfX0 - $first_pass[$k-1][0]) > $dfDiffSpace) { |
|
798 | - $dfX1 = floatval($first_pass[$k-1][0]); |
|
799 | - $dfY1 = floatval($first_pass[$k-1][1]); |
|
797 | + if ($k > 0 && abs($dfX0 - $first_pass[$k - 1][0]) > $dfDiffSpace) { |
|
798 | + $dfX1 = floatval($first_pass[$k - 1][0]); |
|
799 | + $dfY1 = floatval($first_pass[$k - 1][1]); |
|
800 | 800 | $dfX2 = floatval($first_pass[$k][0]); |
801 | 801 | $dfY2 = floatval($first_pass[$k][1]); |
802 | 802 | if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 && |
803 | - $k+1 < count($first_pass) && |
|
804 | - $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX) |
|
803 | + $k + 1 < count($first_pass) && |
|
804 | + $first_pass[$k - 1][0] > -180 && $first_pass[$k - 1][0] < $dfRightBorderX) |
|
805 | 805 | { |
806 | 806 | $poNewLS[] = array(-180, $first_pass[$k][1]); |
807 | 807 | $k++; |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | $poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]); |
810 | 810 | continue; |
811 | 811 | } else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 && |
812 | - $k+1 < count($first_pass) && |
|
813 | - $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180) |
|
812 | + $k + 1 < count($first_pass) && |
|
813 | + $first_pass[$k - 1][0] > $dfLeftBorderX && $first_pass[$k - 1][0] < 180) |
|
814 | 814 | { |
815 | 815 | $poNewLS[] = array(180, $first_pass[$k][1]); |
816 | 816 | $k++; |
@@ -833,12 +833,12 @@ discard block |
||
833 | 833 | } |
834 | 834 | if ($dfX1 <= 180 && $dfX2 >= 180 && $dfX1 < $dfX2) |
835 | 835 | { |
836 | - $dfRatio = (180 - $dfX1) / ($dfX2 - $dfX1); |
|
837 | - $dfY = $dfRatio * $dfY2 + (1 - $dfRatio) * $dfY1; |
|
838 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
836 | + $dfRatio = (180 - $dfX1)/($dfX2 - $dfX1); |
|
837 | + $dfY = $dfRatio*$dfY2 + (1 - $dfRatio)*$dfY1; |
|
838 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
839 | 839 | $poMulti[] = $poNewLS; |
840 | 840 | $poNewLS = array(); |
841 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
841 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
842 | 842 | //$poMulti[] = $poNewLS; |
843 | 843 | } else { |
844 | 844 | //$poNewLS[] = array(); |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $poNewLS0 = array(); |
857 | 857 | //$poMulti[] = $poNewLS0; |
858 | 858 | for ($l = 0; $l < count($first_pass); ++$l) { |
859 | - $poNewLS0[] = array($first_pass[$l][0],$first_pass[$l][1]); |
|
859 | + $poNewLS0[] = array($first_pass[$l][0], $first_pass[$l][1]); |
|
860 | 860 | } |
861 | 861 | $poMulti[] = $poNewLS0; |
862 | 862 | } |
@@ -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,11 +105,11 @@ 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 | /* |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | */ |
130 | 130 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
131 | 131 | $usecoord = true; |
132 | - $coord = explode(',',$_GET['coord']); |
|
133 | - 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) |
|
132 | + $coord = explode(',', $_GET['coord']); |
|
133 | + 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) |
|
134 | 134 | && $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) { |
135 | 135 | if ($tracker) { |
136 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
136 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
137 | 137 | } elseif ($marine) { |
138 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
138 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
139 | 139 | } else { |
140 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
140 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
141 | 141 | } |
142 | 142 | } else { |
143 | 143 | if ($tracker) { |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $from_archive = true; |
153 | 153 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
154 | 154 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
155 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
157 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
158 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
159 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
160 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
155 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
157 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
158 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
159 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
160 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
161 | 161 | } elseif ($min) { |
162 | 162 | if ($tracker) { |
163 | 163 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | # $min = true; |
170 | 170 | } else { |
171 | 171 | if ($tracker) { |
172 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
172 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
173 | 173 | } elseif ($marine) { |
174 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
174 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
175 | 175 | } else { |
176 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
176 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($usecoord) { |
181 | 181 | if (isset($_GET['archive'])) { |
182 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
182 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
183 | 183 | } else { |
184 | 184 | if ($tracker) { |
185 | 185 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | if ($flightcnt == '') $flightcnt = 0; |
193 | 193 | } else $flightcnt = 0; |
194 | 194 | |
195 | -$sqltime = round(microtime(true)-$begintime,2); |
|
195 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
196 | 196 | |
197 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
197 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
198 | 198 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
199 | 199 | |
200 | 200 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (!empty($spotter_array) && is_array($spotter_array)) |
214 | 214 | { |
215 | 215 | $output .= '"features": ['; |
216 | - foreach($spotter_array as $spotter_item) |
|
216 | + foreach ($spotter_array as $spotter_item) |
|
217 | 217 | { |
218 | 218 | $j++; |
219 | 219 | unset($idistance); |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | */ |
271 | 271 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 272 | 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']).'",'; |
|
273 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
274 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
275 | 275 | //" |
276 | 276 | } else { |
277 | 277 | if ($compress) $output .= '"c": "NA",'; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
281 | 281 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 282 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
283 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
284 | 284 | } elseif (isset($spotter_item['aircraft_type'])) { |
285 | 285 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
286 | 286 | } elseif (!$min) { |
@@ -423,15 +423,15 @@ discard block |
||
423 | 423 | if (isset($archivespeed) || $usenextlatlon) { |
424 | 424 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
425 | 425 | if (isset($spotter_item['arrival_airport_latitude'])) { |
426 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
427 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
426 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
427 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
428 | 428 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
429 | 429 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
430 | 430 | } else { |
431 | 431 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
432 | 432 | if (isset($aairport[0]['latitude'])) { |
433 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
434 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
433 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
434 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
435 | 435 | $farr_lat = $aairport[0]['latitude']; |
436 | 436 | $farr_lon = $aairport[0]['longitude']; |
437 | 437 | } |
@@ -444,59 +444,59 @@ discard block |
||
444 | 444 | if ($currenttime != '') { |
445 | 445 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 446 | if (isset($archivespeed)) { |
447 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
448 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
447 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
448 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
449 | 449 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
450 | 450 | else { |
451 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
452 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
451 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
452 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
453 | 453 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
454 | 454 | else { |
455 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
455 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
456 | 456 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 457 | } |
458 | 458 | } |
459 | 459 | } elseif ($usenextlatlon) { |
460 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
461 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
460 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
461 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
462 | 462 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
463 | 463 | else { |
464 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
465 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
464 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
465 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
466 | 466 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
467 | 467 | else { |
468 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
468 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
469 | 469 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } else { |
474 | 474 | if (isset($archivespeed)) { |
475 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
475 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
476 | 476 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
477 | 477 | } elseif ($usenextlatlon) { |
478 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
478 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
479 | 479 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } else { |
483 | 483 | if (isset($archivespeed)) { |
484 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
485 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
484 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
485 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
486 | 486 | if (!isset($idistance) || $fdistance < $idistance) { |
487 | 487 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
488 | 488 | } else { |
489 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
489 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
490 | 490 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
491 | 491 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 492 | } |
493 | 493 | } elseif ($usenextlatlon) { |
494 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
495 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
494 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
495 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
496 | 496 | if (!isset($idistance) || $fdistance < $idistance) { |
497 | 497 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
498 | 498 | } else { |
499 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
499 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
500 | 500 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
501 | 501 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
502 | 502 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | if (!$min) $output .= '"image": "'.$image.'",'; |
507 | 507 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
508 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
509 | 509 | } |
510 | 510 | if (isset($spotter_item['image_source_website'])) { |
511 | 511 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
528 | 528 | } |
529 | 529 | if (isset($spotter_item['acars'])) { |
530 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
530 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
531 | 531 | } |
532 | 532 | // type when not aircraft ? |
533 | 533 | if (isset($spotter_item['type'])) { |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | if ($currenttime != '') { |
548 | 548 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | 549 | if (!isset($archivespeed)) $archivespeed = 1; |
550 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
551 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
550 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
551 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
552 | 552 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
553 | 553 | else { |
554 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
555 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
554 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
555 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
556 | 556 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
557 | 557 | else { |
558 | 558 | $output .= $spotter_item['longitude'].', '; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | } |
633 | 633 | */ |
634 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
634 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
635 | 635 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
636 | 636 | |
637 | 637 | if ( |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
641 | 641 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
642 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
642 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
643 | 643 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
644 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
644 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
645 | 645 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
646 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
646 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
647 | 647 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
648 | 648 | ) { |
649 | 649 | if ($tracker) { |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
673 | 673 | $MapMatching = new MapMatching(); |
674 | 674 | if (isset($spotter_item['date_iso_8601'])) { |
675 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
675 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
676 | 676 | } else { |
677 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
677 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
678 | 678 | } |
679 | 679 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
680 | 680 | } |
@@ -706,9 +706,9 @@ discard block |
||
706 | 706 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
707 | 707 | } |
708 | 708 | $output_history .= '['; |
709 | - $output_history .= $spotter_history['longitude'].', '; |
|
710 | - $output_history .= $spotter_history['latitude'].', '; |
|
711 | - $output_history .= $spotter_history['altitude']*30.48; |
|
709 | + $output_history .= $spotter_history['longitude'].', '; |
|
710 | + $output_history .= $spotter_history['latitude'].', '; |
|
711 | + $output_history .= $spotter_history['altitude']*30.48; |
|
712 | 712 | $output_history .= '],'; |
713 | 713 | /* |
714 | 714 | if ($from_archive === false) { |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | $d = true; |
732 | 732 | } |
733 | 733 | $output_history .= '['; |
734 | - $output_history .= $spotter_history['longitude'].', '; |
|
735 | - $output_history .= $spotter_history['latitude']; |
|
734 | + $output_history .= $spotter_history['longitude'].', '; |
|
735 | + $output_history .= $spotter_history['latitude']; |
|
736 | 736 | $output_history .= '],'; |
737 | 737 | /* |
738 | 738 | if ($from_archive === false) { |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | //echo $output_history; |
749 | 749 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
750 | 750 | $output_historyd = '['; |
751 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | - $output_historyd .= $spotter_item['latitude']; |
|
753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
751 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | + $output_historyd .= $spotter_item['latitude']; |
|
753 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
754 | 754 | $output_historyd .= '],'; |
755 | 755 | //$output_history = $output_historyd.$output_history; |
756 | 756 | $output_history = $output_history.$output_historyd; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $last = array_pop($spotter_history_array); |
759 | 759 | $latitude = $last['latitude']; |
760 | 760 | $longitude = $last['longitude']; |
761 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
761 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | $output_history = substr($output_history, 0, -1); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
772 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
773 | 773 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
774 | 774 | && (isset($spotter_item['departure_airport']) |
775 | 775 | && $spotter_item['departure_airport'] != 'NA' |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | //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))))) { |
805 | 805 | //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))))) { |
806 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
806 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
807 | 807 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
808 | 808 | && (isset($spotter_item['arrival_airport']) |
809 | 809 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -830,11 +830,11 @@ discard block |
||
830 | 830 | } |
831 | 831 | } |
832 | 832 | if ($havedata) { |
833 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
833 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
834 | 834 | foreach ($line[0] as $coord) { |
835 | 835 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
836 | 836 | } |
837 | - $output_dest = substr($output_dest, 0, -1); |
|
837 | + $output_dest = substr($output_dest, 0, -1); |
|
838 | 838 | } |
839 | 839 | $output_dest .= ']}},'; |
840 | 840 | if ($havedata) $output .= $output_dest; |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $output = substr($output, 0, -1); |
845 | 845 | $output .= ']'; |
846 | 846 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
847 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
847 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
848 | 848 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
849 | 849 | $output .= '"fc": "'.$j.'"'; |
850 | 850 | } else { |