@@ -97,6 +97,10 @@ discard block |
||
| 97 | 97 | return strlen($headerLine); // Needed by curl |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $url |
|
| 102 | + * @param string $file |
|
| 103 | + */ |
|
| 100 | 104 | public static function download($url, $file, $referer = '') { |
| 101 | 105 | global $globalDebug, $globalProxy, $globalForceIPv4; |
| 102 | 106 | $fp = fopen($file, 'w'); |
@@ -121,6 +125,9 @@ discard block |
||
| 121 | 125 | fclose($fp); |
| 122 | 126 | } |
| 123 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $in_file |
|
| 130 | + */ |
|
| 124 | 131 | public static function gunzip($in_file,$out_file_name = '') { |
| 125 | 132 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 126 | 133 | $buffer_size = 4096; // read 4kb at a time |
@@ -272,7 +279,7 @@ discard block |
||
| 272 | 279 | * Check is distance realistic |
| 273 | 280 | * @param int $timeDifference the time between the reception of both messages |
| 274 | 281 | * @param float $distance distance covered |
| 275 | - * @return whether distance is realistic |
|
| 282 | + * @return boolean distance is realistic |
|
| 276 | 283 | */ |
| 277 | 284 | public function withinThreshold ($timeDifference, $distance) { |
| 278 | 285 | $x = abs($timeDifference); |
@@ -295,6 +302,9 @@ discard block |
||
| 295 | 302 | } |
| 296 | 303 | |
| 297 | 304 | |
| 305 | + /** |
|
| 306 | + * @param string $latlong |
|
| 307 | + */ |
|
| 298 | 308 | public function convertDec($dms,$latlong) { |
| 299 | 309 | if ($latlong == 'latitude') { |
| 300 | 310 | $deg = substr($dms, 0, 2); |
@@ -306,6 +316,9 @@ discard block |
||
| 306 | 316 | return $deg+(($min*60)/3600); |
| 307 | 317 | } |
| 308 | 318 | |
| 319 | + /** |
|
| 320 | + * @param string $latlong |
|
| 321 | + */ |
|
| 309 | 322 | public function convertDM($coord,$latlong) { |
| 310 | 323 | if ($latlong == 'latitude') { |
| 311 | 324 | if ($coord < 0) $NSEW = 'S'; |
@@ -443,7 +456,7 @@ discard block |
||
| 443 | 456 | /** |
| 444 | 457 | * Returns list of available locales |
| 445 | 458 | * |
| 446 | - * @return array |
|
| 459 | + * @return string[] |
|
| 447 | 460 | */ |
| 448 | 461 | public function listLocaleDir() |
| 449 | 462 | { |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | //protected $cookies = array(); |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * Get data from form result |
|
| 11 | - * @param String $url form URL |
|
| 12 | - * @param String $type type of submit form method (get or post) |
|
| 13 | - * @param String|Array $data values form post method |
|
| 14 | - * @param Array $headers header to submit with the form |
|
| 15 | - * @return String the result |
|
| 16 | - */ |
|
| 10 | + * Get data from form result |
|
| 11 | + * @param String $url form URL |
|
| 12 | + * @param String $type type of submit form method (get or post) |
|
| 13 | + * @param String|Array $data values form post method |
|
| 14 | + * @param Array $headers header to submit with the form |
|
| 15 | + * @return String the result |
|
| 16 | + */ |
|
| 17 | 17 | public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false) { |
| 18 | 18 | global $globalProxy, $globalForceIPv4; |
| 19 | 19 | $ch = curl_init(); |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | - * Convert a HTML table to an array |
|
| 167 | - * @param String $data HTML page |
|
| 168 | - * @return Array array of the tables in HTML page |
|
| 169 | - */ |
|
| 166 | + * Convert a HTML table to an array |
|
| 167 | + * @param String $data HTML page |
|
| 168 | + * @return Array array of the tables in HTML page |
|
| 169 | + */ |
|
| 170 | 170 | public function table2array($data) { |
| 171 | 171 | if (!is_string($data)) return array(); |
| 172 | 172 | if ($data == '') return array(); |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * Convert <p> part of a HTML page to an array |
|
| 204 | - * @param String $data HTML page |
|
| 205 | - * @return Array array of the <p> in HTML page |
|
| 206 | - */ |
|
| 203 | + * Convert <p> part of a HTML page to an array |
|
| 204 | + * @param String $data HTML page |
|
| 205 | + * @return Array array of the <p> in HTML page |
|
| 206 | + */ |
|
| 207 | 207 | public function text2array($data) { |
| 208 | 208 | $html = str_get_html($data); |
| 209 | 209 | if ($html === false) return array(); |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * Give distance between 2 coordonnates |
|
| 222 | - * @param Float $lat latitude of first point |
|
| 223 | - * @param Float $lon longitude of first point |
|
| 224 | - * @param Float $latc latitude of second point |
|
| 225 | - * @param Float $lonc longitude of second point |
|
| 226 | - * @param String $unit km else no unit used |
|
| 227 | - * @return Float Distance in $unit |
|
| 228 | - */ |
|
| 221 | + * Give distance between 2 coordonnates |
|
| 222 | + * @param Float $lat latitude of first point |
|
| 223 | + * @param Float $lon longitude of first point |
|
| 224 | + * @param Float $latc latitude of second point |
|
| 225 | + * @param Float $lonc longitude of second point |
|
| 226 | + * @param String $unit km else no unit used |
|
| 227 | + * @return Float Distance in $unit |
|
| 228 | + */ |
|
| 229 | 229 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 230 | 230 | if ($lat == $latc && $lon == $lonc) return 0; |
| 231 | 231 | $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; |
@@ -243,25 +243,25 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | - * Give plunge between 2 altitudes and distance |
|
| 247 | - * @param Float $initial_altitude altitude of first point in m |
|
| 248 | - * @param Float $final_altitude altitude of second point in m |
|
| 249 | - * @param String $distance distance between two points in m |
|
| 250 | - * @return Float plunge |
|
| 251 | - */ |
|
| 246 | + * Give plunge between 2 altitudes and distance |
|
| 247 | + * @param Float $initial_altitude altitude of first point in m |
|
| 248 | + * @param Float $final_altitude altitude of second point in m |
|
| 249 | + * @param String $distance distance between two points in m |
|
| 250 | + * @return Float plunge |
|
| 251 | + */ |
|
| 252 | 252 | public function plunge($initial_altitude,$final_altitude,$distance) { |
| 253 | 253 | $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
| 254 | 254 | return $plunge; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | - * Give azimuth between 2 coordonnates |
|
| 259 | - * @param Float $lat latitude of first point |
|
| 260 | - * @param Float $lon longitude of first point |
|
| 261 | - * @param Float $latc latitude of second point |
|
| 262 | - * @param Float $lonc longitude of second point |
|
| 263 | - * @return Float Azimuth |
|
| 264 | - */ |
|
| 258 | + * Give azimuth between 2 coordonnates |
|
| 259 | + * @param Float $lat latitude of first point |
|
| 260 | + * @param Float $lon longitude of first point |
|
| 261 | + * @param Float $latc latitude of second point |
|
| 262 | + * @param Float $lonc longitude of second point |
|
| 263 | + * @return Float Azimuth |
|
| 264 | + */ |
|
| 265 | 265 | public function azimuth($lat, $lon, $latc, $lonc) { |
| 266 | 266 | $azimuth = rad2deg(atan(($latc - $lat)/($lonc - $lon))); |
| 267 | 267 | return 360+$azimuth; |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * Check is distance realistic |
|
| 273 | - * @param int $timeDifference the time between the reception of both messages |
|
| 274 | - * @param float $distance distance covered |
|
| 275 | - * @return whether distance is realistic |
|
| 276 | - */ |
|
| 272 | + * Check is distance realistic |
|
| 273 | + * @param int $timeDifference the time between the reception of both messages |
|
| 274 | + * @param float $distance distance covered |
|
| 275 | + * @return whether distance is realistic |
|
| 276 | + */ |
|
| 277 | 277 | public function withinThreshold ($timeDifference, $distance) { |
| 278 | 278 | $x = abs($timeDifference); |
| 279 | 279 | $d = abs($distance); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | public function isInteger($input){ |
| 294 | - return(ctype_digit(strval($input))); |
|
| 294 | + return(ctype_digit(strval($input))); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -322,11 +322,11 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | - * Copy folder contents |
|
| 326 | - * @param string $source Source path |
|
| 327 | - * @param string $dest Destination path |
|
| 328 | - * @return bool Returns true on success, false on failure |
|
| 329 | - */ |
|
| 325 | + * Copy folder contents |
|
| 326 | + * @param string $source Source path |
|
| 327 | + * @param string $dest Destination path |
|
| 328 | + * @return bool Returns true on success, false on failure |
|
| 329 | + */ |
|
| 330 | 330 | public function xcopy($source, $dest) |
| 331 | 331 | { |
| 332 | 332 | $files = glob($source.'*.*'); |
@@ -338,20 +338,20 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | - * Check if an url exist |
|
| 342 | - * @param String $url url to check |
|
| 343 | - * @return bool Return true on succes false on failure |
|
| 344 | - */ |
|
| 341 | + * Check if an url exist |
|
| 342 | + * @param String $url url to check |
|
| 343 | + * @return bool Return true on succes false on failure |
|
| 344 | + */ |
|
| 345 | 345 | public function urlexist($url){ |
| 346 | 346 | $headers=get_headers($url); |
| 347 | 347 | return stripos($headers[0],"200 OK")?true:false; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | - * Convert hexa to string |
|
| 352 | - * @param String $hex data in hexa |
|
| 353 | - * @return String Return result |
|
| 354 | - */ |
|
| 351 | + * Convert hexa to string |
|
| 352 | + * @param String $hex data in hexa |
|
| 353 | + * @return String Return result |
|
| 354 | + */ |
|
| 355 | 355 | public function hex2str($hex) { |
| 356 | 356 | $str = ''; |
| 357 | 357 | $hexln = strlen($hex); |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | - * Convert hexa color to rgb |
|
| 364 | - * @param String $hex data in hexa |
|
| 365 | - * @return String Return result |
|
| 366 | - */ |
|
| 363 | + * Convert hexa color to rgb |
|
| 364 | + * @param String $hex data in hexa |
|
| 365 | + * @return String Return result |
|
| 366 | + */ |
|
| 367 | 367 | public function hex2rgb($hex) { |
| 368 | 368 | $hex = str_replace('#','',$hex); |
| 369 | 369 | return sscanf($hex, "%02x%02x%02x"); |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | - * Returns list of available locales |
|
| 445 | - * |
|
| 446 | - * @return array |
|
| 444 | + * Returns list of available locales |
|
| 445 | + * |
|
| 446 | + * @return array |
|
| 447 | 447 | */ |
| 448 | 448 | public function listLocaleDir() |
| 449 | 449 | { |
@@ -542,100 +542,100 @@ discard block |
||
| 542 | 542 | public function remove_accents($string) { |
| 543 | 543 | if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
| 544 | 544 | $chars = array( |
| 545 | - // Decompositions for Latin-1 Supplement |
|
| 546 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
| 547 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
| 548 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
| 549 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
| 550 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
| 551 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
| 552 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
| 553 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
| 554 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
| 555 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
| 556 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
| 557 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
| 558 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
| 559 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
| 560 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
| 561 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
| 562 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
| 563 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
| 564 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
| 565 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
| 566 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
| 567 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
| 568 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
| 569 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
| 570 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
| 571 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
| 572 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
| 573 | - chr(195).chr(191) => 'y', |
|
| 574 | - // Decompositions for Latin Extended-A |
|
| 575 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
| 576 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
| 577 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
| 578 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
| 579 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
| 580 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
| 581 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
| 582 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
| 583 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
| 584 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
| 585 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
| 586 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
| 587 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
| 588 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
| 589 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
| 590 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
| 591 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
| 592 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
| 593 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
| 594 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
| 595 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
| 596 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
| 597 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
| 598 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
| 599 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
| 600 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 601 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
| 602 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
| 603 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
| 604 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
| 605 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
| 606 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
| 607 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
| 608 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
| 609 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
| 610 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
| 611 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
| 612 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
| 613 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
| 614 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
| 615 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
| 616 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 617 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 618 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 619 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 620 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 621 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 622 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 623 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
| 624 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
| 625 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
| 626 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
| 627 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
| 628 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
| 629 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
| 630 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
| 631 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
| 632 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
| 633 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
| 634 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
| 635 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
| 636 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
| 637 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
| 638 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
| 545 | + // Decompositions for Latin-1 Supplement |
|
| 546 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
| 547 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
| 548 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
| 549 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
| 550 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
| 551 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
| 552 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
| 553 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
| 554 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
| 555 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
| 556 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
| 557 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
| 558 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
| 559 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
| 560 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
| 561 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
| 562 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
| 563 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
| 564 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
| 565 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
| 566 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
| 567 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
| 568 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
| 569 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
| 570 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
| 571 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
| 572 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
| 573 | + chr(195).chr(191) => 'y', |
|
| 574 | + // Decompositions for Latin Extended-A |
|
| 575 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
| 576 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
| 577 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
| 578 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
| 579 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
| 580 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
| 581 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
| 582 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
| 583 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
| 584 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
| 585 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
| 586 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
| 587 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
| 588 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
| 589 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
| 590 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
| 591 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
| 592 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
| 593 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
| 594 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
| 595 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
| 596 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
| 597 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
| 598 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
| 599 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
| 600 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 601 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
| 602 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
| 603 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
| 604 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
| 605 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
| 606 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
| 607 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
| 608 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
| 609 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
| 610 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
| 611 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
| 612 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
| 613 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
| 614 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
| 615 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
| 616 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 617 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 618 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 619 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 620 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 621 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 622 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 623 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
| 624 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
| 625 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
| 626 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
| 627 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
| 628 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
| 629 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
| 630 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
| 631 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
| 632 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
| 633 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
| 634 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
| 635 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
| 636 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
| 637 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
| 638 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
| 639 | 639 | ); |
| 640 | 640 | $string = strtr($string, $chars); |
| 641 | 641 | return $string; |
@@ -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) { |
|
| 17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '', $sizelimit = 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 | } |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | $info = curl_getinfo($ch); |
| 77 | 77 | //var_dump($info); |
| 78 | 78 | curl_close($ch); |
| 79 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
| 79 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
| 80 | 80 | echo "Cloudflare Detected\n"; |
| 81 | 81 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
| 82 | 82 | $useragent = UAgent::random(); |
| 83 | 83 | cloudflare::useUserAgent($useragent); |
| 84 | 84 | if ($clearanceCookie = cloudflare::bypass($url)) { |
| 85 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
| 85 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
| 86 | 86 | } |
| 87 | 87 | } else { |
| 88 | 88 | return $result; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 107 | 107 | if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
| 108 | 108 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 109 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
| 109 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
| 110 | 110 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -121,20 +121,20 @@ discard block |
||
| 121 | 121 | fclose($fp); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 124 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 125 | 125 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 126 | 126 | $buffer_size = 4096; // read 4kb at a time |
| 127 | 127 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 128 | 128 | if ($in_file != '' && file_exists($in_file)) { |
| 129 | 129 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 130 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 131 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 130 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 131 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 132 | 132 | else { |
| 133 | 133 | echo 'gzopen not available'; |
| 134 | 134 | die; |
| 135 | 135 | } |
| 136 | 136 | $out_file = fopen($out_file_name, 'wb'); |
| 137 | - while(!gzeof($file)) { |
|
| 137 | + while (!gzeof($file)) { |
|
| 138 | 138 | fwrite($out_file, gzread($file, $buffer_size)); |
| 139 | 139 | } |
| 140 | 140 | fclose($out_file); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
| 145 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
| 146 | 146 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 147 | 147 | $buffer_size = 4096; // read 4kb at a time |
| 148 | 148 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
| 149 | 149 | if ($in_file != '' && file_exists($in_file)) { |
| 150 | 150 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 151 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
| 151 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
| 152 | 152 | else { |
| 153 | 153 | echo 'bzopen not available'; |
| 154 | 154 | die; |
| 155 | 155 | } |
| 156 | 156 | $out_file = fopen($out_file_name, 'wb'); |
| 157 | - while(!feof($file)) { |
|
| 157 | + while (!feof($file)) { |
|
| 158 | 158 | fwrite($out_file, bzread($file, $buffer_size)); |
| 159 | 159 | } |
| 160 | 160 | fclose($out_file); |
@@ -172,27 +172,27 @@ discard block |
||
| 172 | 172 | if ($data == '') return array(); |
| 173 | 173 | $html = str_get_html($data); |
| 174 | 174 | if ($html === false) return array(); |
| 175 | - $tabledata=array(); |
|
| 176 | - foreach($html->find('tr') as $element) |
|
| 175 | + $tabledata = array(); |
|
| 176 | + foreach ($html->find('tr') as $element) |
|
| 177 | 177 | { |
| 178 | 178 | $td = array(); |
| 179 | - foreach( $element->find('th') as $row) |
|
| 179 | + foreach ($element->find('th') as $row) |
|
| 180 | 180 | { |
| 181 | 181 | $td [] = trim($row->plaintext); |
| 182 | 182 | } |
| 183 | - $td=array_filter($td); |
|
| 183 | + $td = array_filter($td); |
|
| 184 | 184 | $tabledata[] = $td; |
| 185 | 185 | |
| 186 | 186 | $td = array(); |
| 187 | 187 | $tdi = array(); |
| 188 | - foreach( $element->find('td') as $row) |
|
| 188 | + foreach ($element->find('td') as $row) |
|
| 189 | 189 | { |
| 190 | 190 | $td [] = trim($row->plaintext); |
| 191 | 191 | $tdi [] = trim($row->innertext); |
| 192 | 192 | } |
| 193 | - $td=array_filter($td); |
|
| 194 | - $tdi=array_filter($tdi); |
|
| 195 | - $tabledata[]=array_merge($td,$tdi); |
|
| 193 | + $td = array_filter($td); |
|
| 194 | + $tdi = array_filter($tdi); |
|
| 195 | + $tabledata[] = array_merge($td, $tdi); |
|
| 196 | 196 | } |
| 197 | 197 | $html->clear(); |
| 198 | 198 | unset($html); |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | public function text2array($data) { |
| 208 | 208 | $html = str_get_html($data); |
| 209 | 209 | if ($html === false) return array(); |
| 210 | - $tabledata=array(); |
|
| 211 | - foreach($html->find('p') as $element) |
|
| 210 | + $tabledata = array(); |
|
| 211 | + foreach ($html->find('p') as $element) |
|
| 212 | 212 | { |
| 213 | 213 | $tabledata [] = trim($element->plaintext); |
| 214 | 214 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 230 | 230 | if ($lat == $latc && $lon == $lonc) return 0; |
| 231 | - $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; |
|
| 231 | + $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; |
|
| 232 | 232 | if ($unit == "km") { |
| 233 | - return round($dist * 1.609344); |
|
| 233 | + return round($dist*1.609344); |
|
| 234 | 234 | } elseif ($unit == "m") { |
| 235 | - return round($dist * 1.609344 * 1000); |
|
| 235 | + return round($dist*1.609344*1000); |
|
| 236 | 236 | } elseif ($unit == "mile" || $unit == "mi") { |
| 237 | 237 | return round($dist); |
| 238 | 238 | } elseif ($unit == "nm") { |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | * @param String $distance distance between two points in m |
| 250 | 250 | * @return Float plunge |
| 251 | 251 | */ |
| 252 | - public function plunge($initial_altitude,$final_altitude,$distance) { |
|
| 253 | - $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
|
| 252 | + public function plunge($initial_altitude, $final_altitude, $distance) { |
|
| 253 | + $plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance)); |
|
| 254 | 254 | return $plunge; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function azimuth($lat, $lon, $latc, $lonc) { |
| 266 | 266 | $azimuth = rad2deg(atan(($latc - $lat)/($lonc - $lon))); |
| 267 | - return 360+$azimuth; |
|
| 267 | + return 360 + $azimuth; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param float $distance distance covered |
| 275 | 275 | * @return whether distance is realistic |
| 276 | 276 | */ |
| 277 | - public function withinThreshold ($timeDifference, $distance) { |
|
| 277 | + public function withinThreshold($timeDifference, $distance) { |
|
| 278 | 278 | $x = abs($timeDifference); |
| 279 | 279 | $d = abs($distance); |
| 280 | 280 | if ($x == 0 || $d == 0) return true; |
@@ -290,12 +290,12 @@ discard block |
||
| 290 | 290 | return ($array !== array_values($array)); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - public function isInteger($input){ |
|
| 293 | + public function isInteger($input) { |
|
| 294 | 294 | return(ctype_digit(strval($input))); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - public function convertDec($dms,$latlong) { |
|
| 298 | + public function convertDec($dms, $latlong) { |
|
| 299 | 299 | if ($latlong == 'latitude') { |
| 300 | 300 | $deg = substr($dms, 0, 2); |
| 301 | 301 | $min = substr($dms, 2, 4); |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | $deg = substr($dms, 0, 3); |
| 304 | 304 | $min = substr($dms, 3, 5); |
| 305 | 305 | } |
| 306 | - return $deg+(($min*60)/3600); |
|
| 306 | + return $deg + (($min*60)/3600); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - public function convertDM($coord,$latlong) { |
|
| 309 | + public function convertDM($coord, $latlong) { |
|
| 310 | 310 | if ($latlong == 'latitude') { |
| 311 | 311 | if ($coord < 0) $NSEW = 'S'; |
| 312 | 312 | else $NSEW = 'N'; |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | $coord = abs($coord); |
| 318 | 318 | $deg = floor($coord); |
| 319 | - $coord = ($coord-$deg)*60; |
|
| 319 | + $coord = ($coord - $deg)*60; |
|
| 320 | 320 | $min = $coord; |
| 321 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
| 321 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | public function xcopy($source, $dest) |
| 331 | 331 | { |
| 332 | 332 | $files = glob($source.'*.*'); |
| 333 | - foreach($files as $file){ |
|
| 334 | - $file_to_go = str_replace($source,$dest,$file); |
|
| 333 | + foreach ($files as $file) { |
|
| 334 | + $file_to_go = str_replace($source, $dest, $file); |
|
| 335 | 335 | copy($file, $file_to_go); |
| 336 | 336 | } |
| 337 | 337 | return true; |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | * @param String $url url to check |
| 343 | 343 | * @return bool Return true on succes false on failure |
| 344 | 344 | */ |
| 345 | - public function urlexist($url){ |
|
| 346 | - $headers=get_headers($url); |
|
| 347 | - return stripos($headers[0],"200 OK")?true:false; |
|
| 345 | + public function urlexist($url) { |
|
| 346 | + $headers = get_headers($url); |
|
| 347 | + return stripos($headers[0], "200 OK") ?true:false; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | public function hex2str($hex) { |
| 356 | 356 | $str = ''; |
| 357 | 357 | $hexln = strlen($hex); |
| 358 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 358 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
| 359 | 359 | return $str; |
| 360 | 360 | } |
| 361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @return String Return result |
| 366 | 366 | */ |
| 367 | 367 | public function hex2rgb($hex) { |
| 368 | - $hex = str_replace('#','',$hex); |
|
| 368 | + $hex = str_replace('#', '', $hex); |
|
| 369 | 369 | return sscanf($hex, "%02x%02x%02x"); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -373,33 +373,33 @@ discard block |
||
| 373 | 373 | //difference in longitudinal coordinates |
| 374 | 374 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
| 375 | 375 | //difference in the phi of latitudinal coordinates |
| 376 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
| 376 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
| 377 | 377 | //we need to recalculate $dLon if it is greater than pi |
| 378 | - if(abs($dLon) > pi()) { |
|
| 379 | - if($dLon > 0) { |
|
| 380 | - $dLon = (2 * pi() - $dLon) * -1; |
|
| 378 | + if (abs($dLon) > pi()) { |
|
| 379 | + if ($dLon > 0) { |
|
| 380 | + $dLon = (2*pi() - $dLon)*-1; |
|
| 381 | 381 | } else { |
| 382 | - $dLon = 2 * pi() + $dLon; |
|
| 382 | + $dLon = 2*pi() + $dLon; |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | //return the angle, normalized |
| 386 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
| 386 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) { |
|
| 389 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) { |
|
| 390 | 390 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
| 391 | - $a = -($lon2-$lon1); |
|
| 391 | + $a = -($lon2 - $lon1); |
|
| 392 | 392 | $b = $lat2 - $lat1; |
| 393 | - $c = -($a*$lat1+$b*$lon1); |
|
| 394 | - $d = $a*$lat3+$b*$lon3+$c; |
|
| 393 | + $c = -($a*$lat1 + $b*$lon1); |
|
| 394 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
| 395 | 395 | if ($d > -$approx && $d < $approx) return true; |
| 396 | 396 | else return false; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | public function array_merge_noappend() { |
| 400 | 400 | $output = array(); |
| 401 | - foreach(func_get_args() as $array) { |
|
| 402 | - foreach($array as $key => $value) { |
|
| 401 | + foreach (func_get_args() as $array) { |
|
| 402 | + foreach ($array as $key => $value) { |
|
| 403 | 403 | $output[$key] = isset($output[$key]) ? |
| 404 | 404 | array_merge($output[$key], $value) : $value; |
| 405 | 405 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | return $result; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){ |
|
| 466 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') { |
|
| 467 | 467 | global $globalMapRefresh; |
| 468 | 468 | if ($seconds == '') { |
| 469 | 469 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
@@ -474,27 +474,27 @@ discard block |
||
| 474 | 474 | $latitude = deg2rad($latitude); |
| 475 | 475 | $longitude = deg2rad($longitude); |
| 476 | 476 | $bearing = deg2rad($heading); |
| 477 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
| 478 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
| 479 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
| 477 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
| 478 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
| 479 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
| 482 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
| 483 | 483 | // distance in meter |
| 484 | 484 | $R = 6378.14; |
| 485 | - $latitude1 = $latitude * (M_PI/180); |
|
| 486 | - $longitude1 = $longitude * (M_PI/180); |
|
| 487 | - $brng = $bearing * (M_PI/180); |
|
| 485 | + $latitude1 = $latitude*(M_PI/180); |
|
| 486 | + $longitude1 = $longitude*(M_PI/180); |
|
| 487 | + $brng = $bearing*(M_PI/180); |
|
| 488 | 488 | $d = $distance; |
| 489 | 489 | |
| 490 | 490 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
| 491 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
| 491 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
| 492 | 492 | |
| 493 | - $latitude2 = $latitude2 * (180/M_PI); |
|
| 494 | - $longitude2 = $longitude2 * (180/M_PI); |
|
| 493 | + $latitude2 = $latitude2*(180/M_PI); |
|
| 494 | + $longitude2 = $longitude2*(180/M_PI); |
|
| 495 | 495 | |
| 496 | - $flat = round ($latitude2,6); |
|
| 497 | - $flong = round ($longitude2,6); |
|
| 496 | + $flat = round($latitude2, 6); |
|
| 497 | + $flong = round($longitude2, 6); |
|
| 498 | 498 | /* |
| 499 | 499 | $dx = $distance*cos($bearing); |
| 500 | 500 | $dy = $distance*sin($bearing); |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | $flong = $longitude + $dlong; |
| 504 | 504 | $flat = $latitude + $dlat; |
| 505 | 505 | */ |
| 506 | - return array('latitude' => $flat,'longitude' => $flong); |
|
| 506 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -517,14 +517,14 @@ discard block |
||
| 517 | 517 | * @param integer $level GZIP compression level (default: 9) |
| 518 | 518 | * @return string New filename (with .gz appended) if success, or false if operation fails |
| 519 | 519 | */ |
| 520 | - public function gzCompressFile($source, $level = 9){ |
|
| 521 | - $dest = $source . '.gz'; |
|
| 522 | - $mode = 'wb' . $level; |
|
| 520 | + public function gzCompressFile($source, $level = 9) { |
|
| 521 | + $dest = $source.'.gz'; |
|
| 522 | + $mode = 'wb'.$level; |
|
| 523 | 523 | $error = false; |
| 524 | 524 | if ($fp_out = gzopen($dest, $mode)) { |
| 525 | - if ($fp_in = fopen($source,'rb')) { |
|
| 525 | + if ($fp_in = fopen($source, 'rb')) { |
|
| 526 | 526 | while (!feof($fp_in)) |
| 527 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 527 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
| 528 | 528 | fclose($fp_in); |
| 529 | 529 | } else { |
| 530 | 530 | $error = true; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | public function remove_accents($string) { |
| 543 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
| 543 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
| 544 | 544 | $chars = array( |
| 545 | 545 | // Decompositions for Latin-1 Supplement |
| 546 | 546 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
| 598 | 598 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
| 599 | 599 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
| 600 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 600 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
| 601 | 601 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
| 602 | 602 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
| 603 | 603 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -613,13 +613,13 @@ discard block |
||
| 613 | 613 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
| 614 | 614 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
| 615 | 615 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
| 616 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 617 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 618 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 619 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 620 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 621 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 622 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 616 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
| 617 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
| 618 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
| 619 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
| 620 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
| 621 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
| 622 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
| 623 | 623 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
| 624 | 624 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
| 625 | 625 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
| 654 | 654 | if (is_numeric($string[$i]) && $concat_flag) { |
| 655 | 655 | $int .= $string[$i]; |
| 656 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
| 656 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
| 657 | 657 | $concat_flag = false; |
| 658 | 658 | } |
| 659 | 659 | } |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | $slice = array_slice($arr, $offset + 1, $length); |
| 700 | 700 | return implode("", $slice); |
| 701 | 701 | } else { |
| 702 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
| 702 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
| 703 | 703 | } |
| 704 | 704 | } |
| 705 | 705 | |
@@ -709,14 +709,14 @@ discard block |
||
| 709 | 709 | //NOTE: use a trailing slash for folders!!! |
| 710 | 710 | //see http://bugs.php.net/bug.php?id=27609 |
| 711 | 711 | //see http://bugs.php.net/bug.php?id=30931 |
| 712 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
| 712 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
| 713 | 713 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
| 714 | 714 | else if (is_dir($path)) |
| 715 | 715 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
| 716 | 716 | // check tmp file for read/write capabilities |
| 717 | 717 | $rm = file_exists($path); |
| 718 | 718 | $f = @fopen($path, 'a'); |
| 719 | - if ($f===false) |
|
| 719 | + if ($f === false) |
|
| 720 | 720 | return false; |
| 721 | 721 | fclose($f); |
| 722 | 722 | if (!$rm) |
@@ -37,8 +37,11 @@ discard block |
||
| 37 | 37 | } else { |
| 38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
| 39 | 39 | } |
| 40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 40 | + if ($timeout == '') { |
|
| 41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 42 | + } else { |
|
| 43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 44 | + } |
|
| 42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
| 43 | 46 | if ($type == 'post') { |
| 44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -92,8 +95,9 @@ discard block |
||
| 92 | 95 | private function curlResponseHeaderCallback($ch, $headerLine) { |
| 93 | 96 | //global $cookies; |
| 94 | 97 | $cookies = array(); |
| 95 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
| 96 | - $cookies[] = $cookie; |
|
| 98 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
| 99 | + $cookies[] = $cookie; |
|
| 100 | + } |
|
| 97 | 101 | return strlen($headerLine); // Needed by curl |
| 98 | 102 | } |
| 99 | 103 | |
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | curl_setopt($ch, CURLOPT_URL, $url); |
| 105 | 109 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 106 | 110 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 107 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 111 | + if ($referer != '') { |
|
| 112 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 113 | + } |
|
| 108 | 114 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 109 | 115 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
| 110 | 116 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -116,7 +122,9 @@ discard block |
||
| 116 | 122 | 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'); |
| 117 | 123 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 118 | 124 | curl_exec($ch); |
| 119 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
| 125 | + if (curl_errno($ch) && $globalDebug) { |
|
| 126 | + echo 'Download error: '.curl_error($ch); |
|
| 127 | + } |
|
| 120 | 128 | curl_close($ch); |
| 121 | 129 | fclose($fp); |
| 122 | 130 | } |
@@ -124,12 +132,16 @@ discard block |
||
| 124 | 132 | public static function gunzip($in_file,$out_file_name = '') { |
| 125 | 133 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 126 | 134 | $buffer_size = 4096; // read 4kb at a time |
| 127 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 135 | + if ($out_file_name == '') { |
|
| 136 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 137 | + } |
|
| 128 | 138 | if ($in_file != '' && file_exists($in_file)) { |
| 129 | 139 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 130 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 131 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 132 | - else { |
|
| 140 | + if (function_exists('gzopen')) { |
|
| 141 | + $file = gzopen($in_file,'rb'); |
|
| 142 | + } elseif (function_exists('gzopen64')) { |
|
| 143 | + $file = gzopen64($in_file,'rb'); |
|
| 144 | + } else { |
|
| 133 | 145 | echo 'gzopen not available'; |
| 134 | 146 | die; |
| 135 | 147 | } |
@@ -145,11 +157,14 @@ discard block |
||
| 145 | 157 | public static function bunzip2($in_file,$out_file_name = '') { |
| 146 | 158 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 147 | 159 | $buffer_size = 4096; // read 4kb at a time |
| 148 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
| 160 | + if ($out_file_name == '') { |
|
| 161 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
| 162 | + } |
|
| 149 | 163 | if ($in_file != '' && file_exists($in_file)) { |
| 150 | 164 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 151 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
| 152 | - else { |
|
| 165 | + if (function_exists('bzopen')) { |
|
| 166 | + $file = bzopen($in_file,'rb'); |
|
| 167 | + } else { |
|
| 153 | 168 | echo 'bzopen not available'; |
| 154 | 169 | die; |
| 155 | 170 | } |
@@ -168,10 +183,16 @@ discard block |
||
| 168 | 183 | * @return Array array of the tables in HTML page |
| 169 | 184 | */ |
| 170 | 185 | public function table2array($data) { |
| 171 | - if (!is_string($data)) return array(); |
|
| 172 | - if ($data == '') return array(); |
|
| 186 | + if (!is_string($data)) { |
|
| 187 | + return array(); |
|
| 188 | + } |
|
| 189 | + if ($data == '') { |
|
| 190 | + return array(); |
|
| 191 | + } |
|
| 173 | 192 | $html = str_get_html($data); |
| 174 | - if ($html === false) return array(); |
|
| 193 | + if ($html === false) { |
|
| 194 | + return array(); |
|
| 195 | + } |
|
| 175 | 196 | $tabledata=array(); |
| 176 | 197 | foreach($html->find('tr') as $element) |
| 177 | 198 | { |
@@ -206,7 +227,9 @@ discard block |
||
| 206 | 227 | */ |
| 207 | 228 | public function text2array($data) { |
| 208 | 229 | $html = str_get_html($data); |
| 209 | - if ($html === false) return array(); |
|
| 230 | + if ($html === false) { |
|
| 231 | + return array(); |
|
| 232 | + } |
|
| 210 | 233 | $tabledata=array(); |
| 211 | 234 | foreach($html->find('p') as $element) |
| 212 | 235 | { |
@@ -227,7 +250,9 @@ discard block |
||
| 227 | 250 | * @return Float Distance in $unit |
| 228 | 251 | */ |
| 229 | 252 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 230 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
| 253 | + if ($lat == $latc && $lon == $lonc) { |
|
| 254 | + return 0; |
|
| 255 | + } |
|
| 231 | 256 | $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; |
| 232 | 257 | if ($unit == "km") { |
| 233 | 258 | return round($dist * 1.609344); |
@@ -277,10 +302,16 @@ discard block |
||
| 277 | 302 | public function withinThreshold ($timeDifference, $distance) { |
| 278 | 303 | $x = abs($timeDifference); |
| 279 | 304 | $d = abs($distance); |
| 280 | - if ($x == 0 || $d == 0) return true; |
|
| 305 | + if ($x == 0 || $d == 0) { |
|
| 306 | + return true; |
|
| 307 | + } |
|
| 281 | 308 | // may be due to Internet jitter; distance is realistic |
| 282 | - if ($x < 0.7 && $d < 2000) return true; |
|
| 283 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
| 309 | + if ($x < 0.7 && $d < 2000) { |
|
| 310 | + return true; |
|
| 311 | + } else { |
|
| 312 | + return $d/$x < 1500*0.27778; |
|
| 313 | + } |
|
| 314 | + // 1500 km/h max |
|
| 284 | 315 | } |
| 285 | 316 | |
| 286 | 317 | |
@@ -308,11 +339,17 @@ discard block |
||
| 308 | 339 | |
| 309 | 340 | public function convertDM($coord,$latlong) { |
| 310 | 341 | if ($latlong == 'latitude') { |
| 311 | - if ($coord < 0) $NSEW = 'S'; |
|
| 312 | - else $NSEW = 'N'; |
|
| 342 | + if ($coord < 0) { |
|
| 343 | + $NSEW = 'S'; |
|
| 344 | + } else { |
|
| 345 | + $NSEW = 'N'; |
|
| 346 | + } |
|
| 313 | 347 | } else { |
| 314 | - if ($coord < 0) $NSEW = 'W'; |
|
| 315 | - else $NSEW = 'E'; |
|
| 348 | + if ($coord < 0) { |
|
| 349 | + $NSEW = 'W'; |
|
| 350 | + } else { |
|
| 351 | + $NSEW = 'E'; |
|
| 352 | + } |
|
| 316 | 353 | } |
| 317 | 354 | $coord = abs($coord); |
| 318 | 355 | $deg = floor($coord); |
@@ -355,7 +392,9 @@ discard block |
||
| 355 | 392 | public function hex2str($hex) { |
| 356 | 393 | $str = ''; |
| 357 | 394 | $hexln = strlen($hex); |
| 358 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 395 | + for($i=0;$i<$hexln;$i+=2) { |
|
| 396 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 397 | + } |
|
| 359 | 398 | return $str; |
| 360 | 399 | } |
| 361 | 400 | |
@@ -392,8 +431,11 @@ discard block |
||
| 392 | 431 | $b = $lat2 - $lat1; |
| 393 | 432 | $c = -($a*$lat1+$b*$lon1); |
| 394 | 433 | $d = $a*$lat3+$b*$lon3+$c; |
| 395 | - if ($d > -$approx && $d < $approx) return true; |
|
| 396 | - else return false; |
|
| 434 | + if ($d > -$approx && $d < $approx) { |
|
| 435 | + return true; |
|
| 436 | + } else { |
|
| 437 | + return false; |
|
| 438 | + } |
|
| 397 | 439 | } |
| 398 | 440 | |
| 399 | 441 | public function array_merge_noappend() { |
@@ -452,7 +494,9 @@ discard block |
||
| 452 | 494 | return $result; |
| 453 | 495 | } |
| 454 | 496 | $handle = @opendir('./locale'); |
| 455 | - if ($handle === false) return $result; |
|
| 497 | + if ($handle === false) { |
|
| 498 | + return $result; |
|
| 499 | + } |
|
| 456 | 500 | while (false !== ($file = readdir($handle))) { |
| 457 | 501 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
| 458 | 502 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -523,8 +567,9 @@ discard block |
||
| 523 | 567 | $error = false; |
| 524 | 568 | if ($fp_out = gzopen($dest, $mode)) { |
| 525 | 569 | if ($fp_in = fopen($source,'rb')) { |
| 526 | - while (!feof($fp_in)) |
|
| 527 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 570 | + while (!feof($fp_in)) { |
|
| 571 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 572 | + } |
|
| 528 | 573 | fclose($fp_in); |
| 529 | 574 | } else { |
| 530 | 575 | $error = true; |
@@ -533,14 +578,17 @@ discard block |
||
| 533 | 578 | } else { |
| 534 | 579 | $error = true; |
| 535 | 580 | } |
| 536 | - if ($error) |
|
| 537 | - return false; |
|
| 538 | - else |
|
| 539 | - return $dest; |
|
| 581 | + if ($error) { |
|
| 582 | + return false; |
|
| 583 | + } else { |
|
| 584 | + return $dest; |
|
| 585 | + } |
|
| 540 | 586 | } |
| 541 | 587 | |
| 542 | 588 | public function remove_accents($string) { |
| 543 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
| 589 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
| 590 | + return $string; |
|
| 591 | + } |
|
| 544 | 592 | $chars = array( |
| 545 | 593 | // Decompositions for Latin-1 Supplement |
| 546 | 594 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -664,7 +712,9 @@ discard block |
||
| 664 | 712 | $ip = gethostbyname($host); |
| 665 | 713 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
| 666 | 714 | $r = @socket_connect($s, $ip, $port); |
| 667 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 715 | + if (!socket_set_nonblock($s)) { |
|
| 716 | + echo "Unable to set nonblock on socket\n"; |
|
| 717 | + } |
|
| 668 | 718 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
| 669 | 719 | return $s; |
| 670 | 720 | } |
@@ -709,18 +759,22 @@ discard block |
||
| 709 | 759 | //NOTE: use a trailing slash for folders!!! |
| 710 | 760 | //see http://bugs.php.net/bug.php?id=27609 |
| 711 | 761 | //see http://bugs.php.net/bug.php?id=30931 |
| 712 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
| 762 | + if ($path{strlen($path)-1}=='/') { |
|
| 763 | + // recursively return a temporary file path |
|
| 713 | 764 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
| 714 | - else if (is_dir($path)) |
|
| 715 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
| 765 | + } else if (is_dir($path)) { |
|
| 766 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
| 767 | + } |
|
| 716 | 768 | // check tmp file for read/write capabilities |
| 717 | 769 | $rm = file_exists($path); |
| 718 | 770 | $f = @fopen($path, 'a'); |
| 719 | - if ($f===false) |
|
| 720 | - return false; |
|
| 771 | + if ($f===false) { |
|
| 772 | + return false; |
|
| 773 | + } |
|
| 721 | 774 | fclose($f); |
| 722 | - if (!$rm) |
|
| 723 | - unlink($path); |
|
| 775 | + if (!$rm) { |
|
| 776 | + unlink($path); |
|
| 777 | + } |
|
| 724 | 778 | return true; |
| 725 | 779 | } |
| 726 | 780 | } |
@@ -17,62 +17,62 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 38 | 38 | if ($flt['airlines'][0] != '') { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 47 | 47 | if (isset($flt['source'])) { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 49 | 49 | } else { |
| 50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 54 | 54 | if (isset($flt['source'])) { |
| 55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 56 | 56 | } else { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 61 | 61 | if (isset($flt['source'])) { |
| 62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 63 | 63 | } else { |
| 64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 68 | 68 | if (isset($flt['source'])) { |
| 69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 74 | 74 | if ($filter['airlines'][0] != '') { |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 83 | 83 | } |
| 84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 86 | 86 | } |
| 87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 88 | 88 | if (count($filter['source']) == 1) { |
| 89 | 89 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
| 90 | 90 | } else { |
| 91 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 91 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 121 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 122 | 122 | } |
| 123 | 123 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 124 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 124 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 125 | 125 | } |
| 126 | 126 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 127 | 127 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 128 | 128 | if ($filter_query_where != '') { |
| 129 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 129 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 130 | 130 | } |
| 131 | 131 | $filter_query = $filter_query_join.$filter_query_where; |
| 132 | 132 | return $filter_query; |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | if ($limit != '') |
| 150 | 150 | { |
| 151 | 151 | $limit_array = explode(',', $limit); |
| 152 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 153 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 152 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 153 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 154 | 154 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 155 | 155 | { |
| 156 | 156 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } else { |
| 175 | 175 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 176 | 176 | } |
| 177 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 177 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 178 | 178 | |
| 179 | 179 | return $spotter_array; |
| 180 | 180 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 191 | 191 | date_default_timezone_set('UTC'); |
| 192 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 192 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 194 | 194 | if ($globalDBdriver == 'mysql') { |
| 195 | 195 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | try { |
| 213 | 213 | $sth = $this->db->prepare($query); |
| 214 | 214 | $sth->execute(); |
| 215 | - } catch(PDOException $e) { |
|
| 215 | + } catch (PDOException $e) { |
|
| 216 | 216 | echo $e->getMessage(); |
| 217 | 217 | die; |
| 218 | 218 | } |
@@ -226,19 +226,19 @@ discard block |
||
| 226 | 226 | * @return Array the spotter information |
| 227 | 227 | * |
| 228 | 228 | */ |
| 229 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
|
| 229 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false) |
|
| 230 | 230 | { |
| 231 | 231 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 232 | 232 | date_default_timezone_set('UTC'); |
| 233 | 233 | $usecoord = false; |
| 234 | 234 | if (is_array($coord) && !empty($coord)) { |
| 235 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 236 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 237 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 238 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 235 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 236 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 237 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 238 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 239 | 239 | $usecoord = true; |
| 240 | 240 | } |
| 241 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 241 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 242 | 242 | |
| 243 | 243 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 244 | 244 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | try { |
| 300 | 300 | $sth = $this->db->prepare($query); |
| 301 | 301 | $sth->execute(); |
| 302 | - } catch(PDOException $e) { |
|
| 302 | + } catch (PDOException $e) { |
|
| 303 | 303 | echo $e->getMessage(); |
| 304 | 304 | die; |
| 305 | 305 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public function getLiveSpotterCount($filter = array()) |
| 317 | 317 | { |
| 318 | 318 | global $globalDBdriver, $globalLiveInterval; |
| 319 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 319 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 320 | 320 | |
| 321 | 321 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 322 | 322 | if ($globalDBdriver == 'mysql') { |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | try { |
| 330 | 330 | $sth = $this->db->prepare($query); |
| 331 | 331 | $sth->execute(); |
| 332 | - } catch(PDOException $e) { |
|
| 332 | + } catch (PDOException $e) { |
|
| 333 | 333 | echo $e->getMessage(); |
| 334 | 334 | die; |
| 335 | 335 | } |
@@ -352,10 +352,10 @@ discard block |
||
| 352 | 352 | $filter_query = $this->getFilter($filter); |
| 353 | 353 | |
| 354 | 354 | if (is_array($coord)) { |
| 355 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 356 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 357 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 358 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 355 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 356 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 357 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 358 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 359 | 359 | } else return array(); |
| 360 | 360 | if ($globalDBdriver == 'mysql') { |
| 361 | 361 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -378,23 +378,23 @@ discard block |
||
| 378 | 378 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 379 | 379 | $Spotter = new Spotter($this->db); |
| 380 | 380 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 381 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 381 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 382 | 382 | |
| 383 | 383 | if (is_array($coord)) { |
| 384 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 385 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 386 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 387 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 384 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 385 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 386 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 387 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 388 | 388 | } else return array(); |
| 389 | 389 | if ($globalDBdriver == 'mysql') { |
| 390 | 390 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 391 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 391 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 392 | 392 | FROM spotter_live |
| 393 | 393 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 394 | 394 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 395 | 395 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
| 396 | 396 | } else { |
| 397 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 397 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 398 | 398 | FROM spotter_live |
| 399 | 399 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 400 | 400 | FROM spotter_live l |
@@ -406,14 +406,14 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | } else { |
| 408 | 408 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 409 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 409 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 410 | 410 | FROM spotter_live |
| 411 | 411 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 412 | 412 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 413 | 413 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 414 | 414 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 415 | 415 | } else { |
| 416 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 416 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 417 | 417 | FROM spotter_live |
| 418 | 418 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 419 | 419 | FROM spotter_live l |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | try { |
| 429 | 429 | $sth = $this->db->prepare($query); |
| 430 | 430 | $sth->execute(); |
| 431 | - } catch(PDOException $e) { |
|
| 431 | + } catch (PDOException $e) { |
|
| 432 | 432 | echo $e->getMessage(); |
| 433 | 433 | die; |
| 434 | 434 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | if ($interval == '1m') |
| 478 | 478 | { |
| 479 | 479 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 480 | - } else if ($interval == '15m'){ |
|
| 480 | + } else if ($interval == '15m') { |
|
| 481 | 481 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -485,14 +485,14 @@ discard block |
||
| 485 | 485 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 488 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 489 | 489 | WHERE spotter_live.latitude <> '' |
| 490 | 490 | AND spotter_live.longitude <> '' |
| 491 | 491 | ".$additional_query." |
| 492 | 492 | HAVING distance < :radius |
| 493 | 493 | ORDER BY distance"; |
| 494 | 494 | |
| 495 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 495 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 496 | 496 | |
| 497 | 497 | return $spotter_array; |
| 498 | 498 | } |
@@ -510,9 +510,9 @@ discard block |
||
| 510 | 510 | date_default_timezone_set('UTC'); |
| 511 | 511 | |
| 512 | 512 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 513 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 513 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 514 | 514 | |
| 515 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 515 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 516 | 516 | |
| 517 | 517 | return $spotter_array; |
| 518 | 518 | } |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | * @return Array the spotter information |
| 524 | 524 | * |
| 525 | 525 | */ |
| 526 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 526 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 527 | 527 | { |
| 528 | 528 | $Spotter = new Spotter($this->db); |
| 529 | 529 | date_default_timezone_set('UTC'); |
| 530 | 530 | |
| 531 | 531 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 532 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 532 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 533 | 533 | |
| 534 | - $date = date('c',$date); |
|
| 535 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 534 | + $date = date('c', $date); |
|
| 535 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 536 | 536 | |
| 537 | 537 | return $spotter_array; |
| 538 | 538 | } |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | $Spotter = new Spotter($this->db); |
| 549 | 549 | date_default_timezone_set('UTC'); |
| 550 | 550 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 551 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 552 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 551 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 552 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 553 | 553 | return $spotter_array; |
| 554 | 554 | } |
| 555 | 555 | |
@@ -559,15 +559,15 @@ discard block |
||
| 559 | 559 | * @return Array the spotter information |
| 560 | 560 | * |
| 561 | 561 | */ |
| 562 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 562 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 563 | 563 | { |
| 564 | 564 | $Spotter = new Spotter($this->db); |
| 565 | 565 | date_default_timezone_set('UTC'); |
| 566 | 566 | |
| 567 | 567 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 568 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 569 | - $date = date('c',$date); |
|
| 570 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 568 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 569 | + $date = date('c', $date); |
|
| 570 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 571 | 571 | return $spotter_array; |
| 572 | 572 | } |
| 573 | 573 | |
@@ -583,13 +583,13 @@ discard block |
||
| 583 | 583 | date_default_timezone_set('UTC'); |
| 584 | 584 | |
| 585 | 585 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 586 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 586 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 587 | 587 | |
| 588 | 588 | try { |
| 589 | 589 | |
| 590 | 590 | $sth = $this->db->prepare($query); |
| 591 | 591 | $sth->execute(array(':ident' => $ident)); |
| 592 | - } catch(PDOException $e) { |
|
| 592 | + } catch (PDOException $e) { |
|
| 593 | 593 | echo $e->getMessage(); |
| 594 | 594 | die; |
| 595 | 595 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | * @return Array the spotter information |
| 605 | 605 | * |
| 606 | 606 | */ |
| 607 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 607 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 608 | 608 | { |
| 609 | 609 | global $globalDBdriver, $globalLiveInterval; |
| 610 | 610 | date_default_timezone_set('UTC'); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | try { |
| 624 | 624 | $sth = $this->db->prepare($query); |
| 625 | 625 | $sth->execute(array(':id' => $id)); |
| 626 | - } catch(PDOException $e) { |
|
| 626 | + } catch (PDOException $e) { |
|
| 627 | 627 | echo $e->getMessage(); |
| 628 | 628 | die; |
| 629 | 629 | } |
@@ -641,12 +641,12 @@ discard block |
||
| 641 | 641 | { |
| 642 | 642 | date_default_timezone_set('UTC'); |
| 643 | 643 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 644 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 644 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 645 | 645 | try { |
| 646 | 646 | |
| 647 | 647 | $sth = $this->db->prepare($query); |
| 648 | 648 | $sth->execute(array(':ident' => $ident)); |
| 649 | - } catch(PDOException $e) { |
|
| 649 | + } catch (PDOException $e) { |
|
| 650 | 650 | echo $e->getMessage(); |
| 651 | 651 | die; |
| 652 | 652 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $sth = $this->db->prepare($query); |
| 678 | 678 | $sth->execute(); |
| 679 | - } catch(PDOException $e) { |
|
| 679 | + } catch (PDOException $e) { |
|
| 680 | 680 | return "error"; |
| 681 | 681 | } |
| 682 | 682 | |
@@ -699,14 +699,14 @@ discard block |
||
| 699 | 699 | |
| 700 | 700 | $sth = $this->db->prepare($query); |
| 701 | 701 | $sth->execute(); |
| 702 | - } catch(PDOException $e) { |
|
| 702 | + } catch (PDOException $e) { |
|
| 703 | 703 | return "error"; |
| 704 | 704 | } |
| 705 | 705 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 706 | 706 | $i = 0; |
| 707 | - $j =0; |
|
| 707 | + $j = 0; |
|
| 708 | 708 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 709 | - foreach($all as $row) |
|
| 709 | + foreach ($all as $row) |
|
| 710 | 710 | { |
| 711 | 711 | $i++; |
| 712 | 712 | $j++; |
@@ -714,9 +714,9 @@ discard block |
||
| 714 | 714 | if ($globalDebug) echo "."; |
| 715 | 715 | try { |
| 716 | 716 | |
| 717 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 717 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 718 | 718 | $sth->execute(); |
| 719 | - } catch(PDOException $e) { |
|
| 719 | + } catch (PDOException $e) { |
|
| 720 | 720 | return "error"; |
| 721 | 721 | } |
| 722 | 722 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | if ($i > 0) { |
| 728 | 728 | try { |
| 729 | 729 | |
| 730 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 730 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 731 | 731 | $sth->execute(); |
| 732 | - } catch(PDOException $e) { |
|
| 732 | + } catch (PDOException $e) { |
|
| 733 | 733 | return "error"; |
| 734 | 734 | } |
| 735 | 735 | } |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | $sth = $this->db->prepare($query); |
| 744 | 744 | $sth->execute(); |
| 745 | - } catch(PDOException $e) { |
|
| 745 | + } catch (PDOException $e) { |
|
| 746 | 746 | return "error"; |
| 747 | 747 | } |
| 748 | 748 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -790,13 +790,13 @@ discard block |
||
| 790 | 790 | public function deleteLiveSpotterDataByIdent($ident) |
| 791 | 791 | { |
| 792 | 792 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 793 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 793 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 794 | 794 | |
| 795 | 795 | try { |
| 796 | 796 | |
| 797 | 797 | $sth = $this->db->prepare($query); |
| 798 | 798 | $sth->execute(array(':ident' => $ident)); |
| 799 | - } catch(PDOException $e) { |
|
| 799 | + } catch (PDOException $e) { |
|
| 800 | 800 | return "error"; |
| 801 | 801 | } |
| 802 | 802 | |
@@ -812,13 +812,13 @@ discard block |
||
| 812 | 812 | public function deleteLiveSpotterDataById($id) |
| 813 | 813 | { |
| 814 | 814 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 815 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 815 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 816 | 816 | |
| 817 | 817 | try { |
| 818 | 818 | |
| 819 | 819 | $sth = $this->db->prepare($query); |
| 820 | 820 | $sth->execute(array(':id' => $id)); |
| 821 | - } catch(PDOException $e) { |
|
| 821 | + } catch (PDOException $e) { |
|
| 822 | 822 | return "error"; |
| 823 | 823 | } |
| 824 | 824 | |
@@ -836,13 +836,13 @@ discard block |
||
| 836 | 836 | { |
| 837 | 837 | global $globalDBdriver, $globalTimezone; |
| 838 | 838 | if ($globalDBdriver == 'mysql') { |
| 839 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 839 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 840 | 840 | WHERE spotter_live.ident = :ident |
| 841 | 841 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 842 | 842 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 843 | 843 | $query_data = array(':ident' => $ident); |
| 844 | 844 | } else { |
| 845 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 845 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 846 | 846 | WHERE spotter_live.ident = :ident |
| 847 | 847 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 848 | 848 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -851,8 +851,8 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | $sth = $this->db->prepare($query); |
| 853 | 853 | $sth->execute($query_data); |
| 854 | - $ident_result=''; |
|
| 855 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 854 | + $ident_result = ''; |
|
| 855 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 856 | 856 | { |
| 857 | 857 | $ident_result = $row['ident']; |
| 858 | 858 | } |
@@ -869,13 +869,13 @@ discard block |
||
| 869 | 869 | { |
| 870 | 870 | global $globalDBdriver, $globalTimezone; |
| 871 | 871 | if ($globalDBdriver == 'mysql') { |
| 872 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 872 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 873 | 873 | WHERE spotter_live.ident = :ident |
| 874 | 874 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 875 | 875 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 876 | 876 | $query_data = array(':ident' => $ident); |
| 877 | 877 | } else { |
| 878 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 878 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 879 | 879 | WHERE spotter_live.ident = :ident |
| 880 | 880 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
| 881 | 881 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -884,8 +884,8 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | $sth = $this->db->prepare($query); |
| 886 | 886 | $sth->execute($query_data); |
| 887 | - $ident_result=''; |
|
| 888 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 887 | + $ident_result = ''; |
|
| 888 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 889 | 889 | { |
| 890 | 890 | $ident_result = $row['flightaware_id']; |
| 891 | 891 | } |
@@ -902,13 +902,13 @@ discard block |
||
| 902 | 902 | { |
| 903 | 903 | global $globalDBdriver, $globalTimezone; |
| 904 | 904 | if ($globalDBdriver == 'mysql') { |
| 905 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 905 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 906 | 906 | WHERE spotter_live.flightaware_id = :id |
| 907 | 907 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 908 | 908 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 909 | 909 | $query_data = array(':id' => $id); |
| 910 | 910 | } else { |
| 911 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 911 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 912 | 912 | WHERE spotter_live.flightaware_id = :id |
| 913 | 913 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 914 | 914 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -917,8 +917,8 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | $sth = $this->db->prepare($query); |
| 919 | 919 | $sth->execute($query_data); |
| 920 | - $ident_result=''; |
|
| 921 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 920 | + $ident_result = ''; |
|
| 921 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 922 | 922 | { |
| 923 | 923 | $ident_result = $row['flightaware_id']; |
| 924 | 924 | } |
@@ -935,13 +935,13 @@ discard block |
||
| 935 | 935 | { |
| 936 | 936 | global $globalDBdriver, $globalTimezone; |
| 937 | 937 | if ($globalDBdriver == 'mysql') { |
| 938 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 938 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 939 | 939 | WHERE spotter_live.ModeS = :modes |
| 940 | 940 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 941 | 941 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 942 | 942 | $query_data = array(':modes' => $modes); |
| 943 | 943 | } else { |
| 944 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 944 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 945 | 945 | WHERE spotter_live.ModeS = :modes |
| 946 | 946 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
| 947 | 947 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -950,8 +950,8 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | $sth = $this->db->prepare($query); |
| 952 | 952 | $sth->execute($query_data); |
| 953 | - $ident_result=''; |
|
| 954 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 953 | + $ident_result = ''; |
|
| 954 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 955 | 955 | { |
| 956 | 956 | //$ident_result = $row['spotter_live_id']; |
| 957 | 957 | $ident_result = $row['flightaware_id']; |
@@ -976,8 +976,8 @@ discard block |
||
| 976 | 976 | return array(); |
| 977 | 977 | } else { |
| 978 | 978 | $q_array = explode(" ", $q); |
| 979 | - foreach ($q_array as $q_item){ |
|
| 980 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 979 | + foreach ($q_array as $q_item) { |
|
| 980 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 981 | 981 | $additional_query .= " AND ("; |
| 982 | 982 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
| 983 | 983 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -992,11 +992,11 @@ discard block |
||
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | if ($globalDBdriver == 'mysql') { |
| 995 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 995 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 996 | 996 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 997 | 997 | AND spotter_live.date < UTC_TIMESTAMP()"; |
| 998 | 998 | } else { |
| 999 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 999 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1000 | 1000 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1001 | 1001 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1002 | 1002 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | * @return String success or false |
| 1017 | 1017 | * |
| 1018 | 1018 | */ |
| 1019 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 1019 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 1020 | 1020 | { |
| 1021 | 1021 | global $globalURL, $globalArchive, $globalDebug; |
| 1022 | 1022 | $Common = new Common(); |
@@ -1116,27 +1116,27 @@ discard block |
||
| 1116 | 1116 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1117 | 1117 | |
| 1118 | 1118 | |
| 1119 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1120 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1121 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1122 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1123 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1124 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1125 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1126 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1127 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1128 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1129 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1130 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1131 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1132 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1133 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1134 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1135 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1136 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1137 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1138 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1139 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1119 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1120 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1121 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1122 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1123 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1124 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1125 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1126 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1127 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1128 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1129 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1130 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1131 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1132 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1133 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1134 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1135 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1136 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1137 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1138 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1139 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1140 | 1140 | |
| 1141 | 1141 | $airline_name = ''; |
| 1142 | 1142 | $airline_icao = ''; |
@@ -1158,10 +1158,10 @@ discard block |
||
| 1158 | 1158 | $arrival_airport_country = ''; |
| 1159 | 1159 | |
| 1160 | 1160 | |
| 1161 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1162 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1163 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1164 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1161 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 1162 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 1163 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 1164 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1165 | 1165 | |
| 1166 | 1166 | $query = ''; |
| 1167 | 1167 | if ($globalArchive) { |
@@ -1172,19 +1172,19 @@ discard block |
||
| 1172 | 1172 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
| 1173 | 1173 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
| 1174 | 1174 | |
| 1175 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
| 1175 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
| 1176 | 1176 | try { |
| 1177 | 1177 | |
| 1178 | 1178 | $sth = $this->db->prepare($query); |
| 1179 | 1179 | $sth->execute($query_values); |
| 1180 | 1180 | $sth->closeCursor(); |
| 1181 | - } catch(PDOException $e) { |
|
| 1181 | + } catch (PDOException $e) { |
|
| 1182 | 1182 | return "error : ".$e->getMessage(); |
| 1183 | 1183 | } |
| 1184 | 1184 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1185 | 1185 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 1186 | 1186 | $SpotterArchive = new SpotterArchive($this->db); |
| 1187 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1187 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 1188 | 1188 | if ($globalDebug) echo $result.')'; |
| 1189 | 1189 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1190 | 1190 | echo '(Not adding to archive)'; |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | |
| 1198 | 1198 | public function getOrderBy() |
| 1199 | 1199 | { |
| 1200 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1200 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1201 | 1201 | return $orderby; |
| 1202 | 1202 | } |
| 1203 | 1203 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class TSK { |
| 4 | 4 | public function parse_xml($url) { |
| 5 | 5 | $Common = new Common(); |
| 6 | - $filedata = $Common->getData($url,'get','','','','','','',true); |
|
| 6 | + $filedata = $Common->getData($url, 'get', '', '', '', '', '', '', true); |
|
| 7 | 7 | if ($filedata != '' && $filedata !== false) { |
| 8 | 8 | $xml = simplexml_load_string($filedata); |
| 9 | 9 | if ($xml !== false) { |
@@ -9,20 +9,20 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | require_once(dirname(__FILE__).'/class.GeoidHeight.php'); |
| 11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | class SpotterImport { |
| 16 | - private $all_flights = array(); |
|
| 17 | - private $last_delete_hourly = 0; |
|
| 18 | - private $last_delete = 0; |
|
| 19 | - private $stats = array(); |
|
| 20 | - private $tmd = 0; |
|
| 21 | - private $source_location = array(); |
|
| 22 | - public $db = null; |
|
| 23 | - public $nb = 0; |
|
| 16 | + private $all_flights = array(); |
|
| 17 | + private $last_delete_hourly = 0; |
|
| 18 | + private $last_delete = 0; |
|
| 19 | + private $stats = array(); |
|
| 20 | + private $tmd = 0; |
|
| 21 | + private $source_location = array(); |
|
| 22 | + public $db = null; |
|
| 23 | + public $nb = 0; |
|
| 24 | 24 | |
| 25 | - public function __construct($dbc = null) { |
|
| 25 | + public function __construct($dbc = null) { |
|
| 26 | 26 | global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid; |
| 27 | 27 | if (!(isset($globalNoDB) && $globalNoDB)) { |
| 28 | 28 | $Connection = new Connection($dbc); |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | $currentdate = date('Y-m-d'); |
| 35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 36 | 36 | if (!empty($sourcestat)) { |
| 37 | - foreach($sourcestat as $srcst) { |
|
| 38 | - $type = $srcst['stats_type']; |
|
| 37 | + foreach($sourcestat as $srcst) { |
|
| 38 | + $type = $srcst['stats_type']; |
|
| 39 | 39 | if ($type == 'polar' || $type == 'hist') { |
| 40 | - $source = $srcst['source_name']; |
|
| 41 | - $data = $srcst['source_data']; |
|
| 42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 43 | - } |
|
| 44 | - } |
|
| 40 | + $source = $srcst['source_name']; |
|
| 41 | + $data = $srcst['source_data']; |
|
| 42 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | $GeoidClass = FALSE; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function get_Schedule($id,$ident) { |
|
| 61 | + public function get_Schedule($id,$ident) { |
|
| 62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 63 | 63 | // Get schedule here, so it's done only one time |
| 64 | 64 | |
@@ -78,42 +78,42 @@ discard block |
||
| 78 | 78 | $operator = $Spotter->getOperator($ident); |
| 79 | 79 | $scheduleexist = false; |
| 80 | 80 | if ($Schedule->checkSchedule($operator) == 0) { |
| 81 | - $operator = $Translation->checkTranslation($ident); |
|
| 82 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
| 81 | + $operator = $Translation->checkTranslation($ident); |
|
| 82 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
| 83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 88 | - // Should also check if route schedule = route from DB |
|
| 89 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
| 85 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 88 | + // Should also check if route schedule = route from DB |
|
| 89 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
| 90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
| 91 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 92 | - if (trim($airport_icao) != '') { |
|
| 91 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 92 | + if (trim($airport_icao) != '') { |
|
| 93 | 93 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 94 | 94 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
| 95 | - } |
|
| 95 | + } |
|
| 96 | + } |
|
| 96 | 97 | } |
| 97 | - } |
|
| 98 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 98 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 99 | 99 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
| 100 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 101 | - if (trim($airport_icao) != '') { |
|
| 100 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 101 | + if (trim($airport_icao) != '') { |
|
| 102 | 102 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 103 | 103 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
| 104 | - } |
|
| 104 | + } |
|
| 105 | 105 | } |
| 106 | - } |
|
| 107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 106 | + } |
|
| 107 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 108 | 108 | } |
| 109 | - } else $scheduleexist = true; |
|
| 109 | + } else $scheduleexist = true; |
|
| 110 | 110 | } else $scheduleexist = true; |
| 111 | 111 | // close connection, at least one way will work ? |
| 112 | - if ($scheduleexist) { |
|
| 112 | + if ($scheduleexist) { |
|
| 113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 114 | - $sch = $Schedule->getSchedule($operator); |
|
| 114 | + $sch = $Schedule->getSchedule($operator); |
|
| 115 | 115 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 116 | - } |
|
| 116 | + } |
|
| 117 | 117 | $Spotter->db = null; |
| 118 | 118 | $Schedule->db = null; |
| 119 | 119 | $Translation->db = null; |
@@ -128,78 +128,78 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | */ |
| 130 | 130 | } |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - public function checkAll() { |
|
| 133 | + public function checkAll() { |
|
| 134 | 134 | global $globalDebug, $globalNoImport; |
| 135 | 135 | if ($globalDebug) echo "Update last seen flights data...\n"; |
| 136 | 136 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 137 | - foreach ($this->all_flights as $key => $flight) { |
|
| 137 | + foreach ($this->all_flights as $key => $flight) { |
|
| 138 | 138 | if (isset($this->all_flights[$key]['id'])) { |
| 139 | - //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
| 140 | - $Spotter = new Spotter($this->db); |
|
| 141 | - $real_arrival = $this->arrival($key); |
|
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 143 | - } |
|
| 144 | - } |
|
| 139 | + //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
| 140 | + $Spotter = new Spotter($this->db); |
|
| 141 | + $real_arrival = $this->arrival($key); |
|
| 142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + } |
|
| 145 | 146 | } |
| 146 | - } |
|
| 147 | 147 | |
| 148 | - public function arrival($key) { |
|
| 148 | + public function arrival($key) { |
|
| 149 | 149 | global $globalClosestMinDist, $globalDebug; |
| 150 | 150 | if ($globalDebug) echo 'Update arrival...'."\n"; |
| 151 | 151 | $Spotter = new Spotter($this->db); |
| 152 | - $airport_icao = ''; |
|
| 153 | - $airport_time = ''; |
|
| 154 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 152 | + $airport_icao = ''; |
|
| 153 | + $airport_time = ''; |
|
| 154 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 157 | - if (isset($closestAirports[0])) { |
|
| 158 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 159 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 160 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 161 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 162 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 163 | - foreach ($closestAirports as $airport) { |
|
| 164 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 165 | - $airport_icao = $airport['icao']; |
|
| 166 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 167 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 168 | - break; |
|
| 169 | - } |
|
| 170 | - } |
|
| 171 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 172 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 173 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 174 | - } else { |
|
| 175 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 176 | - } |
|
| 177 | - } else { |
|
| 178 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 179 | - } |
|
| 156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 157 | + if (isset($closestAirports[0])) { |
|
| 158 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 159 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 160 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 161 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 162 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 163 | + foreach ($closestAirports as $airport) { |
|
| 164 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 165 | + $airport_icao = $airport['icao']; |
|
| 166 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 167 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 168 | + break; |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 172 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 173 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 174 | + } else { |
|
| 175 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 176 | + } |
|
| 177 | + } else { |
|
| 178 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - } else { |
|
| 182 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 183 | - } |
|
| 184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 185 | - } |
|
| 181 | + } else { |
|
| 182 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 183 | + } |
|
| 184 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | |
| 189 | - public function del() { |
|
| 189 | + public function del() { |
|
| 190 | 190 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 191 | 191 | // Delete old infos |
| 192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 193 | 193 | foreach ($this->all_flights as $key => $flight) { |
| 194 | - if (isset($flight['lastupdate'])) { |
|
| 194 | + if (isset($flight['lastupdate'])) { |
|
| 195 | 195 | if ($flight['lastupdate'] < (time()-1800)) { |
| 196 | - $this->delKey($key); |
|
| 196 | + $this->delKey($key); |
|
| 197 | 197 | } |
| 198 | - } |
|
| 198 | + } |
|
| 199 | + } |
|
| 199 | 200 | } |
| 200 | - } |
|
| 201 | 201 | |
| 202 | - public function delKey($key) { |
|
| 202 | + public function delKey($key) { |
|
| 203 | 203 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 204 | 204 | // Delete old infos |
| 205 | 205 | if (isset($this->all_flights[$key]['id'])) { |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | unset($this->all_flights[$key]); |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - public function add($line) { |
|
| 219 | + public function add($line) { |
|
| 220 | 220 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive; |
| 221 | 221 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 222 | 222 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
@@ -242,20 +242,20 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | // SBS format is CSV format |
| 244 | 244 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
| 245 | - //print_r($line); |
|
| 246 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 247 | - if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
| 245 | + //print_r($line); |
|
| 246 | + if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 247 | + if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
| 248 | 248 | |
| 249 | 249 | // Increment message number |
| 250 | 250 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
| 251 | - $current_date = date('Y-m-d'); |
|
| 252 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 253 | - else $source = ''; |
|
| 254 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 255 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 256 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 257 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 258 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 251 | + $current_date = date('Y-m-d'); |
|
| 252 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 253 | + else $source = ''; |
|
| 254 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 255 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 256 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 257 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 258 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /* |
@@ -271,54 +271,54 @@ discard block |
||
| 271 | 271 | //$this->db = $dbc; |
| 272 | 272 | |
| 273 | 273 | //$hex = trim($line['hex']); |
| 274 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 275 | - else $id = trim($line['id']); |
|
| 274 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 275 | + else $id = trim($line['id']); |
|
| 276 | 276 | |
| 277 | 277 | if (!isset($this->all_flights[$id])) { |
| 278 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
| 279 | - $this->all_flights[$id] = array(); |
|
| 280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 283 | - if (!isset($line['id'])) { |
|
| 278 | + if ($globalDebug) echo 'New flight...'."\n"; |
|
| 279 | + $this->all_flights[$id] = array(); |
|
| 280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 283 | + if (!isset($line['id'])) { |
|
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 285 | 285 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | 287 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 288 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 290 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 288 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 290 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 291 | 291 | } |
| 292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | //print_r($this->all_flights); |
| 297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 299 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 299 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 302 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
| 301 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 302 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
| 303 | 303 | $timeelapsed = microtime(true); |
| 304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 305 | - $Spotter = new Spotter($this->db); |
|
| 306 | - if (isset($this->all_flights[$id]['source_type'])) { |
|
| 305 | + $Spotter = new Spotter($this->db); |
|
| 306 | + if (isset($this->all_flights[$id]['source_type'])) { |
|
| 307 | 307 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
| 308 | - } else { |
|
| 308 | + } else { |
|
| 309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | - } |
|
| 311 | - $Spotter->db = null; |
|
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 310 | + } |
|
| 311 | + $Spotter->db = null; |
|
| 312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 314 | 314 | } |
| 315 | - } |
|
| 316 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 317 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 315 | + } |
|
| 316 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 317 | + if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 318 | 318 | } |
| 319 | - if (isset($line['id']) && !isset($line['hex'])) { |
|
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 321 | - } |
|
| 319 | + if (isset($line['id']) && !isset($line['hex'])) { |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 321 | + } |
|
| 322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 323 | 323 | $icao = $line['aircraft_icao']; |
| 324 | 324 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -349,9 +349,9 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 351 | 351 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
| 352 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 352 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 353 | 353 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 354 | - } else { |
|
| 354 | + } else { |
|
| 355 | 355 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 356 | 356 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 357 | 357 | /* |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | print_r($line); |
| 361 | 361 | */ |
| 362 | 362 | return ''; |
| 363 | - } |
|
| 363 | + } |
|
| 364 | 364 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 365 | 365 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
| 366 | 366 | return ''; |
@@ -376,21 +376,21 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
| 379 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 379 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 380 | 380 | } |
| 381 | 381 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 382 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 382 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 383 | 383 | } |
| 384 | 384 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 385 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 385 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 386 | 386 | } |
| 387 | 387 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 388 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 388 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 392 | 392 | |
| 393 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 393 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 394 | 394 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 395 | 395 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 396 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -399,23 +399,23 @@ discard block |
||
| 399 | 399 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 400 | 400 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 401 | 401 | } else { |
| 402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 403 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 403 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 404 | 404 | $timeelapsed = microtime(true); |
| 405 | - $Spotter = new Spotter($this->db); |
|
| 406 | - $fromsource = NULL; |
|
| 407 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 408 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 405 | + $Spotter = new Spotter($this->db); |
|
| 406 | + $fromsource = NULL; |
|
| 407 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 408 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 409 | 409 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 410 | 410 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 411 | 411 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 412 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 412 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 413 | 413 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 414 | 414 | $Spotter->db = null; |
| 415 | 415 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 416 | - } |
|
| 416 | + } |
|
| 417 | 417 | } |
| 418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 418 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 419 | 419 | |
| 420 | 420 | /* |
| 421 | 421 | if (!isset($line['id'])) { |
@@ -425,63 +425,63 @@ discard block |
||
| 425 | 425 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 426 | 426 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 427 | 427 | */ |
| 428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 428 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 429 | 429 | |
| 430 | - //$putinarchive = true; |
|
| 431 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 430 | + //$putinarchive = true; |
|
| 431 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 432 | 432 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 433 | - } |
|
| 434 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 433 | + } |
|
| 434 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 435 | 435 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 436 | - } |
|
| 437 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 438 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 439 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 436 | + } |
|
| 437 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 438 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 439 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 440 | 440 | $timeelapsed = microtime(true); |
| 441 | 441 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 442 | 442 | $Spotter = new Spotter($this->db); |
| 443 | 443 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 444 | 444 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 445 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 446 | 446 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 447 | - } |
|
| 448 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 447 | + } |
|
| 448 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 449 | 449 | $timeelapsed = microtime(true); |
| 450 | 450 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 451 | - $Spotter = new Spotter($this->db); |
|
| 452 | - $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 453 | - if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 451 | + $Spotter = new Spotter($this->db); |
|
| 452 | + $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
| 453 | + if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
| 454 | 454 | $Translation = new Translation($this->db); |
| 455 | 455 | $ident = $Translation->checkTranslation(trim($line['ident'])); |
| 456 | 456 | $route = $Spotter->getRouteInfo($ident); |
| 457 | 457 | $Translation->db = null; |
| 458 | - } |
|
| 459 | - $Spotter->db = null; |
|
| 460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 461 | - } |
|
| 458 | + } |
|
| 459 | + $Spotter->db = null; |
|
| 460 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 461 | + } |
|
| 462 | 462 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 463 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 464 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 463 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 464 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 465 | 465 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 466 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 467 | - } |
|
| 466 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 467 | + } |
|
| 468 | 468 | } |
| 469 | 469 | if (!isset($globalFork)) $globalFork = TRUE; |
| 470 | 470 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 471 | 471 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
| 472 | 472 | } |
| 473 | - } |
|
| 473 | + } |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
| 477 | 477 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 479 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 480 | - //$dataFound = true; |
|
| 478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 479 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 480 | + //$dataFound = true; |
|
| 481 | 481 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 482 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 483 | - if ($distance > 1000 && $distance < 10000) { |
|
| 484 | - // use datetime |
|
| 482 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 483 | + if ($distance > 1000 && $distance < 10000) { |
|
| 484 | + // use datetime |
|
| 485 | 485 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 486 | 486 | $speed = $speed*3.6; |
| 487 | 487 | if ($speed < 1000) { |
@@ -490,49 +490,49 @@ discard block |
||
| 490 | 490 | } else { |
| 491 | 491 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 492 | 492 | } |
| 493 | - } |
|
| 493 | + } |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
| 497 | 497 | |
| 498 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 499 | - if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
| 500 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 501 | - return false; |
|
| 502 | - } |
|
| 503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 504 | - else unset($timediff); |
|
| 505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 506 | - else unset($timediff_archive); |
|
| 507 | - if ($this->tmd > 5 |
|
| 508 | - || (isset($line['format_source']) |
|
| 509 | - && $line['format_source'] == 'airwhere' |
|
| 510 | - && ((!isset($this->all_flights[$id]['latitude']) |
|
| 511 | - || !isset($this->all_flights[$id]['longitude'])) |
|
| 512 | - || (isset($this->all_flights[$id]['latitude']) |
|
| 513 | - && isset($this->all_flights[$id]['longitude']) |
|
| 514 | - && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
| 515 | - && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
| 516 | - ) |
|
| 517 | - ) |
|
| 518 | - ) |
|
| 519 | - || (isset($globalVA) && $globalVA) |
|
| 520 | - || (isset($globalIVAO) && $globalIVAO) |
|
| 521 | - || (isset($globalVATSIM) && $globalVATSIM) |
|
| 522 | - || (isset($globalphpVMS) && $globalphpVMS) |
|
| 523 | - || (isset($globalVAM) && $globalVAM) |
|
| 524 | - || !isset($timediff) |
|
| 525 | - || $timediff > $globalLiveInterval |
|
| 526 | - || $globalArchive |
|
| 527 | - || ($timediff > 30 |
|
| 528 | - && isset($this->all_flights[$id]['latitude']) |
|
| 529 | - && isset($this->all_flights[$id]['longitude']) |
|
| 530 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
| 531 | - ) |
|
| 532 | - ) { |
|
| 498 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 499 | + if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
| 500 | + if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 501 | + return false; |
|
| 502 | + } |
|
| 503 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 504 | + else unset($timediff); |
|
| 505 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 506 | + else unset($timediff_archive); |
|
| 507 | + if ($this->tmd > 5 |
|
| 508 | + || (isset($line['format_source']) |
|
| 509 | + && $line['format_source'] == 'airwhere' |
|
| 510 | + && ((!isset($this->all_flights[$id]['latitude']) |
|
| 511 | + || !isset($this->all_flights[$id]['longitude'])) |
|
| 512 | + || (isset($this->all_flights[$id]['latitude']) |
|
| 513 | + && isset($this->all_flights[$id]['longitude']) |
|
| 514 | + && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
| 515 | + && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
| 516 | + ) |
|
| 517 | + ) |
|
| 518 | + ) |
|
| 519 | + || (isset($globalVA) && $globalVA) |
|
| 520 | + || (isset($globalIVAO) && $globalIVAO) |
|
| 521 | + || (isset($globalVATSIM) && $globalVATSIM) |
|
| 522 | + || (isset($globalphpVMS) && $globalphpVMS) |
|
| 523 | + || (isset($globalVAM) && $globalVAM) |
|
| 524 | + || !isset($timediff) |
|
| 525 | + || $timediff > $globalLiveInterval |
|
| 526 | + || $globalArchive |
|
| 527 | + || ($timediff > 30 |
|
| 528 | + && isset($this->all_flights[$id]['latitude']) |
|
| 529 | + && isset($this->all_flights[$id]['longitude']) |
|
| 530 | + && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
| 531 | + ) |
|
| 532 | + ) { |
|
| 533 | 533 | |
| 534 | 534 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
| 535 | - if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
| 535 | + if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
| 536 | 536 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
| 537 | 537 | || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
| 538 | 538 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -540,9 +540,9 @@ discard block |
||
| 540 | 540 | $this->all_flights[$id]['putinarchive'] = true; |
| 541 | 541 | $this->tmd = 0; |
| 542 | 542 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 543 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 544 | - $timeelapsed = microtime(true); |
|
| 545 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 543 | + if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 544 | + $timeelapsed = microtime(true); |
|
| 545 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 546 | 546 | $Spotter = new Spotter($this->db); |
| 547 | 547 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 548 | 548 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
@@ -550,11 +550,11 @@ discard block |
||
| 550 | 550 | $Spotter->db = null; |
| 551 | 551 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 552 | 552 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 553 | - } |
|
| 553 | + } |
|
| 554 | 554 | } |
| 555 | 555 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
| 556 | - } |
|
| 557 | - /* |
|
| 556 | + } |
|
| 557 | + /* |
|
| 558 | 558 | else { |
| 559 | 559 | if (!isset($timediff)) echo 'NO TIMEDIFF'; |
| 560 | 560 | else { |
@@ -568,16 +568,16 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 571 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 571 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 572 | 572 | if (!isset($this->all_flights[$id]['archive_latitude'])) { |
| 573 | 573 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 574 | 574 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 575 | 575 | } |
| 576 | 576 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
| 577 | 577 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
| 578 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 579 | - $dataFound = true; |
|
| 580 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 578 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 579 | + $dataFound = true; |
|
| 580 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 581 | 581 | } |
| 582 | 582 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 583 | 583 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -588,24 +588,24 @@ discard block |
||
| 588 | 588 | //$putinarchive = true; |
| 589 | 589 | } |
| 590 | 590 | */ |
| 591 | - /* |
|
| 591 | + /* |
|
| 592 | 592 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 593 | 593 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
| 594 | 594 | } |
| 595 | 595 | */ |
| 596 | 596 | } |
| 597 | 597 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 598 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 599 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 598 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 599 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 600 | 600 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
| 601 | 601 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 602 | 602 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 603 | 603 | } |
| 604 | 604 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
| 605 | 605 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
| 606 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 607 | - $dataFound = true; |
|
| 608 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 606 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 607 | + $dataFound = true; |
|
| 608 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 609 | 609 | } |
| 610 | 610 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 611 | 611 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -623,67 +623,67 @@ discard block |
||
| 623 | 623 | */ |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - } else if ($globalDebug && $timediff > 30) { |
|
| 626 | + } else if ($globalDebug && $timediff > 30) { |
|
| 627 | 627 | $this->tmd = $this->tmd + 1; |
| 628 | 628 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 629 | 629 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
| 630 | 630 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 631 | 631 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 632 | - } |
|
| 632 | + } |
|
| 633 | 633 | } |
| 634 | 634 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 635 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 635 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 637 | 637 | } |
| 638 | 638 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 639 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 640 | - //$dataFound = true; |
|
| 639 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 640 | + //$dataFound = true; |
|
| 641 | 641 | } |
| 642 | 642 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 644 | 644 | } |
| 645 | 645 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 647 | 647 | } |
| 648 | 648 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 649 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 650 | - //$dataFound = true; |
|
| 649 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 650 | + //$dataFound = true; |
|
| 651 | 651 | } |
| 652 | 652 | if (isset($line['ground']) && $line['ground'] != '') { |
| 653 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 653 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 654 | 654 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 655 | 655 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 656 | 656 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 657 | 657 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 658 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 659 | 659 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 660 | - } |
|
| 661 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 662 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 663 | - //$dataFound = true; |
|
| 660 | + } |
|
| 661 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 662 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 663 | + //$dataFound = true; |
|
| 664 | 664 | } |
| 665 | 665 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 666 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 667 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 669 | - $highlight = ''; |
|
| 670 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 671 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 672 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 673 | - if ($highlight != '') { |
|
| 666 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 667 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 669 | + $highlight = ''; |
|
| 670 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 671 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 672 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 673 | + if ($highlight != '') { |
|
| 674 | 674 | $timeelapsed = microtime(true); |
| 675 | 675 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 676 | - $Spotter = new Spotter($this->db); |
|
| 677 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 678 | - $Spotter->db = null; |
|
| 679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 676 | + $Spotter = new Spotter($this->db); |
|
| 677 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 678 | + $Spotter->db = null; |
|
| 679 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 680 | 680 | } |
| 681 | 681 | //$putinarchive = true; |
| 682 | 682 | //$highlight = ''; |
| 683 | - } |
|
| 683 | + } |
|
| 684 | 684 | |
| 685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 686 | - //$dataFound = true; |
|
| 685 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 686 | + //$dataFound = true; |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | if (isset($line['altitude']) && $line['altitude'] != '') { |
@@ -694,13 +694,13 @@ discard block |
||
| 694 | 694 | $line['altitude'] = $line['altitude'] - $geoid; |
| 695 | 695 | } |
| 696 | 696 | } |
| 697 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 697 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 698 | 698 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
| 699 | 699 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 700 | 700 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 701 | 701 | //$dataFound = true; |
| 702 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 703 | - if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
| 702 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 703 | + if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
| 704 | 704 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 705 | 705 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 706 | 706 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -709,27 +709,27 @@ discard block |
||
| 709 | 709 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 710 | 710 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 711 | 711 | } |
| 712 | - } |
|
| 713 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 712 | + } |
|
| 713 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 717 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 717 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | if (isset($line['heading']) && $line['heading'] != '') { |
| 721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 723 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 724 | - //$dataFound = true; |
|
| 721 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 723 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 724 | + //$dataFound = true; |
|
| 725 | 725 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 726 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 727 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 729 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 726 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 727 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 728 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 729 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 730 | 730 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 731 | - // If not enough messages and ACARS set heading to 0 |
|
| 732 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 731 | + // If not enough messages and ACARS set heading to 0 |
|
| 732 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 733 | 733 | } |
| 734 | 734 | if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 735 | 735 | elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -742,125 +742,125 @@ discard block |
||
| 742 | 742 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 743 | 743 | //if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 744 | 744 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 745 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 746 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 747 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 748 | - //print_r($this->all_flights); |
|
| 749 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 750 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 751 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 745 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 746 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 747 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 748 | + //print_r($this->all_flights); |
|
| 749 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 750 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 751 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 752 | 752 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 753 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 754 | - $timeelapsed = microtime(true); |
|
| 755 | - $SpotterLive = new SpotterLive($this->db); |
|
| 756 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 753 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 754 | + $timeelapsed = microtime(true); |
|
| 755 | + $SpotterLive = new SpotterLive($this->db); |
|
| 756 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 757 | 757 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 758 | 758 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 759 | - } elseif (isset($line['id'])) { |
|
| 759 | + } elseif (isset($line['id'])) { |
|
| 760 | 760 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 761 | 761 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 762 | - } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 762 | + } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
| 763 | 763 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 764 | 764 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 765 | - } else $recent_ident = ''; |
|
| 766 | - $SpotterLive->db=null; |
|
| 767 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 768 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 765 | + } else $recent_ident = ''; |
|
| 766 | + $SpotterLive->db=null; |
|
| 767 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 768 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 769 | 769 | } else $recent_ident = ''; |
| 770 | - } else { |
|
| 770 | + } else { |
|
| 771 | 771 | $recent_ident = ''; |
| 772 | 772 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 773 | - } |
|
| 774 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 775 | - if($recent_ident == "") |
|
| 776 | - { |
|
| 773 | + } |
|
| 774 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 775 | + if($recent_ident == "") |
|
| 776 | + { |
|
| 777 | 777 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 778 | 778 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 779 | 779 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 780 | 780 | //adds the spotter data for the archive |
| 781 | 781 | $ignoreImport = false; |
| 782 | 782 | foreach($globalAirportIgnore as $airportIgnore) { |
| 783 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 783 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 784 | 784 | $ignoreImport = true; |
| 785 | - } |
|
| 785 | + } |
|
| 786 | 786 | } |
| 787 | 787 | if (count($globalAirportAccept) > 0) { |
| 788 | - $ignoreImport = true; |
|
| 789 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 788 | + $ignoreImport = true; |
|
| 789 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 790 | 790 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 791 | - $ignoreImport = false; |
|
| 791 | + $ignoreImport = false; |
|
| 792 | + } |
|
| 792 | 793 | } |
| 793 | - } |
|
| 794 | 794 | } |
| 795 | 795 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 796 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 796 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 797 | 797 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
| 798 | - $ignoreImport = true; |
|
| 798 | + $ignoreImport = true; |
|
| 799 | + } |
|
| 799 | 800 | } |
| 800 | - } |
|
| 801 | 801 | } |
| 802 | 802 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 803 | - $ignoreImport = true; |
|
| 804 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 803 | + $ignoreImport = true; |
|
| 804 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 805 | 805 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
| 806 | - $ignoreImport = false; |
|
| 806 | + $ignoreImport = false; |
|
| 807 | + } |
|
| 807 | 808 | } |
| 808 | - } |
|
| 809 | 809 | } |
| 810 | 810 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 811 | - $ignoreImport = true; |
|
| 812 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 811 | + $ignoreImport = true; |
|
| 812 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 813 | 813 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 814 | - $ignoreImport = false; |
|
| 814 | + $ignoreImport = false; |
|
| 815 | + } |
|
| 815 | 816 | } |
| 816 | - } |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | if (!$ignoreImport) { |
| 820 | - $highlight = ''; |
|
| 821 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 822 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 823 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 825 | - $timeelapsed = microtime(true); |
|
| 826 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 820 | + $highlight = ''; |
|
| 821 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 822 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 823 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 824 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 825 | + $timeelapsed = microtime(true); |
|
| 826 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 827 | 827 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 828 | - $Spotter = new Spotter($this->db); |
|
| 829 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 830 | - $Spotter->db = null; |
|
| 831 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 828 | + $Spotter = new Spotter($this->db); |
|
| 829 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 830 | + $Spotter->db = null; |
|
| 831 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 832 | 832 | } |
| 833 | - } |
|
| 834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 835 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 833 | + } |
|
| 834 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 835 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 836 | 836 | |
| 837 | - // Add source stat in DB |
|
| 838 | - $Stats = new Stats($this->db); |
|
| 839 | - if (!empty($this->stats)) { |
|
| 837 | + // Add source stat in DB |
|
| 838 | + $Stats = new Stats($this->db); |
|
| 839 | + if (!empty($this->stats)) { |
|
| 840 | 840 | if ($globalDebug) echo 'Add source stats : '; |
| 841 | - foreach($this->stats as $date => $data) { |
|
| 842 | - foreach($data as $source => $sourced) { |
|
| 843 | - //print_r($sourced); |
|
| 844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 846 | - if (isset($sourced['msg'])) { |
|
| 847 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 848 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 849 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 850 | - unset($this->stats[$date][$source]['msg']); |
|
| 851 | - } |
|
| 852 | - } |
|
| 853 | - } |
|
| 854 | - if ($date != date('Y-m-d')) { |
|
| 855 | - unset($this->stats[$date]); |
|
| 856 | - } |
|
| 857 | - } |
|
| 858 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 841 | + foreach($this->stats as $date => $data) { |
|
| 842 | + foreach($data as $source => $sourced) { |
|
| 843 | + //print_r($sourced); |
|
| 844 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 845 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 846 | + if (isset($sourced['msg'])) { |
|
| 847 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 848 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 849 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 850 | + unset($this->stats[$date][$source]['msg']); |
|
| 851 | + } |
|
| 852 | + } |
|
| 853 | + } |
|
| 854 | + if ($date != date('Y-m-d')) { |
|
| 855 | + unset($this->stats[$date]); |
|
| 856 | + } |
|
| 857 | + } |
|
| 858 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 859 | 859 | |
| 860 | - } |
|
| 861 | - $Stats->db = null; |
|
| 862 | - } |
|
| 863 | - $this->del(); |
|
| 860 | + } |
|
| 861 | + $Stats->db = null; |
|
| 862 | + } |
|
| 863 | + $this->del(); |
|
| 864 | 864 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 865 | 865 | //$ignoreImport = false; |
| 866 | 866 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -878,41 +878,41 @@ discard block |
||
| 878 | 878 | */ |
| 879 | 879 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 880 | 880 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 881 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 882 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 883 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 881 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 882 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 883 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 884 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 885 | - $SpotterLive = new SpotterLive($this->db); |
|
| 886 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 887 | - $SpotterLive->db=null; |
|
| 885 | + $SpotterLive = new SpotterLive($this->db); |
|
| 886 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 887 | + $SpotterLive->db=null; |
|
| 888 | 888 | } |
| 889 | - } |
|
| 890 | - if ($globalDebug) echo " Done\n"; |
|
| 891 | - $this->last_delete = time(); |
|
| 889 | + } |
|
| 890 | + if ($globalDebug) echo " Done\n"; |
|
| 891 | + $this->last_delete = time(); |
|
| 892 | 892 | } |
| 893 | - } else { |
|
| 893 | + } else { |
|
| 894 | 894 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
| 895 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 896 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 895 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 896 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 897 | 897 | } |
| 898 | 898 | if (isset($globalDaemon) && !$globalDaemon) { |
| 899 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 899 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
| 900 | 900 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 901 | - $Spotter = new Spotter($this->db); |
|
| 902 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 903 | - $Spotter->db = null; |
|
| 901 | + $Spotter = new Spotter($this->db); |
|
| 902 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 903 | + $Spotter->db = null; |
|
| 904 | + } |
|
| 904 | 905 | } |
| 905 | - } |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | - } |
|
| 908 | + } |
|
| 909 | 909 | } |
| 910 | - } |
|
| 911 | - //adds the spotter LIVE data |
|
| 912 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 913 | - //echo "\nAdd in Live !! \n"; |
|
| 914 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 915 | - if ($globalDebug) { |
|
| 910 | + } |
|
| 911 | + //adds the spotter LIVE data |
|
| 912 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 913 | + //echo "\nAdd in Live !! \n"; |
|
| 914 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 915 | + if ($globalDebug) { |
|
| 916 | 916 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 917 | 917 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
| 918 | 918 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -920,60 +920,60 @@ discard block |
||
| 920 | 920 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
| 921 | 921 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
| 922 | 922 | } |
| 923 | - } |
|
| 924 | - $ignoreImport = false; |
|
| 925 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 926 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 923 | + } |
|
| 924 | + $ignoreImport = false; |
|
| 925 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 926 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 927 | 927 | |
| 928 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 929 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 930 | - $ignoreImport = true; |
|
| 928 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 929 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 930 | + $ignoreImport = true; |
|
| 931 | + } |
|
| 931 | 932 | } |
| 932 | - } |
|
| 933 | - if (count($globalAirportAccept) > 0) { |
|
| 934 | - $ignoreImport = true; |
|
| 935 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 936 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 933 | + if (count($globalAirportAccept) > 0) { |
|
| 934 | + $ignoreImport = true; |
|
| 935 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 936 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 937 | 937 | $ignoreImport = false; |
| 938 | - } |
|
| 938 | + } |
|
| 939 | 939 | } |
| 940 | - } |
|
| 941 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 940 | + } |
|
| 941 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 942 | 942 | foreach($globalAirlineIgnore as $airlineIgnore) { |
| 943 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 943 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 944 | 944 | $ignoreImport = true; |
| 945 | - } |
|
| 945 | + } |
|
| 946 | 946 | } |
| 947 | - } |
|
| 948 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 947 | + } |
|
| 948 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 949 | 949 | $ignoreImport = true; |
| 950 | 950 | foreach($globalAirlineAccept as $airlineAccept) { |
| 951 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 951 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 952 | 952 | $ignoreImport = false; |
| 953 | - } |
|
| 953 | + } |
|
| 954 | + } |
|
| 954 | 955 | } |
| 955 | - } |
|
| 956 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 956 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 957 | 957 | $ignoreImport = true; |
| 958 | 958 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 959 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 960 | - $ignoreImport = false; |
|
| 961 | - } |
|
| 959 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 960 | + $ignoreImport = false; |
|
| 961 | + } |
|
| 962 | + } |
|
| 962 | 963 | } |
| 963 | - } |
|
| 964 | 964 | |
| 965 | - if (!$ignoreImport) { |
|
| 965 | + if (!$ignoreImport) { |
|
| 966 | 966 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 967 | 967 | if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 968 | 968 | $timeelapsed = microtime(true); |
| 969 | 969 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 970 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 970 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 971 | 971 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 972 | 972 | $SpotterLive = new SpotterLive($this->db); |
| 973 | 973 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 974 | 974 | $SpotterLive->db = null; |
| 975 | 975 | if ($globalDebug) echo $result."\n"; |
| 976 | - } |
|
| 976 | + } |
|
| 977 | 977 | } |
| 978 | 978 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 979 | 979 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | //if ($line['format_source'] != 'aprs') { |
| 986 | 986 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
| 987 | 987 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 988 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 988 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
| 989 | 989 | $source = $this->all_flights[$id]['source_name']; |
| 990 | 990 | if ($source == '') $source = $this->all_flights[$id]['format_source']; |
| 991 | 991 | if (!isset($this->source_location[$source])) { |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | if ($stats_heading == 16) $stats_heading = 0; |
| 1012 | 1012 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1013 | 1013 | for ($i=0;$i<=15;$i++) { |
| 1014 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 1014 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 1017 | 1017 | } else { |
@@ -1024,17 +1024,17 @@ discard block |
||
| 1024 | 1024 | //var_dump($this->stats); |
| 1025 | 1025 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 1026 | 1026 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1027 | - end($this->stats[$current_date][$source]['hist']); |
|
| 1028 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 1027 | + end($this->stats[$current_date][$source]['hist']); |
|
| 1028 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 1029 | 1029 | } else $mini = 0; |
| 1030 | 1030 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 1031 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 1031 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 1034 | 1034 | } else { |
| 1035 | 1035 | $this->stats[$current_date][$source]['hist'][$distance] += 1; |
| 1036 | 1036 | } |
| 1037 | - } |
|
| 1037 | + } |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | $this->all_flights[$id]['lastupdate'] = time(); |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | //$this->del(); |
| 1045 | 1045 | |
| 1046 | 1046 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 1047 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 1047 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 1048 | 1048 | if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
| 1049 | 1049 | $SpotterLive = new SpotterLive($this->db); |
| 1050 | 1050 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
@@ -1052,19 +1052,19 @@ discard block |
||
| 1052 | 1052 | //SpotterLive->deleteLiveSpotterData(); |
| 1053 | 1053 | if ($globalDebug) echo " Done\n"; |
| 1054 | 1054 | $this->last_delete_hourly = time(); |
| 1055 | - } else { |
|
| 1055 | + } else { |
|
| 1056 | 1056 | $this->del(); |
| 1057 | 1057 | $this->last_delete_hourly = time(); |
| 1058 | - } |
|
| 1058 | + } |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - } |
|
| 1062 | - //$ignoreImport = false; |
|
| 1061 | + } |
|
| 1062 | + //$ignoreImport = false; |
|
| 1063 | 1063 | } |
| 1064 | 1064 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 1065 | 1065 | if ($send) return $this->all_flights[$id]; |
| 1066 | - } |
|
| 1066 | + } |
|
| 1067 | + } |
|
| 1067 | 1068 | } |
| 1068 | - } |
|
| 1069 | 1069 | } |
| 1070 | 1070 | ?> |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $currentdate = date('Y-m-d'); |
| 35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 36 | 36 | if (!empty($sourcestat)) { |
| 37 | - foreach($sourcestat as $srcst) { |
|
| 37 | + foreach ($sourcestat as $srcst) { |
|
| 38 | 38 | $type = $srcst['stats_type']; |
| 39 | 39 | if ($type == 'polar' || $type == 'hist') { |
| 40 | 40 | $source = $srcst['source_name']; |
| 41 | 41 | $data = $srcst['source_data']; |
| 42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | - } catch(Exception $e) { |
|
| 54 | + } catch (Exception $e) { |
|
| 55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
| 56 | 56 | $GeoidClass = FALSE; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function get_Schedule($id,$ident) { |
|
| 61 | + public function get_Schedule($id, $ident) { |
|
| 62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 63 | 63 | // Get schedule here, so it's done only one time |
| 64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
| 86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 88 | 88 | // Should also check if route schedule = route from DB |
| 89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
| 90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
| 108 | 108 | } |
| 109 | 109 | } else $scheduleexist = true; |
| 110 | 110 | } else $scheduleexist = true; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ($scheduleexist) { |
| 113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 114 | 114 | $sch = $Schedule->getSchedule($operator); |
| 115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 116 | 116 | } |
| 117 | 117 | $Spotter->db = null; |
| 118 | 118 | $Schedule->db = null; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 140 | 140 | $Spotter = new Spotter($this->db); |
| 141 | 141 | $real_arrival = $this->arrival($key); |
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $airport_time = ''; |
| 154 | 154 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
| 155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 157 | 157 | if (isset($closestAirports[0])) { |
| 158 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 159 | 159 | $airport_icao = $closestAirports[0]['icao']; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
| 172 | 172 | $airport_icao = $closestAirports[0]['icao']; |
| 173 | 173 | $airport_time = $this->all_flights[$key]['datetime']; |
| 174 | 174 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } else { |
| 182 | 182 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 183 | 183 | } |
| 184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 184 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 193 | 193 | foreach ($this->all_flights as $key => $flight) { |
| 194 | 194 | if (isset($flight['lastupdate'])) { |
| 195 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
| 195 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
| 196 | 196 | $this->delKey($key); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $real_arrival = $this->arrival($key); |
| 209 | 209 | $Spotter = new Spotter($this->db); |
| 210 | 210 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 211 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 211 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 212 | 212 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $send = false; |
| 242 | 242 | |
| 243 | 243 | // SBS format is CSV format |
| 244 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 244 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 245 | 245 | //print_r($line); |
| 246 | 246 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
| 247 | 247 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
@@ -277,25 +277,25 @@ discard block |
||
| 277 | 277 | if (!isset($this->all_flights[$id])) { |
| 278 | 278 | if ($globalDebug) echo 'New flight...'."\n"; |
| 279 | 279 | $this->all_flights[$id] = array(); |
| 280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
| 282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 283 | 283 | if (!isset($line['id'])) { |
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 285 | 285 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 287 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 288 | 288 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 290 | 290 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 291 | 291 | } |
| 292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | //print_r($this->all_flights); |
| 297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
| 299 | 299 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | 301 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -304,20 +304,20 @@ discard block |
||
| 304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 305 | 305 | $Spotter = new Spotter($this->db); |
| 306 | 306 | if (isset($this->all_flights[$id]['source_type'])) { |
| 307 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
| 307 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
| 308 | 308 | } else { |
| 309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | 310 | } |
| 311 | 311 | $Spotter->db = null; |
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 317 | 317 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
| 318 | 318 | } |
| 319 | 319 | if (isset($line['id']) && !isset($line['hex'])) { |
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
| 321 | 321 | } |
| 322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 323 | 323 | $icao = $line['aircraft_icao']; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
| 327 | 327 | $Spotter->db = null; |
| 328 | 328 | } |
| 329 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
| 329 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
| 330 | 330 | } |
| 331 | 331 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
| 332 | 332 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | $Spotter = new Spotter($this->db); |
| 335 | 335 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 336 | 336 | $Spotter->db = null; |
| 337 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 337 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -342,15 +342,15 @@ discard block |
||
| 342 | 342 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
| 343 | 343 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 344 | 344 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 345 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 345 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 346 | 346 | } |
| 347 | 347 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 348 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 348 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 349 | 349 | } |
| 350 | 350 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 351 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 351 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 352 | 352 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 353 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 353 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 354 | 354 | } else { |
| 355 | 355 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 356 | 356 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -361,31 +361,31 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | return ''; |
| 363 | 363 | } |
| 364 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 364 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 365 | 365 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
| 366 | 366 | return ''; |
| 367 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 367 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 368 | 368 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
| 369 | 369 | return ''; |
| 370 | 370 | } elseif (!isset($line['datetime'])) { |
| 371 | 371 | date_default_timezone_set('UTC'); |
| 372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 373 | 373 | } else { |
| 374 | 374 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 375 | 375 | return ''; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
| 379 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 379 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 380 | 380 | } |
| 381 | 381 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 382 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 382 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 383 | 383 | } |
| 384 | 384 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 385 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 385 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
| 386 | 386 | } |
| 387 | 387 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 388 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 388 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -393,13 +393,13 @@ discard block |
||
| 393 | 393 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 394 | 394 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 395 | 395 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 396 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 397 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 398 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 399 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 400 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 396 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 397 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 398 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 399 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 400 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 401 | 401 | } else { |
| 402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 403 | 403 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 404 | 404 | $timeelapsed = microtime(true); |
| 405 | 405 | $Spotter = new Spotter($this->db); |
@@ -409,13 +409,13 @@ discard block |
||
| 409 | 409 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 410 | 410 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 411 | 411 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 412 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 412 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 413 | 413 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 414 | 414 | $Spotter->db = null; |
| 415 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 415 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 418 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 419 | 419 | |
| 420 | 420 | /* |
| 421 | 421 | if (!isset($line['id'])) { |
@@ -425,25 +425,25 @@ discard block |
||
| 425 | 425 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 426 | 426 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 427 | 427 | */ |
| 428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 428 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 429 | 429 | |
| 430 | 430 | //$putinarchive = true; |
| 431 | 431 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 432 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 432 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 433 | 433 | } |
| 434 | 434 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 435 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 435 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 436 | 436 | } |
| 437 | 437 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 438 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 438 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 439 | 439 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 440 | 440 | $timeelapsed = microtime(true); |
| 441 | 441 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 442 | 442 | $Spotter = new Spotter($this->db); |
| 443 | 443 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 444 | 444 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 445 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 447 | 447 | } |
| 448 | 448 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 449 | 449 | $timeelapsed = microtime(true); |
@@ -457,35 +457,35 @@ discard block |
||
| 457 | 457 | $Translation->db = null; |
| 458 | 458 | } |
| 459 | 459 | $Spotter->db = null; |
| 460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 460 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 461 | 461 | } |
| 462 | 462 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 463 | 463 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 464 | 464 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 465 | 465 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 466 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 466 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | if (!isset($globalFork)) $globalFork = TRUE; |
| 470 | 470 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 471 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 471 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
| 477 | 477 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 479 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 479 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 480 | 480 | //$dataFound = true; |
| 481 | 481 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 482 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 482 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 483 | 483 | if ($distance > 1000 && $distance < 10000) { |
| 484 | 484 | // use datetime |
| 485 | 485 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 486 | 486 | $speed = $speed*3.6; |
| 487 | 487 | if ($speed < 1000) { |
| 488 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 488 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 489 | 489 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 490 | 490 | } else { |
| 491 | 491 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -500,9 +500,9 @@ discard block |
||
| 500 | 500 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
| 501 | 501 | return false; |
| 502 | 502 | } |
| 503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 503 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 504 | 504 | else unset($timediff); |
| 505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 505 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
| 506 | 506 | else unset($timediff_archive); |
| 507 | 507 | if ($this->tmd > 5 |
| 508 | 508 | || (isset($line['format_source']) |
@@ -527,14 +527,14 @@ discard block |
||
| 527 | 527 | || ($timediff > 30 |
| 528 | 528 | && isset($this->all_flights[$id]['latitude']) |
| 529 | 529 | && isset($this->all_flights[$id]['longitude']) |
| 530 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
| 530 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
| 531 | 531 | ) |
| 532 | 532 | ) { |
| 533 | 533 | |
| 534 | 534 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
| 535 | 535 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
| 536 | 536 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
| 537 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 537 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 538 | 538 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 539 | 539 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 540 | 540 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -544,11 +544,11 @@ discard block |
||
| 544 | 544 | $timeelapsed = microtime(true); |
| 545 | 545 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 546 | 546 | $Spotter = new Spotter($this->db); |
| 547 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 547 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 548 | 548 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 549 | 549 | else $this->all_flights[$id]['over_country'] = ''; |
| 550 | 550 | $Spotter->db = null; |
| 551 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 551 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 552 | 552 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -574,13 +574,13 @@ discard block |
||
| 574 | 574 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 575 | 575 | } |
| 576 | 576 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
| 577 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
| 577 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
| 578 | 578 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 579 | 579 | $dataFound = true; |
| 580 | 580 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 581 | 581 | } |
| 582 | 582 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 583 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 583 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 584 | 584 | /* |
| 585 | 585 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 586 | 586 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -602,13 +602,13 @@ discard block |
||
| 602 | 602 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 603 | 603 | } |
| 604 | 604 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
| 605 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
| 605 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
| 606 | 606 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 607 | 607 | $dataFound = true; |
| 608 | 608 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 609 | 609 | } |
| 610 | 610 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 611 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 611 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 612 | 612 | /* |
| 613 | 613 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 614 | 614 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -626,46 +626,46 @@ discard block |
||
| 626 | 626 | } else if ($globalDebug && $timediff > 30) { |
| 627 | 627 | $this->tmd = $this->tmd + 1; |
| 628 | 628 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 629 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 630 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 629 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 630 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 631 | 631 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 635 | 635 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 637 | 637 | } |
| 638 | 638 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 639 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 639 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 640 | 640 | //$dataFound = true; |
| 641 | 641 | } |
| 642 | 642 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 644 | 644 | } |
| 645 | 645 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 647 | 647 | } |
| 648 | 648 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 649 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 649 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 650 | 650 | //$dataFound = true; |
| 651 | 651 | } |
| 652 | 652 | if (isset($line['ground']) && $line['ground'] != '') { |
| 653 | 653 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 654 | 654 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 655 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 656 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 657 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 659 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 655 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 656 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 657 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 658 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 659 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 660 | 660 | } |
| 661 | 661 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 662 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 662 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 663 | 663 | //$dataFound = true; |
| 664 | 664 | } |
| 665 | 665 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 666 | 666 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 667 | 667 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
| 668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 669 | 669 | $highlight = ''; |
| 670 | 670 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 671 | 671 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -674,66 +674,66 @@ discard block |
||
| 674 | 674 | $timeelapsed = microtime(true); |
| 675 | 675 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 676 | 676 | $Spotter = new Spotter($this->db); |
| 677 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 677 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 678 | 678 | $Spotter->db = null; |
| 679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 679 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 680 | 680 | } |
| 681 | 681 | //$putinarchive = true; |
| 682 | 682 | //$highlight = ''; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 685 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 686 | 686 | //$dataFound = true; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 690 | 690 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
| 691 | 691 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
| 692 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
| 692 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
| 693 | 693 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
| 694 | 694 | $line['altitude'] = $line['altitude'] - $geoid; |
| 695 | 695 | } |
| 696 | 696 | } |
| 697 | 697 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 698 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 699 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 700 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 698 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 699 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 700 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 701 | 701 | //$dataFound = true; |
| 702 | 702 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 703 | 703 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 704 | 704 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 705 | 705 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 706 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 707 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 708 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 709 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 710 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 706 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 707 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 708 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 709 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 710 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 713 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 717 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 717 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | if (isset($line['heading']) && $line['heading'] != '') { |
| 721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 723 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 721 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 723 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 724 | 724 | //$dataFound = true; |
| 725 | 725 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 726 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 727 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 726 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 727 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 728 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 729 | 729 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
| 730 | 730 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 731 | 731 | // If not enough messages and ACARS set heading to 0 |
| 732 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 732 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 733 | 733 | } |
| 734 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 735 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 736 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 734 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 735 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 736 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 737 | 737 | |
| 738 | 738 | // print_r($this->all_flights[$id]); |
| 739 | 739 | //gets the callsign from the last hour |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 745 | 745 | $this->all_flights[$id]['lastupdate'] = time(); |
| 746 | 746 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
| 747 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 747 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 748 | 748 | //print_r($this->all_flights); |
| 749 | 749 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 750 | 750 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -755,61 +755,61 @@ discard block |
||
| 755 | 755 | $SpotterLive = new SpotterLive($this->db); |
| 756 | 756 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 757 | 757 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 758 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 759 | 759 | } elseif (isset($line['id'])) { |
| 760 | 760 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 761 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 762 | 762 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 763 | 763 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 764 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 764 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 765 | 765 | } else $recent_ident = ''; |
| 766 | - $SpotterLive->db=null; |
|
| 766 | + $SpotterLive->db = null; |
|
| 767 | 767 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 768 | 768 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 769 | 769 | } else $recent_ident = ''; |
| 770 | 770 | } else { |
| 771 | 771 | $recent_ident = ''; |
| 772 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 772 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 773 | 773 | } |
| 774 | 774 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 775 | - if($recent_ident == "") |
|
| 775 | + if ($recent_ident == "") |
|
| 776 | 776 | { |
| 777 | 777 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 778 | 778 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 779 | 779 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 780 | 780 | //adds the spotter data for the archive |
| 781 | 781 | $ignoreImport = false; |
| 782 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 782 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 783 | 783 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 784 | 784 | $ignoreImport = true; |
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | 787 | if (count($globalAirportAccept) > 0) { |
| 788 | 788 | $ignoreImport = true; |
| 789 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 789 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 790 | 790 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 791 | 791 | $ignoreImport = false; |
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 796 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 797 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 796 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 797 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 798 | 798 | $ignoreImport = true; |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 803 | 803 | $ignoreImport = true; |
| 804 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 805 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 804 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 805 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 806 | 806 | $ignoreImport = false; |
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 811 | 811 | $ignoreImport = true; |
| 812 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 812 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 813 | 813 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 814 | 814 | $ignoreImport = false; |
| 815 | 815 | } |
@@ -821,32 +821,32 @@ discard block |
||
| 821 | 821 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 822 | 822 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 823 | 823 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 824 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 825 | 825 | $timeelapsed = microtime(true); |
| 826 | 826 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 827 | 827 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 828 | 828 | $Spotter = new Spotter($this->db); |
| 829 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 829 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
| 830 | 830 | $Spotter->db = null; |
| 831 | 831 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 834 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 835 | 835 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 836 | 836 | |
| 837 | 837 | // Add source stat in DB |
| 838 | 838 | $Stats = new Stats($this->db); |
| 839 | 839 | if (!empty($this->stats)) { |
| 840 | 840 | if ($globalDebug) echo 'Add source stats : '; |
| 841 | - foreach($this->stats as $date => $data) { |
|
| 842 | - foreach($data as $source => $sourced) { |
|
| 841 | + foreach ($this->stats as $date => $data) { |
|
| 842 | + foreach ($data as $source => $sourced) { |
|
| 843 | 843 | //print_r($sourced); |
| 844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 844 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 845 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 846 | 846 | if (isset($sourced['msg'])) { |
| 847 | 847 | if (time() - $sourced['msg']['date'] > 10) { |
| 848 | 848 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 849 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 849 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 850 | 850 | unset($this->stats[$date][$source]['msg']); |
| 851 | 851 | } |
| 852 | 852 | } |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 885 | 885 | $SpotterLive = new SpotterLive($this->db); |
| 886 | 886 | $SpotterLive->deleteLiveSpotterData(); |
| 887 | - $SpotterLive->db=null; |
|
| 887 | + $SpotterLive->db = null; |
|
| 888 | 888 | } |
| 889 | 889 | } |
| 890 | 890 | if ($globalDebug) echo " Done\n"; |
| 891 | 891 | $this->last_delete = time(); |
| 892 | 892 | } |
| 893 | 893 | } else { |
| 894 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 894 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 895 | 895 | $this->all_flights[$id]['id'] = $recent_ident; |
| 896 | 896 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 897 | 897 | } |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 900 | 900 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 901 | 901 | $Spotter = new Spotter($this->db); |
| 902 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 902 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
| 903 | 903 | $Spotter->db = null; |
| 904 | 904 | } |
| 905 | 905 | } |
@@ -925,37 +925,37 @@ discard block |
||
| 925 | 925 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 926 | 926 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 927 | 927 | |
| 928 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 928 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 929 | 929 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 930 | 930 | $ignoreImport = true; |
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | 933 | if (count($globalAirportAccept) > 0) { |
| 934 | 934 | $ignoreImport = true; |
| 935 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 935 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 936 | 936 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 937 | 937 | $ignoreImport = false; |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | } |
| 941 | 941 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 942 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 943 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 942 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 943 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 944 | 944 | $ignoreImport = true; |
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | 948 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 949 | 949 | $ignoreImport = true; |
| 950 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 951 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 950 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 951 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 952 | 952 | $ignoreImport = false; |
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 957 | 957 | $ignoreImport = true; |
| 958 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 958 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 959 | 959 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 960 | 960 | $ignoreImport = false; |
| 961 | 961 | } |
@@ -963,23 +963,23 @@ discard block |
||
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | if (!$ignoreImport) { |
| 966 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 967 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 966 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 967 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 968 | 968 | $timeelapsed = microtime(true); |
| 969 | 969 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 970 | 970 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 971 | 971 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 972 | 972 | $SpotterLive = new SpotterLive($this->db); |
| 973 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 973 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 974 | 974 | $SpotterLive->db = null; |
| 975 | 975 | if ($globalDebug) echo $result."\n"; |
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 979 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 979 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 980 | 980 | } |
| 981 | 981 | $this->all_flights[$id]['putinarchive'] = false; |
| 982 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 982 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 983 | 983 | |
| 984 | 984 | // Put statistics in $this->stats variable |
| 985 | 985 | //if ($line['format_source'] != 'aprs') { |
@@ -998,19 +998,19 @@ discard block |
||
| 998 | 998 | $latitude = $globalCenterLatitude; |
| 999 | 999 | $longitude = $globalCenterLongitude; |
| 1000 | 1000 | } |
| 1001 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 1001 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 1002 | 1002 | } else { |
| 1003 | 1003 | $latitude = $this->source_location[$source]['latitude']; |
| 1004 | 1004 | $longitude = $this->source_location[$source]['longitude']; |
| 1005 | 1005 | } |
| 1006 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1006 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1007 | 1007 | //$stats_heading = $stats_heading%22.5; |
| 1008 | 1008 | $stats_heading = round($stats_heading/22.5); |
| 1009 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1009 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1010 | 1010 | $current_date = date('Y-m-d'); |
| 1011 | 1011 | if ($stats_heading == 16) $stats_heading = 0; |
| 1012 | 1012 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1013 | - for ($i=0;$i<=15;$i++) { |
|
| 1013 | + for ($i = 0; $i <= 15; $i++) { |
|
| 1014 | 1014 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 1015 | 1015 | } |
| 1016 | 1016 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1025,9 +1025,9 @@ discard block |
||
| 1025 | 1025 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 1026 | 1026 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1027 | 1027 | end($this->stats[$current_date][$source]['hist']); |
| 1028 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 1028 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 1029 | 1029 | } else $mini = 0; |
| 1030 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 1030 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 1031 | 1031 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1032 | 1032 | } |
| 1033 | 1033 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1041 | 1041 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 1042 | 1042 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1043 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1043 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 1044 | 1044 | //$this->del(); |
| 1045 | 1045 | |
| 1046 | 1046 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -52,7 +52,9 @@ discard block |
||
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | 54 | } catch(Exception $e) { |
| 55 | - if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 55 | + if ($globalDebug) { |
|
| 56 | + echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 57 | + } |
|
| 56 | 58 | $GeoidClass = FALSE; |
| 57 | 59 | } |
| 58 | 60 | } |
@@ -71,7 +73,9 @@ discard block |
||
| 71 | 73 | $dbc = $this->db; |
| 72 | 74 | $this->all_flights[$id]['schedule_check'] = true; |
| 73 | 75 | if ($globalSchedulesFetch) { |
| 74 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 76 | + if ($globalDebug) { |
|
| 77 | + echo 'Getting schedule info...'."\n"; |
|
| 78 | + } |
|
| 75 | 79 | $Spotter = new Spotter($dbc); |
| 76 | 80 | $Schedule = new Schedule($dbc); |
| 77 | 81 | $Translation = new Translation($dbc); |
@@ -82,7 +86,9 @@ discard block |
||
| 82 | 86 | if ($Schedule->checkSchedule($operator) == 0) { |
| 83 | 87 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 88 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 89 | + if ($globalDebug) { |
|
| 90 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 91 | + } |
|
| 86 | 92 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 87 | 93 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 88 | 94 | // Should also check if route schedule = route from DB |
@@ -91,7 +97,9 @@ discard block |
||
| 91 | 97 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 92 | 98 | if (trim($airport_icao) != '') { |
| 93 | 99 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 94 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 100 | + if ($globalDebug) { |
|
| 101 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 102 | + } |
|
| 95 | 103 | } |
| 96 | 104 | } |
| 97 | 105 | } |
@@ -100,17 +108,25 @@ discard block |
||
| 100 | 108 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 101 | 109 | if (trim($airport_icao) != '') { |
| 102 | 110 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 103 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 111 | + if ($globalDebug) { |
|
| 112 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 113 | + } |
|
| 104 | 114 | } |
| 105 | 115 | } |
| 106 | 116 | } |
| 107 | 117 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
| 108 | 118 | } |
| 109 | - } else $scheduleexist = true; |
|
| 110 | - } else $scheduleexist = true; |
|
| 119 | + } else { |
|
| 120 | + $scheduleexist = true; |
|
| 121 | + } |
|
| 122 | + } else { |
|
| 123 | + $scheduleexist = true; |
|
| 124 | + } |
|
| 111 | 125 | // close connection, at least one way will work ? |
| 112 | 126 | if ($scheduleexist) { |
| 113 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 127 | + if ($globalDebug) { |
|
| 128 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 129 | + } |
|
| 114 | 130 | $sch = $Schedule->getSchedule($operator); |
| 115 | 131 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 116 | 132 | } |
@@ -132,14 +148,18 @@ discard block |
||
| 132 | 148 | |
| 133 | 149 | public function checkAll() { |
| 134 | 150 | global $globalDebug, $globalNoImport; |
| 135 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 151 | + if ($globalDebug) { |
|
| 152 | + echo "Update last seen flights data...\n"; |
|
| 153 | + } |
|
| 136 | 154 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 137 | 155 | foreach ($this->all_flights as $key => $flight) { |
| 138 | 156 | if (isset($this->all_flights[$key]['id'])) { |
| 139 | 157 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 140 | 158 | $Spotter = new Spotter($this->db); |
| 141 | 159 | $real_arrival = $this->arrival($key); |
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 160 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) { |
|
| 161 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 162 | + } |
|
| 143 | 163 | } |
| 144 | 164 | } |
| 145 | 165 | } |
@@ -147,24 +167,32 @@ discard block |
||
| 147 | 167 | |
| 148 | 168 | public function arrival($key) { |
| 149 | 169 | global $globalClosestMinDist, $globalDebug; |
| 150 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 170 | + if ($globalDebug) { |
|
| 171 | + echo 'Update arrival...'."\n"; |
|
| 172 | + } |
|
| 151 | 173 | $Spotter = new Spotter($this->db); |
| 152 | 174 | $airport_icao = ''; |
| 153 | 175 | $airport_time = ''; |
| 154 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 176 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 177 | + $globalClosestMinDist = 50; |
|
| 178 | + } |
|
| 155 | 179 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | 180 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 157 | 181 | if (isset($closestAirports[0])) { |
| 158 | 182 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 159 | 183 | $airport_icao = $closestAirports[0]['icao']; |
| 160 | 184 | $airport_time = $this->all_flights[$key]['datetime']; |
| 161 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 185 | + if ($globalDebug) { |
|
| 186 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 187 | + } |
|
| 162 | 188 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 163 | 189 | foreach ($closestAirports as $airport) { |
| 164 | 190 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 165 | 191 | $airport_icao = $airport['icao']; |
| 166 | 192 | $airport_time = $this->all_flights[$key]['datetime']; |
| 167 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 193 | + if ($globalDebug) { |
|
| 194 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 195 | + } |
|
| 168 | 196 | break; |
| 169 | 197 | } |
| 170 | 198 | } |
@@ -172,14 +200,20 @@ discard block |
||
| 172 | 200 | $airport_icao = $closestAirports[0]['icao']; |
| 173 | 201 | $airport_time = $this->all_flights[$key]['datetime']; |
| 174 | 202 | } else { |
| 175 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 203 | + if ($globalDebug) { |
|
| 204 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 205 | + } |
|
| 176 | 206 | } |
| 177 | 207 | } else { |
| 178 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 208 | + if ($globalDebug) { |
|
| 209 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 210 | + } |
|
| 179 | 211 | } |
| 180 | 212 | |
| 181 | 213 | } else { |
| 182 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 216 | + } |
|
| 183 | 217 | } |
| 184 | 218 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 185 | 219 | } |
@@ -189,7 +223,9 @@ discard block |
||
| 189 | 223 | public function del() { |
| 190 | 224 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 191 | 225 | // Delete old infos |
| 192 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 226 | + if ($globalDebug) { |
|
| 227 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 228 | + } |
|
| 193 | 229 | foreach ($this->all_flights as $key => $flight) { |
| 194 | 230 | if (isset($flight['lastupdate'])) { |
| 195 | 231 | if ($flight['lastupdate'] < (time()-1800)) { |
@@ -203,13 +239,17 @@ discard block |
||
| 203 | 239 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 204 | 240 | // Delete old infos |
| 205 | 241 | if (isset($this->all_flights[$key]['id'])) { |
| 206 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 244 | + } |
|
| 207 | 245 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 208 | 246 | $real_arrival = $this->arrival($key); |
| 209 | 247 | $Spotter = new Spotter($this->db); |
| 210 | 248 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 211 | 249 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 212 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 250 | + if ($globalDebug && $result != 'success') { |
|
| 251 | + echo '!!! ERROR : '.$result."\n"; |
|
| 252 | + } |
|
| 213 | 253 | } |
| 214 | 254 | } |
| 215 | 255 | } |
@@ -219,9 +259,13 @@ discard block |
||
| 219 | 259 | public function add($line) { |
| 220 | 260 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive; |
| 221 | 261 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 222 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
|
| 223 | - if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000; |
|
| 224 | -/* |
|
| 262 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 263 | + $globalCoordMinChange = '0.01'; |
|
| 264 | + } |
|
| 265 | + if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') { |
|
| 266 | + $globalAircraftMaxUpdate = 3000; |
|
| 267 | + } |
|
| 268 | + /* |
|
| 225 | 269 | $Spotter = new Spotter(); |
| 226 | 270 | $dbc = $Spotter->db; |
| 227 | 271 | $SpotterLive = new SpotterLive($dbc); |
@@ -243,19 +287,28 @@ discard block |
||
| 243 | 287 | // SBS format is CSV format |
| 244 | 288 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
| 245 | 289 | //print_r($line); |
| 246 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 290 | + if (isset($line['hex'])) { |
|
| 291 | + $line['hex'] = strtoupper($line['hex']); |
|
| 292 | + } |
|
| 247 | 293 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
| 248 | 294 | |
| 249 | 295 | // Increment message number |
| 250 | 296 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
| 251 | 297 | $current_date = date('Y-m-d'); |
| 252 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 253 | - else $source = ''; |
|
| 254 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 298 | + if (isset($line['source_name'])) { |
|
| 299 | + $source = $line['source_name']; |
|
| 300 | + } else { |
|
| 301 | + $source = ''; |
|
| 302 | + } |
|
| 303 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 304 | + $source = $line['format_source']; |
|
| 305 | + } |
|
| 255 | 306 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 256 | 307 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 257 | 308 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 258 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 309 | + } else { |
|
| 310 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 311 | + } |
|
| 259 | 312 | } |
| 260 | 313 | |
| 261 | 314 | /* |
@@ -271,23 +324,38 @@ discard block |
||
| 271 | 324 | //$this->db = $dbc; |
| 272 | 325 | |
| 273 | 326 | //$hex = trim($line['hex']); |
| 274 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 275 | - else $id = trim($line['id']); |
|
| 327 | + if (!isset($line['id'])) { |
|
| 328 | + $id = trim($line['hex']); |
|
| 329 | + } else { |
|
| 330 | + $id = trim($line['id']); |
|
| 331 | + } |
|
| 276 | 332 | |
| 277 | 333 | if (!isset($this->all_flights[$id])) { |
| 278 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
| 334 | + if ($globalDebug) { |
|
| 335 | + echo 'New flight...'."\n"; |
|
| 336 | + } |
|
| 279 | 337 | $this->all_flights[$id] = array(); |
| 280 | 338 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 281 | 339 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 340 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
| 341 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 342 | + } |
|
| 283 | 343 | if (!isset($line['id'])) { |
| 284 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 285 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 344 | + if (!isset($globalDaemon)) { |
|
| 345 | + $globalDaemon = TRUE; |
|
| 346 | + } |
|
| 347 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 286 | 348 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 349 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 350 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 351 | + } |
|
| 288 | 352 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 290 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 353 | + } else { |
|
| 354 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 355 | + } |
|
| 356 | + if ($globalAllFlights !== FALSE) { |
|
| 357 | + $dataFound = true; |
|
| 358 | + } |
|
| 291 | 359 | } |
| 292 | 360 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | 361 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -309,12 +377,20 @@ discard block |
||
| 309 | 377 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | 378 | } |
| 311 | 379 | $Spotter->db = null; |
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 380 | + if ($globalDebugTimeElapsed) { |
|
| 381 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 382 | + } |
|
| 383 | + if ($aircraft_icao != '') { |
|
| 384 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 385 | + } |
|
| 314 | 386 | } |
| 315 | 387 | } |
| 316 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 317 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 388 | + if ($globalAllFlights !== FALSE) { |
|
| 389 | + $dataFound = true; |
|
| 390 | + } |
|
| 391 | + if ($globalDebug) { |
|
| 392 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 393 | + } |
|
| 318 | 394 | } |
| 319 | 395 | if (isset($line['id']) && !isset($line['hex'])) { |
| 320 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
@@ -323,7 +399,9 @@ discard block |
||
| 323 | 399 | $icao = $line['aircraft_icao']; |
| 324 | 400 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 325 | 401 | $Spotter = new Spotter($this->db); |
| 326 | - if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 402 | + if (isset($Spotter->aircraft_correct_icaotype[$icao])) { |
|
| 403 | + $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 404 | + } |
|
| 327 | 405 | $Spotter->db = null; |
| 328 | 406 | } |
| 329 | 407 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
@@ -334,15 +412,24 @@ discard block |
||
| 334 | 412 | $Spotter = new Spotter($this->db); |
| 335 | 413 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 336 | 414 | $Spotter->db = null; |
| 337 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 415 | + if ($aircraft_icao != '') { |
|
| 416 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 417 | + } |
|
| 338 | 418 | } |
| 339 | 419 | } |
| 340 | 420 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
| 341 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 342 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 343 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 344 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 345 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 421 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 422 | + $aircraft_icao = 'GLID'; |
|
| 423 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 424 | + $aircraft_icao = 'UHEL'; |
|
| 425 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 426 | + $aircraft_icao = 'TOWPLANE'; |
|
| 427 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 428 | + $aircraft_icao = 'POWAIRC'; |
|
| 429 | + } |
|
| 430 | + if (isset($aircraft_icao)) { |
|
| 431 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 432 | + } |
|
| 346 | 433 | } |
| 347 | 434 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 348 | 435 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -352,8 +439,11 @@ discard block |
||
| 352 | 439 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 353 | 440 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 354 | 441 | } else { |
| 355 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 356 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 442 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 443 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 444 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 445 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 446 | + } |
|
| 357 | 447 | /* |
| 358 | 448 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 359 | 449 | print_r($this->all_flights[$id]); |
@@ -362,16 +452,22 @@ discard block |
||
| 362 | 452 | return ''; |
| 363 | 453 | } |
| 364 | 454 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 365 | - if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 455 | + if ($globalDebug) { |
|
| 456 | + echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 457 | + } |
|
| 366 | 458 | return ''; |
| 367 | 459 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
| 368 | - if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 460 | + if ($globalDebug) { |
|
| 461 | + echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 462 | + } |
|
| 369 | 463 | return ''; |
| 370 | 464 | } elseif (!isset($line['datetime'])) { |
| 371 | 465 | date_default_timezone_set('UTC'); |
| 372 | 466 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 373 | 467 | } else { |
| 374 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 468 | + if ($globalDebug) { |
|
| 469 | + echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 470 | + } |
|
| 375 | 471 | return ''; |
| 376 | 472 | } |
| 377 | 473 | |
@@ -392,30 +488,48 @@ discard block |
||
| 392 | 488 | |
| 393 | 489 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 394 | 490 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 395 | - if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 491 | + if ($globalDebug) { |
|
| 492 | + echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 493 | + } |
|
| 396 | 494 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 397 | 495 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 398 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 399 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 400 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 496 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 497 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 498 | + } elseif (isset($line['id'])) { |
|
| 499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 500 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 501 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 502 | + } |
|
| 401 | 503 | } else { |
| 402 | 504 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
| 403 | 505 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 404 | 506 | $timeelapsed = microtime(true); |
| 405 | 507 | $Spotter = new Spotter($this->db); |
| 406 | 508 | $fromsource = NULL; |
| 407 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 408 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 409 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 410 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 411 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 509 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 510 | + $fromsource = $globalAirlinesSource; |
|
| 511 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 512 | + $fromsource = 'vatsim'; |
|
| 513 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 514 | + $fromsource = 'ivao'; |
|
| 515 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 516 | + $fromsource = 'vatsim'; |
|
| 517 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 518 | + $fromsource = 'ivao'; |
|
| 519 | + } |
|
| 412 | 520 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
| 413 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 521 | + if ($globalDebug && $result != 'success') { |
|
| 522 | + echo '!!! ERROR : '.$result."\n"; |
|
| 523 | + } |
|
| 414 | 524 | $Spotter->db = null; |
| 415 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 525 | + if ($globalDebugTimeElapsed) { |
|
| 526 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 527 | + } |
|
| 416 | 528 | } |
| 417 | 529 | } |
| 418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 530 | + } else { |
|
| 531 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 532 | + } |
|
| 419 | 533 | |
| 420 | 534 | /* |
| 421 | 535 | if (!isset($line['id'])) { |
@@ -425,7 +539,9 @@ discard block |
||
| 425 | 539 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 426 | 540 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 427 | 541 | */ |
| 428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 542 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 543 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 544 | + } |
|
| 429 | 545 | |
| 430 | 546 | //$putinarchive = true; |
| 431 | 547 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -443,7 +559,9 @@ discard block |
||
| 443 | 559 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 444 | 560 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 445 | 561 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 562 | + if ($globalDebugTimeElapsed) { |
|
| 563 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 564 | + } |
|
| 447 | 565 | } |
| 448 | 566 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 449 | 567 | $timeelapsed = microtime(true); |
@@ -457,7 +575,9 @@ discard block |
||
| 457 | 575 | $Translation->db = null; |
| 458 | 576 | } |
| 459 | 577 | $Spotter->db = null; |
| 460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 578 | + if ($globalDebugTimeElapsed) { |
|
| 579 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 580 | + } |
|
| 461 | 581 | } |
| 462 | 582 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 463 | 583 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -466,9 +586,13 @@ discard block |
||
| 466 | 586 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
| 467 | 587 | } |
| 468 | 588 | } |
| 469 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 589 | + if (!isset($globalFork)) { |
|
| 590 | + $globalFork = TRUE; |
|
| 591 | + } |
|
| 470 | 592 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 471 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 593 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 594 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 595 | + } |
|
| 472 | 596 | } |
| 473 | 597 | } |
| 474 | 598 | } |
@@ -486,9 +610,13 @@ discard block |
||
| 486 | 610 | $speed = $speed*3.6; |
| 487 | 611 | if ($speed < 1000) { |
| 488 | 612 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 489 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 613 | + if ($globalDebug) { |
|
| 614 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 615 | + } |
|
| 490 | 616 | } else { |
| 491 | - if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 617 | + if ($globalDebug) { |
|
| 618 | + echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 619 | + } |
|
| 492 | 620 | } |
| 493 | 621 | } |
| 494 | 622 | } |
@@ -497,13 +625,21 @@ discard block |
||
| 497 | 625 | |
| 498 | 626 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 499 | 627 | if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
| 500 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 628 | + if ($globalDebug) { |
|
| 629 | + echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 630 | + } |
|
| 501 | 631 | return false; |
| 502 | 632 | } |
| 503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 504 | - else unset($timediff); |
|
| 505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 506 | - else unset($timediff_archive); |
|
| 633 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 634 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 635 | + } else { |
|
| 636 | + unset($timediff); |
|
| 637 | + } |
|
| 638 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) { |
|
| 639 | + $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 640 | + } else { |
|
| 641 | + unset($timediff_archive); |
|
| 642 | + } |
|
| 507 | 643 | if ($this->tmd > 5 |
| 508 | 644 | || (isset($line['format_source']) |
| 509 | 645 | && $line['format_source'] == 'airwhere' |
@@ -540,16 +676,25 @@ discard block |
||
| 540 | 676 | $this->all_flights[$id]['putinarchive'] = true; |
| 541 | 677 | $this->tmd = 0; |
| 542 | 678 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 543 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 679 | + if ($globalDebug) { |
|
| 680 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 681 | + } |
|
| 544 | 682 | $timeelapsed = microtime(true); |
| 545 | 683 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 546 | 684 | $Spotter = new Spotter($this->db); |
| 547 | 685 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 548 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 549 | - else $this->all_flights[$id]['over_country'] = ''; |
|
| 686 | + if (!empty($all_country)) { |
|
| 687 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 688 | + } else { |
|
| 689 | + $this->all_flights[$id]['over_country'] = ''; |
|
| 690 | + } |
|
| 550 | 691 | $Spotter->db = null; |
| 551 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 552 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 692 | + if ($globalDebugTimeElapsed) { |
|
| 693 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 694 | + } |
|
| 695 | + if ($globalDebug) { |
|
| 696 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 697 | + } |
|
| 553 | 698 | } |
| 554 | 699 | } |
| 555 | 700 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
@@ -595,7 +740,9 @@ discard block |
||
| 595 | 740 | */ |
| 596 | 741 | } |
| 597 | 742 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 598 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 743 | + if ($line['longitude'] > 180) { |
|
| 744 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 745 | + } |
|
| 599 | 746 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 600 | 747 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
| 601 | 748 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -632,7 +779,9 @@ discard block |
||
| 632 | 779 | } |
| 633 | 780 | } |
| 634 | 781 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 635 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 782 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 783 | + $dataFound = true; |
|
| 784 | + } |
|
| 636 | 785 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 637 | 786 | } |
| 638 | 787 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -654,35 +803,53 @@ discard block |
||
| 654 | 803 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 655 | 804 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 656 | 805 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 657 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 659 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 806 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 807 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 808 | + } elseif (isset($line['id'])) { |
|
| 809 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 810 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 811 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 812 | + } |
|
| 813 | + } |
|
| 814 | + if ($line['ground'] != 1) { |
|
| 815 | + $line['ground'] = 0; |
|
| 660 | 816 | } |
| 661 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 662 | 817 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 663 | 818 | //$dataFound = true; |
| 664 | 819 | } |
| 665 | 820 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 666 | 821 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 667 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 822 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
| 823 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 824 | + } |
|
| 668 | 825 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 669 | 826 | $highlight = ''; |
| 670 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 671 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 672 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 827 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 828 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 829 | + } |
|
| 830 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 831 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 832 | + } |
|
| 833 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 834 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 835 | + } |
|
| 673 | 836 | if ($highlight != '') { |
| 674 | 837 | $timeelapsed = microtime(true); |
| 675 | 838 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 676 | 839 | $Spotter = new Spotter($this->db); |
| 677 | 840 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 678 | 841 | $Spotter->db = null; |
| 679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 842 | + if ($globalDebugTimeElapsed) { |
|
| 843 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 844 | + } |
|
| 680 | 845 | } |
| 681 | 846 | //$putinarchive = true; |
| 682 | 847 | //$highlight = ''; |
| 683 | 848 | } |
| 684 | 849 | |
| 685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 850 | + } else { |
|
| 851 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 852 | + } |
|
| 686 | 853 | //$dataFound = true; |
| 687 | 854 | } |
| 688 | 855 | |
@@ -695,19 +862,27 @@ discard block |
||
| 695 | 862 | } |
| 696 | 863 | } |
| 697 | 864 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 698 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 865 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
| 866 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 867 | + } |
|
| 699 | 868 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 700 | 869 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 701 | 870 | //$dataFound = true; |
| 702 | 871 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 703 | 872 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 704 | 873 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 705 | - if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
|
| 874 | + if ($globalDebug) { |
|
| 875 | + echo '--- Reset because of altitude'."\n"; |
|
| 876 | + } |
|
| 706 | 877 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 707 | 878 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 708 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 709 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 710 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 879 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 880 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 881 | + } elseif (isset($line['id'])) { |
|
| 882 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 883 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 884 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 885 | + } |
|
| 711 | 886 | } |
| 712 | 887 | } |
| 713 | 888 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
@@ -718,22 +893,32 @@ discard block |
||
| 718 | 893 | } |
| 719 | 894 | |
| 720 | 895 | if (isset($line['heading']) && $line['heading'] != '') { |
| 721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 896 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
| 897 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 898 | + } |
|
| 722 | 899 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 723 | 900 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 724 | 901 | //$dataFound = true; |
| 725 | 902 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 726 | 903 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 727 | 904 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
| 728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 729 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 905 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
| 906 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 907 | + } |
|
| 908 | + if ($globalDebug) { |
|
| 909 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 910 | + } |
|
| 730 | 911 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 731 | 912 | // If not enough messages and ACARS set heading to 0 |
| 732 | 913 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 733 | 914 | } |
| 734 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 735 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 736 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 915 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 916 | + $dataFound = false; |
|
| 917 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 918 | + $dataFound = false; |
|
| 919 | + } elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) { |
|
| 920 | + $dataFound = false; |
|
| 921 | + } |
|
| 737 | 922 | |
| 738 | 923 | // print_r($this->all_flights[$id]); |
| 739 | 924 | //gets the callsign from the last hour |
@@ -750,23 +935,38 @@ discard block |
||
| 750 | 935 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 751 | 936 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 752 | 937 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 753 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 938 | + if ($globalDebug) { |
|
| 939 | + echo "Check if aircraft is already in DB..."; |
|
| 940 | + } |
|
| 754 | 941 | $timeelapsed = microtime(true); |
| 755 | 942 | $SpotterLive = new SpotterLive($this->db); |
| 756 | 943 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 757 | 944 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 945 | + if ($globalDebugTimeElapsed) { |
|
| 946 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 947 | + } |
|
| 759 | 948 | } elseif (isset($line['id'])) { |
| 760 | 949 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 950 | + if ($globalDebugTimeElapsed) { |
|
| 951 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 952 | + } |
|
| 762 | 953 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 763 | 954 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 764 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 765 | - } else $recent_ident = ''; |
|
| 955 | + if ($globalDebugTimeElapsed) { |
|
| 956 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 957 | + } |
|
| 958 | + } else { |
|
| 959 | + $recent_ident = ''; |
|
| 960 | + } |
|
| 766 | 961 | $SpotterLive->db=null; |
| 767 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 768 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 769 | - } else $recent_ident = ''; |
|
| 962 | + if ($globalDebug && $recent_ident == '') { |
|
| 963 | + echo " Not in DB.\n"; |
|
| 964 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 965 | + echo " Already in DB.\n"; |
|
| 966 | + } |
|
| 967 | + } else { |
|
| 968 | + $recent_ident = ''; |
|
| 969 | + } |
|
| 770 | 970 | } else { |
| 771 | 971 | $recent_ident = ''; |
| 772 | 972 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -774,7 +974,9 @@ discard block |
||
| 774 | 974 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 775 | 975 | if($recent_ident == "") |
| 776 | 976 | { |
| 777 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 977 | + if ($globalDebug) { |
|
| 978 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 979 | + } |
|
| 778 | 980 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 779 | 981 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 780 | 982 | //adds the spotter data for the archive |
@@ -818,31 +1020,49 @@ discard block |
||
| 818 | 1020 | |
| 819 | 1021 | if (!$ignoreImport) { |
| 820 | 1022 | $highlight = ''; |
| 821 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 822 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 823 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1023 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 1024 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 1025 | + } |
|
| 1026 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 1027 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 1028 | + } |
|
| 1029 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 1030 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 1031 | + } |
|
| 1032 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1033 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1034 | + } |
|
| 825 | 1035 | $timeelapsed = microtime(true); |
| 826 | 1036 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 827 | 1037 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 828 | 1038 | $Spotter = new Spotter($this->db); |
| 829 | 1039 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
| 830 | 1040 | $Spotter->db = null; |
| 831 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 1041 | + if ($globalDebug && isset($result)) { |
|
| 1042 | + echo $result."\n"; |
|
| 1043 | + } |
|
| 832 | 1044 | } |
| 833 | 1045 | } |
| 834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1046 | + if ($globalDebugTimeElapsed) { |
|
| 1047 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1048 | + } |
|
| 835 | 1049 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 836 | 1050 | |
| 837 | 1051 | // Add source stat in DB |
| 838 | 1052 | $Stats = new Stats($this->db); |
| 839 | 1053 | if (!empty($this->stats)) { |
| 840 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 1054 | + if ($globalDebug) { |
|
| 1055 | + echo 'Add source stats : '; |
|
| 1056 | + } |
|
| 841 | 1057 | foreach($this->stats as $date => $data) { |
| 842 | 1058 | foreach($data as $source => $sourced) { |
| 843 | 1059 | //print_r($sourced); |
| 844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1060 | + if (isset($sourced['polar'])) { |
|
| 1061 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 1062 | + } |
|
| 1063 | + if (isset($sourced['hist'])) { |
|
| 1064 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1065 | + } |
|
| 846 | 1066 | if (isset($sourced['msg'])) { |
| 847 | 1067 | if (time() - $sourced['msg']['date'] > 10) { |
| 848 | 1068 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -855,13 +1075,17 @@ discard block |
||
| 855 | 1075 | unset($this->stats[$date]); |
| 856 | 1076 | } |
| 857 | 1077 | } |
| 858 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 1078 | + if ($globalDebug) { |
|
| 1079 | + echo 'Done'."\n"; |
|
| 1080 | + } |
|
| 859 | 1081 | |
| 860 | 1082 | } |
| 861 | 1083 | $Stats->db = null; |
| 862 | 1084 | } |
| 863 | 1085 | $this->del(); |
| 864 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 1086 | + } elseif ($globalDebug) { |
|
| 1087 | + echo 'Ignore data'."\n"; |
|
| 1088 | + } |
|
| 865 | 1089 | //$ignoreImport = false; |
| 866 | 1090 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 867 | 1091 | //print_r($this->all_flights[$id]); |
@@ -878,7 +1102,9 @@ discard block |
||
| 878 | 1102 | */ |
| 879 | 1103 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 880 | 1104 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 881 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1105 | + if ($globalDebug) { |
|
| 1106 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1107 | + } |
|
| 882 | 1108 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 883 | 1109 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 884 | 1110 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -887,7 +1113,9 @@ discard block |
||
| 887 | 1113 | $SpotterLive->db=null; |
| 888 | 1114 | } |
| 889 | 1115 | } |
| 890 | - if ($globalDebug) echo " Done\n"; |
|
| 1116 | + if ($globalDebug) { |
|
| 1117 | + echo " Done\n"; |
|
| 1118 | + } |
|
| 891 | 1119 | $this->last_delete = time(); |
| 892 | 1120 | } |
| 893 | 1121 | } else { |
@@ -914,11 +1142,17 @@ discard block |
||
| 914 | 1142 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 915 | 1143 | if ($globalDebug) { |
| 916 | 1144 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 917 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 918 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1145 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1146 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1147 | + } else { |
|
| 1148 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1149 | + } |
|
| 919 | 1150 | } else { |
| 920 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 921 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1151 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1152 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1153 | + } else { |
|
| 1154 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1155 | + } |
|
| 922 | 1156 | } |
| 923 | 1157 | } |
| 924 | 1158 | $ignoreImport = false; |
@@ -964,22 +1198,30 @@ discard block |
||
| 964 | 1198 | |
| 965 | 1199 | if (!$ignoreImport) { |
| 966 | 1200 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 967 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1201 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1202 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1203 | + } |
|
| 968 | 1204 | $timeelapsed = microtime(true); |
| 969 | 1205 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 970 | 1206 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 971 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1207 | + if ($globalDebug) { |
|
| 1208 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1209 | + } |
|
| 972 | 1210 | $SpotterLive = new SpotterLive($this->db); |
| 973 | 1211 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 974 | 1212 | $SpotterLive->db = null; |
| 975 | - if ($globalDebug) echo $result."\n"; |
|
| 1213 | + if ($globalDebug) { |
|
| 1214 | + echo $result."\n"; |
|
| 1215 | + } |
|
| 976 | 1216 | } |
| 977 | 1217 | } |
| 978 | 1218 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 979 | 1219 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 980 | 1220 | } |
| 981 | 1221 | $this->all_flights[$id]['putinarchive'] = false; |
| 982 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1222 | + if ($globalDebugTimeElapsed) { |
|
| 1223 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1224 | + } |
|
| 983 | 1225 | |
| 984 | 1226 | // Put statistics in $this->stats variable |
| 985 | 1227 | //if ($line['format_source'] != 'aprs') { |
@@ -987,7 +1229,9 @@ discard block |
||
| 987 | 1229 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 988 | 1230 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 989 | 1231 | $source = $this->all_flights[$id]['source_name']; |
| 990 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 1232 | + if ($source == '') { |
|
| 1233 | + $source = $this->all_flights[$id]['format_source']; |
|
| 1234 | + } |
|
| 991 | 1235 | if (!isset($this->source_location[$source])) { |
| 992 | 1236 | $Location = new Source($this->db); |
| 993 | 1237 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -1008,7 +1252,9 @@ discard block |
||
| 1008 | 1252 | $stats_heading = round($stats_heading/22.5); |
| 1009 | 1253 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 1010 | 1254 | $current_date = date('Y-m-d'); |
| 1011 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1255 | + if ($stats_heading == 16) { |
|
| 1256 | + $stats_heading = 0; |
|
| 1257 | + } |
|
| 1012 | 1258 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1013 | 1259 | for ($i=0;$i<=15;$i++) { |
| 1014 | 1260 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -1026,7 +1272,9 @@ discard block |
||
| 1026 | 1272 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1027 | 1273 | end($this->stats[$current_date][$source]['hist']); |
| 1028 | 1274 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 1029 | - } else $mini = 0; |
|
| 1275 | + } else { |
|
| 1276 | + $mini = 0; |
|
| 1277 | + } |
|
| 1030 | 1278 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 1031 | 1279 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1032 | 1280 | } |
@@ -1038,19 +1286,27 @@ discard block |
||
| 1038 | 1286 | } |
| 1039 | 1287 | |
| 1040 | 1288 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1041 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1289 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1290 | + $send = true; |
|
| 1291 | + } |
|
| 1042 | 1292 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1043 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1293 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1294 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1295 | + } |
|
| 1044 | 1296 | //$this->del(); |
| 1045 | 1297 | |
| 1046 | 1298 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 1047 | 1299 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 1048 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1300 | + if ($globalDebug) { |
|
| 1301 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1302 | + } |
|
| 1049 | 1303 | $SpotterLive = new SpotterLive($this->db); |
| 1050 | 1304 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 1051 | 1305 | $SpotterLive->db = null; |
| 1052 | 1306 | //SpotterLive->deleteLiveSpotterData(); |
| 1053 | - if ($globalDebug) echo " Done\n"; |
|
| 1307 | + if ($globalDebug) { |
|
| 1308 | + echo " Done\n"; |
|
| 1309 | + } |
|
| 1054 | 1310 | $this->last_delete_hourly = time(); |
| 1055 | 1311 | } else { |
| 1056 | 1312 | $this->del(); |
@@ -1062,7 +1318,9 @@ discard block |
||
| 1062 | 1318 | //$ignoreImport = false; |
| 1063 | 1319 | } |
| 1064 | 1320 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 1065 | - if ($send) return $this->all_flights[$id]; |
|
| 1321 | + if ($send) { |
|
| 1322 | + return $this->all_flights[$id]; |
|
| 1323 | + } |
|
| 1066 | 1324 | } |
| 1067 | 1325 | } |
| 1068 | 1326 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | }; |
| 344 | 344 | |
| 345 | 345 | <?php |
| 346 | - if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
| 346 | + if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
| 347 | 347 | ?> |
| 348 | 348 | function tskPopup (feature, layer) { |
| 349 | 349 | var output = ''; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | }; |
| 379 | 379 | update_tsk(); |
| 380 | 380 | <?php |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | ?> |
| 383 | 383 | map.on('moveend', function() { |
| 384 | 384 | //if (map.getZoom() > 7) { |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
| 395 | 395 | |
| 396 | 396 | <?php |
| 397 | - // Add support for custom json via $globalMapJson |
|
| 398 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 397 | + // Add support for custom json via $globalMapJson |
|
| 398 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 399 | 399 | foreach ($globalMapJson as $json) { |
| 400 | - if (isset($json['url'])) { |
|
| 400 | + if (isset($json['url'])) { |
|
| 401 | 401 | ?> |
| 402 | 402 | update_genLayer('<?php print $json['url']; ?>'); |
| 403 | 403 | <?php |
@@ -406,9 +406,9 @@ discard block |
||
| 406 | 406 | setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
| 407 | 407 | <?php |
| 408 | 408 | } |
| 409 | - } |
|
| 409 | + } |
|
| 410 | + } |
|
| 410 | 411 | } |
| 411 | - } |
|
| 412 | 412 | |
| 413 | 413 | ?> |
| 414 | 414 | //adds the bootstrap tooltip to the map icons |
@@ -13,35 +13,35 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | if (isset($_GET['3d'])) { |
| 16 | - setcookie('MapFormat','3d'); |
|
| 16 | + setcookie('MapFormat', '3d'); |
|
| 17 | 17 | } else if (isset($_GET['2d'])) { |
| 18 | - setcookie('MapFormat','2d'); |
|
| 18 | + setcookie('MapFormat', '2d'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
| 22 | - $tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
| 22 | + $tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if (isset($_POST['archive'])) { |
| 26 | - setcookie('archive','true'); |
|
| 27 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
| 28 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
| 29 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
| 26 | + setcookie('archive', 'true'); |
|
| 27 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
| 28 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
| 29 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
| 30 | 30 | } |
| 31 | 31 | if (isset($_POST['noarchive'])) { |
| 32 | - setcookie('archive','false',-1); |
|
| 33 | - setcookie('archive_begin','',-1); |
|
| 34 | - setcookie('archive_end','',-1); |
|
| 35 | - setcookie('archive_speed','',-1); |
|
| 32 | + setcookie('archive', 'false', -1); |
|
| 33 | + setcookie('archive_begin', '', -1); |
|
| 34 | + setcookie('archive_end', '', -1); |
|
| 35 | + setcookie('archive_speed', '', -1); |
|
| 36 | 36 | } |
| 37 | 37 | // When button "Remove all filters" is clicked |
| 38 | 38 | if (isset($_POST['removefilters'])) { |
| 39 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
| 40 | - return strpos($key,'filter_') === 0; |
|
| 39 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
| 40 | + return strpos($key, 'filter_') === 0; |
|
| 41 | 41 | }); |
| 42 | 42 | foreach ($allfilters as $filt) { |
| 43 | 43 | unset($_COOKIE[$filt]); |
| 44 | - setcookie($filt,null,-1); |
|
| 44 | + setcookie($filt, null, -1); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | ?> |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 247 | 247 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 248 | 248 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 249 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 249 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 250 | 250 | <?php |
| 251 | 251 | if (!isset($type) || $type == 'aircraft') { |
| 252 | 252 | ?> |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 320 | 320 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 321 | 321 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 322 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 322 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 323 | 323 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
| 324 | 324 | <?php |
| 325 | 325 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -724,8 +724,8 @@ discard block |
||
| 724 | 724 | ?> |
| 725 | 725 | <div class="search"> |
| 726 | 726 | <form action="<?php print $globalURL; ?>/search" method="get"> |
| 727 | - <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
| 728 | - <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 727 | + <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
| 728 | + <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 729 | 729 | </form> |
| 730 | 730 | </div> |
| 731 | 731 | <div class="social"> |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | print '</div>'; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 746 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 747 | 747 | ?> |
| 748 | 748 | <div class="top-header clear" role="main"> |
| 749 | 749 | <?php |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | </div> |
| 757 | 757 | <?php |
| 758 | 758 | } |
| 759 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
| 759 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
| 760 | 760 | { |
| 761 | 761 | ?> |
| 762 | 762 | <div class="top-header clear" role="main"> |
@@ -769,15 +769,15 @@ discard block |
||
| 769 | 769 | var zoom = 13; |
| 770 | 770 | //create the map |
| 771 | 771 | <?php |
| 772 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 772 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 773 | 773 | ?> |
| 774 | 774 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 775 | 775 | <?php |
| 776 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 776 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
| 777 | 777 | ?> |
| 778 | 778 | map = L.map('map', { zoomControl:true }); |
| 779 | 779 | <?php |
| 780 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 780 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 781 | 781 | ?> |
| 782 | 782 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 783 | 783 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 786 | 786 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 787 | 787 | <?php |
| 788 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
| 788 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
| 789 | 789 | ?> |
| 790 | 790 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 791 | 791 | <?php |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
| 23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
| 24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
| 25 | -$title="Install"; |
|
| 25 | +$title = "Install"; |
|
| 26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
| 27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | if (!extension_loaded('curl')) { |
| 96 | 96 | $error[] = "Curl is not loaded."; |
| 97 | 97 | } |
| 98 | - if(function_exists('apache_get_modules') ){ |
|
| 99 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
| 98 | + if (function_exists('apache_get_modules')) { |
|
| 99 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
| 100 | 100 | $error[] = "mod_rewrite is not available."; |
| 101 | 101 | } |
| 102 | 102 | /* |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
| 113 | 113 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
| 114 | 114 | if (function_exists('get_headers')) { |
| 115 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
| 116 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
| 115 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
| 116 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
| 117 | 117 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -484,13 +484,13 @@ discard block |
||
| 484 | 484 | ?> |
| 485 | 485 | <tr> |
| 486 | 486 | <?php |
| 487 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 487 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
| 488 | 488 | ?> |
| 489 | 489 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 490 | 490 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
| 491 | 491 | <?php |
| 492 | 492 | } else { |
| 493 | - $hostport = explode(':',$source['host']); |
|
| 493 | + $hostport = explode(':', $source['host']); |
|
| 494 | 494 | if (isset($hostport[1])) { |
| 495 | 495 | $host = $hostport[0]; |
| 496 | 496 | $port = $hostport[1]; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | <select name="timezones[]" id="timezones"> |
| 539 | 539 | <?php |
| 540 | 540 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 541 | - foreach($timezonelist as $timezones){ |
|
| 541 | + foreach ($timezonelist as $timezones) { |
|
| 542 | 542 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
| 543 | 543 | print '<option selected>'.$timezones.'</option>'; |
| 544 | 544 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | <select name="timezones[]" id="timezones"> |
| 592 | 592 | <?php |
| 593 | 593 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 594 | - foreach($timezonelist as $timezones){ |
|
| 594 | + foreach ($timezonelist as $timezones) { |
|
| 595 | 595 | if ($timezones == 'UTC') { |
| 596 | 596 | print '<option selected>'.$timezones.'</option>'; |
| 597 | 597 | } else print '<option>'.$timezones.'</option>'; |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | <br /> |
| 1001 | 1001 | <p> |
| 1002 | 1002 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1003 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1003 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
| 1004 | 1004 | </p> |
| 1005 | 1005 | <br /> |
| 1006 | 1006 | <p> |
@@ -1062,14 +1062,14 @@ discard block |
||
| 1062 | 1062 | $error = ''; |
| 1063 | 1063 | |
| 1064 | 1064 | if (isset($_POST['dbtype'])) { |
| 1065 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
| 1066 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
| 1067 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
| 1068 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
| 1069 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
| 1070 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
| 1071 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
| 1072 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
| 1065 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
| 1066 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
| 1067 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
| 1068 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
| 1069 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
| 1070 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
| 1071 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
| 1072 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
| 1073 | 1073 | |
| 1074 | 1074 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
| 1075 | 1075 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1089,49 +1089,49 @@ discard block |
||
| 1089 | 1089 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
| 1090 | 1090 | */ |
| 1091 | 1091 | |
| 1092 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
| 1092 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
| 1093 | 1093 | |
| 1094 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
| 1095 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
| 1096 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
| 1097 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
| 1098 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
| 1094 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
| 1095 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
| 1096 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
| 1097 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
| 1098 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
| 1099 | 1099 | |
| 1100 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
| 1101 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
| 1102 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
| 1103 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
| 1104 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
| 1105 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
| 1106 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
| 1107 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
| 1108 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
| 1109 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 1100 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
| 1101 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
| 1102 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
| 1103 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
| 1104 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
| 1105 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
| 1106 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
| 1107 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
| 1108 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
| 1109 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 1110 | 1110 | |
| 1111 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
| 1112 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
| 1113 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
| 1114 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
| 1115 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1116 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
| 1111 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
| 1112 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
| 1113 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
| 1114 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
| 1115 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1116 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
| 1117 | 1117 | |
| 1118 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
| 1119 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
| 1118 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
| 1119 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
| 1120 | 1120 | |
| 1121 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
| 1122 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
| 1123 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
| 1121 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
| 1122 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
| 1123 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
| 1124 | 1124 | |
| 1125 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
| 1125 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
| 1126 | 1126 | if ($acars == 'acars') { |
| 1127 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
| 1127 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
| 1128 | 1128 | } else { |
| 1129 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
| 1129 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
| 1133 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
| 1134 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 1132 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
| 1133 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
| 1134 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 1135 | 1135 | |
| 1136 | 1136 | $source_name = $_POST['source_name']; |
| 1137 | 1137 | $source_latitude = $_POST['source_latitude']; |
@@ -1145,8 +1145,8 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | $sources = array(); |
| 1147 | 1147 | foreach ($source_name as $keys => $name) { |
| 1148 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1149 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1148 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
| 1149 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 1152 | 1152 | |
@@ -1155,16 +1155,16 @@ discard block |
||
| 1155 | 1155 | $newstype = $_POST['newstype']; |
| 1156 | 1156 | |
| 1157 | 1157 | $newsfeeds = array(); |
| 1158 | - foreach($newsurl as $newskey => $url) { |
|
| 1158 | + foreach ($newsurl as $newskey => $url) { |
|
| 1159 | 1159 | if ($url != '') { |
| 1160 | 1160 | $type = $newstype[$newskey]; |
| 1161 | 1161 | $lng = $newslng[$newskey]; |
| 1162 | 1162 | if (isset($newsfeeds[$type][$lng])) { |
| 1163 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
| 1163 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
| 1164 | 1164 | } else $newsfeeds[$type][$lng] = array($url); |
| 1165 | 1165 | } |
| 1166 | 1166 | } |
| 1167 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
| 1167 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
| 1168 | 1168 | |
| 1169 | 1169 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
| 1170 | 1170 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1175,27 +1175,27 @@ discard block |
||
| 1175 | 1175 | $sbsurl = $_POST['sbsurl']; |
| 1176 | 1176 | */ |
| 1177 | 1177 | |
| 1178 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
| 1179 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
| 1180 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
| 1181 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
| 1182 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
| 1183 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
| 1184 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
| 1185 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
| 1178 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
| 1179 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
| 1180 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
| 1181 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
| 1182 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
| 1183 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
| 1184 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
| 1185 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
| 1186 | 1186 | |
| 1187 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
| 1188 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1189 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1190 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
| 1191 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1192 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1193 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
| 1194 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1195 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1196 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
| 1197 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1198 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1187 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
| 1188 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
| 1189 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
| 1190 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
| 1191 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
| 1192 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
| 1193 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
| 1194 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
| 1195 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
| 1196 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
| 1197 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
| 1198 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
| 1199 | 1199 | |
| 1200 | 1200 | /* |
| 1201 | 1201 | $globalSBS1Hosts = array(); |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | } |
| 1212 | 1212 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
| 1213 | 1213 | */ |
| 1214 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
| 1214 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
| 1215 | 1215 | $host = $_POST['host']; |
| 1216 | 1216 | $port = $_POST['port']; |
| 1217 | 1217 | $name = $_POST['name']; |
@@ -1228,113 +1228,113 @@ discard block |
||
| 1228 | 1228 | else $cov = 'FALSE'; |
| 1229 | 1229 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
| 1230 | 1230 | else $arch = 'FALSE'; |
| 1231 | - if (strpos($format[$key],'_callback')) { |
|
| 1232 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
| 1231 | + if (strpos($format[$key], '_callback')) { |
|
| 1232 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
| 1233 | 1233 | } elseif ($h != '' || $name[$key] != '') { |
| 1234 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
| 1234 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | if ($format[$key] == 'airwhere') $forcepilots = true; |
| 1237 | 1237 | } |
| 1238 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
| 1238 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
| 1239 | 1239 | |
| 1240 | 1240 | /* |
| 1241 | 1241 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
| 1242 | 1242 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
| 1243 | 1243 | */ |
| 1244 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
| 1245 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
| 1246 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
| 1244 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
| 1245 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
| 1246 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
| 1247 | 1247 | |
| 1248 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
| 1249 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
| 1248 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
| 1249 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
| 1250 | 1250 | |
| 1251 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
| 1252 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
| 1251 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
| 1252 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
| 1253 | 1253 | |
| 1254 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
| 1255 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
| 1254 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
| 1255 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
| 1256 | 1256 | |
| 1257 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
| 1258 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
| 1259 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
| 1260 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
| 1257 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
| 1258 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
| 1259 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
| 1260 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
| 1261 | 1261 | |
| 1262 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
| 1263 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
| 1264 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
| 1262 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
| 1263 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
| 1264 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
| 1265 | 1265 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1266 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
| 1267 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1266 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
| 1267 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
| 1268 | 1268 | |
| 1269 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1270 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
| 1271 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1272 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
| 1273 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
| 1274 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
| 1275 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
| 1276 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
| 1269 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1270 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
| 1271 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1272 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
| 1273 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
| 1274 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
| 1275 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
| 1276 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
| 1277 | 1277 | |
| 1278 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
| 1279 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
| 1278 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
| 1279 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
| 1280 | 1280 | |
| 1281 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1282 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
| 1281 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1282 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
| 1283 | 1283 | |
| 1284 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
| 1284 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
| 1285 | 1285 | if ($archiveyear == "archiveyear") { |
| 1286 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
| 1286 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
| 1287 | 1287 | } else { |
| 1288 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
| 1288 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
| 1289 | 1289 | } |
| 1290 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1291 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1292 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1293 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1290 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1291 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1292 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1293 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1294 | 1294 | |
| 1295 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
| 1296 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1297 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
| 1298 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
| 1295 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
| 1296 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1297 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
| 1298 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
| 1299 | 1299 | |
| 1300 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
| 1301 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
| 1302 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
| 1300 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
| 1301 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
| 1302 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
| 1303 | 1303 | |
| 1304 | 1304 | // Create in settings.php keys not yet configurable if not already here |
| 1305 | 1305 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1306 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1306 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
| 1307 | 1307 | |
| 1308 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
| 1308 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
| 1309 | 1309 | if ($resetyearstats == 'resetyearstats') { |
| 1310 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1310 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1311 | 1311 | } else { |
| 1312 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1312 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
| 1315 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
| 1316 | 1316 | if ($archive == 'archive') { |
| 1317 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
| 1317 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
| 1318 | 1318 | } else { |
| 1319 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
| 1319 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
| 1320 | 1320 | } |
| 1321 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
| 1321 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
| 1322 | 1322 | if ($archiveresults == 'archiveresults') { |
| 1323 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
| 1323 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
| 1324 | 1324 | } else { |
| 1325 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
| 1325 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
| 1326 | 1326 | } |
| 1327 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
| 1327 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
| 1328 | 1328 | if ($daemon == 'daemon') { |
| 1329 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
| 1329 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
| 1330 | 1330 | } else { |
| 1331 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
| 1331 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
| 1332 | 1332 | } |
| 1333 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
| 1333 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
| 1334 | 1334 | if ($schedules == 'schedules') { |
| 1335 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
| 1335 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
| 1336 | 1336 | } else { |
| 1337 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
| 1337 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | /* |
@@ -1345,252 +1345,252 @@ discard block |
||
| 1345 | 1345 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
| 1346 | 1346 | } |
| 1347 | 1347 | */ |
| 1348 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
| 1349 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1350 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1351 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1352 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1348 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
| 1349 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
| 1350 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
| 1351 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
| 1352 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
| 1353 | 1353 | $va = false; |
| 1354 | 1354 | if ($globalivao == 'ivao') { |
| 1355 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
| 1355 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
| 1356 | 1356 | $va = true; |
| 1357 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1357 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
| 1358 | 1358 | if ($globalvatsim == 'vatsim') { |
| 1359 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
| 1359 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
| 1360 | 1360 | $va = true; |
| 1361 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1361 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
| 1362 | 1362 | if ($globalphpvms == 'phpvms') { |
| 1363 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
| 1363 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
| 1364 | 1364 | $va = true; |
| 1365 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1365 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
| 1366 | 1366 | if ($globalvam == 'vam') { |
| 1367 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
| 1367 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
| 1368 | 1368 | $va = true; |
| 1369 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1369 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
| 1370 | 1370 | if ($va) { |
| 1371 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
| 1372 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1371 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
| 1372 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
| 1373 | 1373 | if ($globalva == 'va' || $va) { |
| 1374 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
| 1375 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1374 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
| 1375 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1376 | 1376 | } else { |
| 1377 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
| 1378 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1379 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1377 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
| 1378 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1379 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | 1382 | |
| 1383 | 1383 | |
| 1384 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
| 1384 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
| 1385 | 1385 | if ($notam == 'notam') { |
| 1386 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
| 1386 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
| 1387 | 1387 | } else { |
| 1388 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
| 1388 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
| 1389 | 1389 | } |
| 1390 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
| 1390 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
| 1391 | 1391 | if ($owner == 'owner') { |
| 1392 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
| 1392 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
| 1393 | 1393 | } else { |
| 1394 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
| 1394 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
| 1395 | 1395 | } |
| 1396 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
| 1396 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
| 1397 | 1397 | if ($map3d == 'map3d') { |
| 1398 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
| 1398 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
| 1399 | 1399 | } else { |
| 1400 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
| 1400 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
| 1401 | 1401 | } |
| 1402 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
| 1402 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
| 1403 | 1403 | if ($crash == 'crash') { |
| 1404 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
| 1404 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
| 1405 | 1405 | } else { |
| 1406 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
| 1406 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
| 1407 | 1407 | } |
| 1408 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
| 1408 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
| 1409 | 1409 | if ($fires == 'fires') { |
| 1410 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
| 1410 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
| 1411 | 1411 | } else { |
| 1412 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
| 1412 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
| 1413 | 1413 | } |
| 1414 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
| 1414 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
| 1415 | 1415 | if ($firessupport == 'firessupport') { |
| 1416 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
| 1416 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
| 1417 | 1417 | } else { |
| 1418 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
| 1418 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
| 1419 | 1419 | } |
| 1420 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
| 1420 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
| 1421 | 1421 | if ($mapsatellites == 'mapsatellites') { |
| 1422 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
| 1422 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
| 1423 | 1423 | } else { |
| 1424 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
| 1424 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
| 1425 | 1425 | } |
| 1426 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
| 1426 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
| 1427 | 1427 | if ($map3ddefault == 'map3ddefault') { |
| 1428 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
| 1428 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
| 1429 | 1429 | } else { |
| 1430 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
| 1430 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
| 1431 | 1431 | } |
| 1432 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
| 1432 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
| 1433 | 1433 | if ($map3dliveries == 'map3dliveries') { |
| 1434 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
| 1434 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
| 1435 | 1435 | } else { |
| 1436 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
| 1436 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
| 1437 | 1437 | } |
| 1438 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
| 1438 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
| 1439 | 1439 | if ($translate == 'translate') { |
| 1440 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
| 1440 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
| 1441 | 1441 | } else { |
| 1442 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
| 1442 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
| 1443 | 1443 | } |
| 1444 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
| 1444 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
| 1445 | 1445 | if ($realairlines == 'realairlines') { |
| 1446 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
| 1446 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
| 1447 | 1447 | } else { |
| 1448 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
| 1448 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
| 1449 | 1449 | } |
| 1450 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
| 1450 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
| 1451 | 1451 | if ($estimation == 'estimation') { |
| 1452 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
| 1452 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
| 1453 | 1453 | } else { |
| 1454 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
| 1454 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
| 1455 | 1455 | } |
| 1456 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
| 1456 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
| 1457 | 1457 | if ($metar == 'metar') { |
| 1458 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
| 1458 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
| 1459 | 1459 | } else { |
| 1460 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
| 1460 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
| 1461 | 1461 | } |
| 1462 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
| 1462 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
| 1463 | 1463 | if ($metarcycle == 'metarcycle') { |
| 1464 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
| 1464 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
| 1465 | 1465 | } else { |
| 1466 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
| 1466 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
| 1467 | 1467 | } |
| 1468 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
| 1468 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
| 1469 | 1469 | if ($fork == 'fork') { |
| 1470 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
| 1470 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
| 1471 | 1471 | } else { |
| 1472 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
| 1472 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
| 1475 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
| 1476 | 1476 | if ($colormap == 'colormap') { |
| 1477 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1477 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1478 | 1478 | } else { |
| 1479 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1479 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | if (isset($_POST['aircrafticoncolor'])) { |
| 1483 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
| 1484 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
| 1483 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
| 1484 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1488 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
| 1487 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1488 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
| 1489 | 1489 | |
| 1490 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
| 1491 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
| 1492 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
| 1493 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
| 1494 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
| 1495 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
| 1490 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
| 1491 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
| 1492 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
| 1493 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
| 1494 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
| 1495 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
| 1496 | 1496 | |
| 1497 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
| 1497 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
| 1498 | 1498 | if ($mappopup == 'mappopup') { |
| 1499 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
| 1499 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
| 1500 | 1500 | } else { |
| 1501 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
| 1501 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
| 1502 | 1502 | } |
| 1503 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
| 1503 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
| 1504 | 1504 | if ($airportpopup == 'airportpopup') { |
| 1505 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
| 1505 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
| 1506 | 1506 | } else { |
| 1507 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
| 1507 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
| 1508 | 1508 | } |
| 1509 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
| 1509 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
| 1510 | 1510 | if ($maphistory == 'maphistory') { |
| 1511 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
| 1511 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
| 1512 | 1512 | } else { |
| 1513 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
| 1513 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
| 1514 | 1514 | } |
| 1515 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
| 1515 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
| 1516 | 1516 | if ($maptooltip == 'maptooltip') { |
| 1517 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
| 1517 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
| 1518 | 1518 | } else { |
| 1519 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
| 1519 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
| 1520 | 1520 | } |
| 1521 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
| 1521 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
| 1522 | 1522 | if ($flightroute == 'flightroute') { |
| 1523 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
| 1523 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
| 1524 | 1524 | } else { |
| 1525 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
| 1525 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
| 1526 | 1526 | } |
| 1527 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
| 1527 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
| 1528 | 1528 | if ($flightremainingroute == 'flightremainingroute') { |
| 1529 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1529 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1530 | 1530 | } else { |
| 1531 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1531 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1532 | 1532 | } |
| 1533 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
| 1533 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
| 1534 | 1534 | if ($allflights == 'allflights') { |
| 1535 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
| 1535 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
| 1536 | 1536 | } else { |
| 1537 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
| 1537 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
| 1538 | 1538 | } |
| 1539 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
| 1539 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
| 1540 | 1540 | if ($bbox == 'bbox') { |
| 1541 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
| 1541 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
| 1542 | 1542 | } else { |
| 1543 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
| 1543 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
| 1544 | 1544 | } |
| 1545 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
| 1545 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
| 1546 | 1546 | if ($groundaltitude == 'groundaltitude') { |
| 1547 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
| 1547 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
| 1548 | 1548 | } else { |
| 1549 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
| 1549 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
| 1550 | 1550 | } |
| 1551 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
| 1551 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
| 1552 | 1552 | if ($waypoints == 'waypoints') { |
| 1553 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
| 1553 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
| 1554 | 1554 | } else { |
| 1555 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
| 1555 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
| 1556 | 1556 | } |
| 1557 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
| 1557 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
| 1558 | 1558 | if ($geoid == 'geoid') { |
| 1559 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
| 1559 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
| 1560 | 1560 | } else { |
| 1561 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
| 1561 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
| 1562 | 1562 | } |
| 1563 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
| 1564 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
| 1563 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
| 1564 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
| 1565 | 1565 | |
| 1566 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
| 1566 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
| 1567 | 1567 | if ($noairlines == 'noairlines') { |
| 1568 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
| 1568 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
| 1569 | 1569 | } else { |
| 1570 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
| 1570 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
| 1573 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
| 1574 | 1574 | if ($tsk == 'tsk') { |
| 1575 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
| 1575 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
| 1576 | 1576 | } else { |
| 1577 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
| 1577 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1580 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
| 1581 | 1581 | |
| 1582 | 1582 | // Set some defaults values... |
| 1583 | 1583 | if (!isset($globalAircraftImageSources)) { |
| 1584 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1585 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1584 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 1585 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1586 | 1586 | } |
| 1587 | 1587 | |
| 1588 | 1588 | if (!isset($globalSchedulesSources)) { |
| 1589 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1590 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1589 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1590 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
| 1593 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
| 1594 | 1594 | |
| 1595 | 1595 | if ($error == '') settings::modify_settings($settings); |
| 1596 | 1596 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -4,11 +4,19 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -159,45 +167,72 @@ discard block |
||
| 159 | 167 | </div> |
| 160 | 168 | <p> |
| 161 | 169 | <label for="dbhost">Database hostname</label> |
| 162 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 170 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 171 | + print $globalDBhost; |
|
| 172 | +} |
|
| 173 | +?>" /> |
|
| 163 | 174 | </p> |
| 164 | 175 | <p> |
| 165 | 176 | <label for="dbport">Database port</label> |
| 166 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 177 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 178 | + print $globalDBport; |
|
| 179 | +} |
|
| 180 | +?>" /> |
|
| 167 | 181 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 168 | 182 | </p> |
| 169 | 183 | <p> |
| 170 | 184 | <label for="dbname">Database name</label> |
| 171 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 185 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 186 | + print $globalDBname; |
|
| 187 | +} |
|
| 188 | +?>" /> |
|
| 172 | 189 | </p> |
| 173 | 190 | <p> |
| 174 | 191 | <label for="dbuser">Database user</label> |
| 175 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 192 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 193 | + print $globalDBuser; |
|
| 194 | +} |
|
| 195 | +?>" /> |
|
| 176 | 196 | </p> |
| 177 | 197 | <p> |
| 178 | 198 | <label for="dbuserpass">Database user password</label> |
| 179 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 199 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 200 | + print $globalDBpass; |
|
| 201 | +} |
|
| 202 | +?>" /> |
|
| 180 | 203 | </p> |
| 181 | 204 | </fieldset> |
| 182 | 205 | <fieldset id="site"> |
| 183 | 206 | <legend>Site configuration</legend> |
| 184 | 207 | <p> |
| 185 | 208 | <label for="sitename">Site name</label> |
| 186 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 209 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 210 | + print $globalName; |
|
| 211 | +} |
|
| 212 | +?>" /> |
|
| 187 | 213 | </p> |
| 188 | 214 | <p> |
| 189 | 215 | <label for="siteurl">Site directory</label> |
| 190 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 216 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 217 | + print $globalURL; |
|
| 218 | +} |
|
| 219 | +?>" /> |
|
| 191 | 220 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 192 | 221 | </p> |
| 193 | 222 | <p> |
| 194 | 223 | <label for="timezone">Timezone</label> |
| 195 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 224 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 225 | + print $globalTimezone; |
|
| 226 | +} |
|
| 227 | +?>" /> |
|
| 196 | 228 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 197 | 229 | </p> |
| 198 | 230 | <p> |
| 199 | 231 | <label for="language">Language</label> |
| 200 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 232 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 233 | + print $globalLanguage; |
|
| 234 | +} |
|
| 235 | +?>" /> |
|
| 201 | 236 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 202 | 237 | </p> |
| 203 | 238 | </fieldset> |
@@ -218,11 +253,17 @@ discard block |
||
| 218 | 253 | <div id="mapbox_data"> |
| 219 | 254 | <p> |
| 220 | 255 | <label for="mapboxid">Mapbox id</label> |
| 221 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 256 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 257 | + print $globalMapboxId; |
|
| 258 | +} |
|
| 259 | +?>" /> |
|
| 222 | 260 | </p> |
| 223 | 261 | <p> |
| 224 | 262 | <label for="mapboxtoken">Mapbox token</label> |
| 225 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 263 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 264 | + print $globalMapboxToken; |
|
| 265 | +} |
|
| 266 | +?>" /> |
|
| 226 | 267 | </p> |
| 227 | 268 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 228 | 269 | </div> |
@@ -230,7 +271,10 @@ discard block |
||
| 230 | 271 | <div id="google_data"> |
| 231 | 272 | <p> |
| 232 | 273 | <label for="googlekey">Google API key</label> |
| 233 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 274 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 275 | + print $globalGoogleAPIKey; |
|
| 276 | +} |
|
| 277 | +?>" /> |
|
| 234 | 278 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 235 | 279 | </p> |
| 236 | 280 | </div> |
@@ -238,7 +282,10 @@ discard block |
||
| 238 | 282 | <div id="bing_data"> |
| 239 | 283 | <p> |
| 240 | 284 | <label for="bingkey">Bing Map key</label> |
| 241 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 285 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 286 | + print $globalBingMapKey; |
|
| 287 | +} |
|
| 288 | +?>" /> |
|
| 242 | 289 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 243 | 290 | </p> |
| 244 | 291 | </div> |
@@ -246,7 +293,10 @@ discard block |
||
| 246 | 293 | <div id="mapquest_data"> |
| 247 | 294 | <p> |
| 248 | 295 | <label for="mapquestkey">MapQuest key</label> |
| 249 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 296 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 297 | + print $globalMapQuestKey; |
|
| 298 | +} |
|
| 299 | +?>" /> |
|
| 250 | 300 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 251 | 301 | </p> |
| 252 | 302 | </div> |
@@ -254,11 +304,17 @@ discard block |
||
| 254 | 304 | <div id="here_data"> |
| 255 | 305 | <p> |
| 256 | 306 | <label for="hereappid">Here App_Id</label> |
| 257 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 307 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 308 | + print $globalHereappId; |
|
| 309 | +} |
|
| 310 | +?>" /> |
|
| 258 | 311 | </p> |
| 259 | 312 | <p> |
| 260 | 313 | <label for="hereappcode">Here App_Code</label> |
| 261 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 314 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 315 | + print $globalHereappCode; |
|
| 316 | +} |
|
| 317 | +?>" /> |
|
| 262 | 318 | </p> |
| 263 | 319 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 264 | 320 | </div> |
@@ -266,7 +322,10 @@ discard block |
||
| 266 | 322 | <div id="openweathermap_data"> |
| 267 | 323 | <p> |
| 268 | 324 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 269 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 325 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 326 | + print $globalOpenWeatherMapKey; |
|
| 327 | +} |
|
| 328 | +?>" /> |
|
| 270 | 329 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 271 | 330 | </p> |
| 272 | 331 | </div> |
@@ -276,42 +335,86 @@ discard block |
||
| 276 | 335 | <legend>Coverage area</legend> |
| 277 | 336 | <p> |
| 278 | 337 | <label for="latitudemax">The maximum latitude (north)</label> |
| 279 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 338 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 339 | + print $globalLatitudeMax; |
|
| 340 | +} |
|
| 341 | +?>" /> |
|
| 280 | 342 | </p> |
| 281 | 343 | <p> |
| 282 | 344 | <label for="latitudemin">The minimum latitude (south)</label> |
| 283 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 345 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 346 | + print $globalLatitudeMin; |
|
| 347 | +} |
|
| 348 | +?>" /> |
|
| 284 | 349 | </p> |
| 285 | 350 | <p> |
| 286 | 351 | <label for="longitudemax">The maximum longitude (west)</label> |
| 287 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 352 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 353 | + print $globalLongitudeMax; |
|
| 354 | +} |
|
| 355 | +?>" /> |
|
| 288 | 356 | </p> |
| 289 | 357 | <p> |
| 290 | 358 | <label for="longitudemin">The minimum longitude (east)</label> |
| 291 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 359 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 360 | + print $globalLongitudeMin; |
|
| 361 | +} |
|
| 362 | +?>" /> |
|
| 292 | 363 | </p> |
| 293 | 364 | <p> |
| 294 | 365 | <label for="latitudecenter">The latitude center</label> |
| 295 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 366 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 367 | + print $globalCenterLatitude; |
|
| 368 | +} |
|
| 369 | +?>" /> |
|
| 296 | 370 | </p> |
| 297 | 371 | <p> |
| 298 | 372 | <label for="longitudecenter">The longitude center</label> |
| 299 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 373 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 374 | + print $globalCenterLongitude; |
|
| 375 | +} |
|
| 376 | +?>" /> |
|
| 300 | 377 | </p> |
| 301 | 378 | <p> |
| 302 | 379 | <label for="livezoom">Default Zoom on live map</label> |
| 303 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 380 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 381 | + print $globalLiveZoom; |
|
| 382 | +} else { |
|
| 383 | + print '9'; |
|
| 384 | +} |
|
| 385 | +?>" /> |
|
| 304 | 386 | </p> |
| 305 | 387 | <p> |
| 306 | 388 | <label for="squawk_country">Country for squawk usage</label> |
| 307 | 389 | <select name="squawk_country" id="squawk_country"> |
| 308 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 309 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 310 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 311 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 312 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 313 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 314 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 390 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 391 | + print ' selected '; |
|
| 392 | +} |
|
| 393 | +?>>UK</option> |
|
| 394 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 395 | + print ' selected '; |
|
| 396 | +} |
|
| 397 | +?>>NZ</option> |
|
| 398 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 399 | + print ' selected '; |
|
| 400 | +} |
|
| 401 | +?>>US</option> |
|
| 402 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 403 | + print ' selected '; |
|
| 404 | +} |
|
| 405 | +?>>AU</option> |
|
| 406 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 407 | + print ' selected '; |
|
| 408 | +} |
|
| 409 | +?>>NL</option> |
|
| 410 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 411 | + print ' selected '; |
|
| 412 | +} |
|
| 413 | +?>>FR</option> |
|
| 414 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 415 | + print ' selected '; |
|
| 416 | +} |
|
| 417 | +?>>TR</option> |
|
| 315 | 418 | </select> |
| 316 | 419 | </p> |
| 317 | 420 | </fieldset> |
@@ -320,15 +423,24 @@ discard block |
||
| 320 | 423 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 321 | 424 | <p> |
| 322 | 425 | <label for="latitude">Center latitude</label> |
| 323 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 426 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 427 | + echo $globalDistanceIgnore['latitude']; |
|
| 428 | +} |
|
| 429 | +?>" /> |
|
| 324 | 430 | </p> |
| 325 | 431 | <p> |
| 326 | 432 | <label for="longitude">Center longitude</label> |
| 327 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 433 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 434 | + echo $globalDistanceIgnore['longitude']; |
|
| 435 | +} |
|
| 436 | +?>" /> |
|
| 328 | 437 | </p> |
| 329 | 438 | <p> |
| 330 | 439 | <label for="Distance">Distance (in km)</label> |
| 331 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 440 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 441 | + echo $globalDistanceIgnore['distance']; |
|
| 442 | +} |
|
| 443 | +?>" /> |
|
| 332 | 444 | </p> |
| 333 | 445 | </fieldset> |
| 334 | 446 | <fieldset id="sourceloc"> |
@@ -441,11 +553,17 @@ discard block |
||
| 441 | 553 | <div id="flightaware_data"> |
| 442 | 554 | <p> |
| 443 | 555 | <label for="flightawareusername">FlightAware username</label> |
| 444 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 556 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 557 | + print $globalFlightAwareUsername; |
|
| 558 | +} |
|
| 559 | +?>" /> |
|
| 445 | 560 | </p> |
| 446 | 561 | <p> |
| 447 | 562 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 448 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 563 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 564 | + print $globalFlightAwarePassword; |
|
| 565 | +} |
|
| 566 | +?>" /> |
|
| 449 | 567 | </p> |
| 450 | 568 | </div> |
| 451 | 569 | --> |
@@ -487,7 +605,10 @@ discard block |
||
| 487 | 605 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 488 | 606 | ?> |
| 489 | 607 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 490 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 608 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 609 | + print $source['port']; |
|
| 610 | +} |
|
| 611 | +?>" /></td> |
|
| 491 | 612 | <?php |
| 492 | 613 | } else { |
| 493 | 614 | $hostport = explode(':',$source['host']); |
@@ -506,34 +627,106 @@ discard block |
||
| 506 | 627 | ?> |
| 507 | 628 | <td> |
| 508 | 629 | <select name="format[]" id="format"> |
| 509 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 510 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 511 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 512 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 513 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 514 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 515 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 516 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 517 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 518 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 519 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 520 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 521 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 522 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 523 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 524 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 525 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 526 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 527 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 528 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 529 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 630 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 631 | + print 'selected'; |
|
| 632 | +} |
|
| 633 | +?>>Auto</option> |
|
| 634 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 635 | + print 'selected'; |
|
| 636 | +} |
|
| 637 | +?>>SBS</option> |
|
| 638 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 639 | + print 'selected'; |
|
| 640 | +} |
|
| 641 | +?>>TSV</option> |
|
| 642 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 643 | + print 'selected'; |
|
| 644 | +} |
|
| 645 | +?>>Raw</option> |
|
| 646 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 647 | + print 'selected'; |
|
| 648 | +} |
|
| 649 | +?>>APRS</option> |
|
| 650 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 651 | + print 'selected'; |
|
| 652 | +} |
|
| 653 | +?>>Radarcape deltadb.txt</option> |
|
| 654 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 655 | + print 'selected'; |
|
| 656 | +} |
|
| 657 | +?>>Vatsim</option> |
|
| 658 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 659 | + print 'selected'; |
|
| 660 | +} |
|
| 661 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 662 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 663 | + print 'selected'; |
|
| 664 | +} |
|
| 665 | +?>>Virtual Radar Server TCP</option> |
|
| 666 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 667 | + print 'selected'; |
|
| 668 | +} |
|
| 669 | +?>>phpVMS</option> |
|
| 670 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 671 | + print 'selected'; |
|
| 672 | +} |
|
| 673 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 674 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 675 | + print 'selected'; |
|
| 676 | +} |
|
| 677 | +?>>Virtual Airlines Manager</option> |
|
| 678 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 679 | + print 'selected'; |
|
| 680 | +} |
|
| 681 | +?>>IVAO</option> |
|
| 682 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 683 | + print 'selected'; |
|
| 684 | +} |
|
| 685 | +?>>FlightGear Multiplayer</option> |
|
| 686 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 687 | + print 'selected'; |
|
| 688 | +} |
|
| 689 | +?>>FlightGear Singleplayer</option> |
|
| 690 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 691 | + print 'selected'; |
|
| 692 | +} |
|
| 693 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 694 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 695 | + print 'selected'; |
|
| 696 | +} |
|
| 697 | +?>>ACARS SBS-3 over TCP</option> |
|
| 698 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 699 | + print 'selected'; |
|
| 700 | +} |
|
| 701 | +?>>NMEA AIS over TCP</option> |
|
| 702 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 703 | + print 'selected'; |
|
| 704 | +} |
|
| 705 | +?>>AirWhere website</option> |
|
| 706 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 707 | + print 'selected'; |
|
| 708 | +} |
|
| 709 | +?>>HidnSeek Callback</option> |
|
| 710 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 711 | + print 'selected'; |
|
| 712 | +} |
|
| 713 | +?>>Blitzortung</option> |
|
| 530 | 714 | </select> |
| 531 | 715 | </td> |
| 532 | 716 | <td> |
| 533 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 717 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 718 | + print $source['name']; |
|
| 719 | +} |
|
| 720 | +?>" /> |
|
| 534 | 721 | </td> |
| 535 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 536 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 722 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 723 | + print 'checked'; |
|
| 724 | +} |
|
| 725 | +?> /></td> |
|
| 726 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 727 | + print 'checked'; |
|
| 728 | +} |
|
| 729 | +?> /></td> |
|
| 537 | 730 | <td> |
| 538 | 731 | <select name="timezones[]" id="timezones"> |
| 539 | 732 | <?php |
@@ -543,7 +736,9 @@ discard block |
||
| 543 | 736 | print '<option selected>'.$timezones.'</option>'; |
| 544 | 737 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 545 | 738 | print '<option selected>'.$timezones.'</option>'; |
| 546 | - } else print '<option>'.$timezones.'</option>'; |
|
| 739 | + } else { |
|
| 740 | + print '<option>'.$timezones.'</option>'; |
|
| 741 | + } |
|
| 547 | 742 | } |
| 548 | 743 | ?> |
| 549 | 744 | </select> |
@@ -594,7 +789,9 @@ discard block |
||
| 594 | 789 | foreach($timezonelist as $timezones){ |
| 595 | 790 | if ($timezones == 'UTC') { |
| 596 | 791 | print '<option selected>'.$timezones.'</option>'; |
| 597 | - } else print '<option>'.$timezones.'</option>'; |
|
| 792 | + } else { |
|
| 793 | + print '<option>'.$timezones.'</option>'; |
|
| 794 | + } |
|
| 598 | 795 | } |
| 599 | 796 | ?> |
| 600 | 797 | </select> |
@@ -618,11 +815,17 @@ discard block |
||
| 618 | 815 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 619 | 816 | <p> |
| 620 | 817 | <label for="acarshost">ACARS UDP host</label> |
| 621 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 818 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 819 | + print $globalACARSHost; |
|
| 820 | +} |
|
| 821 | +?>" /> |
|
| 622 | 822 | </p> |
| 623 | 823 | <p> |
| 624 | 824 | <label for="acarsport">ACARS UDP port</label> |
| 625 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 825 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 826 | + print $globalACARSPort; |
|
| 827 | +} |
|
| 828 | +?>" /> |
|
| 626 | 829 | </p> |
| 627 | 830 | </fieldset> |
| 628 | 831 | </div> |
@@ -648,17 +851,38 @@ discard block |
||
| 648 | 851 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 649 | 852 | <td> |
| 650 | 853 | <select name="newslang[]"> |
| 651 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 652 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 854 | + <option value="en"<?php if ($lng == 'en') { |
|
| 855 | + print ' selected'; |
|
| 856 | +} |
|
| 857 | +?>>English</option> |
|
| 858 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 859 | + print ' selected'; |
|
| 860 | +} |
|
| 861 | +?>>French</option> |
|
| 653 | 862 | </select> |
| 654 | 863 | </td> |
| 655 | 864 | <td> |
| 656 | 865 | <select name="newstype[]"> |
| 657 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 658 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 659 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 660 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 661 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 866 | + <option value="global"<?php if ($type == 'global') { |
|
| 867 | + print ' selected'; |
|
| 868 | +} |
|
| 869 | +?>>Global</option> |
|
| 870 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 871 | + print ' selected'; |
|
| 872 | +} |
|
| 873 | +?>>Aircraft</option> |
|
| 874 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 875 | + print ' selected'; |
|
| 876 | +} |
|
| 877 | +?>>Marine</option> |
|
| 878 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 879 | + print ' selected'; |
|
| 880 | +} |
|
| 881 | +?>>Tracker</option> |
|
| 882 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 883 | + print ' selected'; |
|
| 884 | +} |
|
| 885 | +?>>Satellite</option> |
|
| 662 | 886 | </select> |
| 663 | 887 | </td> |
| 664 | 888 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -791,13 +1015,19 @@ discard block |
||
| 791 | 1015 | <div id="schedules_options"> |
| 792 | 1016 | <p> |
| 793 | 1017 | <label for="britishairways">British Airways API Key</label> |
| 794 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1018 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 1019 | + print $globalBritishAirwaysKey; |
|
| 1020 | +} |
|
| 1021 | +?>" /> |
|
| 795 | 1022 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 796 | 1023 | </p> |
| 797 | 1024 | <!-- |
| 798 | 1025 | <p> |
| 799 | 1026 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 800 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1027 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1028 | + print $globalTransaviaKey; |
|
| 1029 | +} |
|
| 1030 | +?>" /> |
|
| 801 | 1031 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 802 | 1032 | </p> |
| 803 | 1033 | --> |
@@ -806,10 +1036,16 @@ discard block |
||
| 806 | 1036 | <b>Lufthansa API Key</b> |
| 807 | 1037 | <p> |
| 808 | 1038 | <label for="lufthansakey">Key</label> |
| 809 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1039 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1040 | + print $globalLufthansaKey['key']; |
|
| 1041 | +} |
|
| 1042 | +?>" /> |
|
| 810 | 1043 | </p><p> |
| 811 | 1044 | <label for="lufthansasecret">Secret</label> |
| 812 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1045 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1046 | + print $globalLufthansaKey['secret']; |
|
| 1047 | +} |
|
| 1048 | +?>" /> |
|
| 813 | 1049 | </p> |
| 814 | 1050 | </div> |
| 815 | 1051 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -829,7 +1065,10 @@ discard block |
||
| 829 | 1065 | </p> |
| 830 | 1066 | <p> |
| 831 | 1067 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 832 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1068 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1069 | + print $globalNOTAMSource; |
|
| 1070 | +} |
|
| 1071 | +?>" /> |
|
| 833 | 1072 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 834 | 1073 | </p> |
| 835 | 1074 | <br /> |
@@ -845,14 +1084,20 @@ discard block |
||
| 845 | 1084 | <div id="metarsrc"> |
| 846 | 1085 | <p> |
| 847 | 1086 | <label for="metarsource">URL of your METAR source</label> |
| 848 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1087 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1088 | + print $globalMETARurl; |
|
| 1089 | +} |
|
| 1090 | +?>" /> |
|
| 849 | 1091 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 850 | 1092 | </p> |
| 851 | 1093 | </div> |
| 852 | 1094 | <br /> |
| 853 | 1095 | <p> |
| 854 | 1096 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 855 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1097 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1098 | + print $globalBitlyAccessToken; |
|
| 1099 | +} |
|
| 1100 | +?>" /> |
|
| 856 | 1101 | </p> |
| 857 | 1102 | <br /> |
| 858 | 1103 | <p> |
@@ -868,11 +1113,26 @@ discard block |
||
| 868 | 1113 | <p> |
| 869 | 1114 | <label for="geoid_source">Geoid Source</label> |
| 870 | 1115 | <select name="geoid_source" id="geoid_source"> |
| 871 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 872 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 873 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 874 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 875 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1116 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1117 | + print ' selected="selected"'; |
|
| 1118 | +} |
|
| 1119 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1120 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1121 | + print ' selected="selected"'; |
|
| 1122 | +} |
|
| 1123 | +?>>EGM96 5' (19MB)</option> |
|
| 1124 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1125 | + print ' selected="selected"'; |
|
| 1126 | +} |
|
| 1127 | +?>>EGM2008 5' (19MB)</option> |
|
| 1128 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1129 | + print ' selected="selected"'; |
|
| 1130 | +} |
|
| 1131 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1132 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1133 | + print ' selected="selected"'; |
|
| 1134 | +} |
|
| 1135 | +?>>EGM2008 1' (470MB)</option> |
|
| 876 | 1136 | </select> |
| 877 | 1137 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 878 | 1138 | </p> |
@@ -894,7 +1154,12 @@ discard block |
||
| 894 | 1154 | </p> |
| 895 | 1155 | <p> |
| 896 | 1156 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 897 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1157 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1158 | + print $globalArchiveMonths; |
|
| 1159 | +} else { |
|
| 1160 | + echo '1'; |
|
| 1161 | +} |
|
| 1162 | +?>" /> |
|
| 898 | 1163 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 899 | 1164 | </p> |
| 900 | 1165 | <p> |
@@ -904,12 +1169,22 @@ discard block |
||
| 904 | 1169 | </p> |
| 905 | 1170 | <p> |
| 906 | 1171 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 907 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1172 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1173 | + print $globalArchiveKeepMonths; |
|
| 1174 | +} else { |
|
| 1175 | + echo '1'; |
|
| 1176 | +} |
|
| 1177 | +?>" /> |
|
| 908 | 1178 | <p class="help-block">0 to disable</p> |
| 909 | 1179 | </p> |
| 910 | 1180 | <p> |
| 911 | 1181 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 912 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1182 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1183 | + print $globalArchiveKeepTrackMonths; |
|
| 1184 | +} else { |
|
| 1185 | + echo '1'; |
|
| 1186 | +} |
|
| 1187 | +?>" /> |
|
| 913 | 1188 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 914 | 1189 | </p> |
| 915 | 1190 | <br /> |
@@ -919,7 +1194,12 @@ discard block |
||
| 919 | 1194 | <p class="help-block">Uncheck if the script is running as cron job</p> |
| 920 | 1195 | <div id="cronends"> |
| 921 | 1196 | <label for="cronend">Run script for xx seconds</label> |
| 922 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1197 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1198 | + print $globalCronEnd; |
|
| 1199 | +} else { |
|
| 1200 | + print '0'; |
|
| 1201 | +} |
|
| 1202 | +?>" /> |
|
| 923 | 1203 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 924 | 1204 | </div> |
| 925 | 1205 | </p> |
@@ -972,15 +1252,30 @@ discard block |
||
| 972 | 1252 | <br /> |
| 973 | 1253 | <p> |
| 974 | 1254 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 975 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1255 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1256 | + echo $globalLiveInterval; |
|
| 1257 | +} else { |
|
| 1258 | + echo '200'; |
|
| 1259 | +} |
|
| 1260 | +?>" /> |
|
| 976 | 1261 | </p> |
| 977 | 1262 | <p> |
| 978 | 1263 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 979 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1264 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1265 | + echo $globalMapRefresh; |
|
| 1266 | +} else { |
|
| 1267 | + echo '30'; |
|
| 1268 | +} |
|
| 1269 | +?>" /> |
|
| 980 | 1270 | </p> |
| 981 | 1271 | <p> |
| 982 | 1272 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 983 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1273 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1274 | + echo $globalMapIdleTimeout; |
|
| 1275 | +} else { |
|
| 1276 | + echo '30'; |
|
| 1277 | +} |
|
| 1278 | +?>" /> |
|
| 984 | 1279 | <p class="help-block">0 to disable</p> |
| 985 | 1280 | </p> |
| 986 | 1281 | <p> |
@@ -995,12 +1290,20 @@ discard block |
||
| 995 | 1290 | <br /> |
| 996 | 1291 | <p> |
| 997 | 1292 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 998 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1293 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1294 | + echo $globalClosestMinDist; |
|
| 1295 | +} else { |
|
| 1296 | + echo '50'; |
|
| 1297 | +} |
|
| 1298 | +?>" /> |
|
| 999 | 1299 | </p> |
| 1000 | 1300 | <br /> |
| 1001 | 1301 | <p> |
| 1002 | 1302 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1003 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1303 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1304 | + echo $globalAircraftSize; |
|
| 1305 | +} |
|
| 1306 | +?>" /> |
|
| 1004 | 1307 | </p> |
| 1005 | 1308 | <br /> |
| 1006 | 1309 | <p> |
@@ -1019,7 +1322,12 @@ discard block |
||
| 1019 | 1322 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 1020 | 1323 | ?> |
| 1021 | 1324 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1022 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1325 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1326 | + echo $globalAircraftIconColor; |
|
| 1327 | +} else { |
|
| 1328 | + echo '1a3151'; |
|
| 1329 | +} |
|
| 1330 | +?>" /> |
|
| 1023 | 1331 | <?php |
| 1024 | 1332 | if (!is_writable('../cache')) { |
| 1025 | 1333 | ?> |
@@ -1037,14 +1345,27 @@ discard block |
||
| 1037 | 1345 | <p> |
| 1038 | 1346 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1039 | 1347 | <div class="range"> |
| 1040 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1041 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1348 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1349 | + echo $globalAirportZoom; |
|
| 1350 | +} else { |
|
| 1351 | + echo '7'; |
|
| 1352 | +} |
|
| 1353 | +?>" /> |
|
| 1354 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1355 | + echo $globalAirportZoom; |
|
| 1356 | +} else { |
|
| 1357 | + echo '7'; |
|
| 1358 | +} |
|
| 1359 | +?></output> |
|
| 1042 | 1360 | </div> |
| 1043 | 1361 | </p> |
| 1044 | 1362 | <br /> |
| 1045 | 1363 | <p> |
| 1046 | 1364 | <label for="customcss">Custom CSS web path</label> |
| 1047 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1365 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1366 | + echo $globalCustomCSS; |
|
| 1367 | +} |
|
| 1368 | +?>" /> |
|
| 1048 | 1369 | </p> |
| 1049 | 1370 | </fieldset> |
| 1050 | 1371 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1071,8 +1392,12 @@ discard block |
||
| 1071 | 1392 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1072 | 1393 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1073 | 1394 | |
| 1074 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1075 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1395 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1396 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1397 | + } |
|
| 1398 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1399 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1400 | + } |
|
| 1076 | 1401 | |
| 1077 | 1402 | $_SESSION['database_root'] = $dbroot; |
| 1078 | 1403 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1140,15 +1465,23 @@ discard block |
||
| 1140 | 1465 | $source_city = $_POST['source_city']; |
| 1141 | 1466 | $source_country = $_POST['source_country']; |
| 1142 | 1467 | $source_ref = $_POST['source_ref']; |
| 1143 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1144 | - else $source_id = array(); |
|
| 1468 | + if (isset($source_id)) { |
|
| 1469 | + $source_id = $_POST['source_id']; |
|
| 1470 | + } else { |
|
| 1471 | + $source_id = array(); |
|
| 1472 | + } |
|
| 1145 | 1473 | |
| 1146 | 1474 | $sources = array(); |
| 1147 | 1475 | foreach ($source_name as $keys => $name) { |
| 1148 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1149 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1476 | + if (isset($source_id[$keys])) { |
|
| 1477 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1478 | + } else { |
|
| 1479 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1480 | + } |
|
| 1481 | + } |
|
| 1482 | + if (count($sources) > 0) { |
|
| 1483 | + $_SESSION['sources'] = $sources; |
|
| 1150 | 1484 | } |
| 1151 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1152 | 1485 | |
| 1153 | 1486 | $newsurl = $_POST['newsurl']; |
| 1154 | 1487 | $newslng = $_POST['newslang']; |
@@ -1161,7 +1494,9 @@ discard block |
||
| 1161 | 1494 | $lng = $newslng[$newskey]; |
| 1162 | 1495 | if (isset($newsfeeds[$type][$lng])) { |
| 1163 | 1496 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1164 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1497 | + } else { |
|
| 1498 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1499 | + } |
|
| 1165 | 1500 | } |
| 1166 | 1501 | } |
| 1167 | 1502 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1185,17 +1520,29 @@ discard block |
||
| 1185 | 1520 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1186 | 1521 | |
| 1187 | 1522 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1188 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1189 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1523 | + if ($globalaircraft == 'aircraft') { |
|
| 1524 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1525 | + } else { |
|
| 1526 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1527 | + } |
|
| 1190 | 1528 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1191 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1192 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1529 | + if ($globaltracker == 'tracker') { |
|
| 1530 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1531 | + } else { |
|
| 1532 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1533 | + } |
|
| 1193 | 1534 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1194 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1195 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1535 | + if ($globalmarine == 'marine') { |
|
| 1536 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1537 | + } else { |
|
| 1538 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1539 | + } |
|
| 1196 | 1540 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1197 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1198 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1541 | + if ($globalsatellite == 'satellite') { |
|
| 1542 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1543 | + } else { |
|
| 1544 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1545 | + } |
|
| 1199 | 1546 | |
| 1200 | 1547 | /* |
| 1201 | 1548 | $globalSBS1Hosts = array(); |
@@ -1217,23 +1564,37 @@ discard block |
||
| 1217 | 1564 | $name = $_POST['name']; |
| 1218 | 1565 | $format = $_POST['format']; |
| 1219 | 1566 | $timezones = $_POST['timezones']; |
| 1220 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1221 | - else $sourcestats = array(); |
|
| 1222 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1223 | - else $noarchive = array(); |
|
| 1567 | + if (isset($_POST['sourcestats'])) { |
|
| 1568 | + $sourcestats = $_POST['sourcestats']; |
|
| 1569 | + } else { |
|
| 1570 | + $sourcestats = array(); |
|
| 1571 | + } |
|
| 1572 | + if (isset($_POST['noarchive'])) { |
|
| 1573 | + $noarchive = $_POST['noarchive']; |
|
| 1574 | + } else { |
|
| 1575 | + $noarchive = array(); |
|
| 1576 | + } |
|
| 1224 | 1577 | $gSources = array(); |
| 1225 | 1578 | $forcepilots = false; |
| 1226 | 1579 | foreach ($host as $key => $h) { |
| 1227 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1228 | - else $cov = 'FALSE'; |
|
| 1229 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1230 | - else $arch = 'FALSE'; |
|
| 1580 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1581 | + $cov = 'TRUE'; |
|
| 1582 | + } else { |
|
| 1583 | + $cov = 'FALSE'; |
|
| 1584 | + } |
|
| 1585 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1586 | + $arch = 'TRUE'; |
|
| 1587 | + } else { |
|
| 1588 | + $arch = 'FALSE'; |
|
| 1589 | + } |
|
| 1231 | 1590 | if (strpos($format[$key],'_callback')) { |
| 1232 | 1591 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1233 | 1592 | } elseif ($h != '' || $name[$key] != '') { |
| 1234 | 1593 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1235 | 1594 | } |
| 1236 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1595 | + if ($format[$key] == 'airwhere') { |
|
| 1596 | + $forcepilots = true; |
|
| 1597 | + } |
|
| 1237 | 1598 | } |
| 1238 | 1599 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1239 | 1600 | |
@@ -1264,7 +1625,9 @@ discard block |
||
| 1264 | 1625 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1265 | 1626 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1266 | 1627 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1267 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1628 | + } else { |
|
| 1629 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1630 | + } |
|
| 1268 | 1631 | |
| 1269 | 1632 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1270 | 1633 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1303,7 +1666,9 @@ discard block |
||
| 1303 | 1666 | |
| 1304 | 1667 | // Create in settings.php keys not yet configurable if not already here |
| 1305 | 1668 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1306 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1669 | + if (!isset($globalDebug)) { |
|
| 1670 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1671 | + } |
|
| 1307 | 1672 | |
| 1308 | 1673 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1309 | 1674 | if ($resetyearstats == 'resetyearstats') { |
@@ -1346,37 +1711,56 @@ discard block |
||
| 1346 | 1711 | } |
| 1347 | 1712 | */ |
| 1348 | 1713 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1349 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1350 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1351 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1352 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1714 | + if ($globalsbs == 'sbs') { |
|
| 1715 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1716 | + } else { |
|
| 1717 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1718 | + } |
|
| 1719 | + if ($globalaprs == 'aprs') { |
|
| 1720 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1721 | + } else { |
|
| 1722 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1723 | + } |
|
| 1353 | 1724 | $va = false; |
| 1354 | 1725 | if ($globalivao == 'ivao') { |
| 1355 | 1726 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1356 | 1727 | $va = true; |
| 1357 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1728 | + } else { |
|
| 1729 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1730 | + } |
|
| 1358 | 1731 | if ($globalvatsim == 'vatsim') { |
| 1359 | 1732 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1360 | 1733 | $va = true; |
| 1361 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1734 | + } else { |
|
| 1735 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1736 | + } |
|
| 1362 | 1737 | if ($globalphpvms == 'phpvms') { |
| 1363 | 1738 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1364 | 1739 | $va = true; |
| 1365 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1740 | + } else { |
|
| 1741 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1742 | + } |
|
| 1366 | 1743 | if ($globalvam == 'vam') { |
| 1367 | 1744 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1368 | 1745 | $va = true; |
| 1369 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1746 | + } else { |
|
| 1747 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1748 | + } |
|
| 1370 | 1749 | if ($va) { |
| 1371 | 1750 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1372 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1751 | + } else { |
|
| 1752 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1753 | + } |
|
| 1373 | 1754 | if ($globalva == 'va' || $va) { |
| 1374 | 1755 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1375 | 1756 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1376 | 1757 | } else { |
| 1377 | 1758 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1378 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1379 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1759 | + if ($forcepilots) { |
|
| 1760 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1761 | + } else { |
|
| 1762 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1763 | + } |
|
| 1380 | 1764 | } |
| 1381 | 1765 | |
| 1382 | 1766 | |
@@ -1577,7 +1961,9 @@ discard block |
||
| 1577 | 1961 | $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
| 1578 | 1962 | } |
| 1579 | 1963 | |
| 1580 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1964 | + if (!isset($globalTransaction)) { |
|
| 1965 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1966 | + } |
|
| 1581 | 1967 | |
| 1582 | 1968 | // Set some defaults values... |
| 1583 | 1969 | if (!isset($globalAircraftImageSources)) { |
@@ -1592,15 +1978,23 @@ discard block |
||
| 1592 | 1978 | |
| 1593 | 1979 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1594 | 1980 | |
| 1595 | - if ($error == '') settings::modify_settings($settings); |
|
| 1596 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 1981 | + if ($error == '') { |
|
| 1982 | + settings::modify_settings($settings); |
|
| 1983 | + } |
|
| 1984 | + if ($error == '') { |
|
| 1985 | + settings::comment_settings($settings_comment); |
|
| 1986 | + } |
|
| 1597 | 1987 | if ($error != '') { |
| 1598 | 1988 | print '<div class="info column">'.$error.'</div>'; |
| 1599 | 1989 | require('../footer.php'); |
| 1600 | 1990 | exit; |
| 1601 | 1991 | } else { |
| 1602 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1603 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 1992 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 1993 | + $_SESSION['waypoints'] = 1; |
|
| 1994 | + } |
|
| 1995 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 1996 | + $_SESSION['owner'] = 1; |
|
| 1997 | + } |
|
| 1604 | 1998 | if (isset($_POST['createdb'])) { |
| 1605 | 1999 | $_SESSION['install'] = 'database_create'; |
| 1606 | 2000 | } else { |
@@ -1637,10 +2031,18 @@ discard block |
||
| 1637 | 2031 | $popw = false; |
| 1638 | 2032 | foreach ($_SESSION['done'] as $done) { |
| 1639 | 2033 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1640 | - if ($done == 'Create database') $pop = true; |
|
| 1641 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1642 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1643 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2034 | + if ($done == 'Create database') { |
|
| 2035 | + $pop = true; |
|
| 2036 | + } |
|
| 2037 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2038 | + $pop = true; |
|
| 2039 | + } |
|
| 2040 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2041 | + $popi = true; |
|
| 2042 | + } |
|
| 2043 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2044 | + $popw = true; |
|
| 2045 | + } |
|
| 1644 | 2046 | } |
| 1645 | 2047 | if ($pop) { |
| 1646 | 2048 | sleep(5); |
@@ -1651,7 +2053,9 @@ discard block |
||
| 1651 | 2053 | } else if ($popw) { |
| 1652 | 2054 | sleep(5); |
| 1653 | 2055 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1654 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2056 | + } else { |
|
| 2057 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2058 | + } |
|
| 1655 | 2059 | print '</div></ul>'; |
| 1656 | 2060 | print '<div id="error"></div>'; |
| 1657 | 2061 | /* foreach ($_SESSION['done'] as $done) { |