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