@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
| 6 | 6 | $Common = new Common(); |
| 7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
| 8 | -$showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
| 8 | +$showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
| 9 | 9 | |
| 10 | 10 | if (!isset($type)) $type = 'aircraft'; |
| 11 | 11 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | print '<th class="more"></th>'; |
| 103 | 103 | print '</thead>'; |
| 104 | -} else if (strtolower($current_page) == "upcoming"){ |
|
| 104 | +} else if (strtolower($current_page) == "upcoming") { |
|
| 105 | 105 | print '<thead>'; |
| 106 | 106 | if ($_GET['sort'] == "airline_name_asc") |
| 107 | 107 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | */ |
| 153 | 153 | print '</thead>'; |
| 154 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
| 154 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
| 155 | 155 | print '<thead>'; |
| 156 | 156 | print '<th class="aircraft_thumbnail"></th>'; |
| 157 | 157 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | print '</thead>'; |
| 189 | 189 | } else { |
| 190 | 190 | |
| 191 | - if ($hide_th_links === true){ |
|
| 191 | + if ($hide_th_links === true) { |
|
| 192 | 192 | print '<thead>'; |
| 193 | 193 | print '<th class="aircraft_thumbnail"></th>'; |
| 194 | 194 | if ($type == 'aircraft') { |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | print '<tbody>'."\n"; |
| 438 | -foreach($spotter_array as $spotter_item) |
|
| 438 | +foreach ($spotter_array as $spotter_item) |
|
| 439 | 439 | { |
| 440 | 440 | if (isset($globalTimezone)) |
| 441 | 441 | { |
@@ -470,13 +470,13 @@ discard block |
||
| 470 | 470 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 471 | 471 | } |
| 472 | 472 | if (isset($spotter_item['airline_name'])) { |
| 473 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 473 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 474 | 474 | } else { |
| 475 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 475 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 476 | 476 | } |
| 477 | 477 | } else { |
| 478 | 478 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 479 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 479 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 480 | 480 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 481 | 481 | if (isset($spotter_item['airline_name'])) { |
| 482 | 482 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | { |
| 496 | 496 | print '<td class="aircraft_thumbnail">'."\n"; |
| 497 | 497 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 498 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 498 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 499 | 499 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 500 | 500 | if (isset($spotter_item['airline_name'])) { |
| 501 | 501 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | { |
| 514 | 514 | print '<td class="aircraft_thumbnail">'."\n"; |
| 515 | 515 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 516 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 516 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 517 | 517 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 518 | 518 | if (isset($spotter_item['airline_name'])) { |
| 519 | 519 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | print '</td>'."\n"; |
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
| 530 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
| 531 | 531 | if ($type == 'aircraft') { |
| 532 | 532 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 533 | 533 | $spotter_item['squawk'] = '-'; |
@@ -544,17 +544,17 @@ discard block |
||
| 544 | 544 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 545 | 545 | } |
| 546 | 546 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 547 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 547 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 548 | 548 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
| 549 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 549 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 550 | 550 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
| 551 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 551 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 552 | 552 | } else { |
| 553 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 553 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 554 | 554 | } |
| 555 | 555 | } else { |
| 556 | 556 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 557 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 557 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 558 | 558 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 559 | 559 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 560 | 560 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | { |
| 588 | 588 | print '<td class="aircraft_thumbnail">'."\n"; |
| 589 | 589 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 590 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 590 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 591 | 591 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 592 | 592 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 593 | 593 | print '</td>'."\n"; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | { |
| 602 | 602 | print '<td class="aircraft_thumbnail">'."\n"; |
| 603 | 603 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 604 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 604 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 605 | 605 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 606 | 606 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 607 | 607 | print '</td>'."\n"; |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | print '</td>'."\n"; |
| 674 | 674 | // Aircraft type |
| 675 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
| 675 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
| 676 | 676 | print '<td class="type">'."\n"; |
| 677 | 677 | if ($type == 'aircraft') { |
| 678 | 678 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
@@ -722,22 +722,22 @@ discard block |
||
| 722 | 722 | } |
| 723 | 723 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 724 | 724 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 725 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 726 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 725 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 726 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 727 | 727 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 728 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 728 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 729 | 729 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 730 | 730 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 731 | 731 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 732 | 732 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 733 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 733 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 734 | 734 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 735 | 735 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 736 | 736 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 737 | 737 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 738 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 738 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 739 | 739 | } else { |
| 740 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 740 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 741 | 741 | } |
| 742 | 742 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
| 743 | 743 | } |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | $latitude = $spotter_item['latitude']; |
| 753 | 753 | $longitude = $spotter_item['longitude']; |
| 754 | 754 | } |
| 755 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
| 755 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
| 756 | 756 | } else $distance = ''; |
| 757 | 757 | if ($distance != '') { |
| 758 | 758 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -795,20 +795,20 @@ discard block |
||
| 795 | 795 | } |
| 796 | 796 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 797 | 797 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 798 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 798 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 799 | 799 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 800 | 800 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 801 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 801 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 802 | 802 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 803 | 803 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 804 | 804 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 805 | 805 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 806 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 806 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 807 | 807 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 808 | 808 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 809 | 809 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 810 | 810 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 811 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 811 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 812 | 812 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 813 | 813 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 814 | 814 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $latitude = $spotter_item['latitude']; |
| 822 | 822 | $longitude = $spotter_item['longitude']; |
| 823 | 823 | } |
| 824 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
| 824 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
| 825 | 825 | } else $distance = ''; |
| 826 | 826 | if ($distance != '') { |
| 827 | 827 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -864,19 +864,19 @@ discard block |
||
| 864 | 864 | print '<span class="mobile">-</span>'."\n"; |
| 865 | 865 | } else { |
| 866 | 866 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 867 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 868 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 867 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 868 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 869 | 869 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 870 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 871 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 870 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 871 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 872 | 872 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 873 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 874 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 873 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 874 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | print '</td>'."\n"; |
| 878 | 878 | } |
| 879 | - if(strtolower($current_page) != "upcoming"){ |
|
| 879 | + if (strtolower($current_page) != "upcoming") { |
|
| 880 | 880 | if ($type == 'aircraft') { |
| 881 | 881 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 882 | 882 | print '<td class="pilot">'."\n"; |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | |
| 913 | 913 | if ($showRouteStop) { |
| 914 | 914 | // Route stop |
| 915 | - if(strtolower($current_page) != "upcoming"){ |
|
| 915 | + if (strtolower($current_page) != "upcoming") { |
|
| 916 | 916 | print '<td class="route_stop">'."\n"; |
| 917 | 917 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
| 918 | 918 | print '<span class="nomobile">-</span>'."\n"; |
@@ -931,11 +931,11 @@ discard block |
||
| 931 | 931 | } |
| 932 | 932 | if ($showDuration) { |
| 933 | 933 | // Duration |
| 934 | - if(strtolower($current_page) != "upcoming"){ |
|
| 934 | + if (strtolower($current_page) != "upcoming") { |
|
| 935 | 935 | print '<td class="duration">'."\n"; |
| 936 | 936 | if (isset($spotter_item['duration'])) { |
| 937 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 938 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 937 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 938 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 939 | 939 | } else { |
| 940 | 940 | print '<span class="nomobile">-</span>'."\n"; |
| 941 | 941 | print '<span class="mobile">-</span>'."\n"; |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
| 949 | 949 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
| 950 | 950 | print '<td class="message"><p>'."\n"; |
| 951 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 951 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 952 | 952 | print '</p><p class="decode">'; |
| 953 | 953 | $decode_array = json_decode($spotter_item['decode']); |
| 954 | 954 | foreach ($decode_array as $key => $value) { |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | print '</td>'."\n"; |
| 959 | 959 | } else { |
| 960 | 960 | print '<td class="message">'."\n"; |
| 961 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 961 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 962 | 962 | print '</td>'."\n"; |
| 963 | 963 | } |
| 964 | 964 | } |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | } |
| 984 | 984 | print '</td>'."\n"; |
| 985 | 985 | print '<td class="message">'."\n"; |
| 986 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 986 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 987 | 987 | print '</td>'."\n"; |
| 988 | 988 | } |
| 989 | 989 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | print '</td>'."\n"; |
| 1010 | 1010 | */ |
| 1011 | 1011 | print '<td class="message">'."\n"; |
| 1012 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1012 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1013 | 1013 | print '</td>'."\n"; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | require_once('header.php'); |
| 24 | 24 | |
| 25 | 25 | //calculuation for the pagination |
| 26 | -if(!isset($_GET['limit'])) |
|
| 26 | +if (!isset($_GET['limit'])) |
|
| 27 | 27 | { |
| 28 | 28 | $limit_start = 0; |
| 29 | 29 | $limit_end = 25; |
| 30 | 30 | $absolute_difference = 25; |
| 31 | -} else { |
|
| 31 | +} else { |
|
| 32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
| 33 | 33 | $limit_start = $limit_explode[0]; |
| 34 | 34 | $limit_end = $limit_explode[1]; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
| 52 | 52 | else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
| 53 | 53 | |
| 54 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 54 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 55 | 55 | $sql_begin = microtime(true); |
| 56 | 56 | if ($type == 'marine') { |
| 57 | 57 | $spotter_array = $Marine->getLatestMarineData($limit_start.",".$absolute_difference, $sort); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } else { |
| 61 | 61 | $spotter_array = $Spotter->getLatestSpotterData($limit_start.",".$absolute_difference, $sort); |
| 62 | 62 | } |
| 63 | -$sql_time = microtime(true)-$sql_begin; |
|
| 63 | +$sql_time = microtime(true) - $sql_begin; |
|
| 64 | 64 | $page_begin = microtime(true); |
| 65 | 65 | if (!empty($spotter_array)) |
| 66 | 66 | { |
@@ -77,6 +77,6 @@ discard block |
||
| 77 | 77 | print '</div>'; |
| 78 | 78 | print '</div>'; |
| 79 | 79 | } |
| 80 | -$page_time = microtime(true)-$page_begin; |
|
| 80 | +$page_time = microtime(true) - $page_begin; |
|
| 81 | 81 | require_once('footer.php'); |
| 82 | 82 | ?> |
| 83 | 83 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | require_once('require/class.Language.php'); |
| 4 | 4 | require_once('require/class.Translation.php'); |
| 5 | 5 | $type = ''; |
| 6 | -$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 6 | +$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 7 | 7 | if (isset($_GET['marine'])) { |
| 8 | 8 | require_once('require/class.Marine.php'); |
| 9 | 9 | require_once('require/class.MarineLive.php'); |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | $page_url = $globalURL.'/ident/'.$_GET['ident']; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -if (!isset($_GET['ident'])){ |
|
| 33 | +if (!isset($_GET['ident'])) { |
|
| 34 | 34 | header('Location: '.$globalURL.''); |
| 35 | 35 | } else { |
| 36 | 36 | $Translation = new Translation(); |
| 37 | 37 | //calculuation for the pagination |
| 38 | - if(!isset($_GET['limit'])) |
|
| 38 | + if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | $limit_start = 0; |
| 41 | 41 | $limit_end = 25; |
@@ -54,18 +54,18 @@ discard block |
||
| 54 | 54 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 55 | 55 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 56 | 56 | |
| 57 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 57 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 58 | 58 | if ($type == 'aircraft') { |
| 59 | 59 | if ($sort != '') |
| 60 | 60 | { |
| 61 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 61 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 62 | 62 | if (empty($spotter_array)) { |
| 63 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 63 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 64 | 64 | } |
| 65 | 65 | } else { |
| 66 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 66 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 67 | 67 | if (empty($spotter_array)) { |
| 68 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 68 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | if (empty($spotter_array)) { |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | $ident = $new_ident; |
| 75 | 75 | if ($sort != '') |
| 76 | 76 | { |
| 77 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 77 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 78 | 78 | if (empty($spotter_array)) { |
| 79 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 79 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 80 | 80 | } |
| 81 | 81 | } else { |
| 82 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 82 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 83 | 83 | if (empty($spotter_array)) { |
| 84 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 84 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -89,34 +89,34 @@ discard block |
||
| 89 | 89 | } elseif ($type == 'marine') { |
| 90 | 90 | if ($sort != '') |
| 91 | 91 | { |
| 92 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 92 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 93 | 93 | if (empty($spotter_array)) { |
| 94 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 94 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 95 | 95 | } |
| 96 | 96 | } else { |
| 97 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 97 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 98 | 98 | if (empty($spotter_array)) { |
| 99 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 99 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } elseif ($type == 'tracker') { |
| 103 | 103 | if ($sort != '') |
| 104 | 104 | { |
| 105 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 105 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 106 | 106 | if (empty($spotter_array)) { |
| 107 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
| 107 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
| 108 | 108 | } |
| 109 | 109 | } else { |
| 110 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 110 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 111 | 111 | if (empty($spotter_array)) { |
| 112 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
| 112 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if (!empty($spotter_array)) |
| 118 | 118 | { |
| 119 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
|
| 119 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['ident']); |
|
| 120 | 120 | $ident = $spotter_array[0]['ident']; |
| 121 | 121 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
| 122 | 122 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | var data = google.visualization.arrayToDataTable([ |
| 138 | 138 | ["Hour","'._("Altitude").'","'._("Speed").'"], '; |
| 139 | 139 | $altitude_data = ''; |
| 140 | - foreach($all_data as $data) |
|
| 140 | + foreach ($all_data as $data) |
|
| 141 | 141 | { |
| 142 | - $altitude_data .= '[ "'.date("G:i",strtotime($data['date']." UTC")).'",'.$data['altitude'].','.$data['ground_speed'].'],'; |
|
| 142 | + $altitude_data .= '[ "'.date("G:i", strtotime($data['date']." UTC")).'",'.$data['altitude'].','.$data['ground_speed'].'],'; |
|
| 143 | 143 | } |
| 144 | 144 | $altitude_data = substr($altitude_data, 0, -1); |
| 145 | 145 | print $altitude_data.']); |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | if ($type == 'aircraft') include('ident-sub-menu.php'); |
| 181 | 181 | print '<div class="table column">'; |
| 182 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 183 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 184 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 182 | + if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
| 183 | + elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
| 184 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
| 185 | 185 | |
| 186 | 186 | include('table-output.php'); |
| 187 | 187 | print '<div class="pagination">'; |
@@ -4,21 +4,21 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | $type = ''; |
| 6 | 6 | if (isset($_GET['marine'])) { |
| 7 | - require_once('require/class.Marine.php');; |
|
| 7 | + require_once('require/class.Marine.php'); ; |
|
| 8 | 8 | require_once('require/class.MarineLive.php'); |
| 9 | - $MarineLive=new MarineLive(); |
|
| 9 | + $MarineLive = new MarineLive(); |
|
| 10 | 10 | $type = 'marine'; |
| 11 | 11 | $page_url = $globalURL.'/marine/currently'; |
| 12 | 12 | } elseif (isset($_GET['tracker'])) { |
| 13 | - require_once('require/class.Tracker.php');; |
|
| 13 | + require_once('require/class.Tracker.php'); ; |
|
| 14 | 14 | require_once('require/class.TrackerLive.php'); |
| 15 | - $TrackerLive=new TrackerLive(); |
|
| 15 | + $TrackerLive = new TrackerLive(); |
|
| 16 | 16 | $type = 'tracker'; |
| 17 | 17 | $page_url = $globalURL.'/tracker/currently'; |
| 18 | 18 | } else { |
| 19 | - require_once('require/class.Spotter.php');; |
|
| 19 | + require_once('require/class.Spotter.php'); ; |
|
| 20 | 20 | require_once('require/class.SpotterLive.php'); |
| 21 | - $SpotterLive=new SpotterLive(); |
|
| 21 | + $SpotterLive = new SpotterLive(); |
|
| 22 | 22 | $type = 'aircraft'; |
| 23 | 23 | $page_url = $globalURL.'/currently'; |
| 24 | 24 | } |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $title = "Current Activity"; |
| 27 | 27 | require_once('header.php'); |
| 28 | 28 | //calculuation for the pagination |
| 29 | -if(!isset($_GET['limit'])) |
|
| 29 | +if (!isset($_GET['limit'])) |
|
| 30 | 30 | { |
| 31 | 31 | $limit_start = 0; |
| 32 | 32 | $limit_end = 25; |
| 33 | 33 | $absolute_difference = 25; |
| 34 | -} else { |
|
| 34 | +} else { |
|
| 35 | 35 | $limit_explode = explode(",", $_GET['limit']); |
| 36 | 36 | $limit_start = $limit_explode[0]; |
| 37 | 37 | $limit_end = $limit_explode[1]; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | elseif ($type == 'marine') print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
| 55 | 55 | elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
| 56 | 56 | |
| 57 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 57 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 58 | 58 | if ($sort != '') { |
| 59 | 59 | if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
| 60 | 60 | elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | $type = 'aircraft'; |
| 4 | 4 | if (isset($_GET['marine'])) $type = 'marine'; |
| 5 | 5 | elseif (isset($_GET['tracker'])) $type = 'tracker'; |
| 6 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 6 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 7 | 7 | if ($date == '') $date = date('Y-m-d'); |
| 8 | 8 | if ($type == 'marine') header('Location: '.$globalURL.'/marine/date/'.$date); |
| 9 | 9 | elseif ($type == 'tracker') header('Location: '.$globalURL.'/tracker/date/'.$date); |
@@ -2,34 +2,34 @@ discard block |
||
| 2 | 2 | require_once('require/class.Connection.php'); |
| 3 | 3 | require_once('require/class.Language.php'); |
| 4 | 4 | $type = ''; |
| 5 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 5 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 6 | 6 | if (isset($_GET['marine'])) { |
| 7 | - require_once('require/class.Marine.php');; |
|
| 7 | + require_once('require/class.Marine.php'); ; |
|
| 8 | 8 | $Marine = new Marine(); |
| 9 | 9 | $type = 'marine'; |
| 10 | 10 | $page_url = $globalURL.'/marine/date/'.$date; |
| 11 | 11 | } elseif (isset($_GET['tracker'])) { |
| 12 | - require_once('require/class.Tracker.php');; |
|
| 12 | + require_once('require/class.Tracker.php'); ; |
|
| 13 | 13 | $Tracker = new Tracker(); |
| 14 | 14 | $type = 'tracker'; |
| 15 | 15 | $page_url = $globalURL.'/tracker/date/'.$date; |
| 16 | 16 | } else { |
| 17 | - require_once('require/class.Spotter.php');; |
|
| 17 | + require_once('require/class.Spotter.php'); ; |
|
| 18 | 18 | $Spotter = new Spotter(); |
| 19 | 19 | $type = 'aircraft'; |
| 20 | 20 | $page_url = $globalURL.'/date/'.$date; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if (!isset($_GET['date'])){ |
|
| 23 | +if (!isset($_GET['date'])) { |
|
| 24 | 24 | header('Location: '.$globalURL.''); |
| 25 | 25 | } else { |
| 26 | 26 | //calculuation for the pagination |
| 27 | - if(!isset($_GET['limit'])) |
|
| 27 | + if (!isset($_GET['limit'])) |
|
| 28 | 28 | { |
| 29 | 29 | $limit_start = 0; |
| 30 | 30 | $limit_end = 25; |
| 31 | 31 | $absolute_difference = 25; |
| 32 | - } else { |
|
| 32 | + } else { |
|
| 33 | 33 | $limit_explode = explode(",", $_GET['limit']); |
| 34 | 34 | $limit_start = $limit_explode[0]; |
| 35 | 35 | $limit_end = $limit_explode[1]; |
@@ -43,24 +43,24 @@ discard block |
||
| 43 | 43 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 44 | 44 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 45 | 45 | |
| 46 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 46 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 47 | 47 | if ($sort != '') |
| 48 | 48 | { |
| 49 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 50 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 49 | + if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 50 | + elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 51 | + else $spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference, $sort); |
|
| 52 | 52 | } else { |
| 53 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 54 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 55 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 53 | + if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 54 | + elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 55 | + else $spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if (!empty($spotter_array)) |
| 59 | 59 | { |
| 60 | 60 | date_default_timezone_set($globalTimezone); |
| 61 | - if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | - elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | - else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 61 | + if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | + elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | + else $title = sprintf(_("Detailed View for flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 64 | 64 | |
| 65 | 65 | require_once('header.php'); |
| 66 | 66 | print '<div class="select-item">'; |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 79 | 79 | print '<br />'; |
| 80 | 80 | print '<div class="info column">'; |
| 81 | - if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | - else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 81 | + if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | + else print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 83 | 83 | print '</div>'; |
| 84 | 84 | |
| 85 | 85 | if ($type == 'aircraft') include('date-sub-menu.php'); |
| 86 | 86 | print '<div class="table column">'; |
| 87 | - if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | - else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 87 | + if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | + else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 90 | 90 | |
| 91 | 91 | include('table-output.php'); |
| 92 | 92 | print '<div class="pagination">'; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
| 50 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
| 51 | 51 | $Tracker = new Tracker($this->db); |
| 52 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 52 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 61 | 61 | foreach ($this->all_tracked as $key => $flight) { |
| 62 | 62 | if (isset($flight['lastupdate'])) { |
| 63 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 63 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 64 | 64 | if (isset($this->all_tracked[$key]['id'])) { |
| 65 | 65 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
| 66 | 66 | /* |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | //$real_arrival = $this->arrival($key); |
| 72 | 72 | $Tracker = new Tracker($this->db); |
| 73 | 73 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
| 74 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
| 74 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
| 75 | 75 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 76 | 76 | } |
| 77 | 77 | // Put in archive |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $send = false; |
| 92 | 92 | |
| 93 | 93 | // SBS format is CSV format |
| 94 | - if(is_array($line) && isset($line['ident'])) { |
|
| 94 | + if (is_array($line) && isset($line['ident'])) { |
|
| 95 | 95 | //print_r($line); |
| 96 | 96 | if (isset($line['ident'])) { |
| 97 | 97 | |
@@ -114,33 +114,33 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | if (!isset($this->all_tracked[$id])) { |
| 116 | 116 | $this->all_tracked[$id] = array(); |
| 117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
| 118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
| 119 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
| 118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
| 119 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
| 120 | 120 | if (!isset($line['id'])) { |
| 121 | 121 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 122 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 123 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 122 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 123 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
| 124 | 124 | if ($globalAllTracked !== FALSE) $dataFound = true; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 127 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 128 | 128 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
| 129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
| 129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
| 130 | 130 | } else { |
| 131 | 131 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 132 | 132 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 133 | 133 | return ''; |
| 134 | 134 | } |
| 135 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 135 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 136 | 136 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 137 | 137 | return ''; |
| 138 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 138 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 139 | 139 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 140 | 140 | return ''; |
| 141 | 141 | } elseif (!isset($line['datetime'])) { |
| 142 | 142 | date_default_timezone_set('UTC'); |
| 143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 144 | 144 | } else { |
| 145 | 145 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 146 | 146 | return ''; |
@@ -148,38 +148,38 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
| 150 | 150 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 151 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 151 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
| 152 | 152 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
| 153 | 153 | $timeelapsed = microtime(true); |
| 154 | 154 | $Tracker = new Tracker($this->db); |
| 155 | 155 | $fromsource = NULL; |
| 156 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 156 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
| 157 | 157 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 158 | 158 | $Tracker->db = null; |
| 159 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 159 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 160 | 160 | } |
| 161 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 161 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (isset($line['speed']) && $line['speed'] != '') { |
| 165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
| 166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
| 167 | 167 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 168 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 168 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
| 169 | 169 | if ($distance > 1000 && $distance < 10000) { |
| 170 | 170 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 171 | 171 | $speed = $speed*3.6; |
| 172 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
| 172 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
| 173 | 173 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 178 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 178 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
| 179 | 179 | else unset($timediff); |
| 180 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 180 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
| 181 | 181 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 182 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 182 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 183 | 183 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 184 | 184 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 185 | 185 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 188 | 188 | $timeelapsed = microtime(true); |
| 189 | 189 | $Tracker = new Tracker($this->db); |
| 190 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 190 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 191 | 191 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
| 192 | 192 | $Tracker->db = null; |
| 193 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 193 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 194 | 194 | $this->tmd = 0; |
| 195 | 195 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 196 | 196 | } |
@@ -198,73 +198,73 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 200 | 200 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 201 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 201 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 202 | 202 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 203 | 203 | $dataFound = true; |
| 204 | 204 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 205 | 205 | } |
| 206 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
| 206 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
| 207 | 207 | } |
| 208 | 208 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 209 | 209 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 210 | 210 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 211 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 211 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 212 | 212 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 213 | 213 | $dataFound = true; |
| 214 | 214 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 215 | 215 | } |
| 216 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
| 216 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | } else if ($globalDebug && $timediff > 20) { |
| 220 | 220 | $this->tmd = $this->tmd + 1; |
| 221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
| 223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
| 223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 228 | 228 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 229 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 229 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
| 230 | 230 | } |
| 231 | 231 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 232 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 232 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
| 233 | 233 | } |
| 234 | 234 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 235 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 235 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
| 236 | 236 | } |
| 237 | 237 | if (isset($line['comment']) && $line['comment'] != '') { |
| 238 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
| 238 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
| 239 | 239 | //$dataFound = true; |
| 240 | 240 | } |
| 241 | 241 | if (isset($line['type']) && $line['type'] != '') { |
| 242 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 242 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
| 243 | 243 | //$dataFound = true; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 247 | 247 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 248 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 249 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
|
| 250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
| 248 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 249 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => round($line['altitude']/100))); |
|
| 250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
| 251 | 251 | //$dataFound = true; |
| 252 | 252 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if (isset($line['heading']) && $line['heading'] != '') { |
| 260 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 261 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 260 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 261 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
| 263 | 263 | //$dataFound = true; |
| 264 | 264 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 265 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 266 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 267 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 265 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 266 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
| 267 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 268 | 268 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
| 269 | 269 | } |
| 270 | 270 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -272,39 +272,39 @@ discard block |
||
| 272 | 272 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
| 273 | 273 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 274 | 274 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
| 275 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 275 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 276 | 276 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 277 | 277 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 278 | 278 | $timeelapsed = microtime(true); |
| 279 | 279 | $TrackerLive = new TrackerLive($this->db); |
| 280 | 280 | if (isset($line['id'])) { |
| 281 | 281 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
| 282 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 282 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 283 | 283 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 284 | 284 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 285 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 285 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 286 | 286 | } else $recent_ident = ''; |
| 287 | - $TrackerLive->db=null; |
|
| 287 | + $TrackerLive->db = null; |
|
| 288 | 288 | |
| 289 | 289 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 290 | 290 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 291 | 291 | } else { |
| 292 | 292 | $recent_ident = ''; |
| 293 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
| 293 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
| 294 | 294 | } |
| 295 | 295 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 296 | - if($recent_ident == "") |
|
| 296 | + if ($recent_ident == "") |
|
| 297 | 297 | { |
| 298 | 298 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
| 299 | 299 | //adds the spotter data for the archive |
| 300 | 300 | $highlight = ''; |
| 301 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 301 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 302 | 302 | $timeelapsed = microtime(true); |
| 303 | 303 | $Tracker = new Tracker($this->db); |
| 304 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 304 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
| 305 | 305 | $Tracker->db = null; |
| 306 | 306 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 307 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 307 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 308 | 308 | |
| 309 | 309 | /* |
| 310 | 310 | // Add source stat in DB |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
| 343 | 343 | $TrackerLive = new TrackerLive($this->db); |
| 344 | 344 | $TrackerLive->deleteLiveTrackerData(); |
| 345 | - $TrackerLive->db=null; |
|
| 345 | + $TrackerLive->db = null; |
|
| 346 | 346 | if ($globalDebug) echo " Done\n"; |
| 347 | 347 | $this->last_delete = time(); |
| 348 | 348 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $this->all_tracked[$id]['addedTracker'] = 1; |
| 352 | 352 | if (isset($globalDaemon) && !$globalDaemon) { |
| 353 | 353 | $Tracker = new Tracker($this->db); |
| 354 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
| 354 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
| 355 | 355 | $Tracker->db = null; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -365,14 +365,14 @@ discard block |
||
| 365 | 365 | $ignoreImport = false; |
| 366 | 366 | |
| 367 | 367 | if (!$ignoreImport) { |
| 368 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 368 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 369 | 369 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 370 | 370 | $timeelapsed = microtime(true); |
| 371 | 371 | $TrackerLive = new TrackerLive($this->db); |
| 372 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 372 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
| 373 | 373 | $TrackerLive->db = null; |
| 374 | 374 | $this->all_tracked[$id]['putinarchive'] = false; |
| 375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 375 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 376 | 376 | |
| 377 | 377 | // Put statistics in $this->stats variable |
| 378 | 378 | /* |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
| 433 | 433 | if ($globalDebug) echo $result."\n"; |
| 434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 435 | 435 | //$this->del(); |
| 436 | 436 | |
| 437 | 437 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if (isset($this->all_tracked[$key]['id'])) { |
| 59 | 59 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
| 60 | 60 | $Marine = new Marine($this->db); |
| 61 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 61 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 70 | 70 | foreach ($this->all_tracked as $key => $flight) { |
| 71 | 71 | if (isset($flight['lastupdate'])) { |
| 72 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 72 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 73 | 73 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 74 | 74 | if (isset($this->all_tracked[$key]['id'])) { |
| 75 | 75 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | //$real_arrival = $this->arrival($key); |
| 82 | 82 | $Marine = new Marine($this->db); |
| 83 | 83 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
| 84 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 84 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
| 85 | 85 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 86 | 86 | } |
| 87 | 87 | // Put in archive |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function add($line) { |
| 98 | - global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
|
| 98 | + global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine; |
|
| 99 | 99 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 100 | 100 | date_default_timezone_set('UTC'); |
| 101 | 101 | $dataFound = false; |
| 102 | 102 | $send = false; |
| 103 | 103 | |
| 104 | 104 | // SBS format is CSV format |
| 105 | - if(is_array($line) && isset($line['mmsi'])) { |
|
| 105 | + if (is_array($line) && isset($line['mmsi'])) { |
|
| 106 | 106 | //print_r($line); |
| 107 | 107 | if (isset($line['mmsi'])) { |
| 108 | 108 | |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | if (!isset($this->all_tracked[$id])) { |
| 128 | 128 | $this->all_tracked[$id] = array(); |
| 129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 130 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
| 131 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0)); |
|
| 130 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '')); |
|
| 131 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
| 132 | 132 | if (!isset($line['id'])) { |
| 133 | 133 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 135 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 135 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
| 136 | 136 | if ($globalAllTracked !== FALSE) $dataFound = true; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 140 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 140 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi'])); |
|
| 141 | 141 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 142 | 142 | $Marine = new Marine($this->db); |
| 143 | 143 | $identity = $Marine->getIdentity($line['mmsi']); |
@@ -151,64 +151,64 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | if (isset($line['type_id'])) { |
| 154 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 154 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id']))); |
|
| 155 | 155 | } |
| 156 | 156 | if (isset($line['type']) && $line['type'] != '') { |
| 157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
| 158 | 158 | } |
| 159 | 159 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 160 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 160 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type'])); |
|
| 161 | 161 | } |
| 162 | 162 | if (isset($line['imo']) && $line['imo'] != '') { |
| 163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo'])); |
|
| 164 | 164 | } |
| 165 | 165 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign'])); |
|
| 167 | 167 | } |
| 168 | 168 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 169 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 169 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code'])); |
|
| 170 | 170 | } |
| 171 | 171 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date'])); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
| 177 | 177 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 178 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 178 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
| 179 | 179 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
| 180 | 180 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 181 | 181 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 182 | 182 | $timeelapsed = microtime(true); |
| 183 | 183 | $Marine = new Marine($this->db); |
| 184 | 184 | $fromsource = NULL; |
| 185 | - $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 185 | + $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
| 186 | 186 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 187 | 187 | $Marine->db = null; |
| 188 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 188 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 192 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 195 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 196 | 196 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
| 197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
| 197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
| 198 | 198 | } else { |
| 199 | 199 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
| 200 | 200 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 201 | 201 | return ''; |
| 202 | 202 | } |
| 203 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 203 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 204 | 204 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 205 | 205 | return ''; |
| 206 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 206 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 207 | 207 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 208 | 208 | return ''; |
| 209 | 209 | } elseif (!isset($line['datetime'])) { |
| 210 | 210 | date_default_timezone_set('UTC'); |
| 211 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 211 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 212 | 212 | } else { |
| 213 | 213 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 214 | 214 | return ''; |
@@ -216,24 +216,24 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | if (isset($line['speed'])) { |
| 219 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 219 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
| 221 | 221 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 222 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 222 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
| 223 | 223 | if ($distance > 1000 && $distance < 10000) { |
| 224 | 224 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 225 | 225 | $speed = $speed*3.6; |
| 226 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
| 226 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
| 227 | 227 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 232 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 232 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
| 233 | 233 | else unset($timediff); |
| 234 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 234 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
| 235 | 235 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 236 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 236 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 237 | 237 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 238 | 238 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 239 | 239 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | $timeelapsed = microtime(true); |
| 243 | 243 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 244 | 244 | $Marine = new Marine($this->db); |
| 245 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 245 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 246 | 246 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
| 247 | 247 | $Marine->db = null; |
| 248 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 248 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 249 | 249 | } |
| 250 | 250 | $this->tmd = 0; |
| 251 | 251 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
@@ -254,52 +254,52 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 256 | 256 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 257 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 257 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 258 | 258 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 259 | 259 | $dataFound = true; |
| 260 | 260 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 261 | 261 | } |
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
| 263 | 263 | } |
| 264 | 264 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 265 | 265 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 266 | 266 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 267 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 267 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 268 | 268 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 269 | 269 | $dataFound = true; |
| 270 | 270 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 271 | 271 | } |
| 272 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
| 272 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | } else if ($globalDebug && $timediff > 20) { |
| 276 | 276 | $this->tmd = $this->tmd + 1; |
| 277 | 277 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 278 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
| 279 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 278 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
| 279 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 280 | 280 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 284 | 284 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 285 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 285 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
| 286 | 286 | } |
| 287 | 287 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 288 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 288 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
| 289 | 289 | } |
| 290 | 290 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 291 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 291 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
| 292 | 292 | } |
| 293 | 293 | if (isset($line['status']) && $line['status'] != '') { |
| 294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status'])); |
|
| 295 | 295 | } |
| 296 | 296 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 297 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 297 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id'])); |
|
| 298 | 298 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
| 299 | 299 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 300 | 300 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 301 | 301 | $Marine = new Marine($this->db); |
| 302 | - $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
|
| 302 | + $Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']); |
|
| 303 | 303 | unset($Marine); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -307,18 +307,18 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 310 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 310 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if (isset($line['heading']) && $line['heading'] != '') { |
| 314 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 315 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 316 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 314 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 315 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
| 316 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
| 317 | 317 | //$dataFound = true; |
| 318 | 318 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 319 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 321 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 319 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
| 321 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 322 | 322 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
| 323 | 323 | } |
| 324 | 324 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
| 329 | 329 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 330 | 330 | if ($this->all_tracked[$id]['addedMarine'] == 0) { |
| 331 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 331 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 332 | 332 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 333 | 333 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 334 | 334 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
@@ -336,37 +336,37 @@ discard block |
||
| 336 | 336 | $MarineLive = new MarineLive($this->db); |
| 337 | 337 | if (isset($line['id'])) { |
| 338 | 338 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 339 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 339 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 340 | 340 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
| 341 | 341 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 342 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 342 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 343 | 343 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 344 | 344 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 345 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 345 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 346 | 346 | } else $recent_ident = ''; |
| 347 | - $MarineLive->db=null; |
|
| 347 | + $MarineLive->db = null; |
|
| 348 | 348 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 349 | 349 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 350 | 350 | } else $recent_ident = ''; |
| 351 | 351 | } else { |
| 352 | 352 | $recent_ident = ''; |
| 353 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
| 353 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
| 354 | 354 | } |
| 355 | 355 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 356 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 356 | + if ($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 357 | 357 | { |
| 358 | 358 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 359 | 359 | //adds the spotter data for the archive |
| 360 | 360 | $highlight = ''; |
| 361 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 361 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 362 | 362 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 363 | 363 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 364 | 364 | $timeelapsed = microtime(true); |
| 365 | 365 | $Marine = new Marine($this->db); |
| 366 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 366 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
| 367 | 367 | $Marine->db = null; |
| 368 | 368 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 369 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 369 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | /* |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 407 | 407 | $MarineLive = new MarineLive($this->db); |
| 408 | 408 | $MarineLive->deleteLiveMarineData(); |
| 409 | - $MarineLive->db=null; |
|
| 409 | + $MarineLive->db = null; |
|
| 410 | 410 | if ($globalDebug) echo " Done\n"; |
| 411 | 411 | } |
| 412 | 412 | $this->last_delete = time(); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 418 | 418 | if (isset($globalDaemon) && !$globalDaemon) { |
| 419 | 419 | $Marine = new Marine($this->db); |
| 420 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
| 420 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
| 421 | 421 | $Marine->db = null; |
| 422 | 422 | } |
| 423 | 423 | } |
@@ -432,20 +432,20 @@ discard block |
||
| 432 | 432 | $ignoreImport = false; |
| 433 | 433 | |
| 434 | 434 | if (!$ignoreImport) { |
| 435 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 435 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 436 | 436 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 437 | 437 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 438 | 438 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 439 | 439 | $timeelapsed = microtime(true); |
| 440 | 440 | $MarineLive = new MarineLive($this->db); |
| 441 | - $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 441 | + $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
| 442 | 442 | $MarineLive->db = null; |
| 443 | 443 | if ($globalDebug) echo $result."\n"; |
| 444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 444 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 448 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 448 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
| 449 | 449 | } |
| 450 | 450 | $this->all_tracked[$id]['putinarchive'] = false; |
| 451 | 451 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 507 | 507 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
| 508 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 508 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 509 | 509 | //$this->del(); |
| 510 | 510 | |
| 511 | 511 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
| 6 | 6 | |
| 7 | -class Tracker{ |
|
| 7 | +class Tracker { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -18,33 +18,33 @@ discard block |
||
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 21 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 23 | 23 | $filters = array(); |
| 24 | 24 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 25 | 25 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 26 | 26 | $filters = $globalStatsFilters[$globalFilterName]; |
| 27 | 27 | } else { |
| 28 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 28 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | if (isset($filter[0]['source'])) { |
| 32 | - $filters = array_merge($filters,$filter); |
|
| 32 | + $filters = array_merge($filters, $filter); |
|
| 33 | 33 | } |
| 34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 34 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 35 | 35 | $filter_query_join = ''; |
| 36 | 36 | $filter_query_where = ''; |
| 37 | - foreach($filters as $flt) { |
|
| 37 | + foreach ($filters as $flt) { |
|
| 38 | 38 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 47 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 47 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 48 | 48 | } |
| 49 | 49 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 50 | 50 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 74 | 74 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 75 | 75 | if ($filter_query_where != '') { |
| 76 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 76 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 77 | 77 | } |
| 78 | 78 | $filter_query = $filter_query_join.$filter_query_where; |
| 79 | 79 | return $filter_query; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return Array the spotter information |
| 89 | 89 | * |
| 90 | 90 | */ |
| 91 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 91 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 92 | 92 | { |
| 93 | 93 | date_default_timezone_set('UTC'); |
| 94 | 94 | if (!is_string($query)) |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | $sth = $this->db->prepare($query.$limitQuery); |
| 109 | 109 | $sth->execute($params); |
| 110 | 110 | } catch (PDOException $e) { |
| 111 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 111 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 112 | 112 | exit(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $num_rows = 0; |
| 116 | 116 | $spotter_array = array(); |
| 117 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 117 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 118 | 118 | { |
| 119 | 119 | $num_rows++; |
| 120 | 120 | $temp_array = array(); |
@@ -170,17 +170,17 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 172 | 172 | } else { |
| 173 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 173 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 174 | 174 | } |
| 175 | 175 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 176 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 177 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 176 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 177 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 178 | 178 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 179 | 179 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 180 | 180 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 181 | 181 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 182 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 183 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 182 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 183 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 184 | 184 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $limit_array = explode(",", $limit); |
| 219 | 219 | |
| 220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 222 | 222 | |
| 223 | 223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 224 | 224 | { |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 238 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 239 | 239 | |
| 240 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 240 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 241 | 241 | |
| 242 | 242 | return $spotter_array; |
| 243 | 243 | } |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | if ($id == '') return array(); |
| 257 | 257 | $additional_query = "tracker_output.famtrackid = :id"; |
| 258 | 258 | $query_values = array(':id' => $id); |
| 259 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 259 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 261 | 261 | return $spotter_array; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $query_values = array(); |
| 277 | 277 | $limit_query = ''; |
| 278 | 278 | $additional_query = ''; |
| 279 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 279 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 280 | 280 | if ($ident != "") |
| 281 | 281 | { |
| 282 | 282 | if (!is_string($ident)) |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | $limit_array = explode(",", $limit); |
| 294 | 294 | |
| 295 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 295 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 297 | 297 | |
| 298 | 298 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 299 | 299 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return $spotter_array; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 320 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 321 | 321 | { |
| 322 | 322 | global $global_query, $globalTimezone, $globalDBdriver; |
| 323 | 323 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $limit_query = ''; |
| 326 | 326 | $additional_query = ''; |
| 327 | 327 | |
| 328 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 328 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 329 | 329 | |
| 330 | 330 | if ($date != "") |
| 331 | 331 | { |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $limit_array = explode(",", $limit); |
| 353 | 353 | |
| 354 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 354 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 356 | 356 | |
| 357 | 357 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 358 | 358 | { |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | * @return Array list of source name |
| 384 | 384 | * |
| 385 | 385 | */ |
| 386 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 386 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 387 | 387 | { |
| 388 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 388 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 389 | 389 | $query_values = array(); |
| 390 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
| 390 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
| 391 | 391 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
| 392 | 392 | if ($type != '') { |
| 393 | 393 | $query_values = array(':type' => $type); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $source_array = array(); |
| 403 | 403 | $temp_array = array(); |
| 404 | 404 | |
| 405 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 405 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 406 | 406 | { |
| 407 | 407 | $temp_array['source_name'] = $row['source_name']; |
| 408 | 408 | $source_array[] = $temp_array; |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getAllIdents($filters = array()) |
| 421 | 421 | { |
| 422 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 423 | - $query = "SELECT DISTINCT tracker_output.ident |
|
| 422 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 423 | + $query = "SELECT DISTINCT tracker_output.ident |
|
| 424 | 424 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
| 425 | 425 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
| 426 | 426 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $ident_array = array(); |
| 431 | 431 | $temp_array = array(); |
| 432 | 432 | |
| 433 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 433 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 434 | 434 | { |
| 435 | 435 | $temp_array['ident'] = $row['ident']; |
| 436 | 436 | $ident_array[] = $temp_array; |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | } else $offset = '+00:00'; |
| 456 | 456 | |
| 457 | 457 | if ($globalDBdriver == 'mysql') { |
| 458 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 458 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 459 | 459 | FROM tracker_output |
| 460 | 460 | WHERE tracker_output.date <> '' |
| 461 | 461 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
| 462 | 462 | } else { |
| 463 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 463 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 464 | 464 | FROM tracker_output |
| 465 | 465 | WHERE tracker_output.date <> '' |
| 466 | 466 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $date_array = array(); |
| 473 | 473 | $temp_array = array(); |
| 474 | 474 | |
| 475 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 475 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 476 | 476 | { |
| 477 | 477 | $temp_array['date'] = $row['date']; |
| 478 | 478 | |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | * @return String success or false |
| 492 | 492 | * |
| 493 | 493 | */ |
| 494 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
| 494 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
| 495 | 495 | { |
| 496 | 496 | |
| 497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 498 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
| 499 | 499 | |
| 500 | 500 | try { |
| 501 | 501 | $sth = $this->db->prepare($query); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 520 | 520 | { |
| 521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 522 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
| 523 | 523 | |
| 524 | 524 | try { |
| 525 | 525 | $sth = $this->db->prepare($query); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @param String $verticalrate vertival rate of flight |
| 560 | 560 | * @return String success or false |
| 561 | 561 | */ |
| 562 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
| 562 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
| 563 | 563 | { |
| 564 | 564 | global $globalURL; |
| 565 | 565 | |
@@ -627,21 +627,21 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
| 630 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 630 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 631 | 631 | { |
| 632 | 632 | $date = date("Y-m-d H:i:s", time()); |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 636 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 637 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 643 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 644 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 635 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 636 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 637 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 643 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 644 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 645 | 645 | |
| 646 | 646 | if ($latitude == '' && $longitude == '') { |
| 647 | 647 | $latitude = 0; |
@@ -649,10 +649,10 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 651 | 651 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 654 | |
| 655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 655 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
@@ -678,13 +678,13 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | global $globalDBdriver, $globalTimezone; |
| 680 | 680 | if ($globalDBdriver == 'mysql') { |
| 681 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 681 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 682 | 682 | WHERE tracker_output.ident = :ident |
| 683 | 683 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 684 | 684 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 685 | 685 | $query_data = array(':ident' => $ident); |
| 686 | 686 | } else { |
| 687 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 687 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 688 | 688 | WHERE tracker_output.ident = :ident |
| 689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute($query_data); |
| 696 | - $ident_result=''; |
|
| 697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 696 | + $ident_result = ''; |
|
| 697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 698 | 698 | { |
| 699 | 699 | $ident_result = $row['ident']; |
| 700 | 700 | } |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | return false; |
| 721 | 721 | } else { |
| 722 | 722 | $q_array = explode(" ", $q); |
| 723 | - foreach ($q_array as $q_item){ |
|
| 724 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 723 | + foreach ($q_array as $q_item) { |
|
| 724 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 725 | 725 | $additional_query .= " AND ("; |
| 726 | 726 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
| 727 | 727 | $additional_query .= ")"; |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | if ($globalDBdriver == 'mysql') { |
| 732 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 732 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 733 | 733 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 734 | 734 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 735 | 735 | } else { |
| 736 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 736 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 737 | 737 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 738 | 738 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 739 | 739 | } |
@@ -806,11 +806,11 @@ discard block |
||
| 806 | 806 | * @return Array the callsign list |
| 807 | 807 | * |
| 808 | 808 | */ |
| 809 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 809 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 810 | 810 | { |
| 811 | 811 | global $globalDBdriver; |
| 812 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 813 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 812 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 813 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 814 | 814 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 815 | 815 | if ($olderthanmonths > 0) { |
| 816 | 816 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -824,28 +824,28 @@ discard block |
||
| 824 | 824 | if ($year != '') { |
| 825 | 825 | if ($globalDBdriver == 'mysql') { |
| 826 | 826 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 827 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 827 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 828 | 828 | } else { |
| 829 | 829 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 830 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 830 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | if ($month != '') { |
| 834 | 834 | if ($globalDBdriver == 'mysql') { |
| 835 | 835 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 836 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 836 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 837 | 837 | } else { |
| 838 | 838 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 839 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 839 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 840 | 840 | } |
| 841 | 841 | } |
| 842 | 842 | if ($day != '') { |
| 843 | 843 | if ($globalDBdriver == 'mysql') { |
| 844 | 844 | $query .= " AND DAY(tracker_output.date) = :day"; |
| 845 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 845 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 846 | 846 | } else { |
| 847 | 847 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
| 848 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 848 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $callsign_array = array(); |
| 858 | 858 | $temp_array = array(); |
| 859 | 859 | |
| 860 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 860 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 861 | 861 | { |
| 862 | 862 | $temp_array['callsign_icao'] = $row['ident']; |
| 863 | 863 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | $date_array = array(); |
| 910 | 910 | $temp_array = array(); |
| 911 | 911 | |
| 912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 913 | 913 | { |
| 914 | 914 | $temp_array['date_name'] = $row['date_name']; |
| 915 | 915 | $temp_array['date_count'] = $row['date_count']; |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $datetime = new DateTime(); |
| 936 | 936 | $offset = $datetime->format('P'); |
| 937 | 937 | } else $offset = '+00:00'; |
| 938 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 938 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 939 | 939 | if ($globalDBdriver == 'mysql') { |
| 940 | 940 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 941 | 941 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | $date_array = array(); |
| 957 | 957 | $temp_array = array(); |
| 958 | 958 | |
| 959 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 959 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 960 | 960 | { |
| 961 | 961 | $temp_array['date_name'] = $row['date_name']; |
| 962 | 962 | $temp_array['date_count'] = $row['date_count']; |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | $datetime = new DateTime(); |
| 982 | 982 | $offset = $datetime->format('P'); |
| 983 | 983 | } else $offset = '+00:00'; |
| 984 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 984 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 985 | 985 | if ($globalDBdriver == 'mysql') { |
| 986 | 986 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 987 | 987 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | $date_array = array(); |
| 1003 | 1003 | $temp_array = array(); |
| 1004 | 1004 | |
| 1005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $temp_array['date_name'] = $row['date_name']; |
| 1008 | 1008 | $temp_array['date_count'] = $row['date_count']; |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | $date_array = array(); |
| 1050 | 1050 | $temp_array = array(); |
| 1051 | 1051 | |
| 1052 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1052 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1053 | 1053 | { |
| 1054 | 1054 | $temp_array['month_name'] = $row['month_name']; |
| 1055 | 1055 | $temp_array['year_name'] = $row['year_name']; |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | $datetime = new DateTime(); |
| 1079 | 1079 | $offset = $datetime->format('P'); |
| 1080 | 1080 | } else $offset = '+00:00'; |
| 1081 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1081 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1082 | 1082 | if ($globalDBdriver == 'mysql') { |
| 1083 | 1083 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 1084 | 1084 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | $date_array = array(); |
| 1100 | 1100 | $temp_array = array(); |
| 1101 | 1101 | |
| 1102 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1102 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1103 | 1103 | { |
| 1104 | 1104 | $temp_array['year_name'] = $row['year_name']; |
| 1105 | 1105 | $temp_array['month_name'] = $row['month_name']; |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | * @return Array the hour list |
| 1120 | 1120 | * |
| 1121 | 1121 | */ |
| 1122 | - public function countAllHours($orderby,$filters = array()) |
|
| 1122 | + public function countAllHours($orderby, $filters = array()) |
|
| 1123 | 1123 | { |
| 1124 | 1124 | global $globalTimezone, $globalDBdriver; |
| 1125 | 1125 | if ($globalTimezone != '') { |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | $hour_array = array(); |
| 1168 | 1168 | $temp_array = array(); |
| 1169 | 1169 | |
| 1170 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1170 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $temp_array['hour_name'] = $row['hour_name']; |
| 1173 | 1173 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1189,8 +1189,8 @@ discard block |
||
| 1189 | 1189 | public function countAllHoursByDate($date, $filters = array()) |
| 1190 | 1190 | { |
| 1191 | 1191 | global $globalTimezone, $globalDBdriver; |
| 1192 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1193 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 1192 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1193 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 1194 | 1194 | if ($globalTimezone != '') { |
| 1195 | 1195 | date_default_timezone_set($globalTimezone); |
| 1196 | 1196 | $datetime = new DateTime($date); |
@@ -1198,12 +1198,12 @@ discard block |
||
| 1198 | 1198 | } else $offset = '+00:00'; |
| 1199 | 1199 | |
| 1200 | 1200 | if ($globalDBdriver == 'mysql') { |
| 1201 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1201 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1202 | 1202 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
| 1203 | 1203 | GROUP BY hour_name |
| 1204 | 1204 | ORDER BY hour_name ASC"; |
| 1205 | 1205 | } else { |
| 1206 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1206 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1207 | 1207 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 1208 | 1208 | GROUP BY hour_name |
| 1209 | 1209 | ORDER BY hour_name ASC"; |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | $hour_array = array(); |
| 1216 | 1216 | $temp_array = array(); |
| 1217 | 1217 | |
| 1218 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1218 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | $temp_array['hour_name'] = $row['hour_name']; |
| 1221 | 1221 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1237,8 +1237,8 @@ discard block |
||
| 1237 | 1237 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1238 | 1238 | { |
| 1239 | 1239 | global $globalTimezone, $globalDBdriver; |
| 1240 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1241 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1240 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1241 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1242 | 1242 | if ($globalTimezone != '') { |
| 1243 | 1243 | date_default_timezone_set($globalTimezone); |
| 1244 | 1244 | $datetime = new DateTime(); |
@@ -1246,12 +1246,12 @@ discard block |
||
| 1246 | 1246 | } else $offset = '+00:00'; |
| 1247 | 1247 | |
| 1248 | 1248 | if ($globalDBdriver == 'mysql') { |
| 1249 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1249 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1250 | 1250 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1251 | 1251 | GROUP BY hour_name |
| 1252 | 1252 | ORDER BY hour_name ASC"; |
| 1253 | 1253 | } else { |
| 1254 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1254 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1255 | 1255 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1256 | 1256 | GROUP BY hour_name |
| 1257 | 1257 | ORDER BY hour_name ASC"; |
@@ -1259,12 +1259,12 @@ discard block |
||
| 1259 | 1259 | |
| 1260 | 1260 | |
| 1261 | 1261 | $sth = $this->db->prepare($query); |
| 1262 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 1262 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 1263 | 1263 | |
| 1264 | 1264 | $hour_array = array(); |
| 1265 | 1265 | $temp_array = array(); |
| 1266 | 1266 | |
| 1267 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1267 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $temp_array['hour_name'] = $row['hour_name']; |
| 1270 | 1270 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1283,32 +1283,32 @@ discard block |
||
| 1283 | 1283 | * @return Integer the number of flights |
| 1284 | 1284 | * |
| 1285 | 1285 | */ |
| 1286 | - public function countOverallTracked($filters = array(),$year = '',$month = '') |
|
| 1286 | + public function countOverallTracked($filters = array(), $year = '', $month = '') |
|
| 1287 | 1287 | { |
| 1288 | 1288 | global $globalDBdriver; |
| 1289 | - $queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
|
| 1289 | + $queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
|
| 1290 | 1290 | $query_values = array(); |
| 1291 | 1291 | $query = ''; |
| 1292 | 1292 | if ($year != '') { |
| 1293 | 1293 | if ($globalDBdriver == 'mysql') { |
| 1294 | 1294 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1295 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1295 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1296 | 1296 | } else { |
| 1297 | 1297 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1298 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1298 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1299 | 1299 | } |
| 1300 | 1300 | } |
| 1301 | 1301 | if ($month != '') { |
| 1302 | 1302 | if ($globalDBdriver == 'mysql') { |
| 1303 | 1303 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1304 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1304 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1305 | 1305 | } else { |
| 1306 | 1306 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1307 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1307 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1308 | 1308 | } |
| 1309 | 1309 | } |
| 1310 | 1310 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1311 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1311 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1312 | 1312 | |
| 1313 | 1313 | $sth = $this->db->prepare($queryi); |
| 1314 | 1314 | $sth->execute($query_values); |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | public function countAllHoursFromToday($filters = array()) |
| 1326 | 1326 | { |
| 1327 | 1327 | global $globalTimezone, $globalDBdriver; |
| 1328 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1328 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1329 | 1329 | if ($globalTimezone != '') { |
| 1330 | 1330 | date_default_timezone_set($globalTimezone); |
| 1331 | 1331 | $datetime = new DateTime(); |
@@ -1333,12 +1333,12 @@ discard block |
||
| 1333 | 1333 | } else $offset = '+00:00'; |
| 1334 | 1334 | |
| 1335 | 1335 | if ($globalDBdriver == 'mysql') { |
| 1336 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1336 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1337 | 1337 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
| 1338 | 1338 | GROUP BY hour_name |
| 1339 | 1339 | ORDER BY hour_name ASC"; |
| 1340 | 1340 | } else { |
| 1341 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1341 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1342 | 1342 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 1343 | 1343 | GROUP BY hour_name |
| 1344 | 1344 | ORDER BY hour_name ASC"; |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | $hour_array = array(); |
| 1351 | 1351 | $temp_array = array(); |
| 1352 | 1352 | |
| 1353 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1353 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1354 | 1354 | { |
| 1355 | 1355 | $temp_array['hour_name'] = $row['hour_name']; |
| 1356 | 1356 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1369,9 +1369,9 @@ discard block |
||
| 1369 | 1369 | */ |
| 1370 | 1370 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1371 | 1371 | { |
| 1372 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 1372 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 1373 | 1373 | |
| 1374 | - $query = "SELECT tracker_output.tracker_id |
|
| 1374 | + $query = "SELECT tracker_output.tracker_id |
|
| 1375 | 1375 | FROM tracker_output |
| 1376 | 1376 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
| 1377 | 1377 | |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | $sth = $this->db->prepare($query); |
| 1380 | 1380 | $sth->execute(); |
| 1381 | 1381 | |
| 1382 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1382 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1383 | 1383 | { |
| 1384 | 1384 | return $row['tracker_id']; |
| 1385 | 1385 | } |
@@ -1404,23 +1404,23 @@ discard block |
||
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | $current_date = date("Y-m-d H:i:s"); |
| 1407 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 1407 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 1408 | 1408 | |
| 1409 | 1409 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 1410 | 1410 | |
| 1411 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 1411 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 1412 | 1412 | $years = $time_array['years']; |
| 1413 | 1413 | |
| 1414 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 1414 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 1415 | 1415 | $months = $time_array['months']; |
| 1416 | 1416 | |
| 1417 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 1417 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 1418 | 1418 | $days = $time_array['days']; |
| 1419 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 1419 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 1420 | 1420 | $hours = $time_array['hours']; |
| 1421 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 1421 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 1422 | 1422 | $minutes = $time_array['minutes']; |
| 1423 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1423 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1424 | 1424 | |
| 1425 | 1425 | return $time_array; |
| 1426 | 1426 | } |
@@ -1443,63 +1443,63 @@ discard block |
||
| 1443 | 1443 | $temp_array['direction_degree'] = $direction; |
| 1444 | 1444 | $temp_array['direction_shortname'] = "N"; |
| 1445 | 1445 | $temp_array['direction_fullname'] = "North"; |
| 1446 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 1446 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 1447 | 1447 | $temp_array['direction_degree'] = $direction; |
| 1448 | 1448 | $temp_array['direction_shortname'] = "NNE"; |
| 1449 | 1449 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 1450 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 1450 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 1451 | 1451 | $temp_array['direction_degree'] = $direction; |
| 1452 | 1452 | $temp_array['direction_shortname'] = "NE"; |
| 1453 | 1453 | $temp_array['direction_fullname'] = "Northeast"; |
| 1454 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 1454 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 1455 | 1455 | $temp_array['direction_degree'] = $direction; |
| 1456 | 1456 | $temp_array['direction_shortname'] = "ENE"; |
| 1457 | 1457 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 1458 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 1458 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 1459 | 1459 | $temp_array['direction_degree'] = $direction; |
| 1460 | 1460 | $temp_array['direction_shortname'] = "E"; |
| 1461 | 1461 | $temp_array['direction_fullname'] = "East"; |
| 1462 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 1462 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 1463 | 1463 | $temp_array['direction_degree'] = $direction; |
| 1464 | 1464 | $temp_array['direction_shortname'] = "ESE"; |
| 1465 | 1465 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 1466 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 1466 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 1467 | 1467 | $temp_array['direction_degree'] = $direction; |
| 1468 | 1468 | $temp_array['direction_shortname'] = "SE"; |
| 1469 | 1469 | $temp_array['direction_fullname'] = "Southeast"; |
| 1470 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 1470 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 1471 | 1471 | $temp_array['direction_degree'] = $direction; |
| 1472 | 1472 | $temp_array['direction_shortname'] = "SSE"; |
| 1473 | 1473 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 1474 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 1474 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 1475 | 1475 | $temp_array['direction_degree'] = $direction; |
| 1476 | 1476 | $temp_array['direction_shortname'] = "S"; |
| 1477 | 1477 | $temp_array['direction_fullname'] = "South"; |
| 1478 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 1478 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 1479 | 1479 | $temp_array['direction_degree'] = $direction; |
| 1480 | 1480 | $temp_array['direction_shortname'] = "SSW"; |
| 1481 | 1481 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 1482 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 1482 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 1483 | 1483 | $temp_array['direction_degree'] = $direction; |
| 1484 | 1484 | $temp_array['direction_shortname'] = "SW"; |
| 1485 | 1485 | $temp_array['direction_fullname'] = "Southwest"; |
| 1486 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 1486 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 1487 | 1487 | $temp_array['direction_degree'] = $direction; |
| 1488 | 1488 | $temp_array['direction_shortname'] = "WSW"; |
| 1489 | 1489 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 1490 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 1490 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 1491 | 1491 | $temp_array['direction_degree'] = $direction; |
| 1492 | 1492 | $temp_array['direction_shortname'] = "W"; |
| 1493 | 1493 | $temp_array['direction_fullname'] = "West"; |
| 1494 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 1494 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 1495 | 1495 | $temp_array['direction_degree'] = $direction; |
| 1496 | 1496 | $temp_array['direction_shortname'] = "WNW"; |
| 1497 | 1497 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 1498 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 1498 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 1499 | 1499 | $temp_array['direction_degree'] = $direction; |
| 1500 | 1500 | $temp_array['direction_shortname'] = "NW"; |
| 1501 | 1501 | $temp_array['direction_fullname'] = "Northwest"; |
| 1502 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 1502 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 1503 | 1503 | $temp_array['direction_degree'] = $direction; |
| 1504 | 1504 | $temp_array['direction_shortname'] = "NNW"; |
| 1505 | 1505 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1516,11 +1516,11 @@ discard block |
||
| 1516 | 1516 | * @param Float $longitude longitute of the flight |
| 1517 | 1517 | * @return String the countrie |
| 1518 | 1518 | */ |
| 1519 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 1519 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 1520 | 1520 | { |
| 1521 | 1521 | global $globalDBdriver, $globalDebug; |
| 1522 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1523 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1522 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1523 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1524 | 1524 | |
| 1525 | 1525 | $Connection = new Connection($this->db); |
| 1526 | 1526 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | public function getCountryFromISO2($iso2) |
| 1561 | 1561 | { |
| 1562 | 1562 | global $globalDBdriver, $globalDebug; |
| 1563 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 1563 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 1564 | 1564 | |
| 1565 | 1565 | $Connection = new Connection($this->db); |
| 1566 | 1566 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | |
| 1609 | 1609 | $bitly_data = json_decode($bitly_data); |
| 1610 | 1610 | $bitly_url = ''; |
| 1611 | - if ($bitly_data->status_txt = "OK"){ |
|
| 1611 | + if ($bitly_data->status_txt = "OK") { |
|
| 1612 | 1612 | $bitly_url = $bitly_data->data->url; |
| 1613 | 1613 | } |
| 1614 | 1614 | |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | |
| 1619 | 1619 | public function getOrderBy() |
| 1620 | 1620 | { |
| 1621 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 1621 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 1622 | 1622 | |
| 1623 | 1623 | return $orderby; |
| 1624 | 1624 | |