@@ -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>'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Get SQL query part for filter used |
| 17 | 17 | * @param Array $filter the filter |
| 18 | - * @return Array the SQL part |
|
| 18 | + * @return string the SQL part |
|
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | public function getFilter($filter = array(),$where = false,$and = false) { |
@@ -486,9 +486,6 @@ discard block |
||
| 486 | 486 | /** |
| 487 | 487 | * Update ident spotter data |
| 488 | 488 | * |
| 489 | - * @param String $flightaware_id the ID from flightaware |
|
| 490 | - * @param String $ident the flight ident |
|
| 491 | - * @return String success or false |
|
| 492 | 489 | * |
| 493 | 490 | */ |
| 494 | 491 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
@@ -510,10 +507,6 @@ discard block |
||
| 510 | 507 | /** |
| 511 | 508 | * Update latest spotter data |
| 512 | 509 | * |
| 513 | - * @param String $flightaware_id the ID from flightaware |
|
| 514 | - * @param String $ident the flight ident |
|
| 515 | - * @param String $arrival_airport_icao the arrival airport |
|
| 516 | - * @return String success or false |
|
| 517 | 510 | * |
| 518 | 511 | */ |
| 519 | 512 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
@@ -535,29 +528,6 @@ discard block |
||
| 535 | 528 | /** |
| 536 | 529 | * Adds a new spotter data |
| 537 | 530 | * |
| 538 | - * @param String $flightaware_id the ID from flightaware |
|
| 539 | - * @param String $ident the flight ident |
|
| 540 | - * @param String $aircraft_icao the aircraft type |
|
| 541 | - * @param String $departure_airport_icao the departure airport |
|
| 542 | - * @param String $arrival_airport_icao the arrival airport |
|
| 543 | - * @param String $latitude latitude of flight |
|
| 544 | - * @param String $longitude latitude of flight |
|
| 545 | - * @param String $waypoints waypoints of flight |
|
| 546 | - * @param String $altitude altitude of flight |
|
| 547 | - * @param String $heading heading of flight |
|
| 548 | - * @param String $groundspeed speed of flight |
|
| 549 | - * @param String $date date of flight |
|
| 550 | - * @param String $departure_airport_time departure time of flight |
|
| 551 | - * @param String $arrival_airport_time arrival time of flight |
|
| 552 | - * @param String $squawk squawk code of flight |
|
| 553 | - * @param String $route_stop route stop of flight |
|
| 554 | - * @param String $highlight highlight or not |
|
| 555 | - * @param String $ModeS ModesS code of flight |
|
| 556 | - * @param String $registration registration code of flight |
|
| 557 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | - * @param String $verticalrate vertival rate of flight |
|
| 560 | - * @return String success or false |
|
| 561 | 531 | */ |
| 562 | 532 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
| 563 | 533 | { |
@@ -1428,7 +1398,7 @@ discard block |
||
| 1428 | 1398 | /** |
| 1429 | 1399 | * Parses the direction degrees to working |
| 1430 | 1400 | * |
| 1431 | - * @param Float $direction the direction in degrees |
|
| 1401 | + * @param integer $direction the direction in degrees |
|
| 1432 | 1402 | * @return Array the direction information |
| 1433 | 1403 | * |
| 1434 | 1404 | */ |
@@ -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 | |
| 21 | 21 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * Executes the SQL statements to get the spotter information |
|
| 84 | - * |
|
| 85 | - * @param String $query the SQL query |
|
| 86 | - * @param Array $params parameter of the query |
|
| 87 | - * @param String $limitQuery the limit query |
|
| 88 | - * @return Array the spotter information |
|
| 89 | - * |
|
| 90 | - */ |
|
| 83 | + * Executes the SQL statements to get the spotter information |
|
| 84 | + * |
|
| 85 | + * @param String $query the SQL query |
|
| 86 | + * @param Array $params parameter of the query |
|
| 87 | + * @param String $limitQuery the limit query |
|
| 88 | + * @return Array the spotter information |
|
| 89 | + * |
|
| 90 | + */ |
|
| 91 | 91 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 92 | 92 | { |
| 93 | 93 | date_default_timezone_set('UTC'); |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * Gets all the spotter information based on the latest data entry |
|
| 204 | - * |
|
| 205 | - * @return Array the spotter information |
|
| 206 | - * |
|
| 207 | - */ |
|
| 203 | + * Gets all the spotter information based on the latest data entry |
|
| 204 | + * |
|
| 205 | + * @return Array the spotter information |
|
| 206 | + * |
|
| 207 | + */ |
|
| 208 | 208 | public function getLatestTrackerData($limit = '', $sort = '', $filter = array()) |
| 209 | 209 | { |
| 210 | 210 | global $global_query; |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | - * Gets all the spotter information based on the callsign |
|
| 266 | - * |
|
| 267 | - * @return Array the spotter information |
|
| 268 | - * |
|
| 269 | - */ |
|
| 265 | + * Gets all the spotter information based on the callsign |
|
| 266 | + * |
|
| 267 | + * @return Array the spotter information |
|
| 268 | + * |
|
| 269 | + */ |
|
| 270 | 270 | public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 271 | 271 | { |
| 272 | 272 | global $global_query; |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | - * Gets all source name |
|
| 381 | - * |
|
| 382 | - * @param String type format of source |
|
| 383 | - * @return Array list of source name |
|
| 384 | - * |
|
| 385 | - */ |
|
| 380 | + * Gets all source name |
|
| 381 | + * |
|
| 382 | + * @param String type format of source |
|
| 383 | + * @return Array list of source name |
|
| 384 | + * |
|
| 385 | + */ |
|
| 386 | 386 | public function getAllSourceName($type = '',$filters = array()) |
| 387 | 387 | { |
| 388 | 388 | $filter_query = $this->getFilter($filters,true,true); |
@@ -412,11 +412,11 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | |
| 414 | 414 | /** |
| 415 | - * Gets a list of all idents/callsigns |
|
| 416 | - * |
|
| 417 | - * @return Array list of ident/callsign names |
|
| 418 | - * |
|
| 419 | - */ |
|
| 415 | + * Gets a list of all idents/callsigns |
|
| 416 | + * |
|
| 417 | + * @return Array list of ident/callsign names |
|
| 418 | + * |
|
| 419 | + */ |
|
| 420 | 420 | public function getAllIdents($filters = array()) |
| 421 | 421 | { |
| 422 | 422 | $filter_query = $this->getFilter($filters,true,true); |
@@ -484,18 +484,18 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | - * Update ident spotter data |
|
| 488 | - * |
|
| 489 | - * @param String $flightaware_id the ID from flightaware |
|
| 490 | - * @param String $ident the flight ident |
|
| 491 | - * @return String success or false |
|
| 492 | - * |
|
| 493 | - */ |
|
| 487 | + * Update ident spotter data |
|
| 488 | + * |
|
| 489 | + * @param String $flightaware_id the ID from flightaware |
|
| 490 | + * @param String $ident the flight ident |
|
| 491 | + * @return String success or false |
|
| 492 | + * |
|
| 493 | + */ |
|
| 494 | 494 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
| 495 | 495 | { |
| 496 | 496 | |
| 497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 498 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 499 | 499 | |
| 500 | 500 | try { |
| 501 | 501 | $sth = $this->db->prepare($query); |
@@ -508,18 +508,18 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | } |
| 510 | 510 | /** |
| 511 | - * Update latest spotter data |
|
| 512 | - * |
|
| 513 | - * @param String $flightaware_id the ID from flightaware |
|
| 514 | - * @param String $ident the flight ident |
|
| 515 | - * @param String $arrival_airport_icao the arrival airport |
|
| 516 | - * @return String success or false |
|
| 517 | - * |
|
| 518 | - */ |
|
| 511 | + * Update latest spotter data |
|
| 512 | + * |
|
| 513 | + * @param String $flightaware_id the ID from flightaware |
|
| 514 | + * @param String $ident the flight ident |
|
| 515 | + * @param String $arrival_airport_icao the arrival airport |
|
| 516 | + * @return String success or false |
|
| 517 | + * |
|
| 518 | + */ |
|
| 519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 520 | 520 | { |
| 521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 522 | + $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 523 | 523 | |
| 524 | 524 | try { |
| 525 | 525 | $sth = $this->db->prepare($query); |
@@ -533,32 +533,32 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | - * Adds a new spotter data |
|
| 537 | - * |
|
| 538 | - * @param String $flightaware_id the ID from flightaware |
|
| 539 | - * @param String $ident the flight ident |
|
| 540 | - * @param String $aircraft_icao the aircraft type |
|
| 541 | - * @param String $departure_airport_icao the departure airport |
|
| 542 | - * @param String $arrival_airport_icao the arrival airport |
|
| 543 | - * @param String $latitude latitude of flight |
|
| 544 | - * @param String $longitude latitude of flight |
|
| 545 | - * @param String $waypoints waypoints of flight |
|
| 546 | - * @param String $altitude altitude of flight |
|
| 547 | - * @param String $heading heading of flight |
|
| 548 | - * @param String $groundspeed speed of flight |
|
| 549 | - * @param String $date date of flight |
|
| 550 | - * @param String $departure_airport_time departure time of flight |
|
| 551 | - * @param String $arrival_airport_time arrival time of flight |
|
| 552 | - * @param String $squawk squawk code of flight |
|
| 553 | - * @param String $route_stop route stop of flight |
|
| 554 | - * @param String $highlight highlight or not |
|
| 555 | - * @param String $ModeS ModesS code of flight |
|
| 556 | - * @param String $registration registration code of flight |
|
| 557 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | - * @param String $verticalrate vertival rate of flight |
|
| 560 | - * @return String success or false |
|
| 561 | - */ |
|
| 536 | + * Adds a new spotter data |
|
| 537 | + * |
|
| 538 | + * @param String $flightaware_id the ID from flightaware |
|
| 539 | + * @param String $ident the flight ident |
|
| 540 | + * @param String $aircraft_icao the aircraft type |
|
| 541 | + * @param String $departure_airport_icao the departure airport |
|
| 542 | + * @param String $arrival_airport_icao the arrival airport |
|
| 543 | + * @param String $latitude latitude of flight |
|
| 544 | + * @param String $longitude latitude of flight |
|
| 545 | + * @param String $waypoints waypoints of flight |
|
| 546 | + * @param String $altitude altitude of flight |
|
| 547 | + * @param String $heading heading of flight |
|
| 548 | + * @param String $groundspeed speed of flight |
|
| 549 | + * @param String $date date of flight |
|
| 550 | + * @param String $departure_airport_time departure time of flight |
|
| 551 | + * @param String $arrival_airport_time arrival time of flight |
|
| 552 | + * @param String $squawk squawk code of flight |
|
| 553 | + * @param String $route_stop route stop of flight |
|
| 554 | + * @param String $highlight highlight or not |
|
| 555 | + * @param String $ModeS ModesS code of flight |
|
| 556 | + * @param String $registration registration code of flight |
|
| 557 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | + * @param String $verticalrate vertival rate of flight |
|
| 560 | + * @return String success or false |
|
| 561 | + */ |
|
| 562 | 562 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
| 563 | 563 | { |
| 564 | 564 | global $globalURL; |
@@ -643,16 +643,16 @@ discard block |
||
| 643 | 643 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 644 | 644 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 645 | 645 | |
| 646 | - if ($latitude == '' && $longitude == '') { |
|
| 647 | - $latitude = 0; |
|
| 648 | - $longitude = 0; |
|
| 649 | - } |
|
| 650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 646 | + if ($latitude == '' && $longitude == '') { |
|
| 647 | + $latitude = 0; |
|
| 648 | + $longitude = 0; |
|
| 649 | + } |
|
| 650 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 654 | |
| 655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 655 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $sth->execute($query_values); |
| 661 | 661 | $this->db = null; |
| 662 | 662 | } catch (PDOException $e) { |
| 663 | - return "error : ".$e->getMessage(); |
|
| 663 | + return "error : ".$e->getMessage(); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | return "success"; |
@@ -669,11 +669,11 @@ discard block |
||
| 669 | 669 | |
| 670 | 670 | |
| 671 | 671 | /** |
| 672 | - * Gets the aircraft ident within the last hour |
|
| 673 | - * |
|
| 674 | - * @return String the ident |
|
| 675 | - * |
|
| 676 | - */ |
|
| 672 | + * Gets the aircraft ident within the last hour |
|
| 673 | + * |
|
| 674 | + * @return String the ident |
|
| 675 | + * |
|
| 676 | + */ |
|
| 677 | 677 | public function getIdentFromLastHour($ident) |
| 678 | 678 | { |
| 679 | 679 | global $globalDBdriver, $globalTimezone; |
@@ -689,11 +689,11 @@ discard block |
||
| 689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
| 691 | 691 | $query_data = array(':ident' => $ident); |
| 692 | - } |
|
| 692 | + } |
|
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute($query_data); |
| 696 | - $ident_result=''; |
|
| 696 | + $ident_result=''; |
|
| 697 | 697 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 698 | 698 | { |
| 699 | 699 | $ident_result = $row['ident']; |
@@ -704,11 +704,11 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | /** |
| 707 | - * Gets the aircraft data from the last 20 seconds |
|
| 708 | - * |
|
| 709 | - * @return Array the spotter data |
|
| 710 | - * |
|
| 711 | - */ |
|
| 707 | + * Gets the aircraft data from the last 20 seconds |
|
| 708 | + * |
|
| 709 | + * @return Array the spotter data |
|
| 710 | + * |
|
| 711 | + */ |
|
| 712 | 712 | public function getRealTimeData($q = '') |
| 713 | 713 | { |
| 714 | 714 | global $globalDBdriver; |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | |
| 748 | 748 | /** |
| 749 | - * Gets all number of flight over countries |
|
| 750 | - * |
|
| 751 | - * @return Array the airline country list |
|
| 752 | - * |
|
| 753 | - */ |
|
| 749 | + * Gets all number of flight over countries |
|
| 750 | + * |
|
| 751 | + * @return Array the airline country list |
|
| 752 | + * |
|
| 753 | + */ |
|
| 754 | 754 | |
| 755 | 755 | public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 756 | 756 | { |
@@ -821,11 +821,11 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
| 824 | - * Gets all callsigns that have flown over |
|
| 825 | - * |
|
| 826 | - * @return Array the callsign list |
|
| 827 | - * |
|
| 828 | - */ |
|
| 824 | + * Gets all callsigns that have flown over |
|
| 825 | + * |
|
| 826 | + * @return Array the callsign list |
|
| 827 | + * |
|
| 828 | + */ |
|
| 829 | 829 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 830 | 830 | { |
| 831 | 831 | global $globalDBdriver; |
@@ -892,11 +892,11 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | |
| 894 | 894 | /** |
| 895 | - * Counts all dates |
|
| 896 | - * |
|
| 897 | - * @return Array the date list |
|
| 898 | - * |
|
| 899 | - */ |
|
| 895 | + * Counts all dates |
|
| 896 | + * |
|
| 897 | + * @return Array the date list |
|
| 898 | + * |
|
| 899 | + */ |
|
| 900 | 900 | public function countAllDates($filters = array()) |
| 901 | 901 | { |
| 902 | 902 | global $globalTimezone, $globalDBdriver; |
@@ -942,11 +942,11 @@ discard block |
||
| 942 | 942 | |
| 943 | 943 | |
| 944 | 944 | /** |
| 945 | - * Counts all dates during the last 7 days |
|
| 946 | - * |
|
| 947 | - * @return Array the date list |
|
| 948 | - * |
|
| 949 | - */ |
|
| 945 | + * Counts all dates during the last 7 days |
|
| 946 | + * |
|
| 947 | + * @return Array the date list |
|
| 948 | + * |
|
| 949 | + */ |
|
| 950 | 950 | public function countAllDatesLast7Days($filters = array()) |
| 951 | 951 | { |
| 952 | 952 | global $globalTimezone, $globalDBdriver; |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | $query .= " GROUP BY date_name |
| 969 | 969 | ORDER BY date_name ASC"; |
| 970 | 970 | $query_data = array(':offset' => $offset); |
| 971 | - } |
|
| 971 | + } |
|
| 972 | 972 | |
| 973 | 973 | $sth = $this->db->prepare($query); |
| 974 | 974 | $sth->execute($query_data); |
@@ -988,11 +988,11 @@ discard block |
||
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | /** |
| 991 | - * Counts all dates during the last month |
|
| 992 | - * |
|
| 993 | - * @return Array the date list |
|
| 994 | - * |
|
| 995 | - */ |
|
| 991 | + * Counts all dates during the last month |
|
| 992 | + * |
|
| 993 | + * @return Array the date list |
|
| 994 | + * |
|
| 995 | + */ |
|
| 996 | 996 | public function countAllDatesLastMonth($filters = array()) |
| 997 | 997 | { |
| 998 | 998 | global $globalTimezone, $globalDBdriver; |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | $query .= " GROUP BY date_name |
| 1015 | 1015 | ORDER BY date_name ASC"; |
| 1016 | 1016 | $query_data = array(':offset' => $offset); |
| 1017 | - } |
|
| 1017 | + } |
|
| 1018 | 1018 | |
| 1019 | 1019 | $sth = $this->db->prepare($query); |
| 1020 | 1020 | $sth->execute($query_data); |
@@ -1036,11 +1036,11 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | - * Counts all month |
|
| 1040 | - * |
|
| 1041 | - * @return Array the month list |
|
| 1042 | - * |
|
| 1043 | - */ |
|
| 1039 | + * Counts all month |
|
| 1040 | + * |
|
| 1041 | + * @return Array the month list |
|
| 1042 | + * |
|
| 1043 | + */ |
|
| 1044 | 1044 | public function countAllMonths($filters = array()) |
| 1045 | 1045 | { |
| 1046 | 1046 | global $globalTimezone, $globalDBdriver; |
@@ -1085,11 +1085,11 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | |
| 1087 | 1087 | /** |
| 1088 | - * Counts all dates during the last year |
|
| 1089 | - * |
|
| 1090 | - * @return Array the date list |
|
| 1091 | - * |
|
| 1092 | - */ |
|
| 1088 | + * Counts all dates during the last year |
|
| 1089 | + * |
|
| 1090 | + * @return Array the date list |
|
| 1091 | + * |
|
| 1092 | + */ |
|
| 1093 | 1093 | public function countAllMonthsLastYear($filters) |
| 1094 | 1094 | { |
| 1095 | 1095 | global $globalTimezone, $globalDBdriver; |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | $query .= " GROUP BY year_name, month_name |
| 1112 | 1112 | ORDER BY year_name, month_name ASC"; |
| 1113 | 1113 | $query_data = array(':offset' => $offset); |
| 1114 | - } |
|
| 1114 | + } |
|
| 1115 | 1115 | |
| 1116 | 1116 | $sth = $this->db->prepare($query); |
| 1117 | 1117 | $sth->execute($query_data); |
@@ -1134,11 +1134,11 @@ discard block |
||
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | 1136 | /** |
| 1137 | - * Counts all hours |
|
| 1138 | - * |
|
| 1139 | - * @return Array the hour list |
|
| 1140 | - * |
|
| 1141 | - */ |
|
| 1137 | + * Counts all hours |
|
| 1138 | + * |
|
| 1139 | + * @return Array the hour list |
|
| 1140 | + * |
|
| 1141 | + */ |
|
| 1142 | 1142 | public function countAllHours($orderby,$filters = array()) |
| 1143 | 1143 | { |
| 1144 | 1144 | global $globalTimezone, $globalDBdriver; |
@@ -1201,11 +1201,11 @@ discard block |
||
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | 1203 | /** |
| 1204 | - * Counts all hours by date |
|
| 1205 | - * |
|
| 1206 | - * @return Array the hour list |
|
| 1207 | - * |
|
| 1208 | - */ |
|
| 1204 | + * Counts all hours by date |
|
| 1205 | + * |
|
| 1206 | + * @return Array the hour list |
|
| 1207 | + * |
|
| 1208 | + */ |
|
| 1209 | 1209 | public function countAllHoursByDate($date, $filters = array()) |
| 1210 | 1210 | { |
| 1211 | 1211 | global $globalTimezone, $globalDBdriver; |
@@ -1249,11 +1249,11 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | |
| 1251 | 1251 | /** |
| 1252 | - * Counts all hours by a ident/callsign |
|
| 1253 | - * |
|
| 1254 | - * @return Array the hour list |
|
| 1255 | - * |
|
| 1256 | - */ |
|
| 1252 | + * Counts all hours by a ident/callsign |
|
| 1253 | + * |
|
| 1254 | + * @return Array the hour list |
|
| 1255 | + * |
|
| 1256 | + */ |
|
| 1257 | 1257 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1258 | 1258 | { |
| 1259 | 1259 | global $globalTimezone, $globalDBdriver; |
@@ -1298,11 +1298,11 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | |
| 1300 | 1300 | /** |
| 1301 | - * Counts all trackers that have flown over |
|
| 1302 | - * |
|
| 1303 | - * @return Integer the number of trackers |
|
| 1304 | - * |
|
| 1305 | - */ |
|
| 1301 | + * Counts all trackers that have flown over |
|
| 1302 | + * |
|
| 1303 | + * @return Integer the number of trackers |
|
| 1304 | + * |
|
| 1305 | + */ |
|
| 1306 | 1306 | public function countOverallTracker($filters = array(),$year = '',$month = '') |
| 1307 | 1307 | { |
| 1308 | 1308 | global $globalDBdriver; |
@@ -1337,11 +1337,11 @@ discard block |
||
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | /** |
| 1340 | - * Counts all trackers type that have flown over |
|
| 1341 | - * |
|
| 1342 | - * @return Integer the number of flights |
|
| 1343 | - * |
|
| 1344 | - */ |
|
| 1340 | + * Counts all trackers type that have flown over |
|
| 1341 | + * |
|
| 1342 | + * @return Integer the number of flights |
|
| 1343 | + * |
|
| 1344 | + */ |
|
| 1345 | 1345 | public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
| 1346 | 1346 | { |
| 1347 | 1347 | global $globalDBdriver; |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | |
| 1377 | 1377 | |
| 1378 | 1378 | /** |
| 1379 | - * Counts all hours of today |
|
| 1380 | - * |
|
| 1381 | - * @return Array the hour list |
|
| 1382 | - * |
|
| 1383 | - */ |
|
| 1379 | + * Counts all hours of today |
|
| 1380 | + * |
|
| 1381 | + * @return Array the hour list |
|
| 1382 | + * |
|
| 1383 | + */ |
|
| 1384 | 1384 | public function countAllHoursFromToday($filters = array()) |
| 1385 | 1385 | { |
| 1386 | 1386 | global $globalTimezone, $globalDBdriver; |
@@ -1420,12 +1420,12 @@ discard block |
||
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | 1422 | |
| 1423 | - /** |
|
| 1424 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1425 | - * |
|
| 1426 | - * @return Integer the Barrie Spotter ID |
|
| 1423 | + /** |
|
| 1424 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1425 | + * |
|
| 1426 | + * @return Integer the Barrie Spotter ID |
|
| 1427 | 1427 | q * |
| 1428 | - */ |
|
| 1428 | + */ |
|
| 1429 | 1429 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1430 | 1430 | { |
| 1431 | 1431 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -1446,13 +1446,13 @@ discard block |
||
| 1446 | 1446 | |
| 1447 | 1447 | |
| 1448 | 1448 | /** |
| 1449 | - * Parses a date string |
|
| 1450 | - * |
|
| 1451 | - * @param String $dateString the date string |
|
| 1452 | - * @param String $timezone the timezone of a user |
|
| 1453 | - * @return Array the time information |
|
| 1454 | - * |
|
| 1455 | - */ |
|
| 1449 | + * Parses a date string |
|
| 1450 | + * |
|
| 1451 | + * @param String $dateString the date string |
|
| 1452 | + * @param String $timezone the timezone of a user |
|
| 1453 | + * @return Array the time information |
|
| 1454 | + * |
|
| 1455 | + */ |
|
| 1456 | 1456 | public function parseDateString($dateString, $timezone = '') |
| 1457 | 1457 | { |
| 1458 | 1458 | $time_array = array(); |
@@ -1485,12 +1485,12 @@ discard block |
||
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | /** |
| 1488 | - * Parses the direction degrees to working |
|
| 1489 | - * |
|
| 1490 | - * @param Float $direction the direction in degrees |
|
| 1491 | - * @return Array the direction information |
|
| 1492 | - * |
|
| 1493 | - */ |
|
| 1488 | + * Parses the direction degrees to working |
|
| 1489 | + * |
|
| 1490 | + * @param Float $direction the direction in degrees |
|
| 1491 | + * @return Array the direction information |
|
| 1492 | + * |
|
| 1493 | + */ |
|
| 1494 | 1494 | public function parseDirection($direction = 0) |
| 1495 | 1495 | { |
| 1496 | 1496 | if ($direction == '') $direction = 0; |
@@ -1569,12 +1569,12 @@ discard block |
||
| 1569 | 1569 | |
| 1570 | 1570 | |
| 1571 | 1571 | /** |
| 1572 | - * Gets Country from latitude/longitude |
|
| 1573 | - * |
|
| 1574 | - * @param Float $latitude latitute of the flight |
|
| 1575 | - * @param Float $longitude longitute of the flight |
|
| 1576 | - * @return String the countrie |
|
| 1577 | - */ |
|
| 1572 | + * Gets Country from latitude/longitude |
|
| 1573 | + * |
|
| 1574 | + * @param Float $latitude latitute of the flight |
|
| 1575 | + * @param Float $longitude longitute of the flight |
|
| 1576 | + * @return String the countrie |
|
| 1577 | + */ |
|
| 1578 | 1578 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1579 | 1579 | { |
| 1580 | 1580 | global $globalDBdriver, $globalDebug; |
@@ -1611,11 +1611,11 @@ discard block |
||
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | /** |
| 1614 | - * Gets Country from iso2 |
|
| 1615 | - * |
|
| 1616 | - * @param String $iso2 ISO2 country code |
|
| 1617 | - * @return String the countrie |
|
| 1618 | - */ |
|
| 1614 | + * Gets Country from iso2 |
|
| 1615 | + * |
|
| 1616 | + * @param String $iso2 ISO2 country code |
|
| 1617 | + * @return String the countrie |
|
| 1618 | + */ |
|
| 1619 | 1619 | public function getCountryFromISO2($iso2) |
| 1620 | 1620 | { |
| 1621 | 1621 | global $globalDBdriver, $globalDebug; |
@@ -1643,11 +1643,11 @@ discard block |
||
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | /** |
| 1646 | - * Gets all vessels types that have flown over |
|
| 1647 | - * |
|
| 1648 | - * @return Array the vessel type list |
|
| 1649 | - * |
|
| 1650 | - */ |
|
| 1646 | + * Gets all vessels types that have flown over |
|
| 1647 | + * |
|
| 1648 | + * @return Array the vessel type list |
|
| 1649 | + * |
|
| 1650 | + */ |
|
| 1651 | 1651 | public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1652 | 1652 | { |
| 1653 | 1653 | global $globalDBdriver; |
@@ -1714,12 +1714,12 @@ discard block |
||
| 1714 | 1714 | |
| 1715 | 1715 | |
| 1716 | 1716 | /** |
| 1717 | - * Gets the short url from bit.ly |
|
| 1718 | - * |
|
| 1719 | - * @param String $url the full url |
|
| 1720 | - * @return String the bit.ly url |
|
| 1721 | - * |
|
| 1722 | - */ |
|
| 1717 | + * Gets the short url from bit.ly |
|
| 1718 | + * |
|
| 1719 | + * @param String $url the full url |
|
| 1720 | + * @return String the bit.ly url |
|
| 1721 | + * |
|
| 1722 | + */ |
|
| 1723 | 1723 | public function getBitlyURL($url) |
| 1724 | 1724 | { |
| 1725 | 1725 | global $globalBitlyAccessToken; |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | if (isset($filter[0]['source'])) { |
| 32 | 32 | $filters = array_merge($filters,$filter); |
| 33 | 33 | } |
| 34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 34 | + if (is_array($globalFilter)) { |
|
| 35 | + $filter = array_merge($filter,$globalFilter); |
|
| 36 | + } |
|
| 35 | 37 | $filter_query_join = ''; |
| 36 | 38 | $filter_query_where = ''; |
| 37 | 39 | foreach($filters as $flt) { |
@@ -70,8 +72,11 @@ discard block |
||
| 70 | 72 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 71 | 73 | } |
| 72 | 74 | } |
| 73 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 74 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 75 | + if ($filter_query_where == '' && $where) { |
|
| 76 | + $filter_query_where = ' WHERE'; |
|
| 77 | + } elseif ($filter_query_where != '' && $and) { |
|
| 78 | + $filter_query_where .= ' AND'; |
|
| 79 | + } |
|
| 75 | 80 | if ($filter_query_where != '') { |
| 76 | 81 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 77 | 82 | } |
@@ -125,26 +130,43 @@ discard block |
||
| 125 | 130 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
| 126 | 131 | } elseif (isset($row['spotter_archive_output_id'])) { |
| 127 | 132 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
| 128 | - */} |
|
| 129 | - elseif (isset($row['trackerid'])) { |
|
| 133 | + */} elseif (isset($row['trackerid'])) { |
|
| 130 | 134 | $temp_array['trackerid'] = $row['trackerid']; |
| 131 | 135 | } else { |
| 132 | 136 | $temp_array['trackerid'] = ''; |
| 133 | 137 | } |
| 134 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 135 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
| 136 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
| 138 | + if (isset($row['famtrackid'])) { |
|
| 139 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 140 | + } |
|
| 141 | + if (isset($row['type'])) { |
|
| 142 | + $temp_array['type'] = $row['type']; |
|
| 143 | + } |
|
| 144 | + if (isset($row['comment'])) { |
|
| 145 | + $temp_array['comment'] = $row['comment']; |
|
| 146 | + } |
|
| 137 | 147 | $temp_array['ident'] = $row['ident']; |
| 138 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 139 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 140 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 141 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 148 | + if (isset($row['latitude'])) { |
|
| 149 | + $temp_array['latitude'] = $row['latitude']; |
|
| 150 | + } |
|
| 151 | + if (isset($row['longitude'])) { |
|
| 152 | + $temp_array['longitude'] = $row['longitude']; |
|
| 153 | + } |
|
| 154 | + if (isset($row['format_source'])) { |
|
| 155 | + $temp_array['format_source'] = $row['format_source']; |
|
| 156 | + } |
|
| 157 | + if (isset($row['altitude'])) { |
|
| 158 | + $temp_array['altitude'] = $row['altitude']; |
|
| 159 | + } |
|
| 142 | 160 | if (isset($row['heading'])) { |
| 143 | 161 | $temp_array['heading'] = $row['heading']; |
| 144 | 162 | $heading_direction = $this->parseDirection($row['heading']); |
| 145 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 163 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 164 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + if (isset($row['ground_speed'])) { |
|
| 168 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 146 | 169 | } |
| 147 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 148 | 170 | |
| 149 | 171 | if (isset($row['date'])) { |
| 150 | 172 | $dateArray = $this->parseDateString($row['date']); |
@@ -187,13 +209,21 @@ discard block |
||
| 187 | 209 | } |
| 188 | 210 | |
| 189 | 211 | $fromsource = NULL; |
| 190 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 191 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 192 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 212 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 213 | + $temp_array['source_name'] = $row['source_name']; |
|
| 214 | + } |
|
| 215 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 216 | + $temp_array['over_country'] = $row['over_country']; |
|
| 217 | + } |
|
| 218 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 219 | + $temp_array['distance'] = $row['distance']; |
|
| 220 | + } |
|
| 193 | 221 | $temp_array['query_number_rows'] = $num_rows; |
| 194 | 222 | $spotter_array[] = $temp_array; |
| 195 | 223 | } |
| 196 | - if ($num_rows == 0) return array(); |
|
| 224 | + if ($num_rows == 0) { |
|
| 225 | + return array(); |
|
| 226 | + } |
|
| 197 | 227 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 198 | 228 | return $spotter_array; |
| 199 | 229 | } |
@@ -224,8 +254,12 @@ discard block |
||
| 224 | 254 | { |
| 225 | 255 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 226 | 256 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 227 | - } else $limit_query = ""; |
|
| 228 | - } else $limit_query = ""; |
|
| 257 | + } else { |
|
| 258 | + $limit_query = ""; |
|
| 259 | + } |
|
| 260 | + } else { |
|
| 261 | + $limit_query = ""; |
|
| 262 | + } |
|
| 229 | 263 | |
| 230 | 264 | if ($sort != "") |
| 231 | 265 | { |
@@ -253,7 +287,9 @@ discard block |
||
| 253 | 287 | global $global_query; |
| 254 | 288 | |
| 255 | 289 | date_default_timezone_set('UTC'); |
| 256 | - if ($id == '') return array(); |
|
| 290 | + if ($id == '') { |
|
| 291 | + return array(); |
|
| 292 | + } |
|
| 257 | 293 | $additional_query = "tracker_output.famtrackid = :id"; |
| 258 | 294 | $query_values = array(':id' => $id); |
| 259 | 295 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -396,8 +432,11 @@ discard block |
||
| 396 | 432 | $query .= " ORDER BY tracker_output.source_name ASC"; |
| 397 | 433 | |
| 398 | 434 | $sth = $this->db->prepare($query); |
| 399 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 400 | - else $sth->execute(); |
|
| 435 | + if (!empty($query_values)) { |
|
| 436 | + $sth->execute($query_values); |
|
| 437 | + } else { |
|
| 438 | + $sth->execute(); |
|
| 439 | + } |
|
| 401 | 440 | |
| 402 | 441 | $source_array = array(); |
| 403 | 442 | $temp_array = array(); |
@@ -452,7 +491,9 @@ discard block |
||
| 452 | 491 | date_default_timezone_set($globalTimezone); |
| 453 | 492 | $datetime = new DateTime(); |
| 454 | 493 | $offset = $datetime->format('P'); |
| 455 | - } else $offset = '+00:00'; |
|
| 494 | + } else { |
|
| 495 | + $offset = '+00:00'; |
|
| 496 | + } |
|
| 456 | 497 | |
| 457 | 498 | if ($globalDBdriver == 'mysql') { |
| 458 | 499 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -608,7 +649,9 @@ discard block |
||
| 608 | 649 | { |
| 609 | 650 | return false; |
| 610 | 651 | } |
| 611 | - } else $altitude = 0; |
|
| 652 | + } else { |
|
| 653 | + $altitude = 0; |
|
| 654 | + } |
|
| 612 | 655 | |
| 613 | 656 | if ($heading != "") |
| 614 | 657 | { |
@@ -647,8 +690,12 @@ discard block |
||
| 647 | 690 | $latitude = 0; |
| 648 | 691 | $longitude = 0; |
| 649 | 692 | } |
| 650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 693 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 694 | + $heading = 0; |
|
| 695 | + } |
|
| 696 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 697 | + $groundspeed = 0; |
|
| 698 | + } |
|
| 652 | 699 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
| 653 | 700 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 701 | |
@@ -757,7 +804,9 @@ discard block |
||
| 757 | 804 | global $globalDBdriver, $globalArchive; |
| 758 | 805 | //$filter_query = $this->getFilter($filters,true,true); |
| 759 | 806 | $Connection= new Connection($this->db); |
| 760 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 807 | + if (!$Connection->tableExists('countries')) { |
|
| 808 | + return array(); |
|
| 809 | + } |
|
| 761 | 810 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 762 | 811 | require_once('class.TrackerLive.php'); |
| 763 | 812 | $TrackerLive = new TrackerLive(); |
@@ -800,7 +849,9 @@ discard block |
||
| 800 | 849 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
| 801 | 850 | } |
| 802 | 851 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 803 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 852 | + if ($limit) { |
|
| 853 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 854 | + } |
|
| 804 | 855 | |
| 805 | 856 | |
| 806 | 857 | $sth = $this->db->prepare($query); |
@@ -833,12 +884,18 @@ discard block |
||
| 833 | 884 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
| 834 | 885 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 835 | 886 | if ($olderthanmonths > 0) { |
| 836 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 837 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 887 | + if ($globalDBdriver == 'mysql') { |
|
| 888 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 889 | + } else { |
|
| 890 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 891 | + } |
|
| 838 | 892 | } |
| 839 | 893 | if ($sincedate != '') { |
| 840 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 841 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 894 | + if ($globalDBdriver == 'mysql') { |
|
| 895 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 896 | + } else { |
|
| 897 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 898 | + } |
|
| 842 | 899 | } |
| 843 | 900 | $query_values = array(); |
| 844 | 901 | if ($year != '') { |
@@ -869,7 +926,9 @@ discard block |
||
| 869 | 926 | } |
| 870 | 927 | } |
| 871 | 928 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
| 872 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 929 | + if ($limit) { |
|
| 930 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 931 | + } |
|
| 873 | 932 | |
| 874 | 933 | $sth = $this->db->prepare($query); |
| 875 | 934 | $sth->execute($query_values); |
@@ -904,7 +963,9 @@ discard block |
||
| 904 | 963 | date_default_timezone_set($globalTimezone); |
| 905 | 964 | $datetime = new DateTime(); |
| 906 | 965 | $offset = $datetime->format('P'); |
| 907 | - } else $offset = '+00:00'; |
|
| 966 | + } else { |
|
| 967 | + $offset = '+00:00'; |
|
| 968 | + } |
|
| 908 | 969 | |
| 909 | 970 | if ($globalDBdriver == 'mysql') { |
| 910 | 971 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -954,7 +1015,9 @@ discard block |
||
| 954 | 1015 | date_default_timezone_set($globalTimezone); |
| 955 | 1016 | $datetime = new DateTime(); |
| 956 | 1017 | $offset = $datetime->format('P'); |
| 957 | - } else $offset = '+00:00'; |
|
| 1018 | + } else { |
|
| 1019 | + $offset = '+00:00'; |
|
| 1020 | + } |
|
| 958 | 1021 | $filter_query = $this->getFilter($filters,true,true); |
| 959 | 1022 | if ($globalDBdriver == 'mysql') { |
| 960 | 1023 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1000,7 +1063,9 @@ discard block |
||
| 1000 | 1063 | date_default_timezone_set($globalTimezone); |
| 1001 | 1064 | $datetime = new DateTime(); |
| 1002 | 1065 | $offset = $datetime->format('P'); |
| 1003 | - } else $offset = '+00:00'; |
|
| 1066 | + } else { |
|
| 1067 | + $offset = '+00:00'; |
|
| 1068 | + } |
|
| 1004 | 1069 | $filter_query = $this->getFilter($filters,true,true); |
| 1005 | 1070 | if ($globalDBdriver == 'mysql') { |
| 1006 | 1071 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1048,7 +1113,9 @@ discard block |
||
| 1048 | 1113 | date_default_timezone_set($globalTimezone); |
| 1049 | 1114 | $datetime = new DateTime(); |
| 1050 | 1115 | $offset = $datetime->format('P'); |
| 1051 | - } else $offset = '+00:00'; |
|
| 1116 | + } else { |
|
| 1117 | + $offset = '+00:00'; |
|
| 1118 | + } |
|
| 1052 | 1119 | |
| 1053 | 1120 | if ($globalDBdriver == 'mysql') { |
| 1054 | 1121 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1097,7 +1164,9 @@ discard block |
||
| 1097 | 1164 | date_default_timezone_set($globalTimezone); |
| 1098 | 1165 | $datetime = new DateTime(); |
| 1099 | 1166 | $offset = $datetime->format('P'); |
| 1100 | - } else $offset = '+00:00'; |
|
| 1167 | + } else { |
|
| 1168 | + $offset = '+00:00'; |
|
| 1169 | + } |
|
| 1101 | 1170 | $filter_query = $this->getFilter($filters,true,true); |
| 1102 | 1171 | if ($globalDBdriver == 'mysql') { |
| 1103 | 1172 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1146,7 +1215,9 @@ discard block |
||
| 1146 | 1215 | date_default_timezone_set($globalTimezone); |
| 1147 | 1216 | $datetime = new DateTime(); |
| 1148 | 1217 | $offset = $datetime->format('P'); |
| 1149 | - } else $offset = '+00:00'; |
|
| 1218 | + } else { |
|
| 1219 | + $offset = '+00:00'; |
|
| 1220 | + } |
|
| 1150 | 1221 | |
| 1151 | 1222 | $orderby_sql = ''; |
| 1152 | 1223 | if ($orderby == "hour") |
@@ -1215,7 +1286,9 @@ discard block |
||
| 1215 | 1286 | date_default_timezone_set($globalTimezone); |
| 1216 | 1287 | $datetime = new DateTime($date); |
| 1217 | 1288 | $offset = $datetime->format('P'); |
| 1218 | - } else $offset = '+00:00'; |
|
| 1289 | + } else { |
|
| 1290 | + $offset = '+00:00'; |
|
| 1291 | + } |
|
| 1219 | 1292 | |
| 1220 | 1293 | if ($globalDBdriver == 'mysql') { |
| 1221 | 1294 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1263,7 +1336,9 @@ discard block |
||
| 1263 | 1336 | date_default_timezone_set($globalTimezone); |
| 1264 | 1337 | $datetime = new DateTime(); |
| 1265 | 1338 | $offset = $datetime->format('P'); |
| 1266 | - } else $offset = '+00:00'; |
|
| 1339 | + } else { |
|
| 1340 | + $offset = '+00:00'; |
|
| 1341 | + } |
|
| 1267 | 1342 | |
| 1268 | 1343 | if ($globalDBdriver == 'mysql') { |
| 1269 | 1344 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1328,8 +1403,11 @@ discard block |
||
| 1328 | 1403 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1329 | 1404 | } |
| 1330 | 1405 | } |
| 1331 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1332 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1406 | + if (empty($query_values)) { |
|
| 1407 | + $queryi .= $this->getFilter($filters); |
|
| 1408 | + } else { |
|
| 1409 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1410 | + } |
|
| 1333 | 1411 | |
| 1334 | 1412 | $sth = $this->db->prepare($queryi); |
| 1335 | 1413 | $sth->execute($query_values); |
@@ -1366,8 +1444,11 @@ discard block |
||
| 1366 | 1444 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1367 | 1445 | } |
| 1368 | 1446 | } |
| 1369 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1370 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1447 | + if (empty($query_values)) { |
|
| 1448 | + $queryi .= $this->getFilter($filters); |
|
| 1449 | + } else { |
|
| 1450 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1451 | + } |
|
| 1371 | 1452 | |
| 1372 | 1453 | $sth = $this->db->prepare($queryi); |
| 1373 | 1454 | $sth->execute($query_values); |
@@ -1389,7 +1470,9 @@ discard block |
||
| 1389 | 1470 | date_default_timezone_set($globalTimezone); |
| 1390 | 1471 | $datetime = new DateTime(); |
| 1391 | 1472 | $offset = $datetime->format('P'); |
| 1392 | - } else $offset = '+00:00'; |
|
| 1473 | + } else { |
|
| 1474 | + $offset = '+00:00'; |
|
| 1475 | + } |
|
| 1393 | 1476 | |
| 1394 | 1477 | if ($globalDBdriver == 'mysql') { |
| 1395 | 1478 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1493,7 +1576,9 @@ discard block |
||
| 1493 | 1576 | */ |
| 1494 | 1577 | public function parseDirection($direction = 0) |
| 1495 | 1578 | { |
| 1496 | - if ($direction == '') $direction = 0; |
|
| 1579 | + if ($direction == '') { |
|
| 1580 | + $direction = 0; |
|
| 1581 | + } |
|
| 1497 | 1582 | $direction_array = array(); |
| 1498 | 1583 | $temp_array = array(); |
| 1499 | 1584 | |
@@ -1582,7 +1667,9 @@ discard block |
||
| 1582 | 1667 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1583 | 1668 | |
| 1584 | 1669 | $Connection = new Connection($this->db); |
| 1585 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1670 | + if (!$Connection->tableExists('countries')) { |
|
| 1671 | + return ''; |
|
| 1672 | + } |
|
| 1586 | 1673 | |
| 1587 | 1674 | try { |
| 1588 | 1675 | /* |
@@ -1602,9 +1689,13 @@ discard block |
||
| 1602 | 1689 | $sth->closeCursor(); |
| 1603 | 1690 | if (count($row) > 0) { |
| 1604 | 1691 | return $row; |
| 1605 | - } else return ''; |
|
| 1692 | + } else { |
|
| 1693 | + return ''; |
|
| 1694 | + } |
|
| 1606 | 1695 | } catch (PDOException $e) { |
| 1607 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1696 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1697 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1698 | + } |
|
| 1608 | 1699 | return ''; |
| 1609 | 1700 | } |
| 1610 | 1701 | |
@@ -1622,7 +1713,9 @@ discard block |
||
| 1622 | 1713 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 1623 | 1714 | |
| 1624 | 1715 | $Connection = new Connection($this->db); |
| 1625 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1716 | + if (!$Connection->tableExists('countries')) { |
|
| 1717 | + return ''; |
|
| 1718 | + } |
|
| 1626 | 1719 | |
| 1627 | 1720 | try { |
| 1628 | 1721 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1634,9 +1727,13 @@ discard block |
||
| 1634 | 1727 | $sth->closeCursor(); |
| 1635 | 1728 | if (count($row) > 0) { |
| 1636 | 1729 | return $row; |
| 1637 | - } else return ''; |
|
| 1730 | + } else { |
|
| 1731 | + return ''; |
|
| 1732 | + } |
|
| 1638 | 1733 | } catch (PDOException $e) { |
| 1639 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1734 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1735 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1736 | + } |
|
| 1640 | 1737 | return ''; |
| 1641 | 1738 | } |
| 1642 | 1739 | |
@@ -1697,7 +1794,9 @@ discard block |
||
| 1697 | 1794 | } |
| 1698 | 1795 | } |
| 1699 | 1796 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
| 1700 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1797 | + if ($limit) { |
|
| 1798 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1799 | + } |
|
| 1701 | 1800 | $sth = $this->db->prepare($query); |
| 1702 | 1801 | $sth->execute($query_values); |
| 1703 | 1802 | $tracker_array = array(); |
@@ -1724,7 +1823,9 @@ discard block |
||
| 1724 | 1823 | { |
| 1725 | 1824 | global $globalBitlyAccessToken; |
| 1726 | 1825 | |
| 1727 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 1826 | + if ($globalBitlyAccessToken == '') { |
|
| 1827 | + return $url; |
|
| 1828 | + } |
|
| 1728 | 1829 | |
| 1729 | 1830 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 1730 | 1831 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
| 6 | 6 | |
| 7 | -class Tracker{ |
|
| 7 | +class Tracker { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -18,33 +18,33 @@ discard block |
||
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 21 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 23 | 23 | $filters = array(); |
| 24 | 24 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 25 | 25 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 26 | 26 | $filters = $globalStatsFilters[$globalFilterName]; |
| 27 | 27 | } else { |
| 28 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 28 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | if (isset($filter[0]['source'])) { |
| 32 | - $filters = array_merge($filters,$filter); |
|
| 32 | + $filters = array_merge($filters, $filter); |
|
| 33 | 33 | } |
| 34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 34 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 35 | 35 | $filter_query_join = ''; |
| 36 | 36 | $filter_query_where = ''; |
| 37 | - foreach($filters as $flt) { |
|
| 37 | + foreach ($filters as $flt) { |
|
| 38 | 38 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 47 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 47 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 48 | 48 | } |
| 49 | 49 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 50 | 50 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 74 | 74 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 75 | 75 | if ($filter_query_where != '') { |
| 76 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 76 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 77 | 77 | } |
| 78 | 78 | $filter_query = $filter_query_join.$filter_query_where; |
| 79 | 79 | return $filter_query; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return Array the spotter information |
| 89 | 89 | * |
| 90 | 90 | */ |
| 91 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 91 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 92 | 92 | { |
| 93 | 93 | date_default_timezone_set('UTC'); |
| 94 | 94 | if (!is_string($query)) |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | $sth = $this->db->prepare($query.$limitQuery); |
| 109 | 109 | $sth->execute($params); |
| 110 | 110 | } catch (PDOException $e) { |
| 111 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 111 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 112 | 112 | exit(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $num_rows = 0; |
| 116 | 116 | $spotter_array = array(); |
| 117 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 117 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 118 | 118 | { |
| 119 | 119 | $num_rows++; |
| 120 | 120 | $temp_array = array(); |
@@ -170,17 +170,17 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 172 | 172 | } else { |
| 173 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 173 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 174 | 174 | } |
| 175 | 175 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 176 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 177 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 176 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 177 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 178 | 178 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 179 | 179 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 180 | 180 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 181 | 181 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 182 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 183 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 182 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 183 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 184 | 184 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $limit_array = explode(",", $limit); |
| 219 | 219 | |
| 220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 222 | 222 | |
| 223 | 223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 224 | 224 | { |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 238 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 239 | 239 | |
| 240 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 240 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 241 | 241 | |
| 242 | 242 | return $spotter_array; |
| 243 | 243 | } |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | if ($id == '') return array(); |
| 257 | 257 | $additional_query = "tracker_output.famtrackid = :id"; |
| 258 | 258 | $query_values = array(':id' => $id); |
| 259 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 259 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 261 | 261 | return $spotter_array; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $query_values = array(); |
| 277 | 277 | $limit_query = ''; |
| 278 | 278 | $additional_query = ''; |
| 279 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 279 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 280 | 280 | if ($ident != "") |
| 281 | 281 | { |
| 282 | 282 | if (!is_string($ident)) |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | $limit_array = explode(",", $limit); |
| 294 | 294 | |
| 295 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 295 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 297 | 297 | |
| 298 | 298 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 299 | 299 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return $spotter_array; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 320 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 321 | 321 | { |
| 322 | 322 | global $global_query, $globalTimezone, $globalDBdriver; |
| 323 | 323 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $limit_query = ''; |
| 326 | 326 | $additional_query = ''; |
| 327 | 327 | |
| 328 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 328 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 329 | 329 | |
| 330 | 330 | if ($date != "") |
| 331 | 331 | { |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $limit_array = explode(",", $limit); |
| 353 | 353 | |
| 354 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 354 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 356 | 356 | |
| 357 | 357 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 358 | 358 | { |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | * @return Array list of source name |
| 384 | 384 | * |
| 385 | 385 | */ |
| 386 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 386 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 387 | 387 | { |
| 388 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 388 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 389 | 389 | $query_values = array(); |
| 390 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
| 390 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
| 391 | 391 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
| 392 | 392 | if ($type != '') { |
| 393 | 393 | $query_values = array(':type' => $type); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $source_array = array(); |
| 403 | 403 | $temp_array = array(); |
| 404 | 404 | |
| 405 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 405 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 406 | 406 | { |
| 407 | 407 | $temp_array['source_name'] = $row['source_name']; |
| 408 | 408 | $source_array[] = $temp_array; |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getAllIdents($filters = array()) |
| 421 | 421 | { |
| 422 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 423 | - $query = "SELECT DISTINCT tracker_output.ident |
|
| 422 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 423 | + $query = "SELECT DISTINCT tracker_output.ident |
|
| 424 | 424 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
| 425 | 425 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
| 426 | 426 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $ident_array = array(); |
| 431 | 431 | $temp_array = array(); |
| 432 | 432 | |
| 433 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 433 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 434 | 434 | { |
| 435 | 435 | $temp_array['ident'] = $row['ident']; |
| 436 | 436 | $ident_array[] = $temp_array; |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | } else $offset = '+00:00'; |
| 456 | 456 | |
| 457 | 457 | if ($globalDBdriver == 'mysql') { |
| 458 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 458 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 459 | 459 | FROM tracker_output |
| 460 | 460 | WHERE tracker_output.date <> '' |
| 461 | 461 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
| 462 | 462 | } else { |
| 463 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 463 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 464 | 464 | FROM tracker_output |
| 465 | 465 | WHERE tracker_output.date <> '' |
| 466 | 466 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $date_array = array(); |
| 473 | 473 | $temp_array = array(); |
| 474 | 474 | |
| 475 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 475 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 476 | 476 | { |
| 477 | 477 | $temp_array['date'] = $row['date']; |
| 478 | 478 | |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | * @return String success or false |
| 492 | 492 | * |
| 493 | 493 | */ |
| 494 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
| 494 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
| 495 | 495 | { |
| 496 | 496 | |
| 497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 498 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
| 499 | 499 | |
| 500 | 500 | try { |
| 501 | 501 | $sth = $this->db->prepare($query); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 520 | 520 | { |
| 521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 522 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
| 523 | 523 | |
| 524 | 524 | try { |
| 525 | 525 | $sth = $this->db->prepare($query); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @param String $verticalrate vertival rate of flight |
| 560 | 560 | * @return String success or false |
| 561 | 561 | */ |
| 562 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
| 562 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
| 563 | 563 | { |
| 564 | 564 | global $globalURL; |
| 565 | 565 | |
@@ -627,21 +627,21 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
| 630 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 630 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 631 | 631 | { |
| 632 | 632 | $date = date("Y-m-d H:i:s", time()); |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 636 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 637 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 643 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 644 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 635 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 636 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 637 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 643 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 644 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 645 | 645 | |
| 646 | 646 | if ($latitude == '' && $longitude == '') { |
| 647 | 647 | $latitude = 0; |
@@ -649,10 +649,10 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 651 | 651 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 654 | |
| 655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 655 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
@@ -678,13 +678,13 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | global $globalDBdriver, $globalTimezone; |
| 680 | 680 | if ($globalDBdriver == 'mysql') { |
| 681 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 681 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 682 | 682 | WHERE tracker_output.ident = :ident |
| 683 | 683 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 684 | 684 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 685 | 685 | $query_data = array(':ident' => $ident); |
| 686 | 686 | } else { |
| 687 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 687 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 688 | 688 | WHERE tracker_output.ident = :ident |
| 689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute($query_data); |
| 696 | - $ident_result=''; |
|
| 697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 696 | + $ident_result = ''; |
|
| 697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 698 | 698 | { |
| 699 | 699 | $ident_result = $row['ident']; |
| 700 | 700 | } |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | return false; |
| 721 | 721 | } else { |
| 722 | 722 | $q_array = explode(" ", $q); |
| 723 | - foreach ($q_array as $q_item){ |
|
| 724 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 723 | + foreach ($q_array as $q_item) { |
|
| 724 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 725 | 725 | $additional_query .= " AND ("; |
| 726 | 726 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
| 727 | 727 | $additional_query .= ")"; |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | if ($globalDBdriver == 'mysql') { |
| 732 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 732 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 733 | 733 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 734 | 734 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 735 | 735 | } else { |
| 736 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 736 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 737 | 737 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 738 | 738 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 739 | 739 | } |
@@ -752,16 +752,16 @@ discard block |
||
| 752 | 752 | * |
| 753 | 753 | */ |
| 754 | 754 | |
| 755 | - public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 755 | + public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 756 | 756 | { |
| 757 | 757 | global $globalDBdriver, $globalArchive; |
| 758 | 758 | //$filter_query = $this->getFilter($filters,true,true); |
| 759 | - $Connection= new Connection($this->db); |
|
| 759 | + $Connection = new Connection($this->db); |
|
| 760 | 760 | if (!$Connection->tableExists('countries')) return array(); |
| 761 | 761 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 762 | 762 | require_once('class.TrackerLive.php'); |
| 763 | 763 | $TrackerLive = new TrackerLive(); |
| 764 | - $filter_query = $TrackerLive->getFilter($filters,true,true); |
|
| 764 | + $filter_query = $TrackerLive->getFilter($filters, true, true); |
|
| 765 | 765 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
| 766 | 766 | if ($olderthanmonths > 0) { |
| 767 | 767 | if ($globalDBdriver == 'mysql') { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | } else { |
| 782 | 782 | require_once('class.TrackerArchive.php'); |
| 783 | 783 | $TrackerArchive = new TrackerArchive(); |
| 784 | - $filter_query = $TrackerArchive->getFilter($filters,true,true); |
|
| 784 | + $filter_query = $TrackerArchive->getFilter($filters, true, true); |
|
| 785 | 785 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
| 786 | 786 | if ($olderthanmonths > 0) { |
| 787 | 787 | if ($globalDBdriver == 'mysql') { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $flight_array = array(); |
| 810 | 810 | $temp_array = array(); |
| 811 | 811 | |
| 812 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 812 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 813 | 813 | { |
| 814 | 814 | $temp_array['flight_count'] = $row['nb']; |
| 815 | 815 | $temp_array['flight_country'] = $row['name']; |
@@ -826,11 +826,11 @@ discard block |
||
| 826 | 826 | * @return Array the callsign list |
| 827 | 827 | * |
| 828 | 828 | */ |
| 829 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 829 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 830 | 830 | { |
| 831 | 831 | global $globalDBdriver; |
| 832 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 833 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 832 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 833 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 834 | 834 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 835 | 835 | if ($olderthanmonths > 0) { |
| 836 | 836 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -844,28 +844,28 @@ discard block |
||
| 844 | 844 | if ($year != '') { |
| 845 | 845 | if ($globalDBdriver == 'mysql') { |
| 846 | 846 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 847 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 847 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 848 | 848 | } else { |
| 849 | 849 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 850 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 850 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | if ($month != '') { |
| 854 | 854 | if ($globalDBdriver == 'mysql') { |
| 855 | 855 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 856 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 856 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 857 | 857 | } else { |
| 858 | 858 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 859 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 859 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | if ($day != '') { |
| 863 | 863 | if ($globalDBdriver == 'mysql') { |
| 864 | 864 | $query .= " AND DAY(tracker_output.date) = :day"; |
| 865 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 865 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 866 | 866 | } else { |
| 867 | 867 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
| 868 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 868 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $callsign_array = array(); |
| 878 | 878 | $temp_array = array(); |
| 879 | 879 | |
| 880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 881 | 881 | { |
| 882 | 882 | $temp_array['callsign_icao'] = $row['ident']; |
| 883 | 883 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $date_array = array(); |
| 930 | 930 | $temp_array = array(); |
| 931 | 931 | |
| 932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 933 | 933 | { |
| 934 | 934 | $temp_array['date_name'] = $row['date_name']; |
| 935 | 935 | $temp_array['date_count'] = $row['date_count']; |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | $datetime = new DateTime(); |
| 956 | 956 | $offset = $datetime->format('P'); |
| 957 | 957 | } else $offset = '+00:00'; |
| 958 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 958 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 959 | 959 | if ($globalDBdriver == 'mysql') { |
| 960 | 960 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 961 | 961 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | $date_array = array(); |
| 977 | 977 | $temp_array = array(); |
| 978 | 978 | |
| 979 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 979 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 980 | 980 | { |
| 981 | 981 | $temp_array['date_name'] = $row['date_name']; |
| 982 | 982 | $temp_array['date_count'] = $row['date_count']; |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $datetime = new DateTime(); |
| 1002 | 1002 | $offset = $datetime->format('P'); |
| 1003 | 1003 | } else $offset = '+00:00'; |
| 1004 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1004 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1005 | 1005 | if ($globalDBdriver == 'mysql') { |
| 1006 | 1006 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1007 | 1007 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | $date_array = array(); |
| 1023 | 1023 | $temp_array = array(); |
| 1024 | 1024 | |
| 1025 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1025 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1026 | 1026 | { |
| 1027 | 1027 | $temp_array['date_name'] = $row['date_name']; |
| 1028 | 1028 | $temp_array['date_count'] = $row['date_count']; |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | $date_array = array(); |
| 1070 | 1070 | $temp_array = array(); |
| 1071 | 1071 | |
| 1072 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1072 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1073 | 1073 | { |
| 1074 | 1074 | $temp_array['month_name'] = $row['month_name']; |
| 1075 | 1075 | $temp_array['year_name'] = $row['year_name']; |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | $datetime = new DateTime(); |
| 1099 | 1099 | $offset = $datetime->format('P'); |
| 1100 | 1100 | } else $offset = '+00:00'; |
| 1101 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1101 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1102 | 1102 | if ($globalDBdriver == 'mysql') { |
| 1103 | 1103 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 1104 | 1104 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | $date_array = array(); |
| 1120 | 1120 | $temp_array = array(); |
| 1121 | 1121 | |
| 1122 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1122 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1123 | 1123 | { |
| 1124 | 1124 | $temp_array['year_name'] = $row['year_name']; |
| 1125 | 1125 | $temp_array['month_name'] = $row['month_name']; |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | * @return Array the hour list |
| 1140 | 1140 | * |
| 1141 | 1141 | */ |
| 1142 | - public function countAllHours($orderby,$filters = array()) |
|
| 1142 | + public function countAllHours($orderby, $filters = array()) |
|
| 1143 | 1143 | { |
| 1144 | 1144 | global $globalTimezone, $globalDBdriver; |
| 1145 | 1145 | if ($globalTimezone != '') { |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | $hour_array = array(); |
| 1188 | 1188 | $temp_array = array(); |
| 1189 | 1189 | |
| 1190 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1190 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | $temp_array['hour_name'] = $row['hour_name']; |
| 1193 | 1193 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1209,8 +1209,8 @@ discard block |
||
| 1209 | 1209 | public function countAllHoursByDate($date, $filters = array()) |
| 1210 | 1210 | { |
| 1211 | 1211 | global $globalTimezone, $globalDBdriver; |
| 1212 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1213 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 1212 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1213 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 1214 | 1214 | if ($globalTimezone != '') { |
| 1215 | 1215 | date_default_timezone_set($globalTimezone); |
| 1216 | 1216 | $datetime = new DateTime($date); |
@@ -1218,12 +1218,12 @@ discard block |
||
| 1218 | 1218 | } else $offset = '+00:00'; |
| 1219 | 1219 | |
| 1220 | 1220 | if ($globalDBdriver == 'mysql') { |
| 1221 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1221 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1222 | 1222 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
| 1223 | 1223 | GROUP BY hour_name |
| 1224 | 1224 | ORDER BY hour_name ASC"; |
| 1225 | 1225 | } else { |
| 1226 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1226 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1227 | 1227 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 1228 | 1228 | GROUP BY hour_name |
| 1229 | 1229 | ORDER BY hour_name ASC"; |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | $hour_array = array(); |
| 1236 | 1236 | $temp_array = array(); |
| 1237 | 1237 | |
| 1238 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1238 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1239 | 1239 | { |
| 1240 | 1240 | $temp_array['hour_name'] = $row['hour_name']; |
| 1241 | 1241 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1258 | 1258 | { |
| 1259 | 1259 | global $globalTimezone, $globalDBdriver; |
| 1260 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1261 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1260 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1261 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1262 | 1262 | if ($globalTimezone != '') { |
| 1263 | 1263 | date_default_timezone_set($globalTimezone); |
| 1264 | 1264 | $datetime = new DateTime(); |
@@ -1266,12 +1266,12 @@ discard block |
||
| 1266 | 1266 | } else $offset = '+00:00'; |
| 1267 | 1267 | |
| 1268 | 1268 | if ($globalDBdriver == 'mysql') { |
| 1269 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1269 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1270 | 1270 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1271 | 1271 | GROUP BY hour_name |
| 1272 | 1272 | ORDER BY hour_name ASC"; |
| 1273 | 1273 | } else { |
| 1274 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1274 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1275 | 1275 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1276 | 1276 | GROUP BY hour_name |
| 1277 | 1277 | ORDER BY hour_name ASC"; |
@@ -1279,12 +1279,12 @@ discard block |
||
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | 1281 | $sth = $this->db->prepare($query); |
| 1282 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 1282 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 1283 | 1283 | |
| 1284 | 1284 | $hour_array = array(); |
| 1285 | 1285 | $temp_array = array(); |
| 1286 | 1286 | |
| 1287 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1287 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1288 | 1288 | { |
| 1289 | 1289 | $temp_array['hour_name'] = $row['hour_name']; |
| 1290 | 1290 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1303,33 +1303,33 @@ discard block |
||
| 1303 | 1303 | * @return Integer the number of trackers |
| 1304 | 1304 | * |
| 1305 | 1305 | */ |
| 1306 | - public function countOverallTracker($filters = array(),$year = '',$month = '') |
|
| 1306 | + public function countOverallTracker($filters = array(), $year = '', $month = '') |
|
| 1307 | 1307 | { |
| 1308 | 1308 | global $globalDBdriver; |
| 1309 | 1309 | //$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
| 1310 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
| 1310 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
| 1311 | 1311 | $query_values = array(); |
| 1312 | 1312 | $query = ''; |
| 1313 | 1313 | if ($year != '') { |
| 1314 | 1314 | if ($globalDBdriver == 'mysql') { |
| 1315 | 1315 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1316 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1316 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1317 | 1317 | } else { |
| 1318 | 1318 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1319 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1319 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1320 | 1320 | } |
| 1321 | 1321 | } |
| 1322 | 1322 | if ($month != '') { |
| 1323 | 1323 | if ($globalDBdriver == 'mysql') { |
| 1324 | 1324 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1325 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1325 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1326 | 1326 | } else { |
| 1327 | 1327 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1328 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1328 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1329 | 1329 | } |
| 1330 | 1330 | } |
| 1331 | 1331 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1332 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1332 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1333 | 1333 | |
| 1334 | 1334 | $sth = $this->db->prepare($queryi); |
| 1335 | 1335 | $sth->execute($query_values); |
@@ -1342,32 +1342,32 @@ discard block |
||
| 1342 | 1342 | * @return Integer the number of flights |
| 1343 | 1343 | * |
| 1344 | 1344 | */ |
| 1345 | - public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
|
| 1345 | + public function countOverallTrackerTypes($filters = array(), $year = '', $month = '') |
|
| 1346 | 1346 | { |
| 1347 | 1347 | global $globalDBdriver; |
| 1348 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
| 1348 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
| 1349 | 1349 | $query_values = array(); |
| 1350 | 1350 | $query = ''; |
| 1351 | 1351 | if ($year != '') { |
| 1352 | 1352 | if ($globalDBdriver == 'mysql') { |
| 1353 | 1353 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1354 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1354 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1355 | 1355 | } else { |
| 1356 | 1356 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1357 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1357 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1358 | 1358 | } |
| 1359 | 1359 | } |
| 1360 | 1360 | if ($month != '') { |
| 1361 | 1361 | if ($globalDBdriver == 'mysql') { |
| 1362 | 1362 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1363 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1363 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1364 | 1364 | } else { |
| 1365 | 1365 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1366 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1366 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | } |
| 1369 | 1369 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1370 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1370 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1371 | 1371 | |
| 1372 | 1372 | $sth = $this->db->prepare($queryi); |
| 1373 | 1373 | $sth->execute($query_values); |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | public function countAllHoursFromToday($filters = array()) |
| 1385 | 1385 | { |
| 1386 | 1386 | global $globalTimezone, $globalDBdriver; |
| 1387 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1387 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1388 | 1388 | if ($globalTimezone != '') { |
| 1389 | 1389 | date_default_timezone_set($globalTimezone); |
| 1390 | 1390 | $datetime = new DateTime(); |
@@ -1392,12 +1392,12 @@ discard block |
||
| 1392 | 1392 | } else $offset = '+00:00'; |
| 1393 | 1393 | |
| 1394 | 1394 | if ($globalDBdriver == 'mysql') { |
| 1395 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1395 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1396 | 1396 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
| 1397 | 1397 | GROUP BY hour_name |
| 1398 | 1398 | ORDER BY hour_name ASC"; |
| 1399 | 1399 | } else { |
| 1400 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1400 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1401 | 1401 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 1402 | 1402 | GROUP BY hour_name |
| 1403 | 1403 | ORDER BY hour_name ASC"; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $hour_array = array(); |
| 1410 | 1410 | $temp_array = array(); |
| 1411 | 1411 | |
| 1412 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1412 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | $temp_array['hour_name'] = $row['hour_name']; |
| 1415 | 1415 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1428,9 +1428,9 @@ discard block |
||
| 1428 | 1428 | */ |
| 1429 | 1429 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1430 | 1430 | { |
| 1431 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 1431 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 1432 | 1432 | |
| 1433 | - $query = "SELECT tracker_output.tracker_id |
|
| 1433 | + $query = "SELECT tracker_output.tracker_id |
|
| 1434 | 1434 | FROM tracker_output |
| 1435 | 1435 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
| 1436 | 1436 | |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | $sth = $this->db->prepare($query); |
| 1439 | 1439 | $sth->execute(); |
| 1440 | 1440 | |
| 1441 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1441 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1442 | 1442 | { |
| 1443 | 1443 | return $row['tracker_id']; |
| 1444 | 1444 | } |
@@ -1463,23 +1463,23 @@ discard block |
||
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | $current_date = date("Y-m-d H:i:s"); |
| 1466 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 1466 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 1467 | 1467 | |
| 1468 | 1468 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 1469 | 1469 | |
| 1470 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 1470 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 1471 | 1471 | $years = $time_array['years']; |
| 1472 | 1472 | |
| 1473 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 1473 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 1474 | 1474 | $months = $time_array['months']; |
| 1475 | 1475 | |
| 1476 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 1476 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 1477 | 1477 | $days = $time_array['days']; |
| 1478 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 1478 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 1479 | 1479 | $hours = $time_array['hours']; |
| 1480 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 1480 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 1481 | 1481 | $minutes = $time_array['minutes']; |
| 1482 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1482 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1483 | 1483 | |
| 1484 | 1484 | return $time_array; |
| 1485 | 1485 | } |
@@ -1502,63 +1502,63 @@ discard block |
||
| 1502 | 1502 | $temp_array['direction_degree'] = $direction; |
| 1503 | 1503 | $temp_array['direction_shortname'] = "N"; |
| 1504 | 1504 | $temp_array['direction_fullname'] = "North"; |
| 1505 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 1505 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 1506 | 1506 | $temp_array['direction_degree'] = $direction; |
| 1507 | 1507 | $temp_array['direction_shortname'] = "NNE"; |
| 1508 | 1508 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 1509 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 1509 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 1510 | 1510 | $temp_array['direction_degree'] = $direction; |
| 1511 | 1511 | $temp_array['direction_shortname'] = "NE"; |
| 1512 | 1512 | $temp_array['direction_fullname'] = "Northeast"; |
| 1513 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 1513 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 1514 | 1514 | $temp_array['direction_degree'] = $direction; |
| 1515 | 1515 | $temp_array['direction_shortname'] = "ENE"; |
| 1516 | 1516 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 1517 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 1517 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 1518 | 1518 | $temp_array['direction_degree'] = $direction; |
| 1519 | 1519 | $temp_array['direction_shortname'] = "E"; |
| 1520 | 1520 | $temp_array['direction_fullname'] = "East"; |
| 1521 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 1521 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 1522 | 1522 | $temp_array['direction_degree'] = $direction; |
| 1523 | 1523 | $temp_array['direction_shortname'] = "ESE"; |
| 1524 | 1524 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 1525 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 1525 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 1526 | 1526 | $temp_array['direction_degree'] = $direction; |
| 1527 | 1527 | $temp_array['direction_shortname'] = "SE"; |
| 1528 | 1528 | $temp_array['direction_fullname'] = "Southeast"; |
| 1529 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 1529 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 1530 | 1530 | $temp_array['direction_degree'] = $direction; |
| 1531 | 1531 | $temp_array['direction_shortname'] = "SSE"; |
| 1532 | 1532 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 1533 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 1533 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 1534 | 1534 | $temp_array['direction_degree'] = $direction; |
| 1535 | 1535 | $temp_array['direction_shortname'] = "S"; |
| 1536 | 1536 | $temp_array['direction_fullname'] = "South"; |
| 1537 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 1537 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 1538 | 1538 | $temp_array['direction_degree'] = $direction; |
| 1539 | 1539 | $temp_array['direction_shortname'] = "SSW"; |
| 1540 | 1540 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 1541 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 1541 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 1542 | 1542 | $temp_array['direction_degree'] = $direction; |
| 1543 | 1543 | $temp_array['direction_shortname'] = "SW"; |
| 1544 | 1544 | $temp_array['direction_fullname'] = "Southwest"; |
| 1545 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 1545 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 1546 | 1546 | $temp_array['direction_degree'] = $direction; |
| 1547 | 1547 | $temp_array['direction_shortname'] = "WSW"; |
| 1548 | 1548 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 1549 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 1549 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 1550 | 1550 | $temp_array['direction_degree'] = $direction; |
| 1551 | 1551 | $temp_array['direction_shortname'] = "W"; |
| 1552 | 1552 | $temp_array['direction_fullname'] = "West"; |
| 1553 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 1553 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 1554 | 1554 | $temp_array['direction_degree'] = $direction; |
| 1555 | 1555 | $temp_array['direction_shortname'] = "WNW"; |
| 1556 | 1556 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 1557 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 1557 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 1558 | 1558 | $temp_array['direction_degree'] = $direction; |
| 1559 | 1559 | $temp_array['direction_shortname'] = "NW"; |
| 1560 | 1560 | $temp_array['direction_fullname'] = "Northwest"; |
| 1561 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 1561 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 1562 | 1562 | $temp_array['direction_degree'] = $direction; |
| 1563 | 1563 | $temp_array['direction_shortname'] = "NNW"; |
| 1564 | 1564 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | * @param Float $longitude longitute of the flight |
| 1576 | 1576 | * @return String the countrie |
| 1577 | 1577 | */ |
| 1578 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 1578 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 1579 | 1579 | { |
| 1580 | 1580 | global $globalDBdriver, $globalDebug; |
| 1581 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1582 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1581 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1582 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1583 | 1583 | |
| 1584 | 1584 | $Connection = new Connection($this->db); |
| 1585 | 1585 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | public function getCountryFromISO2($iso2) |
| 1620 | 1620 | { |
| 1621 | 1621 | global $globalDBdriver, $globalDebug; |
| 1622 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 1622 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 1623 | 1623 | |
| 1624 | 1624 | $Connection = new Connection($this->db); |
| 1625 | 1625 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1648,11 +1648,11 @@ discard block |
||
| 1648 | 1648 | * @return Array the vessel type list |
| 1649 | 1649 | * |
| 1650 | 1650 | */ |
| 1651 | - public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 1651 | + public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 1652 | 1652 | { |
| 1653 | 1653 | global $globalDBdriver; |
| 1654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1655 | - $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
| 1654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1655 | + $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
| 1656 | 1656 | FROM tracker_output ".$filter_query." tracker_output.type <> ''"; |
| 1657 | 1657 | if ($olderthanmonths > 0) { |
| 1658 | 1658 | if ($globalDBdriver == 'mysql') { |
@@ -1672,28 +1672,28 @@ discard block |
||
| 1672 | 1672 | if ($year != '') { |
| 1673 | 1673 | if ($globalDBdriver == 'mysql') { |
| 1674 | 1674 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1675 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1675 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1676 | 1676 | } else { |
| 1677 | 1677 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1678 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1678 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1679 | 1679 | } |
| 1680 | 1680 | } |
| 1681 | 1681 | if ($month != '') { |
| 1682 | 1682 | if ($globalDBdriver == 'mysql') { |
| 1683 | 1683 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1684 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1684 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1685 | 1685 | } else { |
| 1686 | 1686 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1687 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1687 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1688 | 1688 | } |
| 1689 | 1689 | } |
| 1690 | 1690 | if ($day != '') { |
| 1691 | 1691 | if ($globalDBdriver == 'mysql') { |
| 1692 | 1692 | $query .= " AND DAY(tracker_output.date) = :day"; |
| 1693 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1693 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1694 | 1694 | } else { |
| 1695 | 1695 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
| 1696 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1696 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1697 | 1697 | } |
| 1698 | 1698 | } |
| 1699 | 1699 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | $sth->execute($query_values); |
| 1703 | 1703 | $tracker_array = array(); |
| 1704 | 1704 | $temp_array = array(); |
| 1705 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1705 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1706 | 1706 | { |
| 1707 | 1707 | $temp_array['tracker_type'] = $row['tracker_type']; |
| 1708 | 1708 | $temp_array['tracker_type_count'] = $row['tracker_type_count']; |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | |
| 1738 | 1738 | $bitly_data = json_decode($bitly_data); |
| 1739 | 1739 | $bitly_url = ''; |
| 1740 | - if ($bitly_data->status_txt = "OK"){ |
|
| 1740 | + if ($bitly_data->status_txt = "OK") { |
|
| 1741 | 1741 | $bitly_url = $bitly_data->data->url; |
| 1742 | 1742 | } |
| 1743 | 1743 | |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | |
| 1748 | 1748 | public function getOrderBy() |
| 1749 | 1749 | { |
| 1750 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 1750 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 1751 | 1751 | |
| 1752 | 1752 | return $orderby; |
| 1753 | 1753 | |
@@ -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 = '') |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Gets all the spotter information based on the latest data entry |
|
| 90 | - * |
|
| 91 | - * @return Array the spotter information |
|
| 92 | - * |
|
| 93 | - */ |
|
| 89 | + * Gets all the spotter information based on the latest data entry |
|
| 90 | + * |
|
| 91 | + * @return Array the spotter information |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | 94 | public function getLiveTrackerData($limit = '', $sort = '', $filter = array()) |
| 95 | 95 | { |
| 96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * Gets Minimal Live Spotter data |
|
| 136 | - * |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 135 | + * Gets Minimal Live Spotter data |
|
| 136 | + * |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getMinLiveTrackerData($filter = array()) |
| 141 | 141 | { |
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 174 | - * |
|
| 175 | - * @return Array the spotter information |
|
| 176 | - * |
|
| 177 | - */ |
|
| 173 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 174 | + * |
|
| 175 | + * @return Array the spotter information |
|
| 176 | + * |
|
| 177 | + */ |
|
| 178 | 178 | public function getMinLastLiveTrackerData($filter = array()) |
| 179 | 179 | { |
| 180 | 180 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Gets number of latest data entry |
|
| 234 | - * |
|
| 235 | - * @return String number of entry |
|
| 236 | - * |
|
| 237 | - */ |
|
| 233 | + * Gets number of latest data entry |
|
| 234 | + * |
|
| 235 | + * @return String number of entry |
|
| 236 | + * |
|
| 237 | + */ |
|
| 238 | 238 | public function getLiveTrackerCount($filter = array()) |
| 239 | 239 | { |
| 240 | 240 | global $globalDBdriver, $globalLiveInterval; |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 263 | - * |
|
| 264 | - * @return Array the spotter information |
|
| 265 | - * |
|
| 266 | - */ |
|
| 262 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 263 | + * |
|
| 264 | + * @return Array the spotter information |
|
| 265 | + * |
|
| 266 | + */ |
|
| 267 | 267 | public function getLiveTrackerDatabyCoord($coord, $filter = array()) |
| 268 | 268 | { |
| 269 | 269 | global $globalDBdriver, $globalLiveInterval; |
@@ -287,11 +287,11 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
| 290 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 291 | - * |
|
| 292 | - * @return Array the spotter information |
|
| 293 | - * |
|
| 294 | - */ |
|
| 290 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 291 | + * |
|
| 292 | + * @return Array the spotter information |
|
| 293 | + * |
|
| 294 | + */ |
|
| 295 | 295 | public function getMinLiveTrackerDatabyCoord($coord, $filter = array()) |
| 296 | 296 | { |
| 297 | 297 | global $globalDBdriver, $globalLiveInterval; |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 322 | - * |
|
| 323 | - * @return Array the spotter information |
|
| 324 | - * |
|
| 325 | - */ |
|
| 321 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 322 | + * |
|
| 323 | + * @return Array the spotter information |
|
| 324 | + * |
|
| 325 | + */ |
|
| 326 | 326 | public function getLatestTrackerForLayar($lat, $lng, $radius, $interval) |
| 327 | 327 | { |
| 328 | 328 | $Tracker = new Tracker($this->db); |
@@ -335,142 +335,142 @@ discard block |
||
| 335 | 335 | if ($lng != '') |
| 336 | 336 | { |
| 337 | 337 | if (!is_numeric($lng)) |
| 338 | - { |
|
| 339 | - return false; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - if ($radius != '') |
|
| 344 | - { |
|
| 345 | - if (!is_numeric($radius)) |
|
| 346 | - { |
|
| 347 | - return false; |
|
| 348 | - } |
|
| 349 | - } |
|
| 338 | + { |
|
| 339 | + return false; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + if ($radius != '') |
|
| 344 | + { |
|
| 345 | + if (!is_numeric($radius)) |
|
| 346 | + { |
|
| 347 | + return false; |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | 350 | $additional_query = ''; |
| 351 | 351 | if ($interval != '') |
| 352 | - { |
|
| 353 | - if (!is_string($interval)) |
|
| 354 | - { |
|
| 355 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 356 | - return false; |
|
| 357 | - } else { |
|
| 358 | - if ($interval == '1m') |
|
| 359 | - { |
|
| 360 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 361 | - } else if ($interval == '15m'){ |
|
| 362 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
| 363 | - } |
|
| 364 | - } |
|
| 365 | - } else { |
|
| 366 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - $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 |
|
| 352 | + { |
|
| 353 | + if (!is_string($interval)) |
|
| 354 | + { |
|
| 355 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 356 | + return false; |
|
| 357 | + } else { |
|
| 358 | + if ($interval == '1m') |
|
| 359 | + { |
|
| 360 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 361 | + } else if ($interval == '15m'){ |
|
| 362 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
| 363 | + } |
|
| 364 | + } |
|
| 365 | + } else { |
|
| 366 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + $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 |
|
| 370 | 370 | WHERE tracker_live.latitude <> '' |
| 371 | 371 | AND tracker_live.longitude <> '' |
| 372 | 372 | ".$additional_query." |
| 373 | 373 | HAVING distance < :radius |
| 374 | 374 | ORDER BY distance"; |
| 375 | 375 | |
| 376 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 376 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 377 | 377 | |
| 378 | - return $spotter_array; |
|
| 379 | - } |
|
| 378 | + return $spotter_array; |
|
| 379 | + } |
|
| 380 | 380 | |
| 381 | 381 | |
| 382 | - /** |
|
| 383 | - * Gets all the spotter information based on a particular callsign |
|
| 384 | - * |
|
| 385 | - * @return Array the spotter information |
|
| 386 | - * |
|
| 387 | - */ |
|
| 382 | + /** |
|
| 383 | + * Gets all the spotter information based on a particular callsign |
|
| 384 | + * |
|
| 385 | + * @return Array the spotter information |
|
| 386 | + * |
|
| 387 | + */ |
|
| 388 | 388 | public function getLastLiveTrackerDataByIdent($ident) |
| 389 | 389 | { |
| 390 | 390 | $Tracker = new Tracker($this->db); |
| 391 | 391 | date_default_timezone_set('UTC'); |
| 392 | 392 | |
| 393 | 393 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 394 | - $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'; |
|
| 394 | + $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'; |
|
| 395 | 395 | |
| 396 | 396 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 397 | 397 | |
| 398 | 398 | return $spotter_array; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - /** |
|
| 402 | - * Gets all the spotter information based on a particular callsign |
|
| 403 | - * |
|
| 404 | - * @return Array the spotter information |
|
| 405 | - * |
|
| 406 | - */ |
|
| 401 | + /** |
|
| 402 | + * Gets all the spotter information based on a particular callsign |
|
| 403 | + * |
|
| 404 | + * @return Array the spotter information |
|
| 405 | + * |
|
| 406 | + */ |
|
| 407 | 407 | public function getDateLiveTrackerDataByIdent($ident,$date) |
| 408 | 408 | { |
| 409 | 409 | $Tracker = new Tracker($this->db); |
| 410 | 410 | date_default_timezone_set('UTC'); |
| 411 | 411 | |
| 412 | 412 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 413 | - $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'; |
|
| 413 | + $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'; |
|
| 414 | 414 | |
| 415 | - $date = date('c',$date); |
|
| 415 | + $date = date('c',$date); |
|
| 416 | 416 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 417 | 417 | |
| 418 | 418 | return $spotter_array; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - /** |
|
| 422 | - * Gets last spotter information based on a particular callsign |
|
| 423 | - * |
|
| 424 | - * @return Array the spotter information |
|
| 425 | - * |
|
| 426 | - */ |
|
| 421 | + /** |
|
| 422 | + * Gets last spotter information based on a particular callsign |
|
| 423 | + * |
|
| 424 | + * @return Array the spotter information |
|
| 425 | + * |
|
| 426 | + */ |
|
| 427 | 427 | public function getLastLiveTrackerDataById($id) |
| 428 | 428 | { |
| 429 | 429 | $Tracker = new Tracker($this->db); |
| 430 | 430 | date_default_timezone_set('UTC'); |
| 431 | 431 | |
| 432 | 432 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 433 | - $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'; |
|
| 433 | + $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'; |
|
| 434 | 434 | |
| 435 | 435 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
| 436 | 436 | |
| 437 | 437 | return $spotter_array; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - /** |
|
| 441 | - * Gets last spotter information based on a particular callsign |
|
| 442 | - * |
|
| 443 | - * @return Array the spotter information |
|
| 444 | - * |
|
| 445 | - */ |
|
| 440 | + /** |
|
| 441 | + * Gets last spotter information based on a particular callsign |
|
| 442 | + * |
|
| 443 | + * @return Array the spotter information |
|
| 444 | + * |
|
| 445 | + */ |
|
| 446 | 446 | public function getDateLiveTrackerDataById($id,$date) |
| 447 | 447 | { |
| 448 | 448 | $Tracker = new Tracker($this->db); |
| 449 | 449 | date_default_timezone_set('UTC'); |
| 450 | 450 | |
| 451 | 451 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 452 | - $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'; |
|
| 453 | - $date = date('c',$date); |
|
| 452 | + $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'; |
|
| 453 | + $date = date('c',$date); |
|
| 454 | 454 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 455 | 455 | |
| 456 | 456 | return $spotter_array; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - /** |
|
| 460 | - * Gets altitude information based on a particular callsign |
|
| 461 | - * |
|
| 462 | - * @return Array the spotter information |
|
| 463 | - * |
|
| 464 | - */ |
|
| 459 | + /** |
|
| 460 | + * Gets altitude information based on a particular callsign |
|
| 461 | + * |
|
| 462 | + * @return Array the spotter information |
|
| 463 | + * |
|
| 464 | + */ |
|
| 465 | 465 | public function getAltitudeLiveTrackerDataByIdent($ident) |
| 466 | 466 | { |
| 467 | 467 | |
| 468 | 468 | date_default_timezone_set('UTC'); |
| 469 | 469 | |
| 470 | 470 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 471 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 471 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 472 | 472 | |
| 473 | - try { |
|
| 473 | + try { |
|
| 474 | 474 | |
| 475 | 475 | $sth = $this->db->prepare($query); |
| 476 | 476 | $sth->execute(array(':ident' => $ident)); |
@@ -483,12 +483,12 @@ discard block |
||
| 483 | 483 | return $spotter_array; |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - /** |
|
| 487 | - * Gets all the spotter information based on a particular id |
|
| 488 | - * |
|
| 489 | - * @return Array the spotter information |
|
| 490 | - * |
|
| 491 | - */ |
|
| 486 | + /** |
|
| 487 | + * Gets all the spotter information based on a particular id |
|
| 488 | + * |
|
| 489 | + * @return Array the spotter information |
|
| 490 | + * |
|
| 491 | + */ |
|
| 492 | 492 | public function getAllLiveTrackerDataById($id,$liveinterval = false) |
| 493 | 493 | { |
| 494 | 494 | global $globalDBdriver, $globalLiveInterval; |
@@ -516,18 +516,18 @@ discard block |
||
| 516 | 516 | return $spotter_array; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - /** |
|
| 520 | - * Gets all the spotter information based on a particular ident |
|
| 521 | - * |
|
| 522 | - * @return Array the spotter information |
|
| 523 | - * |
|
| 524 | - */ |
|
| 519 | + /** |
|
| 520 | + * Gets all the spotter information based on a particular ident |
|
| 521 | + * |
|
| 522 | + * @return Array the spotter information |
|
| 523 | + * |
|
| 524 | + */ |
|
| 525 | 525 | public function getAllLiveTrackerDataByIdent($ident) |
| 526 | 526 | { |
| 527 | 527 | date_default_timezone_set('UTC'); |
| 528 | 528 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 529 | 529 | $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
| 530 | - try { |
|
| 530 | + try { |
|
| 531 | 531 | |
| 532 | 532 | $sth = $this->db->prepare($query); |
| 533 | 533 | $sth->execute(array(':ident' => $ident)); |
@@ -541,23 +541,23 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | |
| 543 | 543 | /** |
| 544 | - * Deletes all info in the table |
|
| 545 | - * |
|
| 546 | - * @return String success or false |
|
| 547 | - * |
|
| 548 | - */ |
|
| 544 | + * Deletes all info in the table |
|
| 545 | + * |
|
| 546 | + * @return String success or false |
|
| 547 | + * |
|
| 548 | + */ |
|
| 549 | 549 | public function deleteLiveTrackerData() |
| 550 | 550 | { |
| 551 | 551 | global $globalDBdriver; |
| 552 | 552 | if ($globalDBdriver == 'mysql') { |
| 553 | 553 | //$query = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date"; |
| 554 | 554 | $query = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date'; |
| 555 | - //$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)"; |
|
| 555 | + //$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)"; |
|
| 556 | 556 | } else { |
| 557 | 557 | $query = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date"; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - try { |
|
| 560 | + try { |
|
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
@@ -569,18 +569,18 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | /** |
| 572 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 573 | - * |
|
| 574 | - * @return String success or false |
|
| 575 | - * |
|
| 576 | - */ |
|
| 572 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 573 | + * |
|
| 574 | + * @return String success or false |
|
| 575 | + * |
|
| 576 | + */ |
|
| 577 | 577 | public function deleteLiveTrackerDataNotUpdated() |
| 578 | 578 | { |
| 579 | 579 | global $globalDBdriver, $globalDebug; |
| 580 | 580 | if ($globalDBdriver == 'mysql') { |
| 581 | 581 | //$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'; |
| 582 | - $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"; |
|
| 583 | - try { |
|
| 582 | + $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"; |
|
| 583 | + try { |
|
| 584 | 584 | |
| 585 | 585 | $sth = $this->db->prepare($query); |
| 586 | 586 | $sth->execute(); |
@@ -588,8 +588,8 @@ discard block |
||
| 588 | 588 | return "error"; |
| 589 | 589 | } |
| 590 | 590 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
| 591 | - $i = 0; |
|
| 592 | - $j =0; |
|
| 591 | + $i = 0; |
|
| 592 | + $j =0; |
|
| 593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 594 | 594 | foreach($all as $row) |
| 595 | 595 | { |
@@ -597,20 +597,20 @@ discard block |
||
| 597 | 597 | $j++; |
| 598 | 598 | if ($j == 30) { |
| 599 | 599 | if ($globalDebug) echo "."; |
| 600 | - try { |
|
| 600 | + try { |
|
| 601 | 601 | |
| 602 | 602 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 603 | 603 | $sth->execute(); |
| 604 | 604 | } catch(PDOException $e) { |
| 605 | 605 | return "error"; |
| 606 | 606 | } |
| 607 | - $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
| 608 | - $j = 0; |
|
| 607 | + $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
| 608 | + $j = 0; |
|
| 609 | 609 | } |
| 610 | 610 | $query_delete .= "'".$row['famtrackid']."',"; |
| 611 | 611 | } |
| 612 | 612 | if ($i > 0) { |
| 613 | - try { |
|
| 613 | + try { |
|
| 614 | 614 | |
| 615 | 615 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 616 | 616 | $sth->execute(); |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | return "success"; |
| 622 | 622 | } elseif ($globalDBdriver == 'pgsql') { |
| 623 | 623 | //$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"; |
| 624 | - //$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"; |
|
| 625 | - $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)"; |
|
| 626 | - try { |
|
| 624 | + //$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"; |
|
| 625 | + $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)"; |
|
| 626 | + try { |
|
| 627 | 627 | |
| 628 | 628 | $sth = $this->db->prepare($query); |
| 629 | 629 | $sth->execute(); |
@@ -667,17 +667,17 @@ discard block |
||
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
| 670 | - * Deletes all info in the table for an ident |
|
| 671 | - * |
|
| 672 | - * @return String success or false |
|
| 673 | - * |
|
| 674 | - */ |
|
| 670 | + * Deletes all info in the table for an ident |
|
| 671 | + * |
|
| 672 | + * @return String success or false |
|
| 673 | + * |
|
| 674 | + */ |
|
| 675 | 675 | public function deleteLiveTrackerDataByIdent($ident) |
| 676 | 676 | { |
| 677 | 677 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 678 | 678 | $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
| 679 | 679 | |
| 680 | - try { |
|
| 680 | + try { |
|
| 681 | 681 | |
| 682 | 682 | $sth = $this->db->prepare($query); |
| 683 | 683 | $sth->execute(array(':ident' => $ident)); |
@@ -689,17 +689,17 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /** |
| 692 | - * Deletes all info in the table for an id |
|
| 693 | - * |
|
| 694 | - * @return String success or false |
|
| 695 | - * |
|
| 696 | - */ |
|
| 692 | + * Deletes all info in the table for an id |
|
| 693 | + * |
|
| 694 | + * @return String success or false |
|
| 695 | + * |
|
| 696 | + */ |
|
| 697 | 697 | public function deleteLiveTrackerDataById($id) |
| 698 | 698 | { |
| 699 | 699 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 700 | 700 | $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
| 701 | 701 | |
| 702 | - try { |
|
| 702 | + try { |
|
| 703 | 703 | |
| 704 | 704 | $sth = $this->db->prepare($query); |
| 705 | 705 | $sth->execute(array(':id' => $id)); |
@@ -712,11 +712,11 @@ discard block |
||
| 712 | 712 | |
| 713 | 713 | |
| 714 | 714 | /** |
| 715 | - * Gets the aircraft ident within the last hour |
|
| 716 | - * |
|
| 717 | - * @return String the ident |
|
| 718 | - * |
|
| 719 | - */ |
|
| 715 | + * Gets the aircraft ident within the last hour |
|
| 716 | + * |
|
| 717 | + * @return String the ident |
|
| 718 | + * |
|
| 719 | + */ |
|
| 720 | 720 | public function getIdentFromLastHour($ident) |
| 721 | 721 | { |
| 722 | 722 | global $globalDBdriver, $globalTimezone; |
@@ -742,14 +742,14 @@ discard block |
||
| 742 | 742 | $ident_result = $row['ident']; |
| 743 | 743 | } |
| 744 | 744 | return $ident_result; |
| 745 | - } |
|
| 745 | + } |
|
| 746 | 746 | |
| 747 | 747 | /** |
| 748 | - * Check recent aircraft |
|
| 749 | - * |
|
| 750 | - * @return String the ident |
|
| 751 | - * |
|
| 752 | - */ |
|
| 748 | + * Check recent aircraft |
|
| 749 | + * |
|
| 750 | + * @return String the ident |
|
| 751 | + * |
|
| 752 | + */ |
|
| 753 | 753 | public function checkIdentRecent($ident) |
| 754 | 754 | { |
| 755 | 755 | global $globalDBdriver, $globalTimezone; |
@@ -775,14 +775,14 @@ discard block |
||
| 775 | 775 | $ident_result = $row['famtrackid']; |
| 776 | 776 | } |
| 777 | 777 | return $ident_result; |
| 778 | - } |
|
| 778 | + } |
|
| 779 | 779 | |
| 780 | 780 | /** |
| 781 | - * Check recent aircraft by id |
|
| 782 | - * |
|
| 783 | - * @return String the ident |
|
| 784 | - * |
|
| 785 | - */ |
|
| 781 | + * Check recent aircraft by id |
|
| 782 | + * |
|
| 783 | + * @return String the ident |
|
| 784 | + * |
|
| 785 | + */ |
|
| 786 | 786 | public function checkIdRecent($id) |
| 787 | 787 | { |
| 788 | 788 | global $globalDBdriver, $globalTimezone; |
@@ -808,19 +808,19 @@ discard block |
||
| 808 | 808 | $ident_result = $row['famtrackid']; |
| 809 | 809 | } |
| 810 | 810 | return $ident_result; |
| 811 | - } |
|
| 811 | + } |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | - * Adds a new spotter data |
|
| 815 | - * |
|
| 816 | - * @param String $famtrackid the ID from flightaware |
|
| 817 | - * @param String $ident the flight ident |
|
| 818 | - * @param String $aircraft_icao the aircraft type |
|
| 819 | - * @param String $departure_airport_icao the departure airport |
|
| 820 | - * @param String $arrival_airport_icao the arrival airport |
|
| 821 | - * @return String success or false |
|
| 822 | - * |
|
| 823 | - */ |
|
| 814 | + * Adds a new spotter data |
|
| 815 | + * |
|
| 816 | + * @param String $famtrackid the ID from flightaware |
|
| 817 | + * @param String $ident the flight ident |
|
| 818 | + * @param String $aircraft_icao the aircraft type |
|
| 819 | + * @param String $departure_airport_icao the departure airport |
|
| 820 | + * @param String $arrival_airport_icao the arrival airport |
|
| 821 | + * @return String success or false |
|
| 822 | + * |
|
| 823 | + */ |
|
| 824 | 824 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
| 825 | 825 | { |
| 826 | 826 | global $globalURL, $globalArchive, $globalDebug; |
@@ -893,8 +893,8 @@ discard block |
||
| 893 | 893 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 894 | 894 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 895 | 895 | |
| 896 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 897 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 896 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 897 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 898 | 898 | |
| 899 | 899 | $query = ''; |
| 900 | 900 | if ($globalArchive) { |
@@ -909,18 +909,18 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | $sth = $this->db->prepare($query); |
| 911 | 911 | $sth->execute($query_values); |
| 912 | - } catch(PDOException $e) { |
|
| 913 | - return "error : ".$e->getMessage(); |
|
| 914 | - } |
|
| 915 | - /* |
|
| 912 | + } catch(PDOException $e) { |
|
| 913 | + return "error : ".$e->getMessage(); |
|
| 914 | + } |
|
| 915 | + /* |
|
| 916 | 916 | echo 'putinarchive : '.$putinarchive."\n"; |
| 917 | 917 | echo 'noarchive : '.$noarchive."\n"; |
| 918 | 918 | */ |
| 919 | 919 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 920 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 921 | - $TrackerArchive = new TrackerArchive($this->db); |
|
| 922 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 923 | - if ($globalDebug) echo $result.')'; |
|
| 920 | + if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 921 | + $TrackerArchive = new TrackerArchive($this->db); |
|
| 922 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 923 | + if ($globalDebug) echo $result.')'; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | return "success"; |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | * @param Array $filter the filter |
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
| 25 | 25 | } else { |
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | - $filters = array_merge($filters,$filter); |
|
| 30 | + $filters = array_merge($filters, $filter); |
|
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 33 | 33 | $filter_query_join = ''; |
| 34 | 34 | $filter_query_where = ''; |
| 35 | - foreach($filters as $flt) { |
|
| 35 | + foreach ($filters as $flt) { |
|
| 36 | 36 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 37 | 37 | if (isset($flt['source'])) { |
| 38 | - $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"; |
|
| 38 | + $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 | 39 | } else { |
| 40 | - $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"; |
|
| 40 | + $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 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 45 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 45 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 74 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 75 | 75 | } |
| 76 | 76 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } |
| 79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 80 | 80 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 81 | 81 | if ($filter_query_where != '') { |
| 82 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 82 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 83 | 83 | } |
| 84 | 84 | $filter_query = $filter_query_join.$filter_query_where; |
| 85 | 85 | return $filter_query; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if ($limit != '') |
| 103 | 103 | { |
| 104 | 104 | $limit_array = explode(',', $limit); |
| 105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 108 | 108 | { |
| 109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } else { |
| 127 | 127 | $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; |
| 128 | 128 | } |
| 129 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 129 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 130 | 130 | |
| 131 | 131 | return $spotter_array; |
| 132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
| 143 | 143 | date_default_timezone_set('UTC'); |
| 144 | 144 | |
| 145 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 145 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 146 | 146 | |
| 147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 148 | 148 | if ($globalDBdriver == 'mysql') { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | try { |
| 161 | 161 | $sth = $this->db->prepare($query); |
| 162 | 162 | $sth->execute(); |
| 163 | - } catch(PDOException $e) { |
|
| 163 | + } catch (PDOException $e) { |
|
| 164 | 164 | echo $e->getMessage(); |
| 165 | 165 | die; |
| 166 | 166 | } |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 181 | 181 | date_default_timezone_set('UTC'); |
| 182 | 182 | |
| 183 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 183 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 184 | 184 | |
| 185 | 185 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 186 | 186 | if ($globalDBdriver == 'mysql') { |
| 187 | 187 | if (isset($globalArchive) && $globalArchive) { |
| 188 | - $query = "SELECT * FROM ( |
|
| 188 | + $query = "SELECT * FROM ( |
|
| 189 | 189 | 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 |
| 190 | 190 | 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 |
| 191 | 191 | UNION |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | WHERE latitude <> '0' AND longitude <> '0' |
| 196 | 196 | ORDER BY famtrackid, date"; |
| 197 | 197 | } else { |
| 198 | - $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 |
|
| 198 | + $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 |
|
| 199 | 199 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date |
| 200 | 200 | AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
| 201 | 201 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 202 | 202 | } |
| 203 | 203 | } else { |
| 204 | 204 | if (isset($globalArchive) && $globalArchive) { |
| 205 | - $query = "SELECT * FROM ( |
|
| 205 | + $query = "SELECT * FROM ( |
|
| 206 | 206 | 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 |
| 207 | 207 | 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 |
| 208 | 208 | UNION |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | WHERE latitude <> '0' AND longitude <> '0' |
| 213 | 213 | ORDER BY famtrackid, date"; |
| 214 | 214 | } else { |
| 215 | - $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 |
|
| 215 | + $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 |
|
| 216 | 216 | 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' |
| 217 | 217 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 218 | 218 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | try { |
| 222 | 222 | $sth = $this->db->prepare($query); |
| 223 | 223 | $sth->execute(); |
| 224 | - } catch(PDOException $e) { |
|
| 224 | + } catch (PDOException $e) { |
|
| 225 | 225 | echo $e->getMessage(); |
| 226 | 226 | die; |
| 227 | 227 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | public function getLiveTrackerCount($filter = array()) |
| 239 | 239 | { |
| 240 | 240 | global $globalDBdriver, $globalLiveInterval; |
| 241 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 241 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 242 | 242 | |
| 243 | 243 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 244 | 244 | if ($globalDBdriver == 'mysql') { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | try { |
| 250 | 250 | $sth = $this->db->prepare($query); |
| 251 | 251 | $sth->execute(); |
| 252 | - } catch(PDOException $e) { |
|
| 252 | + } catch (PDOException $e) { |
|
| 253 | 253 | echo $e->getMessage(); |
| 254 | 254 | die; |
| 255 | 255 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | $filter_query = $this->getFilter($filter); |
| 273 | 273 | |
| 274 | 274 | if (is_array($coord)) { |
| 275 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 276 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 277 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 278 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 275 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 276 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 277 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 278 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 279 | 279 | } else return array(); |
| 280 | 280 | if ($globalDBdriver == 'mysql') { |
| 281 | 281 | $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; |
@@ -300,17 +300,17 @@ discard block |
||
| 300 | 300 | $filter_query = $this->getFilter($filter); |
| 301 | 301 | |
| 302 | 302 | if (is_array($coord)) { |
| 303 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 304 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 305 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 306 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 303 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 304 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 305 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 306 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 307 | 307 | } else return array(); |
| 308 | 308 | if ($globalDBdriver == 'mysql') { |
| 309 | 309 | $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 |
| 310 | 310 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
| 311 | 311 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 312 | 312 | } else { |
| 313 | - $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 |
|
| 313 | + $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 |
|
| 314 | 314 | 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 l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." 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'"; |
| 315 | 315 | } |
| 316 | 316 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | if ($interval == '1m') |
| 359 | 359 | { |
| 360 | 360 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 361 | - } else if ($interval == '15m'){ |
|
| 361 | + } else if ($interval == '15m') { |
|
| 362 | 362 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -366,14 +366,14 @@ discard block |
||
| 366 | 366 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $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 |
|
| 369 | + $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 |
|
| 370 | 370 | WHERE tracker_live.latitude <> '' |
| 371 | 371 | AND tracker_live.longitude <> '' |
| 372 | 372 | ".$additional_query." |
| 373 | 373 | HAVING distance < :radius |
| 374 | 374 | ORDER BY distance"; |
| 375 | 375 | |
| 376 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 376 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 377 | 377 | |
| 378 | 378 | return $spotter_array; |
| 379 | 379 | } |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | date_default_timezone_set('UTC'); |
| 392 | 392 | |
| 393 | 393 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 394 | - $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'; |
|
| 394 | + $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'; |
|
| 395 | 395 | |
| 396 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 396 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 397 | 397 | |
| 398 | 398 | return $spotter_array; |
| 399 | 399 | } |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | * @return Array the spotter information |
| 405 | 405 | * |
| 406 | 406 | */ |
| 407 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
| 407 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
| 408 | 408 | { |
| 409 | 409 | $Tracker = new Tracker($this->db); |
| 410 | 410 | date_default_timezone_set('UTC'); |
| 411 | 411 | |
| 412 | 412 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 413 | - $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'; |
|
| 413 | + $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'; |
|
| 414 | 414 | |
| 415 | - $date = date('c',$date); |
|
| 416 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 415 | + $date = date('c', $date); |
|
| 416 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 417 | 417 | |
| 418 | 418 | return $spotter_array; |
| 419 | 419 | } |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | date_default_timezone_set('UTC'); |
| 431 | 431 | |
| 432 | 432 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 433 | - $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'; |
|
| 433 | + $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'; |
|
| 434 | 434 | |
| 435 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 435 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 436 | 436 | |
| 437 | 437 | return $spotter_array; |
| 438 | 438 | } |
@@ -443,15 +443,15 @@ discard block |
||
| 443 | 443 | * @return Array the spotter information |
| 444 | 444 | * |
| 445 | 445 | */ |
| 446 | - public function getDateLiveTrackerDataById($id,$date) |
|
| 446 | + public function getDateLiveTrackerDataById($id, $date) |
|
| 447 | 447 | { |
| 448 | 448 | $Tracker = new Tracker($this->db); |
| 449 | 449 | date_default_timezone_set('UTC'); |
| 450 | 450 | |
| 451 | 451 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 452 | - $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'; |
|
| 453 | - $date = date('c',$date); |
|
| 454 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 452 | + $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'; |
|
| 453 | + $date = date('c', $date); |
|
| 454 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 455 | 455 | |
| 456 | 456 | return $spotter_array; |
| 457 | 457 | } |
@@ -468,13 +468,13 @@ discard block |
||
| 468 | 468 | date_default_timezone_set('UTC'); |
| 469 | 469 | |
| 470 | 470 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 471 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 471 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 472 | 472 | |
| 473 | 473 | try { |
| 474 | 474 | |
| 475 | 475 | $sth = $this->db->prepare($query); |
| 476 | 476 | $sth->execute(array(':ident' => $ident)); |
| 477 | - } catch(PDOException $e) { |
|
| 477 | + } catch (PDOException $e) { |
|
| 478 | 478 | echo $e->getMessage(); |
| 479 | 479 | die; |
| 480 | 480 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | * @return Array the spotter information |
| 490 | 490 | * |
| 491 | 491 | */ |
| 492 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
| 492 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
| 493 | 493 | { |
| 494 | 494 | global $globalDBdriver, $globalLiveInterval; |
| 495 | 495 | date_default_timezone_set('UTC'); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | try { |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(array(':id' => $id)); |
| 511 | - } catch(PDOException $e) { |
|
| 511 | + } catch (PDOException $e) { |
|
| 512 | 512 | echo $e->getMessage(); |
| 513 | 513 | die; |
| 514 | 514 | } |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | { |
| 527 | 527 | date_default_timezone_set('UTC'); |
| 528 | 528 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 529 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 529 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 530 | 530 | try { |
| 531 | 531 | |
| 532 | 532 | $sth = $this->db->prepare($query); |
| 533 | 533 | $sth->execute(array(':ident' => $ident)); |
| 534 | - } catch(PDOException $e) { |
|
| 534 | + } catch (PDOException $e) { |
|
| 535 | 535 | echo $e->getMessage(); |
| 536 | 536 | die; |
| 537 | 537 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
| 564 | - } catch(PDOException $e) { |
|
| 564 | + } catch (PDOException $e) { |
|
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -584,14 +584,14 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | $sth = $this->db->prepare($query); |
| 586 | 586 | $sth->execute(); |
| 587 | - } catch(PDOException $e) { |
|
| 587 | + } catch (PDOException $e) { |
|
| 588 | 588 | return "error"; |
| 589 | 589 | } |
| 590 | 590 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
| 591 | 591 | $i = 0; |
| 592 | - $j =0; |
|
| 592 | + $j = 0; |
|
| 593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 594 | - foreach($all as $row) |
|
| 594 | + foreach ($all as $row) |
|
| 595 | 595 | { |
| 596 | 596 | $i++; |
| 597 | 597 | $j++; |
@@ -599,9 +599,9 @@ discard block |
||
| 599 | 599 | if ($globalDebug) echo "."; |
| 600 | 600 | try { |
| 601 | 601 | |
| 602 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 602 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 603 | 603 | $sth->execute(); |
| 604 | - } catch(PDOException $e) { |
|
| 604 | + } catch (PDOException $e) { |
|
| 605 | 605 | return "error"; |
| 606 | 606 | } |
| 607 | 607 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -612,9 +612,9 @@ discard block |
||
| 612 | 612 | if ($i > 0) { |
| 613 | 613 | try { |
| 614 | 614 | |
| 615 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 615 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 616 | 616 | $sth->execute(); |
| 617 | - } catch(PDOException $e) { |
|
| 617 | + } catch (PDOException $e) { |
|
| 618 | 618 | return "error"; |
| 619 | 619 | } |
| 620 | 620 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | $sth = $this->db->prepare($query); |
| 629 | 629 | $sth->execute(); |
| 630 | - } catch(PDOException $e) { |
|
| 630 | + } catch (PDOException $e) { |
|
| 631 | 631 | return "error"; |
| 632 | 632 | } |
| 633 | 633 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -675,13 +675,13 @@ discard block |
||
| 675 | 675 | public function deleteLiveTrackerDataByIdent($ident) |
| 676 | 676 | { |
| 677 | 677 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 678 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 678 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 679 | 679 | |
| 680 | 680 | try { |
| 681 | 681 | |
| 682 | 682 | $sth = $this->db->prepare($query); |
| 683 | 683 | $sth->execute(array(':ident' => $ident)); |
| 684 | - } catch(PDOException $e) { |
|
| 684 | + } catch (PDOException $e) { |
|
| 685 | 685 | return "error"; |
| 686 | 686 | } |
| 687 | 687 | |
@@ -697,13 +697,13 @@ discard block |
||
| 697 | 697 | public function deleteLiveTrackerDataById($id) |
| 698 | 698 | { |
| 699 | 699 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 700 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 700 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 701 | 701 | |
| 702 | 702 | try { |
| 703 | 703 | |
| 704 | 704 | $sth = $this->db->prepare($query); |
| 705 | 705 | $sth->execute(array(':id' => $id)); |
| 706 | - } catch(PDOException $e) { |
|
| 706 | + } catch (PDOException $e) { |
|
| 707 | 707 | return "error"; |
| 708 | 708 | } |
| 709 | 709 | |
@@ -721,13 +721,13 @@ discard block |
||
| 721 | 721 | { |
| 722 | 722 | global $globalDBdriver, $globalTimezone; |
| 723 | 723 | if ($globalDBdriver == 'mysql') { |
| 724 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 724 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 725 | 725 | WHERE tracker_live.ident = :ident |
| 726 | 726 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 727 | 727 | AND tracker_live.date < UTC_TIMESTAMP()'; |
| 728 | 728 | $query_data = array(':ident' => $ident); |
| 729 | 729 | } else { |
| 730 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 730 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 731 | 731 | WHERE tracker_live.ident = :ident |
| 732 | 732 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 733 | 733 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -736,8 +736,8 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | $sth = $this->db->prepare($query); |
| 738 | 738 | $sth->execute($query_data); |
| 739 | - $ident_result=''; |
|
| 740 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 739 | + $ident_result = ''; |
|
| 740 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 741 | 741 | { |
| 742 | 742 | $ident_result = $row['ident']; |
| 743 | 743 | } |
@@ -754,13 +754,13 @@ discard block |
||
| 754 | 754 | { |
| 755 | 755 | global $globalDBdriver, $globalTimezone; |
| 756 | 756 | if ($globalDBdriver == 'mysql') { |
| 757 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 757 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 758 | 758 | WHERE tracker_live.ident = :ident |
| 759 | 759 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 760 | 760 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 761 | 761 | $query_data = array(':ident' => $ident); |
| 762 | 762 | } else { |
| 763 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 763 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 764 | 764 | WHERE tracker_live.ident = :ident |
| 765 | 765 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 766 | 766 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -769,8 +769,8 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | $sth = $this->db->prepare($query); |
| 771 | 771 | $sth->execute($query_data); |
| 772 | - $ident_result=''; |
|
| 773 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 772 | + $ident_result = ''; |
|
| 773 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 774 | 774 | { |
| 775 | 775 | $ident_result = $row['famtrackid']; |
| 776 | 776 | } |
@@ -787,13 +787,13 @@ discard block |
||
| 787 | 787 | { |
| 788 | 788 | global $globalDBdriver, $globalTimezone; |
| 789 | 789 | if ($globalDBdriver == 'mysql') { |
| 790 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 790 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 791 | 791 | WHERE tracker_live.famtrackid = :id |
| 792 | 792 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 793 | 793 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 794 | 794 | $query_data = array(':id' => $id); |
| 795 | 795 | } else { |
| 796 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 796 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 797 | 797 | WHERE tracker_live.famtrackid = :id |
| 798 | 798 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 799 | 799 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | $sth = $this->db->prepare($query); |
| 804 | 804 | $sth->execute($query_data); |
| 805 | - $ident_result=''; |
|
| 806 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 805 | + $ident_result = ''; |
|
| 806 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 807 | 807 | { |
| 808 | 808 | $ident_result = $row['famtrackid']; |
| 809 | 809 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * @return String success or false |
| 822 | 822 | * |
| 823 | 823 | */ |
| 824 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 824 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 825 | 825 | { |
| 826 | 826 | global $globalURL, $globalArchive, $globalDebug; |
| 827 | 827 | $Common = new Common(); |
@@ -880,21 +880,21 @@ discard block |
||
| 880 | 880 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 881 | 881 | |
| 882 | 882 | |
| 883 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 884 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 885 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 886 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 887 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 888 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 889 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 890 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 891 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 892 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 893 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 894 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 895 | - |
|
| 896 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 897 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 883 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 884 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 885 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 886 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 887 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 888 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 889 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 890 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 891 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 892 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 893 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 894 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 895 | + |
|
| 896 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 897 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 898 | 898 | |
| 899 | 899 | $query = ''; |
| 900 | 900 | if ($globalArchive) { |
@@ -904,12 +904,12 @@ discard block |
||
| 904 | 904 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
| 905 | 905 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
| 906 | 906 | |
| 907 | - $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); |
|
| 907 | + $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); |
|
| 908 | 908 | try { |
| 909 | 909 | |
| 910 | 910 | $sth = $this->db->prepare($query); |
| 911 | 911 | $sth->execute($query_values); |
| 912 | - } catch(PDOException $e) { |
|
| 912 | + } catch (PDOException $e) { |
|
| 913 | 913 | return "error : ".$e->getMessage(); |
| 914 | 914 | } |
| 915 | 915 | /* |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 920 | 920 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
| 921 | 921 | $TrackerArchive = new TrackerArchive($this->db); |
| 922 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 922 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
| 923 | 923 | if ($globalDebug) echo $result.')'; |
| 924 | 924 | } |
| 925 | 925 | |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | |
| 930 | 930 | public function getOrderBy() |
| 931 | 931 | { |
| 932 | - $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")); |
|
| 932 | + $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")); |
|
| 933 | 933 | return $orderby; |
| 934 | 934 | } |
| 935 | 935 | |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | 30 | $filters = array_merge($filters,$filter); |
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) { |
|
| 33 | + $filter = array_merge($filter,$globalFilter); |
|
| 34 | + } |
|
| 33 | 35 | $filter_query_join = ''; |
| 34 | 36 | $filter_query_where = ''; |
| 35 | 37 | foreach($filters as $flt) { |
@@ -76,8 +78,11 @@ discard block |
||
| 76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 78 | 80 | } |
| 79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 81 | + if ($filter_query_where == '' && $where) { |
|
| 82 | + $filter_query_where = ' WHERE'; |
|
| 83 | + } elseif ($filter_query_where != '' && $and) { |
|
| 84 | + $filter_query_where .= ' AND'; |
|
| 85 | + } |
|
| 81 | 86 | if ($filter_query_where != '') { |
| 82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 83 | 88 | } |
@@ -119,7 +124,9 @@ discard block |
||
| 119 | 124 | } |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 127 | + if (!isset($globalLiveInterval)) { |
|
| 128 | + $globalLiveInterval = '200'; |
|
| 129 | + } |
|
| 123 | 130 | if ($globalDBdriver == 'mysql') { |
| 124 | 131 | //$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"; |
| 125 | 132 | $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; |
@@ -144,7 +151,9 @@ discard block |
||
| 144 | 151 | |
| 145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
| 146 | 153 | |
| 147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 154 | + if (!isset($globalLiveInterval)) { |
|
| 155 | + $globalLiveInterval = '200'; |
|
| 156 | + } |
|
| 148 | 157 | if ($globalDBdriver == 'mysql') { |
| 149 | 158 | $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 |
| 150 | 159 | 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"; |
@@ -182,7 +191,9 @@ discard block |
||
| 182 | 191 | |
| 183 | 192 | $filter_query = $this->getFilter($filter,true,true); |
| 184 | 193 | |
| 185 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 194 | + if (!isset($globalLiveInterval)) { |
|
| 195 | + $globalLiveInterval = '200'; |
|
| 196 | + } |
|
| 186 | 197 | if ($globalDBdriver == 'mysql') { |
| 187 | 198 | if (isset($globalArchive) && $globalArchive) { |
| 188 | 199 | $query = "SELECT * FROM ( |
@@ -240,7 +251,9 @@ discard block |
||
| 240 | 251 | global $globalDBdriver, $globalLiveInterval; |
| 241 | 252 | $filter_query = $this->getFilter($filter,true,true); |
| 242 | 253 | |
| 243 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 254 | + if (!isset($globalLiveInterval)) { |
|
| 255 | + $globalLiveInterval = '200'; |
|
| 256 | + } |
|
| 244 | 257 | if ($globalDBdriver == 'mysql') { |
| 245 | 258 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 246 | 259 | } else { |
@@ -268,7 +281,9 @@ discard block |
||
| 268 | 281 | { |
| 269 | 282 | global $globalDBdriver, $globalLiveInterval; |
| 270 | 283 | $Spotter = new Spotter($this->db); |
| 271 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 284 | + if (!isset($globalLiveInterval)) { |
|
| 285 | + $globalLiveInterval = '200'; |
|
| 286 | + } |
|
| 272 | 287 | $filter_query = $this->getFilter($filter); |
| 273 | 288 | |
| 274 | 289 | if (is_array($coord)) { |
@@ -276,7 +291,9 @@ discard block |
||
| 276 | 291 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 277 | 292 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 278 | 293 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 279 | - } else return array(); |
|
| 294 | + } else { |
|
| 295 | + return array(); |
|
| 296 | + } |
|
| 280 | 297 | if ($globalDBdriver == 'mysql') { |
| 281 | 298 | $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; |
| 282 | 299 | } else { |
@@ -296,7 +313,9 @@ discard block |
||
| 296 | 313 | { |
| 297 | 314 | global $globalDBdriver, $globalLiveInterval; |
| 298 | 315 | $Spotter = new Spotter($this->db); |
| 299 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 316 | + if (!isset($globalLiveInterval)) { |
|
| 317 | + $globalLiveInterval = '200'; |
|
| 318 | + } |
|
| 300 | 319 | $filter_query = $this->getFilter($filter); |
| 301 | 320 | |
| 302 | 321 | if (is_array($coord)) { |
@@ -304,7 +323,9 @@ discard block |
||
| 304 | 323 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 305 | 324 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 306 | 325 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 307 | - } else return array(); |
|
| 326 | + } else { |
|
| 327 | + return array(); |
|
| 328 | + } |
|
| 308 | 329 | if ($globalDBdriver == 'mysql') { |
| 309 | 330 | $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 |
| 310 | 331 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -497,11 +518,15 @@ discard block |
||
| 497 | 518 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
| 498 | 519 | if ($globalDBdriver == 'mysql') { |
| 499 | 520 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 500 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 521 | + if ($liveinterval) { |
|
| 522 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 523 | + } |
|
| 501 | 524 | $query .= ' ORDER BY date'; |
| 502 | 525 | } else { |
| 503 | 526 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 504 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 527 | + if ($liveinterval) { |
|
| 528 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 529 | + } |
|
| 505 | 530 | $query .= ' ORDER BY date'; |
| 506 | 531 | } |
| 507 | 532 | |
@@ -596,7 +621,9 @@ discard block |
||
| 596 | 621 | $i++; |
| 597 | 622 | $j++; |
| 598 | 623 | if ($j == 30) { |
| 599 | - if ($globalDebug) echo "."; |
|
| 624 | + if ($globalDebug) { |
|
| 625 | + echo "."; |
|
| 626 | + } |
|
| 600 | 627 | try { |
| 601 | 628 | |
| 602 | 629 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -843,7 +870,9 @@ discard block |
||
| 843 | 870 | { |
| 844 | 871 | return false; |
| 845 | 872 | } |
| 846 | - } else return ''; |
|
| 873 | + } else { |
|
| 874 | + return ''; |
|
| 875 | + } |
|
| 847 | 876 | |
| 848 | 877 | if ($longitude != '') |
| 849 | 878 | { |
@@ -851,7 +880,9 @@ discard block |
||
| 851 | 880 | { |
| 852 | 881 | return false; |
| 853 | 882 | } |
| 854 | - } else return ''; |
|
| 883 | + } else { |
|
| 884 | + return ''; |
|
| 885 | + } |
|
| 855 | 886 | |
| 856 | 887 | if ($altitude != '') |
| 857 | 888 | { |
@@ -859,7 +890,9 @@ discard block |
||
| 859 | 890 | { |
| 860 | 891 | return false; |
| 861 | 892 | } |
| 862 | - } else $altitude = 0; |
|
| 893 | + } else { |
|
| 894 | + $altitude = 0; |
|
| 895 | + } |
|
| 863 | 896 | |
| 864 | 897 | if ($heading != '') |
| 865 | 898 | { |
@@ -867,7 +900,9 @@ discard block |
||
| 867 | 900 | { |
| 868 | 901 | return false; |
| 869 | 902 | } |
| 870 | - } else $heading = 0; |
|
| 903 | + } else { |
|
| 904 | + $heading = 0; |
|
| 905 | + } |
|
| 871 | 906 | |
| 872 | 907 | if ($groundspeed != '') |
| 873 | 908 | { |
@@ -875,9 +910,13 @@ discard block |
||
| 875 | 910 | { |
| 876 | 911 | return false; |
| 877 | 912 | } |
| 878 | - } else $groundspeed = 0; |
|
| 913 | + } else { |
|
| 914 | + $groundspeed = 0; |
|
| 915 | + } |
|
| 879 | 916 | date_default_timezone_set('UTC'); |
| 880 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 917 | + if ($date == '') { |
|
| 918 | + $date = date("Y-m-d H:i:s", time()); |
|
| 919 | + } |
|
| 881 | 920 | |
| 882 | 921 | |
| 883 | 922 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -893,12 +932,18 @@ discard block |
||
| 893 | 932 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 894 | 933 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 895 | 934 | |
| 896 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 897 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 935 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 936 | + $groundspeed = 0; |
|
| 937 | + } |
|
| 938 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 939 | + $heading = 0; |
|
| 940 | + } |
|
| 898 | 941 | |
| 899 | 942 | $query = ''; |
| 900 | 943 | if ($globalArchive) { |
| 901 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 944 | + if ($globalDebug) { |
|
| 945 | + echo '-- Delete previous data -- '; |
|
| 946 | + } |
|
| 902 | 947 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; |
| 903 | 948 | } |
| 904 | 949 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
@@ -917,10 +962,14 @@ discard block |
||
| 917 | 962 | echo 'noarchive : '.$noarchive."\n"; |
| 918 | 963 | */ |
| 919 | 964 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 920 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 965 | + if ($globalDebug) { |
|
| 966 | + echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 967 | + } |
|
| 921 | 968 | $TrackerArchive = new TrackerArchive($this->db); |
| 922 | 969 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
| 923 | - if ($globalDebug) echo $result.')'; |
|
| 970 | + if ($globalDebug) { |
|
| 971 | + echo $result.')'; |
|
| 972 | + } |
|
| 924 | 973 | } |
| 925 | 974 | |
| 926 | 975 | return "success"; |
@@ -53,7 +53,12 @@ discard block |
||
| 53 | 53 | } else { |
| 54 | 54 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
| 55 | 55 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
| 56 | - if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
| 56 | + if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
| 57 | + print $globalMapRefresh*2000; |
|
| 58 | +} else { |
|
| 59 | + print '60000'; |
|
| 60 | +} |
|
| 61 | +?>)) { |
|
| 57 | 62 | viewer.dataSources.get(dsn).entities.remove(entity); |
| 58 | 63 | } else { |
| 59 | 64 | //console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100)); |
@@ -127,7 +132,12 @@ discard block |
||
| 127 | 132 | function(){ |
| 128 | 133 | updateMarineData(); |
| 129 | 134 | } |
| 130 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 135 | + ,<?php if (isset($globalMapRefresh)) { |
|
| 136 | + print $globalMapRefresh*1000; |
|
| 137 | +} else { |
|
| 138 | + print '30000'; |
|
| 139 | +} |
|
| 140 | +?>); |
|
| 131 | 141 | } else { |
| 132 | 142 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
| 133 | 143 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | } else { |
| 132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
| 133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
| 134 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
| 134 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
| 135 | 135 | } |
| 136 | 136 | function MarineiconColor(color) { |
| 137 | 137 | document.cookie = 'MarineIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | if (!isset($globalJsonCompress)) $compress = true; |
| 7 | 7 | else $compress = $globalJsonCompress; |
| 8 | 8 | |
| 9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 9 | +if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 10 | +if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | }; |
| 177 | 177 | archive.update = function (props) { |
| 178 | 178 | if (typeof props != 'undefined') { |
| 179 | - //this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
| 180 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
| 179 | + //this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
| 180 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
| 181 | 181 | } else { |
| 182 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
| 182 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | }; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | <?php |
| 341 | 341 | } else { |
| 342 | 342 | ?> |
| 343 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 343 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 344 | 344 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 345 | 345 | <?php |
| 346 | 346 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | /* |
| 357 | 357 | shadowUrl: iconURLShadowpath, |
| 358 | 358 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
| 359 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 359 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 360 | 360 | */ |
| 361 | 361 | }) |
| 362 | 362 | }) |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | <?php |
| 383 | 383 | } else { |
| 384 | 384 | ?> |
| 385 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 385 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 386 | 386 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 387 | 387 | <?php |
| 388 | 388 | } |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | <?php |
| 423 | 423 | } else { |
| 424 | 424 | ?> |
| 425 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 425 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 426 | 426 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 427 | 427 | <?php |
| 428 | 428 | } |
@@ -3,11 +3,18 @@ discard block |
||
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | 5 | // Compressed GeoJson is used if true |
| 6 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 7 | -else $compress = $globalJsonCompress; |
|
| 6 | +if (!isset($globalJsonCompress)) { |
|
| 7 | + $compress = true; |
|
| 8 | +} else { |
|
| 9 | + $compress = $globalJsonCompress; |
|
| 10 | +} |
|
| 8 | 11 | |
| 9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 12 | +if (isset($_GET['ident'])) { |
|
| 13 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 14 | +} |
|
| 15 | +if (isset($_GET['flightaware_id'])) { |
|
| 16 | + $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 17 | +} |
|
| 11 | 18 | ?> |
| 12 | 19 | |
| 13 | 20 | |
@@ -72,9 +79,12 @@ discard block |
||
| 72 | 79 | |
| 73 | 80 | function update_airportsLayer() { |
| 74 | 81 | <?php |
| 75 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
| 76 | - else $getZoom = '7'; |
|
| 77 | -?> |
|
| 82 | + if (isset($_COOKIE['AirportZoom'])) { |
|
| 83 | + $getZoom = $_COOKIE['AirportZoom']; |
|
| 84 | + } else { |
|
| 85 | + $getZoom = '7'; |
|
| 86 | + } |
|
| 87 | + ?> |
|
| 78 | 88 | if (typeof airportsLayer != 'undefined') { |
| 79 | 89 | if (map.hasLayer(airportsLayer) == true) { |
| 80 | 90 | map.removeLayer(airportsLayer); |
@@ -290,9 +300,13 @@ discard block |
||
| 290 | 300 | if (callsign != ""){ markerLabel += callsign; } |
| 291 | 301 | if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; } |
| 292 | 302 | <?php |
| 293 | - if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
| 294 | - elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
| 295 | - else $IconColor = '1a3151'; |
|
| 303 | + if (isset($_COOKIE['IconColor'])) { |
|
| 304 | + $IconColor = $_COOKIE['IconColor']; |
|
| 305 | + } elseif (isset($globalAircraftIconColor)) { |
|
| 306 | + $IconColor = $globalAircraftIconColor; |
|
| 307 | + } else { |
|
| 308 | + $IconColor = '1a3151'; |
|
| 309 | + } |
|
| 296 | 310 | if (!isset($ident) && !isset($flightaware_id)) { |
| 297 | 311 | ?> |
| 298 | 312 | info_update(feature.properties.fc); |
@@ -340,7 +354,12 @@ discard block |
||
| 340 | 354 | <?php |
| 341 | 355 | } else { |
| 342 | 356 | ?> |
| 343 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 357 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 358 | + print $archiveupdatetime*1000; |
|
| 359 | +} else { |
|
| 360 | + print $globalMapRefresh*1000+20000; |
|
| 361 | +} |
|
| 362 | +?>+feature.properties.sqt*1000); |
|
| 344 | 363 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 345 | 364 | <?php |
| 346 | 365 | } |
@@ -382,7 +401,12 @@ discard block |
||
| 382 | 401 | <?php |
| 383 | 402 | } else { |
| 384 | 403 | ?> |
| 385 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 404 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 405 | + print $archiveupdatetime*1000; |
|
| 406 | +} else { |
|
| 407 | + print $globalMapRefresh*1000+20000; |
|
| 408 | +} |
|
| 409 | +?>+feature.properties.sqt*1000); |
|
| 386 | 410 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 387 | 411 | <?php |
| 388 | 412 | } |
@@ -422,7 +446,12 @@ discard block |
||
| 422 | 446 | <?php |
| 423 | 447 | } else { |
| 424 | 448 | ?> |
| 425 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 449 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 450 | + print $archiveupdatetime*1000; |
|
| 451 | +} else { |
|
| 452 | + print $globalMapRefresh*1000+20000; |
|
| 453 | +} |
|
| 454 | +?>+feature.properties.sqt*1000); |
|
| 426 | 455 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 427 | 456 | <?php |
| 428 | 457 | } |
@@ -759,13 +788,23 @@ discard block |
||
| 759 | 788 | if (isset($archive) && $archive) { |
| 760 | 789 | ?> |
| 761 | 790 | //then load it again every 30 seconds |
| 762 | - // var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
| 791 | + // var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 792 | + print ($globalMapRefresh*1000)/2; |
|
| 793 | +} else { |
|
| 794 | + print '15000'; |
|
| 795 | +} |
|
| 796 | +?>); |
|
| 763 | 797 | reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>); |
| 764 | 798 | <?php |
| 765 | 799 | } else { |
| 766 | 800 | ?> |
| 767 | 801 | //then load it again every 30 seconds |
| 768 | - reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 802 | + reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 803 | + print $globalMapRefresh*1000; |
|
| 804 | +} else { |
|
| 805 | + print '30000'; |
|
| 806 | +} |
|
| 807 | +?>); |
|
| 769 | 808 | var currentdate = new Date(); |
| 770 | 809 | var currentyear = new Date().getFullYear(); |
| 771 | 810 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -777,7 +816,12 @@ discard block |
||
| 777 | 816 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
| 778 | 817 | ?> |
| 779 | 818 | update_polarLayer(); |
| 780 | - setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 819 | + setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 820 | + print $globalMapRefresh*1000*2; |
|
| 821 | +} else { |
|
| 822 | + print '60000'; |
|
| 823 | +} |
|
| 824 | +?>); |
|
| 781 | 825 | <?php |
| 782 | 826 | } |
| 783 | 827 | ?> |
@@ -792,7 +836,12 @@ discard block |
||
| 792 | 836 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 793 | 837 | ?> |
| 794 | 838 | update_atcLayer(); |
| 795 | - setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 839 | + setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 840 | + print $globalMapRefresh*1000*2; |
|
| 841 | +} else { |
|
| 842 | + print '60000'; |
|
| 843 | +} |
|
| 844 | +?>); |
|
| 796 | 845 | <?php |
| 797 | 846 | } |
| 798 | 847 | ?> |
@@ -53,7 +53,12 @@ discard block |
||
| 53 | 53 | } else { |
| 54 | 54 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
| 55 | 55 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
| 56 | - if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
| 56 | + if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
| 57 | + print $globalMapRefresh*2000; |
|
| 58 | +} else { |
|
| 59 | + print '60000'; |
|
| 60 | +} |
|
| 61 | +?>)) { |
|
| 57 | 62 | viewer.dataSources.get(dsn).entities.remove(entity); |
| 58 | 63 | } else { |
| 59 | 64 | //console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100)); |
@@ -127,7 +132,12 @@ discard block |
||
| 127 | 132 | function(){ |
| 128 | 133 | updateTrackerData(); |
| 129 | 134 | } |
| 130 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 135 | + ,<?php if (isset($globalMapRefresh)) { |
|
| 136 | + print $globalMapRefresh*1000; |
|
| 137 | +} else { |
|
| 138 | + print '30000'; |
|
| 139 | +} |
|
| 140 | +?>); |
|
| 131 | 141 | } else { |
| 132 | 142 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
| 133 | 143 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | } else { |
| 178 | 178 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
| 179 | 179 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
| 180 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
| 180 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
| 181 | 181 | } |
| 182 | 182 | function TrackericonColor(color) { |
| 183 | 183 | document.cookie = 'TrackerIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | <?php |
| 519 | - } else { |
|
| 520 | - ?> |
|
| 519 | + } else { |
|
| 520 | + ?> |
|
| 521 | 521 | if (map.getZoom() > 7) { |
| 522 | 522 | var style = { |
| 523 | 523 | "color": "#1a3151", |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | layer_marine_data.addLayer(layer); |
| 537 | 537 | } |
| 538 | 538 | <?php |
| 539 | - } |
|
| 539 | + } |
|
| 540 | 540 | ?> |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -5,8 +5,11 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 10 | 13 | ?> |
| 11 | 14 | |
| 12 | 15 | |
@@ -142,9 +145,13 @@ discard block |
||
| 142 | 145 | if (callsign != ""){ markerMarineLabel += callsign; } |
| 143 | 146 | if (type != ""){ markerMarineLabel += ' - '+type; } |
| 144 | 147 | <?php |
| 145 | - if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
| 146 | - elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor; |
|
| 147 | - else $MarineIconColor = '1a3151'; |
|
| 148 | + if (isset($_COOKIE['MarineIconColor'])) { |
|
| 149 | + $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
| 150 | + } elseif (isset($globalMarineIconColor)) { |
|
| 151 | + $MarineIconColor = $globalMarineIconColor; |
|
| 152 | + } else { |
|
| 153 | + $MarineIconColor = '1a3151'; |
|
| 154 | + } |
|
| 148 | 155 | if (!isset($ident) && !isset($fammarine_id)) { |
| 149 | 156 | ?> |
| 150 | 157 | info_marine_update(feature.properties.fc); |
@@ -179,7 +186,12 @@ discard block |
||
| 179 | 186 | <?php |
| 180 | 187 | } else { |
| 181 | 188 | ?> |
| 182 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 189 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 190 | + print $archiveupdatetime*1000; |
|
| 191 | +} else { |
|
| 192 | + print $globalMapRefresh*1000+20000; |
|
| 193 | +} |
|
| 194 | +?>+feature.properties.sqt*1000); |
|
| 183 | 195 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 184 | 196 | <?php |
| 185 | 197 | } |
@@ -228,7 +240,12 @@ discard block |
||
| 228 | 240 | <?php |
| 229 | 241 | } else { |
| 230 | 242 | ?> |
| 231 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 243 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 244 | + print $archiveupdatetime*1000; |
|
| 245 | +} else { |
|
| 246 | + print $globalMapRefresh*1000+20000; |
|
| 247 | +} |
|
| 248 | +?>+feature.properties.sqt*1000); |
|
| 232 | 249 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 233 | 250 | <?php |
| 234 | 251 | } |
@@ -276,7 +293,12 @@ discard block |
||
| 276 | 293 | <?php |
| 277 | 294 | } else { |
| 278 | 295 | ?> |
| 279 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 296 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 297 | + print $archiveupdatetime*1000; |
|
| 298 | +} else { |
|
| 299 | + print $globalMapRefresh*1000+20000; |
|
| 300 | +} |
|
| 301 | +?>+feature.properties.sqt*1000); |
|
| 280 | 302 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 281 | 303 | <?php |
| 282 | 304 | } |
@@ -559,14 +581,24 @@ discard block |
||
| 559 | 581 | if (isset($archive) && $archive) { |
| 560 | 582 | ?> |
| 561 | 583 | //then load it again every 30 seconds |
| 562 | -// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
| 584 | +// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 585 | + print ($globalMapRefresh*1000)/2; |
|
| 586 | +} else { |
|
| 587 | + print '15000'; |
|
| 588 | +} |
|
| 589 | +?>); |
|
| 563 | 590 | reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>); |
| 564 | 591 | <?php |
| 565 | 592 | } else { |
| 566 | 593 | ?> |
| 567 | 594 | //then load it again every 30 seconds |
| 568 | 595 | reloadMarinePage = setInterval( |
| 569 | - function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 596 | + function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 597 | + print $globalMapRefresh*1000; |
|
| 598 | +} else { |
|
| 599 | + print '30000'; |
|
| 600 | +} |
|
| 601 | +?>); |
|
| 570 | 602 | <?php |
| 571 | 603 | } |
| 572 | 604 | ?> |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | require_once('../require/settings.php'); |
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | -setcookie("MapFormat",'2d'); |
|
| 5 | +setcookie("MapFormat", '2d'); |
|
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | if (isset($_GET['fammarine_id'])) { |
| 19 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
| 19 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
| 20 | 20 | } |
| 21 | 21 | if (isset($_GET['ident'])) { |
| 22 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 22 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 23 | 23 | } |
| 24 | 24 | if (!isset($ident) && !isset($fammarine_id)) { |
| 25 | 25 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | <?php |
| 183 | 183 | } else { |
| 184 | 184 | ?> |
| 185 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 185 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 186 | 186 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 187 | 187 | <?php |
| 188 | 188 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | /* |
| 199 | 199 | shadowUrl: iconURLShadowpath, |
| 200 | 200 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
| 201 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 201 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 202 | 202 | */ |
| 203 | 203 | }) |
| 204 | 204 | }) |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | <?php |
| 232 | 232 | } else { |
| 233 | 233 | ?> |
| 234 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 234 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 235 | 235 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 236 | 236 | <?php |
| 237 | 237 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | <?php |
| 280 | 280 | } else { |
| 281 | 281 | ?> |
| 282 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 282 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 283 | 283 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 284 | 284 | <?php |
| 285 | 285 | } |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | <?php |
| 520 | - } else { |
|
| 521 | - ?> |
|
| 520 | + } else { |
|
| 521 | + ?> |
|
| 522 | 522 | if (map.getZoom() > 7) { |
| 523 | 523 | var style = { |
| 524 | 524 | "color": "#1a3151", |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | layer_tracker_data.addLayer(layer); |
| 538 | 538 | } |
| 539 | 539 | <?php |
| 540 | - } |
|
| 540 | + } |
|
| 541 | 541 | ?> |
| 542 | 542 | } |
| 543 | 543 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | require_once('../require/settings.php'); |
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | -setcookie("MapFormat",'2d'); |
|
| 5 | +setcookie("MapFormat", '2d'); |
|
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php |
| 19 | 19 | if (isset($_GET['famtrackid'])) { |
| 20 | - $famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING); |
|
| 20 | + $famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING); |
|
| 21 | 21 | } |
| 22 | 22 | if (isset($_GET['ident'])) { |
| 23 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 23 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 24 | 24 | } |
| 25 | 25 | if (!isset($ident) && !isset($famtrackid)) { |
| 26 | 26 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | <?php |
| 183 | 183 | } else { |
| 184 | 184 | ?> |
| 185 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 185 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 186 | 186 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 187 | 187 | <?php |
| 188 | 188 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | /* |
| 199 | 199 | shadowUrl: iconURLShadowpath, |
| 200 | 200 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
| 201 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 201 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 202 | 202 | */ |
| 203 | 203 | }) |
| 204 | 204 | }) |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | <?php |
| 232 | 232 | } else { |
| 233 | 233 | ?> |
| 234 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 234 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 235 | 235 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 236 | 236 | <?php |
| 237 | 237 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | <?php |
| 280 | 280 | } else { |
| 281 | 281 | ?> |
| 282 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 282 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 283 | 283 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 284 | 284 | <?php |
| 285 | 285 | } |
@@ -5,8 +5,11 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 10 | 13 | ?> |
| 11 | 14 | |
| 12 | 15 | |
@@ -155,9 +158,13 @@ discard block |
||
| 155 | 158 | if (callsign != ""){ markerTrackerLabel += callsign; } |
| 156 | 159 | if (type != ""){ markerTrackerLabel += ' - '+type; } |
| 157 | 160 | <?php |
| 158 | - if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor']; |
|
| 159 | - elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor; |
|
| 160 | - else $IconColor = '1a3151'; |
|
| 161 | + if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 162 | + $IconColor = $_COOKIE['TrackerIconColor']; |
|
| 163 | + } elseif (isset($globalTrackerIconColor)) { |
|
| 164 | + $IconColor = $globalTrackerIconColor; |
|
| 165 | + } else { |
|
| 166 | + $IconColor = '1a3151'; |
|
| 167 | + } |
|
| 161 | 168 | if (!isset($ident) && !isset($famtrackid)) { |
| 162 | 169 | ?> |
| 163 | 170 | info_tracker_update(feature.properties.fc); |
@@ -191,7 +198,12 @@ discard block |
||
| 191 | 198 | <?php |
| 192 | 199 | } else { |
| 193 | 200 | ?> |
| 194 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 201 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 202 | + print $archiveupdatetime*1000; |
|
| 203 | +} else { |
|
| 204 | + print $globalMapRefresh*1000+20000; |
|
| 205 | +} |
|
| 206 | +?>+feature.properties.sqt*1000); |
|
| 195 | 207 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 196 | 208 | <?php |
| 197 | 209 | } |
@@ -247,7 +259,12 @@ discard block |
||
| 247 | 259 | <?php |
| 248 | 260 | } else { |
| 249 | 261 | ?> |
| 250 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 262 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 263 | + print $archiveupdatetime*1000; |
|
| 264 | +} else { |
|
| 265 | + print $globalMapRefresh*1000+20000; |
|
| 266 | +} |
|
| 267 | +?>+feature.properties.sqt*1000); |
|
| 251 | 268 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 252 | 269 | <?php |
| 253 | 270 | } |
@@ -302,7 +319,12 @@ discard block |
||
| 302 | 319 | <?php |
| 303 | 320 | } else { |
| 304 | 321 | ?> |
| 305 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 322 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 323 | + print $archiveupdatetime*1000; |
|
| 324 | +} else { |
|
| 325 | + print $globalMapRefresh*1000+20000; |
|
| 326 | +} |
|
| 327 | +?>+feature.properties.sqt*1000); |
|
| 306 | 328 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 307 | 329 | <?php |
| 308 | 330 | } |
@@ -592,14 +614,24 @@ discard block |
||
| 592 | 614 | if (isset($archive) && $archive) { |
| 593 | 615 | ?> |
| 594 | 616 | //then load it again every 30 seconds |
| 595 | -// var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
| 617 | +// var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 618 | + print ($globalMapRefresh*1000)/2; |
|
| 619 | +} else { |
|
| 620 | + print '15000'; |
|
| 621 | +} |
|
| 622 | +?>); |
|
| 596 | 623 | reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>); |
| 597 | 624 | <?php |
| 598 | 625 | } else { |
| 599 | 626 | ?> |
| 600 | 627 | //then load it again every 30 seconds |
| 601 | 628 | reloadTrackerPage = setInterval( |
| 602 | - function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 629 | + function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 630 | + print $globalMapRefresh*1000; |
|
| 631 | +} else { |
|
| 632 | + print '30000'; |
|
| 633 | +} |
|
| 634 | +?>); |
|
| 603 | 635 | <?php |
| 604 | 636 | } |
| 605 | 637 | ?> |