@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/airline/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/airline/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <li class="dropdown"> |
| 8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "airline-statistics-aircraft" || strtolower($current_page) == "airline-statistics-registration" || strtolower($current_page) == "airline-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "airline-statistics-aircraft" || strtolower($current_page) == "airline-statistics-registration" || strtolower($current_page) == "airline-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 10 | </a> |
| 11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "airline-statistics-departure-airport" || strtolower($current_page) == "airline-statistics-departure-airport-country" || strtolower($current_page) == "airline-statistics-arrival-airport" || strtolower($current_page) == "airline-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "airline-statistics-departure-airport" || strtolower($current_page) == "airline-statistics-departure-airport-country" || strtolower($current_page) == "airline-statistics-arrival-airport" || strtolower($current_page) == "airline-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <li><a href="<?php print $globalURL; ?>/airline/statistics/arrival-airport-country/<?php print $airline; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
| 26 | 26 | </ul> |
| 27 | 27 | </li> |
| 28 | - <li><a href="<?php print $globalURL; ?>/airline/statistics/route/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | - <li><a href="<?php print $globalURL; ?>/airline/statistics/time/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 28 | + <li><a href="<?php print $globalURL; ?>/airline/statistics/route/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | + <li><a href="<?php print $globalURL; ?>/airline/statistics/time/<?php print $airline; ?>" <?php if (strtolower($current_page) == "airline-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 30 | 30 | </ul> |
| 31 | 31 | </div> |
| 32 | 32 | \ No newline at end of file |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/route/<?php print $departure_airport; ?>/<?php print $arrival_airport; ?>" <?php if (strtolower($current_page) == "route-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/route/<?php print $departure_airport; ?>/<?php print $arrival_airport; ?>" <?php if (strtolower($current_page) == "route-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <li class="dropdown"> |
| 8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "route-statistics-aircraft" || strtolower($current_page) == "route-statistics-registration" || strtolower($current_page) == "route-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "route-statistics-aircraft" || strtolower($current_page) == "route-statistics-registration" || strtolower($current_page) == "route-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 10 | </a> |
| 11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "route-statistics-airline" || strtolower($current_page) == "route-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "route-statistics-airline" || strtolower($current_page) == "route-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | <li><a href="<?php print $globalURL; ?>/route/statistics/airline-country/<?php print $departure_airport; ?>/<?php print $arrival_airport; ?>"><?php echo _("Airline by Country"); ?></a></li> |
| 24 | 24 | </ul> |
| 25 | 25 | </li> |
| 26 | - <li><a href="<?php print $globalURL; ?>/route/statistics/time/<?php print $departure_airport; ?>/<?php print $arrival_airport; ?>" <?php if (strtolower($current_page) == "route-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 26 | + <li><a href="<?php print $globalURL; ?>/route/statistics/time/<?php print $departure_airport; ?>/<?php print $arrival_airport; ?>" <?php if (strtolower($current_page) == "route-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 27 | 27 | <li><a href="http://flightaware.com/live/findflight/<?php print $spotter_array[0]['departure_airport_icao']; ?>/<?php print $spotter_array[0]['arrival_airport_icao']; ?>/" target="_blank"><?php echo _("Upcoming Schedule"); ?>»</a></li> |
| 28 | 28 | </ul> |
| 29 | 29 | </div> |
| 30 | 30 | \ No newline at end of file |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/ident/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/ident/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <li class="dropdown"> |
| 8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-aircraft" || strtolower($current_page) == "ident-statistics-registration" || strtolower($current_page) == "ident-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 10 | </a> |
| 11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "ident-statistics-departure-airport" || strtolower($current_page) == "ident-statistics-departure-airport-country" || strtolower($current_page) == "ident-statistics-arrival-airport" || strtolower($current_page) == "ident-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <li><a href="<?php print $globalURL; ?>/ident/statistics/arrival-airport-country/<?php print $ident; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
| 26 | 26 | </ul> |
| 27 | 27 | </li> |
| 28 | - <li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | - <li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 28 | + <li><a href="<?php print $globalURL; ?>/ident/statistics/route/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | + <li><a href="<?php print $globalURL; ?>/ident/statistics/time/<?php print $ident; ?>" <?php if (strtolower($current_page) == "ident-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 30 | 30 | </ul> |
| 31 | 31 | </div> |
| 32 | 32 | \ No newline at end of file |
@@ -8,16 +8,16 @@ discard block |
||
| 8 | 8 | require_once('require/class.Spotter.php'); |
| 9 | 9 | require_once('require/class.Language.php'); |
| 10 | 10 | $Spotter = new Spotter(); |
| 11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 12 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
| 13 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
| 11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 12 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
| 13 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
| 14 | 14 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 15 | 15 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 16 | 16 | } else $spotter_array = array(); |
| 17 | 17 | |
| 18 | 18 | if (!empty($spotter_array)) |
| 19 | 19 | { |
| 20 | - $title = sprintf(_("Most Common Airlines between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
| 20 | + $title = sprintf(_("Most Common Airlines between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
| 21 | 21 | require_once('header.php'); |
| 22 | 22 | print '<div class="info column">'; |
| 23 | 23 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | include('route-sub-menu.php'); |
| 29 | 29 | print '<div class="column">'; |
| 30 | 30 | print '<h2>'._("Most Common Airlines").'</h2>'; |
| 31 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 31 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 32 | 32 | $airline_array = $Spotter->countAllAirlinesByRoute($departure_airport, $arrival_airport); |
| 33 | 33 | if (!empty($airline_array)) |
| 34 | 34 | { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | print '</thead>'; |
| 45 | 45 | print '<tbody>'; |
| 46 | 46 | $i = 1; |
| 47 | - foreach($airline_array as $airline_item) |
|
| 47 | + foreach ($airline_array as $airline_item) |
|
| 48 | 48 | { |
| 49 | 49 | print '<tr>'; |
| 50 | 50 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | -} else $spotter_array = array(); |
|
| 17 | +} else { |
|
| 18 | + $spotter_array = array(); |
|
| 19 | +} |
|
| 18 | 20 | |
| 19 | 21 | if (!empty($spotter_array)) |
| 20 | 22 | { |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/date/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/date/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <li class="dropdown"> |
| 8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-aircraft" || strtolower($current_page) == "date-statistics-registration" || strtolower($current_page) == "date-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-aircraft" || strtolower($current_page) == "date-statistics-registration" || strtolower($current_page) == "date-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 10 | </a> |
| 11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-airline" || strtolower($current_page) == "date-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-airline" || strtolower($current_page) == "date-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | </ul> |
| 25 | 25 | </li> |
| 26 | 26 | <li class="dropdown"> |
| 27 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-departure-airport" || strtolower($current_page) == "date-statistics-departure-airport-country" || strtolower($current_page) == "date-statistics-arrival-airport" || strtolower($current_page) == "date-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 27 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-departure-airport" || strtolower($current_page) == "date-statistics-departure-airport-country" || strtolower($current_page) == "date-statistics-arrival-airport" || strtolower($current_page) == "date-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 28 | 28 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 29 | 29 | </a> |
| 30 | 30 | <ul class="dropdown-menu" role="menu"> |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | <li><a href="<?php print $globalURL; ?>/date/statistics/arrival-airport-country/<?php print $date; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
| 35 | 35 | </ul> |
| 36 | 36 | </li> |
| 37 | - <li><a href="<?php print $globalURL; ?>/date/statistics/route/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 38 | - <li><a href="<?php print $globalURL; ?>/date/statistics/time/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 37 | + <li><a href="<?php print $globalURL; ?>/date/statistics/route/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 38 | + <li><a href="<?php print $globalURL; ?>/date/statistics/time/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 39 | 39 | </ul> |
| 40 | 40 | </div> |
| 41 | 41 | \ No newline at end of file |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | -} else $spotter_array = array(); |
|
| 17 | +} else { |
|
| 18 | + $spotter_array = array(); |
|
| 19 | +} |
|
| 18 | 20 | |
| 19 | 21 | if (!empty($spotter_array)) |
| 20 | 22 | { |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once('require/class.Language.php'); |
| 10 | 10 | |
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 13 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
| 14 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
| 12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 13 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
| 14 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | 17 | } else $spotter_array = array(); |
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Time of Day between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
| 21 | + $title = sprintf(_("Most Common Time of Day between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | include('route-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 33 | 33 | |
| 34 | 34 | $hour_array = $Spotter->countAllHoursByRoute($departure_airport, $arrival_airport); |
| 35 | 35 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | $hour_data = ''; |
| 40 | 40 | $hour_cnt = ''; |
| 41 | 41 | $last = 0; |
| 42 | - foreach($hour_array as $hour_item) |
|
| 42 | + foreach ($hour_array as $hour_item) |
|
| 43 | 43 | { |
| 44 | - while($last != $hour_item['hour_name']) { |
|
| 44 | + while ($last != $hour_item['hour_name']) { |
|
| 45 | 45 | $hour_data .= '"'.$last.':00",'; |
| 46 | 46 | $hour_cnt .= '0,'; |
| 47 | 47 | $last++; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $hour_cnt .= $hour_item['hour_count'].','; |
| 52 | 52 | } |
| 53 | 53 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
| 54 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
| 54 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
| 55 | 55 | print 'c3.generate({ |
| 56 | 56 | bindto: "#chartHour", |
| 57 | 57 | data: { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | print '</thead>'; |
| 77 | 77 | print '<tbody>'; |
| 78 | 78 | $i = 1; |
| 79 | - foreach($hour_array as $hour_item) |
|
| 79 | + foreach ($hour_array as $hour_item) |
|
| 80 | 80 | { |
| 81 | 81 | print '<tr>'; |
| 82 | 82 | print '<td>'.$hour_item['hour_name'].':00</td>'; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -759,10 +759,6 @@ discard block |
||
| 759 | 759 | * |
| 760 | 760 | * @param String $famtrackid the ID from flightaware |
| 761 | 761 | * @param String $ident the flight ident |
| 762 | - * @param String $aircraft_icao the aircraft type |
|
| 763 | - * @param String $departure_airport_icao the departure airport |
|
| 764 | - * @param String $arrival_airport_icao the arrival airport |
|
| 765 | - * @return String success or false |
|
| 766 | 762 | * |
| 767 | 763 | */ |
| 768 | 764 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Get SQL query part for filter used |
|
| 17 | - * @param Array $filter the filter |
|
| 18 | - * @return Array the SQL part |
|
| 19 | - */ |
|
| 16 | + * Get SQL query part for filter used |
|
| 17 | + * @param Array $filter the filter |
|
| 18 | + * @return Array the SQL part |
|
| 19 | + */ |
|
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * Gets all the spotter information based on the latest data entry |
|
| 91 | - * |
|
| 92 | - * @return Array the spotter information |
|
| 93 | - * |
|
| 94 | - */ |
|
| 90 | + * Gets all the spotter information based on the latest data entry |
|
| 91 | + * |
|
| 92 | + * @return Array the spotter information |
|
| 93 | + * |
|
| 94 | + */ |
|
| 95 | 95 | public function getLiveTrackerData($limit = '', $sort = '', $filter = array()) |
| 96 | 96 | { |
| 97 | 97 | global $globalDBdriver, $globalLiveInterval; |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * Gets Minimal Live Spotter data |
|
| 137 | - * |
|
| 138 | - * @return Array the spotter information |
|
| 139 | - * |
|
| 140 | - */ |
|
| 136 | + * Gets Minimal Live Spotter data |
|
| 137 | + * |
|
| 138 | + * @return Array the spotter information |
|
| 139 | + * |
|
| 140 | + */ |
|
| 141 | 141 | public function getMinLiveTrackerData($filter = array()) |
| 142 | 142 | { |
| 143 | 143 | global $globalDBdriver, $globalLiveInterval; |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 175 | - * |
|
| 176 | - * @return Array the spotter information |
|
| 177 | - * |
|
| 178 | - */ |
|
| 174 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 175 | + * |
|
| 176 | + * @return Array the spotter information |
|
| 177 | + * |
|
| 178 | + */ |
|
| 179 | 179 | public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
| 180 | 180 | { |
| 181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | - * Gets number of latest data entry |
|
| 253 | - * |
|
| 254 | - * @return String number of entry |
|
| 255 | - * |
|
| 256 | - */ |
|
| 252 | + * Gets number of latest data entry |
|
| 253 | + * |
|
| 254 | + * @return String number of entry |
|
| 255 | + * |
|
| 256 | + */ |
|
| 257 | 257 | public function getLiveTrackerCount($filter = array()) |
| 258 | 258 | { |
| 259 | 259 | global $globalDBdriver, $globalLiveInterval; |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 282 | - * |
|
| 283 | - * @return Array the spotter information |
|
| 284 | - * |
|
| 285 | - */ |
|
| 281 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 282 | + * |
|
| 283 | + * @return Array the spotter information |
|
| 284 | + * |
|
| 285 | + */ |
|
| 286 | 286 | public function getLiveTrackerDatabyCoord($coord, $filter = array()) |
| 287 | 287 | { |
| 288 | 288 | global $globalDBdriver, $globalLiveInterval; |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 310 | - * |
|
| 311 | - * @return Array the spotter information |
|
| 312 | - * |
|
| 313 | - */ |
|
| 309 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 310 | + * |
|
| 311 | + * @return Array the spotter information |
|
| 312 | + * |
|
| 313 | + */ |
|
| 314 | 314 | public function getMinLiveTrackerDatabyCoord($coord, $filter = array()) |
| 315 | 315 | { |
| 316 | 316 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -378,11 +378,11 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 382 | - * |
|
| 383 | - * @return Array the spotter information |
|
| 384 | - * |
|
| 385 | - */ |
|
| 381 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 382 | + * |
|
| 383 | + * @return Array the spotter information |
|
| 384 | + * |
|
| 385 | + */ |
|
| 386 | 386 | public function getLatestTrackerForLayar($lat, $lng, $radius, $interval) |
| 387 | 387 | { |
| 388 | 388 | $Tracker = new Tracker($this->db); |
@@ -395,142 +395,142 @@ discard block |
||
| 395 | 395 | if ($lng != '') |
| 396 | 396 | { |
| 397 | 397 | if (!is_numeric($lng)) |
| 398 | - { |
|
| 399 | - return false; |
|
| 400 | - } |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - if ($radius != '') |
|
| 404 | - { |
|
| 405 | - if (!is_numeric($radius)) |
|
| 406 | - { |
|
| 407 | - return false; |
|
| 408 | - } |
|
| 409 | - } |
|
| 398 | + { |
|
| 399 | + return false; |
|
| 400 | + } |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + if ($radius != '') |
|
| 404 | + { |
|
| 405 | + if (!is_numeric($radius)) |
|
| 406 | + { |
|
| 407 | + return false; |
|
| 408 | + } |
|
| 409 | + } |
|
| 410 | 410 | $additional_query = ''; |
| 411 | 411 | if ($interval != '') |
| 412 | - { |
|
| 413 | - if (!is_string($interval)) |
|
| 414 | - { |
|
| 415 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 416 | - return false; |
|
| 417 | - } else { |
|
| 418 | - if ($interval == '1m') |
|
| 419 | - { |
|
| 420 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 421 | - } else if ($interval == '15m'){ |
|
| 422 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
| 423 | - } |
|
| 424 | - } |
|
| 425 | - } else { |
|
| 426 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 412 | + { |
|
| 413 | + if (!is_string($interval)) |
|
| 414 | + { |
|
| 415 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 416 | + return false; |
|
| 417 | + } else { |
|
| 418 | + if ($interval == '1m') |
|
| 419 | + { |
|
| 420 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 421 | + } else if ($interval == '15m'){ |
|
| 422 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
| 423 | + } |
|
| 424 | + } |
|
| 425 | + } else { |
|
| 426 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 430 | 430 | WHERE tracker_live.latitude <> '' |
| 431 | 431 | AND tracker_live.longitude <> '' |
| 432 | 432 | ".$additional_query." |
| 433 | 433 | HAVING distance < :radius |
| 434 | 434 | ORDER BY distance"; |
| 435 | 435 | |
| 436 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 436 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 437 | 437 | |
| 438 | - return $spotter_array; |
|
| 439 | - } |
|
| 438 | + return $spotter_array; |
|
| 439 | + } |
|
| 440 | 440 | |
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * Gets all the spotter information based on a particular callsign |
|
| 444 | - * |
|
| 445 | - * @return Array the spotter information |
|
| 446 | - * |
|
| 447 | - */ |
|
| 442 | + /** |
|
| 443 | + * Gets all the spotter information based on a particular callsign |
|
| 444 | + * |
|
| 445 | + * @return Array the spotter information |
|
| 446 | + * |
|
| 447 | + */ |
|
| 448 | 448 | public function getLastLiveTrackerDataByIdent($ident) |
| 449 | 449 | { |
| 450 | 450 | $Tracker = new Tracker($this->db); |
| 451 | 451 | date_default_timezone_set('UTC'); |
| 452 | 452 | |
| 453 | 453 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 454 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 454 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 455 | 455 | |
| 456 | 456 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 457 | 457 | |
| 458 | 458 | return $spotter_array; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - /** |
|
| 462 | - * Gets all the spotter information based on a particular callsign |
|
| 463 | - * |
|
| 464 | - * @return Array the spotter information |
|
| 465 | - * |
|
| 466 | - */ |
|
| 461 | + /** |
|
| 462 | + * Gets all the spotter information based on a particular callsign |
|
| 463 | + * |
|
| 464 | + * @return Array the spotter information |
|
| 465 | + * |
|
| 466 | + */ |
|
| 467 | 467 | public function getDateLiveTrackerDataByIdent($ident,$date) |
| 468 | 468 | { |
| 469 | 469 | $Tracker = new Tracker($this->db); |
| 470 | 470 | date_default_timezone_set('UTC'); |
| 471 | 471 | |
| 472 | 472 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 473 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 473 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 474 | 474 | |
| 475 | - $date = date('c',$date); |
|
| 475 | + $date = date('c',$date); |
|
| 476 | 476 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 477 | 477 | |
| 478 | 478 | return $spotter_array; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - /** |
|
| 482 | - * Gets last spotter information based on a particular callsign |
|
| 483 | - * |
|
| 484 | - * @return Array the spotter information |
|
| 485 | - * |
|
| 486 | - */ |
|
| 481 | + /** |
|
| 482 | + * Gets last spotter information based on a particular callsign |
|
| 483 | + * |
|
| 484 | + * @return Array the spotter information |
|
| 485 | + * |
|
| 486 | + */ |
|
| 487 | 487 | public function getLastLiveTrackerDataById($id) |
| 488 | 488 | { |
| 489 | 489 | $Tracker = new Tracker($this->db); |
| 490 | 490 | date_default_timezone_set('UTC'); |
| 491 | 491 | |
| 492 | 492 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 493 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 493 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 494 | 494 | |
| 495 | 495 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
| 496 | 496 | |
| 497 | 497 | return $spotter_array; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - /** |
|
| 501 | - * Gets last spotter information based on a particular callsign |
|
| 502 | - * |
|
| 503 | - * @return Array the spotter information |
|
| 504 | - * |
|
| 505 | - */ |
|
| 500 | + /** |
|
| 501 | + * Gets last spotter information based on a particular callsign |
|
| 502 | + * |
|
| 503 | + * @return Array the spotter information |
|
| 504 | + * |
|
| 505 | + */ |
|
| 506 | 506 | public function getDateLiveTrackerDataById($id,$date) |
| 507 | 507 | { |
| 508 | 508 | $Tracker = new Tracker($this->db); |
| 509 | 509 | date_default_timezone_set('UTC'); |
| 510 | 510 | |
| 511 | 511 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 512 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 513 | - $date = date('c',$date); |
|
| 512 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 513 | + $date = date('c',$date); |
|
| 514 | 514 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 515 | 515 | |
| 516 | 516 | return $spotter_array; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - /** |
|
| 520 | - * Gets altitude information based on a particular callsign |
|
| 521 | - * |
|
| 522 | - * @return Array the spotter information |
|
| 523 | - * |
|
| 524 | - */ |
|
| 519 | + /** |
|
| 520 | + * Gets altitude information based on a particular callsign |
|
| 521 | + * |
|
| 522 | + * @return Array the spotter information |
|
| 523 | + * |
|
| 524 | + */ |
|
| 525 | 525 | public function getAltitudeLiveTrackerDataByIdent($ident) |
| 526 | 526 | { |
| 527 | 527 | |
| 528 | 528 | date_default_timezone_set('UTC'); |
| 529 | 529 | |
| 530 | 530 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 531 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 531 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 532 | 532 | |
| 533 | - try { |
|
| 533 | + try { |
|
| 534 | 534 | |
| 535 | 535 | $sth = $this->db->prepare($query); |
| 536 | 536 | $sth->execute(array(':ident' => $ident)); |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | return $spotter_array; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - /** |
|
| 547 | - * Gets all the spotter information based on a particular id |
|
| 548 | - * |
|
| 549 | - * @return Array the spotter information |
|
| 550 | - * |
|
| 551 | - */ |
|
| 546 | + /** |
|
| 547 | + * Gets all the spotter information based on a particular id |
|
| 548 | + * |
|
| 549 | + * @return Array the spotter information |
|
| 550 | + * |
|
| 551 | + */ |
|
| 552 | 552 | public function getAllLiveTrackerDataById($id,$liveinterval = false) |
| 553 | 553 | { |
| 554 | 554 | global $globalDBdriver, $globalLiveInterval; |
@@ -576,18 +576,18 @@ discard block |
||
| 576 | 576 | return $spotter_array; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - /** |
|
| 580 | - * Gets all the spotter information based on a particular ident |
|
| 581 | - * |
|
| 582 | - * @return Array the spotter information |
|
| 583 | - * |
|
| 584 | - */ |
|
| 579 | + /** |
|
| 580 | + * Gets all the spotter information based on a particular ident |
|
| 581 | + * |
|
| 582 | + * @return Array the spotter information |
|
| 583 | + * |
|
| 584 | + */ |
|
| 585 | 585 | public function getAllLiveTrackerDataByIdent($ident) |
| 586 | 586 | { |
| 587 | 587 | date_default_timezone_set('UTC'); |
| 588 | 588 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 589 | 589 | $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
| 590 | - try { |
|
| 590 | + try { |
|
| 591 | 591 | |
| 592 | 592 | $sth = $this->db->prepare($query); |
| 593 | 593 | $sth->execute(array(':ident' => $ident)); |
@@ -601,23 +601,23 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 | /** |
| 604 | - * Deletes all info in the table |
|
| 605 | - * |
|
| 606 | - * @return String success or false |
|
| 607 | - * |
|
| 608 | - */ |
|
| 604 | + * Deletes all info in the table |
|
| 605 | + * |
|
| 606 | + * @return String success or false |
|
| 607 | + * |
|
| 608 | + */ |
|
| 609 | 609 | public function deleteLiveTrackerData() |
| 610 | 610 | { |
| 611 | 611 | global $globalDBdriver; |
| 612 | 612 | if ($globalDBdriver == 'mysql') { |
| 613 | 613 | //$query = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date"; |
| 614 | 614 | $query = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date'; |
| 615 | - //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
| 615 | + //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
| 616 | 616 | } else { |
| 617 | 617 | $query = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date"; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - try { |
|
| 620 | + try { |
|
| 621 | 621 | |
| 622 | 622 | $sth = $this->db->prepare($query); |
| 623 | 623 | $sth->execute(); |
@@ -629,18 +629,18 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
| 632 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 633 | - * |
|
| 634 | - * @return String success or false |
|
| 635 | - * |
|
| 636 | - */ |
|
| 632 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 633 | + * |
|
| 634 | + * @return String success or false |
|
| 635 | + * |
|
| 636 | + */ |
|
| 637 | 637 | public function deleteLiveTrackerDataNotUpdated() |
| 638 | 638 | { |
| 639 | 639 | global $globalDBdriver, $globalDebug; |
| 640 | 640 | if ($globalDBdriver == 'mysql') { |
| 641 | 641 | //$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0'; |
| 642 | - $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 643 | - try { |
|
| 642 | + $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 643 | + try { |
|
| 644 | 644 | |
| 645 | 645 | $sth = $this->db->prepare($query); |
| 646 | 646 | $sth->execute(); |
@@ -648,8 +648,8 @@ discard block |
||
| 648 | 648 | return "error"; |
| 649 | 649 | } |
| 650 | 650 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
| 651 | - $i = 0; |
|
| 652 | - $j =0; |
|
| 651 | + $i = 0; |
|
| 652 | + $j =0; |
|
| 653 | 653 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 654 | 654 | foreach($all as $row) |
| 655 | 655 | { |
@@ -657,20 +657,20 @@ discard block |
||
| 657 | 657 | $j++; |
| 658 | 658 | if ($j == 30) { |
| 659 | 659 | if ($globalDebug) echo "."; |
| 660 | - try { |
|
| 660 | + try { |
|
| 661 | 661 | |
| 662 | 662 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 663 | 663 | $sth->execute(); |
| 664 | 664 | } catch(PDOException $e) { |
| 665 | 665 | return "error"; |
| 666 | 666 | } |
| 667 | - $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
| 668 | - $j = 0; |
|
| 667 | + $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
| 668 | + $j = 0; |
|
| 669 | 669 | } |
| 670 | 670 | $query_delete .= "'".$row['famtrackid']."',"; |
| 671 | 671 | } |
| 672 | 672 | if ($i > 0) { |
| 673 | - try { |
|
| 673 | + try { |
|
| 674 | 674 | |
| 675 | 675 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 676 | 676 | $sth->execute(); |
@@ -681,9 +681,9 @@ discard block |
||
| 681 | 681 | return "success"; |
| 682 | 682 | } elseif ($globalDBdriver == 'pgsql') { |
| 683 | 683 | //$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0"; |
| 684 | - //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 685 | - $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 686 | - try { |
|
| 684 | + //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 685 | + $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 686 | + try { |
|
| 687 | 687 | |
| 688 | 688 | $sth = $this->db->prepare($query); |
| 689 | 689 | $sth->execute(); |
@@ -727,17 +727,17 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | /** |
| 730 | - * Deletes all info in the table for an ident |
|
| 731 | - * |
|
| 732 | - * @return String success or false |
|
| 733 | - * |
|
| 734 | - */ |
|
| 730 | + * Deletes all info in the table for an ident |
|
| 731 | + * |
|
| 732 | + * @return String success or false |
|
| 733 | + * |
|
| 734 | + */ |
|
| 735 | 735 | public function deleteLiveTrackerDataByIdent($ident) |
| 736 | 736 | { |
| 737 | 737 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 738 | 738 | $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
| 739 | 739 | |
| 740 | - try { |
|
| 740 | + try { |
|
| 741 | 741 | |
| 742 | 742 | $sth = $this->db->prepare($query); |
| 743 | 743 | $sth->execute(array(':ident' => $ident)); |
@@ -749,17 +749,17 @@ discard block |
||
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | - * Deletes all info in the table for an id |
|
| 753 | - * |
|
| 754 | - * @return String success or false |
|
| 755 | - * |
|
| 756 | - */ |
|
| 752 | + * Deletes all info in the table for an id |
|
| 753 | + * |
|
| 754 | + * @return String success or false |
|
| 755 | + * |
|
| 756 | + */ |
|
| 757 | 757 | public function deleteLiveTrackerDataById($id) |
| 758 | 758 | { |
| 759 | 759 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 760 | 760 | $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
| 761 | 761 | |
| 762 | - try { |
|
| 762 | + try { |
|
| 763 | 763 | |
| 764 | 764 | $sth = $this->db->prepare($query); |
| 765 | 765 | $sth->execute(array(':id' => $id)); |
@@ -772,11 +772,11 @@ discard block |
||
| 772 | 772 | |
| 773 | 773 | |
| 774 | 774 | /** |
| 775 | - * Gets the aircraft ident within the last hour |
|
| 776 | - * |
|
| 777 | - * @return String the ident |
|
| 778 | - * |
|
| 779 | - */ |
|
| 775 | + * Gets the aircraft ident within the last hour |
|
| 776 | + * |
|
| 777 | + * @return String the ident |
|
| 778 | + * |
|
| 779 | + */ |
|
| 780 | 780 | public function getIdentFromLastHour($ident) |
| 781 | 781 | { |
| 782 | 782 | global $globalDBdriver, $globalTimezone; |
@@ -802,14 +802,14 @@ discard block |
||
| 802 | 802 | $ident_result = $row['ident']; |
| 803 | 803 | } |
| 804 | 804 | return $ident_result; |
| 805 | - } |
|
| 805 | + } |
|
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | - * Check recent aircraft |
|
| 809 | - * |
|
| 810 | - * @return String the ident |
|
| 811 | - * |
|
| 812 | - */ |
|
| 808 | + * Check recent aircraft |
|
| 809 | + * |
|
| 810 | + * @return String the ident |
|
| 811 | + * |
|
| 812 | + */ |
|
| 813 | 813 | public function checkIdentRecent($ident) |
| 814 | 814 | { |
| 815 | 815 | global $globalDBdriver, $globalTimezone; |
@@ -835,14 +835,14 @@ discard block |
||
| 835 | 835 | $ident_result = $row['famtrackid']; |
| 836 | 836 | } |
| 837 | 837 | return $ident_result; |
| 838 | - } |
|
| 838 | + } |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | - * Check recent aircraft by id |
|
| 842 | - * |
|
| 843 | - * @return String the ident |
|
| 844 | - * |
|
| 845 | - */ |
|
| 841 | + * Check recent aircraft by id |
|
| 842 | + * |
|
| 843 | + * @return String the ident |
|
| 844 | + * |
|
| 845 | + */ |
|
| 846 | 846 | public function checkIdRecent($id) |
| 847 | 847 | { |
| 848 | 848 | global $globalDBdriver, $globalTimezone; |
@@ -868,19 +868,19 @@ discard block |
||
| 868 | 868 | $ident_result = $row['famtrackid']; |
| 869 | 869 | } |
| 870 | 870 | return $ident_result; |
| 871 | - } |
|
| 871 | + } |
|
| 872 | 872 | |
| 873 | 873 | /** |
| 874 | - * Adds a new spotter data |
|
| 875 | - * |
|
| 876 | - * @param String $famtrackid the ID from flightaware |
|
| 877 | - * @param String $ident the flight ident |
|
| 878 | - * @param String $aircraft_icao the aircraft type |
|
| 879 | - * @param String $departure_airport_icao the departure airport |
|
| 880 | - * @param String $arrival_airport_icao the arrival airport |
|
| 881 | - * @return String success or false |
|
| 882 | - * |
|
| 883 | - */ |
|
| 874 | + * Adds a new spotter data |
|
| 875 | + * |
|
| 876 | + * @param String $famtrackid the ID from flightaware |
|
| 877 | + * @param String $ident the flight ident |
|
| 878 | + * @param String $aircraft_icao the aircraft type |
|
| 879 | + * @param String $departure_airport_icao the departure airport |
|
| 880 | + * @param String $arrival_airport_icao the arrival airport |
|
| 881 | + * @return String success or false |
|
| 882 | + * |
|
| 883 | + */ |
|
| 884 | 884 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
| 885 | 885 | { |
| 886 | 886 | global $globalURL, $globalArchive, $globalDebug; |
@@ -953,8 +953,8 @@ discard block |
||
| 953 | 953 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 954 | 954 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 955 | 955 | |
| 956 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 957 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 956 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 957 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 958 | 958 | |
| 959 | 959 | $query = ''; |
| 960 | 960 | if ($globalArchive) { |
@@ -972,15 +972,15 @@ discard block |
||
| 972 | 972 | } catch(PDOException $e) { |
| 973 | 973 | return "error : ".$e->getMessage(); |
| 974 | 974 | } |
| 975 | - /* |
|
| 975 | + /* |
|
| 976 | 976 | echo 'putinarchive : '.$putinarchive."\n"; |
| 977 | 977 | echo 'noarchive : '.$noarchive."\n"; |
| 978 | 978 | */ |
| 979 | 979 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 980 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 981 | - $TrackerArchive = new TrackerArchive($this->db); |
|
| 982 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 983 | - if ($globalDebug) echo $result.')'; |
|
| 980 | + if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 981 | + $TrackerArchive = new TrackerArchive($this->db); |
|
| 982 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 983 | + if ($globalDebug) echo $result.')'; |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | return "success"; |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (TrackerLive)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (TrackerLive)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -77,8 +81,11 @@ discard block |
||
| 77 | 81 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 78 | 82 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 79 | 83 | } |
| 80 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 81 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 84 | + if ($filter_query_where == '' && $where) { |
|
| 85 | + $filter_query_where = ' WHERE'; |
|
| 86 | + } elseif ($filter_query_where != '' && $and) { |
|
| 87 | + $filter_query_where .= ' AND'; |
|
| 88 | + } |
|
| 82 | 89 | if ($filter_query_where != '') { |
| 83 | 90 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 84 | 91 | } |
@@ -120,7 +127,9 @@ discard block |
||
| 120 | 127 | } |
| 121 | 128 | } |
| 122 | 129 | |
| 123 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 130 | + if (!isset($globalLiveInterval)) { |
|
| 131 | + $globalLiveInterval = '200'; |
|
| 132 | + } |
|
| 124 | 133 | if ($globalDBdriver == 'mysql') { |
| 125 | 134 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
| 126 | 135 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -145,7 +154,9 @@ discard block |
||
| 145 | 154 | |
| 146 | 155 | $filter_query = $this->getFilter($filter,true,true); |
| 147 | 156 | |
| 148 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 157 | + if (!isset($globalLiveInterval)) { |
|
| 158 | + $globalLiveInterval = '200'; |
|
| 159 | + } |
|
| 149 | 160 | if ($globalDBdriver == 'mysql') { |
| 150 | 161 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 151 | 162 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -190,50 +201,74 @@ discard block |
||
| 190 | 201 | } |
| 191 | 202 | $filter_query = $this->getFilter($filter,true,true); |
| 192 | 203 | |
| 193 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 194 | - if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
|
| 204 | + if (!isset($globalLiveInterval)) { |
|
| 205 | + $globalLiveInterval = '200'; |
|
| 206 | + } |
|
| 207 | + if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') { |
|
| 208 | + $globalMap3DTrackersLimit = '300'; |
|
| 209 | + } |
|
| 195 | 210 | if ($globalDBdriver == 'mysql') { |
| 196 | 211 | if (isset($globalArchive) && $globalArchive) { |
| 197 | 212 | $query = "SELECT * FROM ( |
| 198 | 213 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 199 | 214 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 200 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 215 | + if ($usecoord) { |
|
| 216 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 217 | + } |
|
| 201 | 218 | $query .= "UNION |
| 202 | 219 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 203 | 220 | FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
| 204 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 221 | + if ($usecoord) { |
|
| 222 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 223 | + } |
|
| 205 | 224 | $query .= ") AS tracker |
| 206 | 225 | WHERE latitude <> '0' AND longitude <> '0' |
| 207 | 226 | ORDER BY famtrackid, date"; |
| 208 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 227 | + if ($limit) { |
|
| 228 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 229 | + } |
|
| 209 | 230 | } else { |
| 210 | 231 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 211 | 232 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
| 212 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 233 | + if ($usecoord) { |
|
| 234 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 235 | + } |
|
| 213 | 236 | $query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
| 214 | 237 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 215 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 238 | + if ($limit) { |
|
| 239 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 240 | + } |
|
| 216 | 241 | } |
| 217 | 242 | } else { |
| 218 | 243 | if (isset($globalArchive) && $globalArchive) { |
| 219 | 244 | $query = "SELECT * FROM ( |
| 220 | 245 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 221 | 246 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 222 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 247 | + if ($usecoord) { |
|
| 248 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 249 | + } |
|
| 223 | 250 | $query .= "UNION |
| 224 | 251 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 225 | 252 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date"; |
| 226 | - if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 253 | + if ($usecoord) { |
|
| 254 | + $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 255 | + } |
|
| 227 | 256 | $query .= ") AS tracker |
| 228 | 257 | WHERE latitude <> '0' AND longitude <> '0' |
| 229 | 258 | ORDER BY famtrackid, date"; |
| 230 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 259 | + if ($limit) { |
|
| 260 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 261 | + } |
|
| 231 | 262 | } else { |
| 232 | 263 | $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 233 | 264 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' "; |
| 234 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 265 | + if ($usecoord) { |
|
| 266 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 267 | + } |
|
| 235 | 268 | $query .= "ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 236 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 269 | + if ($limit) { |
|
| 270 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 271 | + } |
|
| 237 | 272 | } |
| 238 | 273 | } |
| 239 | 274 | |
@@ -259,7 +294,9 @@ discard block |
||
| 259 | 294 | global $globalDBdriver, $globalLiveInterval; |
| 260 | 295 | $filter_query = $this->getFilter($filter,true,true); |
| 261 | 296 | |
| 262 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 297 | + if (!isset($globalLiveInterval)) { |
|
| 298 | + $globalLiveInterval = '200'; |
|
| 299 | + } |
|
| 263 | 300 | if ($globalDBdriver == 'mysql') { |
| 264 | 301 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 265 | 302 | } else { |
@@ -287,7 +324,9 @@ discard block |
||
| 287 | 324 | { |
| 288 | 325 | global $globalDBdriver, $globalLiveInterval; |
| 289 | 326 | $Tracker = new Tracker($this->db); |
| 290 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 327 | + if (!isset($globalLiveInterval)) { |
|
| 328 | + $globalLiveInterval = '200'; |
|
| 329 | + } |
|
| 291 | 330 | $filter_query = $this->getFilter($filter); |
| 292 | 331 | |
| 293 | 332 | if (is_array($coord)) { |
@@ -295,7 +334,9 @@ discard block |
||
| 295 | 334 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 296 | 335 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 297 | 336 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 298 | - } else return array(); |
|
| 337 | + } else { |
|
| 338 | + return array(); |
|
| 339 | + } |
|
| 299 | 340 | if ($globalDBdriver == 'mysql') { |
| 300 | 341 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
| 301 | 342 | } else { |
@@ -315,7 +356,9 @@ discard block |
||
| 315 | 356 | { |
| 316 | 357 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 317 | 358 | $Tracker = new Tracker($this->db); |
| 318 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 359 | + if (!isset($globalLiveInterval)) { |
|
| 360 | + $globalLiveInterval = '200'; |
|
| 361 | + } |
|
| 319 | 362 | $filter_query = $this->getFilter($filter,true,true); |
| 320 | 363 | |
| 321 | 364 | if (is_array($coord)) { |
@@ -323,7 +366,9 @@ discard block |
||
| 323 | 366 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 324 | 367 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 325 | 368 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 326 | - } else return array(); |
|
| 369 | + } else { |
|
| 370 | + return array(); |
|
| 371 | + } |
|
| 327 | 372 | /* |
| 328 | 373 | if ($globalDBdriver == 'mysql') { |
| 329 | 374 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
@@ -557,13 +602,19 @@ discard block |
||
| 557 | 602 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
| 558 | 603 | if ($globalDBdriver == 'mysql') { |
| 559 | 604 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 560 | - if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 561 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 605 | + if ($liveinterval === true) { |
|
| 606 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 607 | + } elseif ($liveinterval !== false) { |
|
| 608 | + $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 609 | + } |
|
| 562 | 610 | $query .= ' ORDER BY date'; |
| 563 | 611 | } else { |
| 564 | 612 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 565 | - if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 566 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 613 | + if ($liveinterval === true) { |
|
| 614 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 615 | + } elseif ($liveinterval !== false) { |
|
| 616 | + $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 617 | + } |
|
| 567 | 618 | $query .= ' ORDER BY date'; |
| 568 | 619 | } |
| 569 | 620 | |
@@ -658,7 +709,9 @@ discard block |
||
| 658 | 709 | $i++; |
| 659 | 710 | $j++; |
| 660 | 711 | if ($j == 30) { |
| 661 | - if ($globalDebug) echo "."; |
|
| 712 | + if ($globalDebug) { |
|
| 713 | + echo "."; |
|
| 714 | + } |
|
| 662 | 715 | try { |
| 663 | 716 | |
| 664 | 717 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -905,7 +958,9 @@ discard block |
||
| 905 | 958 | { |
| 906 | 959 | return false; |
| 907 | 960 | } |
| 908 | - } else return ''; |
|
| 961 | + } else { |
|
| 962 | + return ''; |
|
| 963 | + } |
|
| 909 | 964 | |
| 910 | 965 | if ($longitude != '') |
| 911 | 966 | { |
@@ -913,7 +968,9 @@ discard block |
||
| 913 | 968 | { |
| 914 | 969 | return false; |
| 915 | 970 | } |
| 916 | - } else return ''; |
|
| 971 | + } else { |
|
| 972 | + return ''; |
|
| 973 | + } |
|
| 917 | 974 | |
| 918 | 975 | if ($altitude != '') |
| 919 | 976 | { |
@@ -921,7 +978,9 @@ discard block |
||
| 921 | 978 | { |
| 922 | 979 | return false; |
| 923 | 980 | } |
| 924 | - } else $altitude = 0; |
|
| 981 | + } else { |
|
| 982 | + $altitude = 0; |
|
| 983 | + } |
|
| 925 | 984 | |
| 926 | 985 | if ($heading != '') |
| 927 | 986 | { |
@@ -929,7 +988,9 @@ discard block |
||
| 929 | 988 | { |
| 930 | 989 | return false; |
| 931 | 990 | } |
| 932 | - } else $heading = 0; |
|
| 991 | + } else { |
|
| 992 | + $heading = 0; |
|
| 993 | + } |
|
| 933 | 994 | |
| 934 | 995 | if ($groundspeed != '') |
| 935 | 996 | { |
@@ -937,9 +998,13 @@ discard block |
||
| 937 | 998 | { |
| 938 | 999 | return false; |
| 939 | 1000 | } |
| 940 | - } else $groundspeed = 0; |
|
| 1001 | + } else { |
|
| 1002 | + $groundspeed = 0; |
|
| 1003 | + } |
|
| 941 | 1004 | date_default_timezone_set('UTC'); |
| 942 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1005 | + if ($date == '') { |
|
| 1006 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1007 | + } |
|
| 943 | 1008 | |
| 944 | 1009 | |
| 945 | 1010 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -955,12 +1020,18 @@ discard block |
||
| 955 | 1020 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 956 | 1021 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 957 | 1022 | |
| 958 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 959 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1023 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1024 | + $groundspeed = 0; |
|
| 1025 | + } |
|
| 1026 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1027 | + $heading = 0; |
|
| 1028 | + } |
|
| 960 | 1029 | |
| 961 | 1030 | $query = ''; |
| 962 | 1031 | if ($globalArchive) { |
| 963 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1032 | + if ($globalDebug) { |
|
| 1033 | + echo '-- Delete previous data -- '; |
|
| 1034 | + } |
|
| 964 | 1035 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; |
| 965 | 1036 | } |
| 966 | 1037 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
@@ -979,10 +1050,14 @@ discard block |
||
| 979 | 1050 | echo 'noarchive : '.$noarchive."\n"; |
| 980 | 1051 | */ |
| 981 | 1052 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 982 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 1053 | + if ($globalDebug) { |
|
| 1054 | + echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 1055 | + } |
|
| 983 | 1056 | $TrackerArchive = new TrackerArchive($this->db); |
| 984 | 1057 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
| 985 | - if ($globalDebug) echo $result.')'; |
|
| 1058 | + if ($globalDebug) { |
|
| 1059 | + echo $result.')'; |
|
| 1060 | + } |
|
| 986 | 1061 | } |
| 987 | 1062 | |
| 988 | 1063 | return "success"; |
@@ -17,33 +17,33 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 38 | 38 | if (isset($flt['source'])) { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 40 | 40 | } else { |
| 41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 78 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 79 | 79 | } |
| 80 | 80 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 81 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 81 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 82 | 82 | } |
| 83 | 83 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 84 | 84 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 85 | 85 | if ($filter_query_where != '') { |
| 86 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 86 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 87 | 87 | } |
| 88 | 88 | $filter_query = $filter_query_join.$filter_query_where; |
| 89 | 89 | return $filter_query; |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | if ($limit != '') |
| 107 | 107 | { |
| 108 | 108 | $limit_array = explode(',', $limit); |
| 109 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 110 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 109 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 110 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 111 | 111 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 112 | 112 | { |
| 113 | 113 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } else { |
| 131 | 131 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
| 132 | 132 | } |
| 133 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 133 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 134 | 134 | |
| 135 | 135 | return $spotter_array; |
| 136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | global $globalDBdriver, $globalLiveInterval; |
| 147 | 147 | date_default_timezone_set('UTC'); |
| 148 | 148 | |
| 149 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 149 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 150 | 150 | |
| 151 | 151 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 152 | 152 | if ($globalDBdriver == 'mysql') { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | try { |
| 165 | 165 | $sth = $this->db->prepare($query); |
| 166 | 166 | $sth->execute(); |
| 167 | - } catch(PDOException $e) { |
|
| 167 | + } catch (PDOException $e) { |
|
| 168 | 168 | echo $e->getMessage(); |
| 169 | 169 | die; |
| 170 | 170 | } |
@@ -179,25 +179,25 @@ discard block |
||
| 179 | 179 | * @return Array the spotter information |
| 180 | 180 | * |
| 181 | 181 | */ |
| 182 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
| 182 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
| 183 | 183 | { |
| 184 | 184 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
| 185 | 185 | date_default_timezone_set('UTC'); |
| 186 | 186 | $usecoord = false; |
| 187 | 187 | if (is_array($coord) && !empty($coord)) { |
| 188 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 189 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 190 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 191 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 188 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 189 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 190 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 191 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 192 | 192 | $usecoord = true; |
| 193 | 193 | } |
| 194 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 194 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 195 | 195 | |
| 196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 197 | 197 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
| 198 | 198 | if ($globalDBdriver == 'mysql') { |
| 199 | 199 | if (isset($globalArchive) && $globalArchive) { |
| 200 | - $query = "SELECT * FROM ( |
|
| 200 | + $query = "SELECT * FROM ( |
|
| 201 | 201 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 202 | 202 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 203 | 203 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } else { |
| 221 | 221 | if (isset($globalArchive) && $globalArchive) { |
| 222 | - $query = "SELECT * FROM ( |
|
| 222 | + $query = "SELECT * FROM ( |
|
| 223 | 223 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 224 | 224 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 225 | 225 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | try { |
| 244 | 244 | $sth = $this->db->prepare($query); |
| 245 | 245 | $sth->execute(); |
| 246 | - } catch(PDOException $e) { |
|
| 246 | + } catch (PDOException $e) { |
|
| 247 | 247 | echo $e->getMessage(); |
| 248 | 248 | die; |
| 249 | 249 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | public function getLiveTrackerCount($filter = array()) |
| 261 | 261 | { |
| 262 | 262 | global $globalDBdriver, $globalLiveInterval; |
| 263 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 263 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 264 | 264 | |
| 265 | 265 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 266 | 266 | if ($globalDBdriver == 'mysql') { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | try { |
| 272 | 272 | $sth = $this->db->prepare($query); |
| 273 | 273 | $sth->execute(); |
| 274 | - } catch(PDOException $e) { |
|
| 274 | + } catch (PDOException $e) { |
|
| 275 | 275 | echo $e->getMessage(); |
| 276 | 276 | die; |
| 277 | 277 | } |
@@ -294,10 +294,10 @@ discard block |
||
| 294 | 294 | $filter_query = $this->getFilter($filter); |
| 295 | 295 | |
| 296 | 296 | if (is_array($coord)) { |
| 297 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 298 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 299 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 300 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 297 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 298 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 299 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 300 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 301 | 301 | } else return array(); |
| 302 | 302 | if ($globalDBdriver == 'mysql') { |
| 303 | 303 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 320 | 320 | $Tracker = new Tracker($this->db); |
| 321 | 321 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 322 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 322 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 323 | 323 | |
| 324 | 324 | if (is_array($coord)) { |
| 325 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 326 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 327 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 328 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 325 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 326 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 327 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 328 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 329 | 329 | } else return array(); |
| 330 | 330 | /* |
| 331 | 331 | if ($globalDBdriver == 'mysql') { |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | if ($globalDBdriver == 'mysql') { |
| 341 | 341 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 342 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 342 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 343 | 343 | FROM tracker_live |
| 344 | 344 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= tracker_live.date |
| 345 | 345 | AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 346 | 346 | AND tracker_live.latitude <> 0 AND tracker_live.longitude <> 0 ORDER BY date DESC'; |
| 347 | 347 | } else { |
| 348 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 348 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 349 | 349 | FROM tracker_live |
| 350 | 350 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
| 351 | 351 | FROM tracker_live l |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } else { |
| 359 | 359 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 360 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 360 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 361 | 361 | FROM tracker_live |
| 362 | 362 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date |
| 363 | 363 | AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 364 | 364 | AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 365 | 365 | AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ORDER BY date DESC"; |
| 366 | 366 | } else { |
| 367 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 367 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 368 | 368 | FROM tracker_live |
| 369 | 369 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
| 370 | 370 | FROM tracker_live l |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | if ($interval == '1m') |
| 422 | 422 | { |
| 423 | 423 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 424 | - } else if ($interval == '15m'){ |
|
| 424 | + } else if ($interval == '15m') { |
|
| 425 | 425 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -429,14 +429,14 @@ discard block |
||
| 429 | 429 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 432 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 433 | 433 | WHERE tracker_live.latitude <> '' |
| 434 | 434 | AND tracker_live.longitude <> '' |
| 435 | 435 | ".$additional_query." |
| 436 | 436 | HAVING distance < :radius |
| 437 | 437 | ORDER BY distance"; |
| 438 | 438 | |
| 439 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 439 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 440 | 440 | |
| 441 | 441 | return $spotter_array; |
| 442 | 442 | } |
@@ -454,9 +454,9 @@ discard block |
||
| 454 | 454 | date_default_timezone_set('UTC'); |
| 455 | 455 | |
| 456 | 456 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 457 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 457 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 458 | 458 | |
| 459 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 459 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 460 | 460 | |
| 461 | 461 | return $spotter_array; |
| 462 | 462 | } |
@@ -467,16 +467,16 @@ discard block |
||
| 467 | 467 | * @return Array the spotter information |
| 468 | 468 | * |
| 469 | 469 | */ |
| 470 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
| 470 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
| 471 | 471 | { |
| 472 | 472 | $Tracker = new Tracker($this->db); |
| 473 | 473 | date_default_timezone_set('UTC'); |
| 474 | 474 | |
| 475 | 475 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 476 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 476 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 477 | 477 | |
| 478 | - $date = date('c',$date); |
|
| 479 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 478 | + $date = date('c', $date); |
|
| 479 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 480 | 480 | |
| 481 | 481 | return $spotter_array; |
| 482 | 482 | } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | date_default_timezone_set('UTC'); |
| 494 | 494 | |
| 495 | 495 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 496 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 496 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 497 | 497 | |
| 498 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 498 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 499 | 499 | |
| 500 | 500 | return $spotter_array; |
| 501 | 501 | } |
@@ -506,15 +506,15 @@ discard block |
||
| 506 | 506 | * @return Array the spotter information |
| 507 | 507 | * |
| 508 | 508 | */ |
| 509 | - public function getDateLiveTrackerDataById($id,$date) |
|
| 509 | + public function getDateLiveTrackerDataById($id, $date) |
|
| 510 | 510 | { |
| 511 | 511 | $Tracker = new Tracker($this->db); |
| 512 | 512 | date_default_timezone_set('UTC'); |
| 513 | 513 | |
| 514 | 514 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 515 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 516 | - $date = date('c',$date); |
|
| 517 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 515 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 516 | + $date = date('c', $date); |
|
| 517 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 518 | 518 | |
| 519 | 519 | return $spotter_array; |
| 520 | 520 | } |
@@ -531,13 +531,13 @@ discard block |
||
| 531 | 531 | date_default_timezone_set('UTC'); |
| 532 | 532 | |
| 533 | 533 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 534 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 534 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 535 | 535 | |
| 536 | 536 | try { |
| 537 | 537 | |
| 538 | 538 | $sth = $this->db->prepare($query); |
| 539 | 539 | $sth->execute(array(':ident' => $ident)); |
| 540 | - } catch(PDOException $e) { |
|
| 540 | + } catch (PDOException $e) { |
|
| 541 | 541 | echo $e->getMessage(); |
| 542 | 542 | die; |
| 543 | 543 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * @return Array the spotter information |
| 553 | 553 | * |
| 554 | 554 | */ |
| 555 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
| 555 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
| 556 | 556 | { |
| 557 | 557 | global $globalDBdriver, $globalLiveInterval; |
| 558 | 558 | date_default_timezone_set('UTC'); |
@@ -561,19 +561,19 @@ discard block |
||
| 561 | 561 | if ($globalDBdriver == 'mysql') { |
| 562 | 562 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 563 | 563 | if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 564 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 564 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
| 565 | 565 | $query .= ' ORDER BY date'; |
| 566 | 566 | } else { |
| 567 | 567 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 568 | 568 | if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
| 569 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 569 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
| 570 | 570 | $query .= ' ORDER BY date'; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | try { |
| 574 | 574 | $sth = $this->db->prepare($query); |
| 575 | 575 | $sth->execute(array(':id' => $id)); |
| 576 | - } catch(PDOException $e) { |
|
| 576 | + } catch (PDOException $e) { |
|
| 577 | 577 | echo $e->getMessage(); |
| 578 | 578 | die; |
| 579 | 579 | } |
@@ -591,12 +591,12 @@ discard block |
||
| 591 | 591 | { |
| 592 | 592 | date_default_timezone_set('UTC'); |
| 593 | 593 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 594 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 594 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 595 | 595 | try { |
| 596 | 596 | |
| 597 | 597 | $sth = $this->db->prepare($query); |
| 598 | 598 | $sth->execute(array(':ident' => $ident)); |
| 599 | - } catch(PDOException $e) { |
|
| 599 | + } catch (PDOException $e) { |
|
| 600 | 600 | echo $e->getMessage(); |
| 601 | 601 | die; |
| 602 | 602 | } |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | $sth = $this->db->prepare($query); |
| 628 | 628 | $sth->execute(); |
| 629 | - } catch(PDOException $e) { |
|
| 629 | + } catch (PDOException $e) { |
|
| 630 | 630 | return "error"; |
| 631 | 631 | } |
| 632 | 632 | |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | $sth = $this->db->prepare($query); |
| 651 | 651 | $sth->execute(); |
| 652 | - } catch(PDOException $e) { |
|
| 652 | + } catch (PDOException $e) { |
|
| 653 | 653 | return "error"; |
| 654 | 654 | } |
| 655 | 655 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
| 656 | 656 | $i = 0; |
| 657 | - $j =0; |
|
| 657 | + $j = 0; |
|
| 658 | 658 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 659 | - foreach($all as $row) |
|
| 659 | + foreach ($all as $row) |
|
| 660 | 660 | { |
| 661 | 661 | $i++; |
| 662 | 662 | $j++; |
@@ -664,9 +664,9 @@ discard block |
||
| 664 | 664 | if ($globalDebug) echo "."; |
| 665 | 665 | try { |
| 666 | 666 | |
| 667 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 667 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 668 | 668 | $sth->execute(); |
| 669 | - } catch(PDOException $e) { |
|
| 669 | + } catch (PDOException $e) { |
|
| 670 | 670 | return "error"; |
| 671 | 671 | } |
| 672 | 672 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | if ($i > 0) { |
| 678 | 678 | try { |
| 679 | 679 | |
| 680 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 680 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 681 | 681 | $sth->execute(); |
| 682 | - } catch(PDOException $e) { |
|
| 682 | + } catch (PDOException $e) { |
|
| 683 | 683 | return "error"; |
| 684 | 684 | } |
| 685 | 685 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | |
| 693 | 693 | $sth = $this->db->prepare($query); |
| 694 | 694 | $sth->execute(); |
| 695 | - } catch(PDOException $e) { |
|
| 695 | + } catch (PDOException $e) { |
|
| 696 | 696 | return "error"; |
| 697 | 697 | } |
| 698 | 698 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -740,13 +740,13 @@ discard block |
||
| 740 | 740 | public function deleteLiveTrackerDataByIdent($ident) |
| 741 | 741 | { |
| 742 | 742 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 743 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 743 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 744 | 744 | |
| 745 | 745 | try { |
| 746 | 746 | |
| 747 | 747 | $sth = $this->db->prepare($query); |
| 748 | 748 | $sth->execute(array(':ident' => $ident)); |
| 749 | - } catch(PDOException $e) { |
|
| 749 | + } catch (PDOException $e) { |
|
| 750 | 750 | return "error"; |
| 751 | 751 | } |
| 752 | 752 | |
@@ -762,13 +762,13 @@ discard block |
||
| 762 | 762 | public function deleteLiveTrackerDataById($id) |
| 763 | 763 | { |
| 764 | 764 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 765 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 765 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 766 | 766 | |
| 767 | 767 | try { |
| 768 | 768 | |
| 769 | 769 | $sth = $this->db->prepare($query); |
| 770 | 770 | $sth->execute(array(':id' => $id)); |
| 771 | - } catch(PDOException $e) { |
|
| 771 | + } catch (PDOException $e) { |
|
| 772 | 772 | return "error"; |
| 773 | 773 | } |
| 774 | 774 | |
@@ -786,13 +786,13 @@ discard block |
||
| 786 | 786 | { |
| 787 | 787 | global $globalDBdriver, $globalTimezone; |
| 788 | 788 | if ($globalDBdriver == 'mysql') { |
| 789 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 789 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 790 | 790 | WHERE tracker_live.ident = :ident |
| 791 | 791 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 792 | 792 | AND tracker_live.date < UTC_TIMESTAMP()'; |
| 793 | 793 | $query_data = array(':ident' => $ident); |
| 794 | 794 | } else { |
| 795 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 795 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 796 | 796 | WHERE tracker_live.ident = :ident |
| 797 | 797 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 798 | 798 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -801,8 +801,8 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | $sth = $this->db->prepare($query); |
| 803 | 803 | $sth->execute($query_data); |
| 804 | - $ident_result=''; |
|
| 805 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 804 | + $ident_result = ''; |
|
| 805 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 806 | 806 | { |
| 807 | 807 | $ident_result = $row['ident']; |
| 808 | 808 | } |
@@ -819,13 +819,13 @@ discard block |
||
| 819 | 819 | { |
| 820 | 820 | global $globalDBdriver, $globalTimezone; |
| 821 | 821 | if ($globalDBdriver == 'mysql') { |
| 822 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 822 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 823 | 823 | WHERE tracker_live.ident = :ident |
| 824 | 824 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 825 | 825 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 826 | 826 | $query_data = array(':ident' => $ident); |
| 827 | 827 | } else { |
| 828 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 828 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 829 | 829 | WHERE tracker_live.ident = :ident |
| 830 | 830 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 831 | 831 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -834,8 +834,8 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | $sth = $this->db->prepare($query); |
| 836 | 836 | $sth->execute($query_data); |
| 837 | - $ident_result=''; |
|
| 838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 837 | + $ident_result = ''; |
|
| 838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 839 | 839 | { |
| 840 | 840 | $ident_result = $row['famtrackid']; |
| 841 | 841 | } |
@@ -852,13 +852,13 @@ discard block |
||
| 852 | 852 | { |
| 853 | 853 | global $globalDBdriver, $globalTimezone; |
| 854 | 854 | if ($globalDBdriver == 'mysql') { |
| 855 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 855 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 856 | 856 | WHERE tracker_live.famtrackid = :id |
| 857 | 857 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 858 | 858 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 859 | 859 | $query_data = array(':id' => $id); |
| 860 | 860 | } else { |
| 861 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 861 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 862 | 862 | WHERE tracker_live.famtrackid = :id |
| 863 | 863 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 864 | 864 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | $sth = $this->db->prepare($query); |
| 869 | 869 | $sth->execute($query_data); |
| 870 | - $ident_result=''; |
|
| 871 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 870 | + $ident_result = ''; |
|
| 871 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 872 | 872 | { |
| 873 | 873 | $ident_result = $row['famtrackid']; |
| 874 | 874 | } |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | * @return String success or false |
| 887 | 887 | * |
| 888 | 888 | */ |
| 889 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 889 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 890 | 890 | { |
| 891 | 891 | global $globalURL, $globalArchive, $globalDebug; |
| 892 | 892 | $Common = new Common(); |
@@ -945,21 +945,21 @@ discard block |
||
| 945 | 945 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 946 | 946 | |
| 947 | 947 | |
| 948 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 949 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 950 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 951 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 952 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 953 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 954 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 955 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 956 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 957 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 958 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 959 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 960 | - |
|
| 961 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 962 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 948 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 949 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 950 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 951 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 952 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 953 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 954 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 955 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 956 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 957 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 958 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 959 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 960 | + |
|
| 961 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 962 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 963 | 963 | |
| 964 | 964 | $query = ''; |
| 965 | 965 | if ($globalArchive) { |
@@ -969,12 +969,12 @@ discard block |
||
| 969 | 969 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
| 970 | 970 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
| 971 | 971 | |
| 972 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
| 972 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
| 973 | 973 | try { |
| 974 | 974 | $sth = $this->db->prepare($query); |
| 975 | 975 | $sth->execute($query_values); |
| 976 | 976 | $sth->closeCursor(); |
| 977 | - } catch(PDOException $e) { |
|
| 977 | + } catch (PDOException $e) { |
|
| 978 | 978 | return "error : ".$e->getMessage(); |
| 979 | 979 | } |
| 980 | 980 | /* |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 985 | 985 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
| 986 | 986 | $TrackerArchive = new TrackerArchive($this->db); |
| 987 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 987 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
| 988 | 988 | if ($globalDebug) echo $result.')'; |
| 989 | 989 | } |
| 990 | 990 | |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | public function getOrderBy() |
| 996 | 996 | { |
| 997 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
| 997 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
| 998 | 998 | return $orderby; |
| 999 | 999 | } |
| 1000 | 1000 | |
@@ -63,7 +63,9 @@ |
||
| 63 | 63 | { |
| 64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 66 | - } else $image = $spotter_item['image_thumbnail']; |
|
| 66 | + } else { |
|
| 67 | + $image = $spotter_item['image_thumbnail']; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | } |
| 69 | 71 | /* else { |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | print '<div class="details">'; |
| 79 | 79 | print '<div><span>'._("Altitude").'</span>'; |
| 80 | 80 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
| 81 | - try { |
|
| 81 | + try { |
|
| 82 | 82 | $groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']); |
| 83 | - } catch(Exception $e) { |
|
| 84 | - } |
|
| 83 | + } catch(Exception $e) { |
|
| 84 | + } |
|
| 85 | 85 | } |
| 86 | 86 | print '<span class="altitude">'; |
| 87 | 87 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | print '</span>'; |
| 93 | 93 | if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*0.3048) { |
| 94 | - print '<br>'; |
|
| 95 | - print '<span>'._("Ground Altitude").'</span>'; |
|
| 96 | - print '<i>'; |
|
| 97 | - print '<span class="groundaltitude">'; |
|
| 98 | - if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 94 | + print '<br>'; |
|
| 95 | + print '<span>'._("Ground Altitude").'</span>'; |
|
| 96 | + print '<i>'; |
|
| 97 | + print '<span class="groundaltitude">'; |
|
| 98 | + if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 99 | 99 | print round($groundAltitude*3.28084).' feet'; |
| 100 | - } else { |
|
| 100 | + } else { |
|
| 101 | 101 | print round($groundAltitude).' m'; |
| 102 | - } |
|
| 103 | - print '</span>'; |
|
| 104 | - print '</i>'; |
|
| 102 | + } |
|
| 103 | + print '</span>'; |
|
| 104 | + print '</i>'; |
|
| 105 | 105 | } |
| 106 | 106 | print '</div>'; |
| 107 | 107 | print '<div><span>'._("Speed").'</span>'; |
@@ -13,14 +13,14 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $from_archive = false; |
| 15 | 15 | if (isset($_GET['ident'])) { |
| 16 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 16 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 17 | 17 | if (isset($_GET['currenttime'])) { |
| 18 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 18 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | 19 | $currenttime = round($currenttime/1000); |
| 20 | - $spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime); |
|
| 20 | + $spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime); |
|
| 21 | 21 | if (empty($spotter_array)) { |
| 22 | 22 | $from_archive = true; |
| 23 | - $spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident,$currenttime); |
|
| 23 | + $spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident, $currenttime); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | } else { |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | if (isset($_GET['famtrackid'])) { |
| 35 | - $famtrackid = urldecode(filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING)); |
|
| 35 | + $famtrackid = urldecode(filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING)); |
|
| 36 | 36 | if (isset($_GET['currenttime'])) { |
| 37 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 37 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 38 | 38 | $currenttime = round($currenttime/1000); |
| 39 | - $spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime); |
|
| 39 | + $spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime); |
|
| 40 | 40 | |
| 41 | 41 | if (empty($spotter_array)) { |
| 42 | 42 | $from_archive = true; |
| 43 | 43 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
| 44 | - $spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid,$currenttime); |
|
| 44 | + $spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid, $currenttime); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | } else { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
| 62 | 62 | { |
| 63 | 63 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 64 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 64 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 65 | 65 | } else $image = $spotter_item['image_thumbnail']; |
| 66 | 66 | |
| 67 | 67 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | print '<div><span>'._("Altitude").'</span>'; |
| 82 | 82 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
| 83 | 83 | try { |
| 84 | - $groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']); |
|
| 85 | - } catch(Exception $e) { |
|
| 84 | + $groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']); |
|
| 85 | + } catch (Exception $e) { |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | print '<span class="altitude">'; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | print '</div>'; |
| 118 | 118 | print '<div><span>'._("Coordinates").'</span>'; |
| 119 | 119 | if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) { |
| 120 | - $latitude = $Common->convertDMS($spotter_item['latitude'],'latitude'); |
|
| 120 | + $latitude = $Common->convertDMS($spotter_item['latitude'], 'latitude'); |
|
| 121 | 121 | print '<span class="latitude">'.$latitude['deg'].'° '.$latitude['min']."′ ".$latitude['sec'].'" '.$latitude['NSEW'].'</span>, '; |
| 122 | - $longitude = $Common->convertDMS($spotter_item['longitude'],'longitude'); |
|
| 122 | + $longitude = $Common->convertDMS($spotter_item['longitude'], 'longitude'); |
|
| 123 | 123 | print '<span class="longitude">'.$longitude['deg'].'° '.$longitude['min']."′ ".$longitude['sec'].'" '.$longitude['NSEW'].'</span>'; |
| 124 | 124 | } elseif ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) { |
| 125 | - $latitude = $Common->convertDM($spotter_item['latitude'],'latitude'); |
|
| 126 | - print '<span class="latitude">'.$latitude['deg'].'° '.round($latitude['min'],3)."′ ".$latitude['NSEW'].'</span>, '; |
|
| 127 | - $longitude = $Common->convertDM($spotter_item['longitude'],'longitude'); |
|
| 128 | - print '<span class="longitude">'.$longitude['deg'].'° '.round($longitude['min'],3)."′ ".$longitude['NSEW'].'</span>'; |
|
| 125 | + $latitude = $Common->convertDM($spotter_item['latitude'], 'latitude'); |
|
| 126 | + print '<span class="latitude">'.$latitude['deg'].'° '.round($latitude['min'], 3)."′ ".$latitude['NSEW'].'</span>, '; |
|
| 127 | + $longitude = $Common->convertDM($spotter_item['longitude'], 'longitude'); |
|
| 128 | + print '<span class="longitude">'.$longitude['deg'].'° '.round($longitude['min'], 3)."′ ".$longitude['NSEW'].'</span>'; |
|
| 129 | 129 | } else { |
| 130 | 130 | print '<span class="latitude">'.$spotter_item['latitude'].'</span>, '; |
| 131 | 131 | print '<span class="longitude">'.$spotter_item['longitude'].'</span>'; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 3 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 4 | 4 | if ($date == '') $date = date('Y-m-d'); |
| 5 | 5 | header('Location: '.$globalURL.'/accident/'.$date); |
| 6 | 6 | ?> |
| 7 | 7 | \ No newline at end of file |
@@ -1,6 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 4 | -if ($date == '') $date = date('Y-m-d'); |
|
| 4 | +if ($date == '') { |
|
| 5 | + $date = date('Y-m-d'); |
|
| 6 | +} |
|
| 5 | 7 | header('Location: '.$globalURL.'/accident/'.$date); |
| 6 | 8 | ?> |
| 7 | 9 | \ No newline at end of file |