@@ -5,23 +5,23 @@ discard block |
||
5 | 5 | $marine = false; |
6 | 6 | $usecoord = false; |
7 | 7 | if (isset($_GET['tracker'])) { |
8 | - $tracker = true; |
|
8 | + $tracker = true; |
|
9 | 9 | } |
10 | 10 | if (isset($_GET['marine'])) { |
11 | - $marine = true; |
|
11 | + $marine = true; |
|
12 | 12 | } |
13 | 13 | if ($tracker) { |
14 | - require_once('require/class.Tracker.php'); |
|
15 | - require_once('require/class.TrackerLive.php'); |
|
16 | - //require_once('require/class.TrackerArchive.php'); |
|
14 | + require_once('require/class.Tracker.php'); |
|
15 | + require_once('require/class.TrackerLive.php'); |
|
16 | + //require_once('require/class.TrackerArchive.php'); |
|
17 | 17 | } elseif ($marine) { |
18 | - require_once('require/class.Marine.php'); |
|
19 | - require_once('require/class.MarineLive.php'); |
|
20 | - //require_once('require/class.MarineArchive.php'); |
|
18 | + require_once('require/class.Marine.php'); |
|
19 | + require_once('require/class.MarineLive.php'); |
|
20 | + //require_once('require/class.MarineArchive.php'); |
|
21 | 21 | } else { |
22 | - require_once('require/class.Spotter.php'); |
|
23 | - require_once('require/class.SpotterLive.php'); |
|
24 | - require_once('require/class.SpotterArchive.php'); |
|
22 | + require_once('require/class.Spotter.php'); |
|
23 | + require_once('require/class.SpotterLive.php'); |
|
24 | + require_once('require/class.SpotterArchive.php'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $begintime = microtime(true); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $Common = new Common(); |
42 | 42 | |
43 | 43 | if (isset($_GET['download'])) { |
44 | - if ($_GET['download'] == "true") |
|
45 | - { |
|
44 | + if ($_GET['download'] == "true") |
|
45 | + { |
|
46 | 46 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
47 | - } |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
497 | 497 | |
498 | 498 | if ( |
499 | - (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
500 | - || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
499 | + (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
500 | + || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
501 | 501 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
503 | - || (isset($history) && $history != '' && $history != 'NA' && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | - || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
505 | - ) { |
|
503 | + || (isset($history) && $history != '' && $history != 'NA' && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | + || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
505 | + ) { |
|
506 | 506 | if ($tracker) { |
507 | 507 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
508 | 508 | } elseif ($marine) { |
@@ -555,26 +555,26 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | if (isset($history) && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
558 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
559 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
558 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
559 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
560 | 560 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
561 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
561 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
562 | 562 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
563 | 563 | if (isset($dairport[0]['latitude'])) { |
564 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
564 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
565 | 565 | } |
566 | - } |
|
567 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
566 | + } |
|
567 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
568 | 568 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
569 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
569 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
570 | 570 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
571 | 571 | if (isset($aairport[0]['latitude'])) { |
572 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
572 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
573 | 573 | } |
574 | - } |
|
575 | - $output_air .= ']}},'; |
|
576 | - $output .= $output_air; |
|
577 | - unset($output_air); |
|
574 | + } |
|
575 | + $output_air .= ']}},'; |
|
576 | + $output .= $output_air; |
|
577 | + unset($output_air); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | $output = substr($output, 0, -1); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Gets all the spotter information based on the latest data entry |
|
132 | - * |
|
133 | - * @return Array the spotter information |
|
134 | - * |
|
135 | - */ |
|
131 | + * Gets all the spotter information based on the latest data entry |
|
132 | + * |
|
133 | + * @return Array the spotter information |
|
134 | + * |
|
135 | + */ |
|
136 | 136 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
137 | 137 | { |
138 | 138 | global $globalDBdriver, $globalLiveInterval; |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
177 | - * Gets Minimal Live Spotter data |
|
178 | - * |
|
179 | - * @return Array the spotter information |
|
180 | - * |
|
181 | - */ |
|
177 | + * Gets Minimal Live Spotter data |
|
178 | + * |
|
179 | + * @return Array the spotter information |
|
180 | + * |
|
181 | + */ |
|
182 | 182 | public function getMinLiveSpotterData($filter = array()) |
183 | 183 | { |
184 | 184 | global $globalDBdriver, $globalLiveInterval; |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * Gets Minimal Live Spotter data since xx seconds |
|
235 | - * |
|
236 | - * @return Array the spotter information |
|
237 | - * |
|
238 | - */ |
|
234 | + * Gets Minimal Live Spotter data since xx seconds |
|
235 | + * |
|
236 | + * @return Array the spotter information |
|
237 | + * |
|
238 | + */ |
|
239 | 239 | public function getMinLastLiveSpotterData($filter = array()) |
240 | 240 | { |
241 | 241 | global $globalDBdriver, $globalLiveInterval; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
254 | 254 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
255 | 255 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
256 | - } else { |
|
256 | + } else { |
|
257 | 257 | /* |
258 | 258 | $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
259 | 259 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | // echo $query; |
266 | 266 | } |
267 | 267 | |
268 | - try { |
|
268 | + try { |
|
269 | 269 | $sth = $this->db->prepare($query); |
270 | 270 | $sth->execute(); |
271 | 271 | } catch(PDOException $e) { |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * Gets number of latest data entry |
|
281 | - * |
|
282 | - * @return String number of entry |
|
283 | - * |
|
284 | - */ |
|
280 | + * Gets number of latest data entry |
|
281 | + * |
|
282 | + * @return String number of entry |
|
283 | + * |
|
284 | + */ |
|
285 | 285 | public function getLiveSpotterCount($filter = array()) |
286 | 286 | { |
287 | 287 | global $globalDBdriver, $globalLiveInterval; |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * Gets all the spotter information based on the latest data entry and coord |
|
312 | - * |
|
313 | - * @return Array the spotter information |
|
314 | - * |
|
315 | - */ |
|
311 | + * Gets all the spotter information based on the latest data entry and coord |
|
312 | + * |
|
313 | + * @return Array the spotter information |
|
314 | + * |
|
315 | + */ |
|
316 | 316 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
317 | 317 | { |
318 | 318 | global $globalDBdriver, $globalLiveInterval; |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | - * Gets all the spotter information based on the latest data entry and coord |
|
341 | - * |
|
342 | - * @return Array the spotter information |
|
343 | - * |
|
344 | - */ |
|
340 | + * Gets all the spotter information based on the latest data entry and coord |
|
341 | + * |
|
342 | + * @return Array the spotter information |
|
343 | + * |
|
344 | + */ |
|
345 | 345 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
346 | 346 | { |
347 | 347 | global $globalDBdriver, $globalLiveInterval; |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
385 | - * Gets all the spotter information based on a user's latitude and longitude |
|
386 | - * |
|
387 | - * @return Array the spotter information |
|
388 | - * |
|
389 | - */ |
|
385 | + * Gets all the spotter information based on a user's latitude and longitude |
|
386 | + * |
|
387 | + * @return Array the spotter information |
|
388 | + * |
|
389 | + */ |
|
390 | 390 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
391 | 391 | { |
392 | 392 | $Spotter = new Spotter($this->db); |
@@ -396,145 +396,145 @@ discard block |
||
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | } |
399 | - if ($lng != '') |
|
400 | - { |
|
401 | - if (!is_numeric($lng)) |
|
402 | - { |
|
403 | - return false; |
|
404 | - } |
|
405 | - } |
|
406 | - |
|
407 | - if ($radius != '') |
|
408 | - { |
|
409 | - if (!is_numeric($radius)) |
|
410 | - { |
|
411 | - return false; |
|
412 | - } |
|
413 | - } |
|
399 | + if ($lng != '') |
|
400 | + { |
|
401 | + if (!is_numeric($lng)) |
|
402 | + { |
|
403 | + return false; |
|
404 | + } |
|
405 | + } |
|
406 | + |
|
407 | + if ($radius != '') |
|
408 | + { |
|
409 | + if (!is_numeric($radius)) |
|
410 | + { |
|
411 | + return false; |
|
412 | + } |
|
413 | + } |
|
414 | 414 | $additional_query = ''; |
415 | - if ($interval != '') |
|
416 | - { |
|
417 | - if (!is_string($interval)) |
|
418 | - { |
|
419 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
420 | - return false; |
|
421 | - } else { |
|
422 | - if ($interval == '1m') |
|
423 | - { |
|
424 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
425 | - } else if ($interval == '15m'){ |
|
426 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
427 | - } |
|
428 | - } |
|
429 | - } else { |
|
430 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
431 | - } |
|
432 | - |
|
433 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
415 | + if ($interval != '') |
|
416 | + { |
|
417 | + if (!is_string($interval)) |
|
418 | + { |
|
419 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
420 | + return false; |
|
421 | + } else { |
|
422 | + if ($interval == '1m') |
|
423 | + { |
|
424 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
425 | + } else if ($interval == '15m'){ |
|
426 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
427 | + } |
|
428 | + } |
|
429 | + } else { |
|
430 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
431 | + } |
|
432 | + |
|
433 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
434 | 434 | WHERE spotter_live.latitude <> '' |
435 | 435 | AND spotter_live.longitude <> '' |
436 | 436 | ".$additional_query." |
437 | 437 | HAVING distance < :radius |
438 | 438 | ORDER BY distance"; |
439 | 439 | |
440 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
440 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
441 | 441 | |
442 | - return $spotter_array; |
|
443 | - } |
|
442 | + return $spotter_array; |
|
443 | + } |
|
444 | 444 | |
445 | 445 | |
446 | - /** |
|
447 | - * Gets all the spotter information based on a particular callsign |
|
448 | - * |
|
449 | - * @return Array the spotter information |
|
450 | - * |
|
451 | - */ |
|
446 | + /** |
|
447 | + * Gets all the spotter information based on a particular callsign |
|
448 | + * |
|
449 | + * @return Array the spotter information |
|
450 | + * |
|
451 | + */ |
|
452 | 452 | public function getLastLiveSpotterDataByIdent($ident) |
453 | 453 | { |
454 | 454 | $Spotter = new Spotter($this->db); |
455 | 455 | date_default_timezone_set('UTC'); |
456 | 456 | |
457 | 457 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
458 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
458 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
459 | 459 | |
460 | 460 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
461 | 461 | |
462 | 462 | return $spotter_array; |
463 | 463 | } |
464 | 464 | |
465 | - /** |
|
466 | - * Gets all the spotter information based on a particular callsign |
|
467 | - * |
|
468 | - * @return Array the spotter information |
|
469 | - * |
|
470 | - */ |
|
465 | + /** |
|
466 | + * Gets all the spotter information based on a particular callsign |
|
467 | + * |
|
468 | + * @return Array the spotter information |
|
469 | + * |
|
470 | + */ |
|
471 | 471 | public function getDateLiveSpotterDataByIdent($ident,$date) |
472 | 472 | { |
473 | 473 | $Spotter = new Spotter($this->db); |
474 | 474 | date_default_timezone_set('UTC'); |
475 | 475 | |
476 | 476 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
477 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
477 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
478 | 478 | |
479 | - $date = date('c',$date); |
|
479 | + $date = date('c',$date); |
|
480 | 480 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
481 | 481 | |
482 | 482 | return $spotter_array; |
483 | 483 | } |
484 | 484 | |
485 | - /** |
|
486 | - * Gets last spotter information based on a particular callsign |
|
487 | - * |
|
488 | - * @return Array the spotter information |
|
489 | - * |
|
490 | - */ |
|
485 | + /** |
|
486 | + * Gets last spotter information based on a particular callsign |
|
487 | + * |
|
488 | + * @return Array the spotter information |
|
489 | + * |
|
490 | + */ |
|
491 | 491 | public function getLastLiveSpotterDataById($id) |
492 | 492 | { |
493 | 493 | $Spotter = new Spotter($this->db); |
494 | 494 | date_default_timezone_set('UTC'); |
495 | 495 | |
496 | 496 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
497 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
497 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
498 | 498 | |
499 | 499 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
500 | 500 | |
501 | 501 | return $spotter_array; |
502 | 502 | } |
503 | 503 | |
504 | - /** |
|
505 | - * Gets last spotter information based on a particular callsign |
|
506 | - * |
|
507 | - * @return Array the spotter information |
|
508 | - * |
|
509 | - */ |
|
504 | + /** |
|
505 | + * Gets last spotter information based on a particular callsign |
|
506 | + * |
|
507 | + * @return Array the spotter information |
|
508 | + * |
|
509 | + */ |
|
510 | 510 | public function getDateLiveSpotterDataById($id,$date) |
511 | 511 | { |
512 | 512 | $Spotter = new Spotter($this->db); |
513 | 513 | date_default_timezone_set('UTC'); |
514 | 514 | |
515 | 515 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
516 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
517 | - $date = date('c',$date); |
|
516 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
517 | + $date = date('c',$date); |
|
518 | 518 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
519 | 519 | |
520 | 520 | return $spotter_array; |
521 | 521 | } |
522 | 522 | |
523 | - /** |
|
524 | - * Gets altitude information based on a particular callsign |
|
525 | - * |
|
526 | - * @return Array the spotter information |
|
527 | - * |
|
528 | - */ |
|
523 | + /** |
|
524 | + * Gets altitude information based on a particular callsign |
|
525 | + * |
|
526 | + * @return Array the spotter information |
|
527 | + * |
|
528 | + */ |
|
529 | 529 | public function getAltitudeLiveSpotterDataByIdent($ident) |
530 | 530 | { |
531 | 531 | |
532 | 532 | date_default_timezone_set('UTC'); |
533 | 533 | |
534 | 534 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
535 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
535 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
536 | 536 | |
537 | - try { |
|
537 | + try { |
|
538 | 538 | |
539 | 539 | $sth = $this->db->prepare($query); |
540 | 540 | $sth->execute(array(':ident' => $ident)); |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | return $spotter_array; |
548 | 548 | } |
549 | 549 | |
550 | - /** |
|
551 | - * Gets all the spotter information based on a particular id |
|
552 | - * |
|
553 | - * @return Array the spotter information |
|
554 | - * |
|
555 | - */ |
|
550 | + /** |
|
551 | + * Gets all the spotter information based on a particular id |
|
552 | + * |
|
553 | + * @return Array the spotter information |
|
554 | + * |
|
555 | + */ |
|
556 | 556 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
557 | 557 | { |
558 | 558 | global $globalDBdriver, $globalLiveInterval; |
@@ -580,18 +580,18 @@ discard block |
||
580 | 580 | return $spotter_array; |
581 | 581 | } |
582 | 582 | |
583 | - /** |
|
584 | - * Gets all the spotter information based on a particular ident |
|
585 | - * |
|
586 | - * @return Array the spotter information |
|
587 | - * |
|
588 | - */ |
|
583 | + /** |
|
584 | + * Gets all the spotter information based on a particular ident |
|
585 | + * |
|
586 | + * @return Array the spotter information |
|
587 | + * |
|
588 | + */ |
|
589 | 589 | public function getAllLiveSpotterDataByIdent($ident) |
590 | 590 | { |
591 | 591 | date_default_timezone_set('UTC'); |
592 | 592 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
593 | 593 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
594 | - try { |
|
594 | + try { |
|
595 | 595 | |
596 | 596 | $sth = $this->db->prepare($query); |
597 | 597 | $sth->execute(array(':ident' => $ident)); |
@@ -605,23 +605,23 @@ discard block |
||
605 | 605 | |
606 | 606 | |
607 | 607 | /** |
608 | - * Deletes all info in the table |
|
609 | - * |
|
610 | - * @return String success or false |
|
611 | - * |
|
612 | - */ |
|
608 | + * Deletes all info in the table |
|
609 | + * |
|
610 | + * @return String success or false |
|
611 | + * |
|
612 | + */ |
|
613 | 613 | public function deleteLiveSpotterData() |
614 | 614 | { |
615 | 615 | global $globalDBdriver; |
616 | 616 | if ($globalDBdriver == 'mysql') { |
617 | 617 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
618 | 618 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
619 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
619 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
620 | 620 | } else { |
621 | 621 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
622 | 622 | } |
623 | 623 | |
624 | - try { |
|
624 | + try { |
|
625 | 625 | |
626 | 626 | $sth = $this->db->prepare($query); |
627 | 627 | $sth->execute(); |
@@ -633,18 +633,18 @@ discard block |
||
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
636 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
637 | - * |
|
638 | - * @return String success or false |
|
639 | - * |
|
640 | - */ |
|
636 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
637 | + * |
|
638 | + * @return String success or false |
|
639 | + * |
|
640 | + */ |
|
641 | 641 | public function deleteLiveSpotterDataNotUpdated() |
642 | 642 | { |
643 | 643 | global $globalDBdriver, $globalDebug; |
644 | 644 | if ($globalDBdriver == 'mysql') { |
645 | 645 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
646 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
647 | - try { |
|
646 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
647 | + try { |
|
648 | 648 | |
649 | 649 | $sth = $this->db->prepare($query); |
650 | 650 | $sth->execute(); |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | return "error"; |
653 | 653 | } |
654 | 654 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
655 | - $i = 0; |
|
656 | - $j =0; |
|
655 | + $i = 0; |
|
656 | + $j =0; |
|
657 | 657 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
658 | 658 | foreach($all as $row) |
659 | 659 | { |
@@ -661,20 +661,20 @@ discard block |
||
661 | 661 | $j++; |
662 | 662 | if ($j == 30) { |
663 | 663 | if ($globalDebug) echo "."; |
664 | - try { |
|
664 | + try { |
|
665 | 665 | |
666 | 666 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
667 | 667 | $sth->execute(); |
668 | 668 | } catch(PDOException $e) { |
669 | 669 | return "error"; |
670 | 670 | } |
671 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
672 | - $j = 0; |
|
671 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
672 | + $j = 0; |
|
673 | 673 | } |
674 | 674 | $query_delete .= "'".$row['flightaware_id']."',"; |
675 | 675 | } |
676 | 676 | if ($i > 0) { |
677 | - try { |
|
677 | + try { |
|
678 | 678 | |
679 | 679 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
680 | 680 | $sth->execute(); |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | return "success"; |
686 | 686 | } elseif ($globalDBdriver == 'pgsql') { |
687 | 687 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
688 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
689 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
690 | - try { |
|
688 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
689 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
690 | + try { |
|
691 | 691 | |
692 | 692 | $sth = $this->db->prepare($query); |
693 | 693 | $sth->execute(); |
@@ -731,17 +731,17 @@ discard block |
||
731 | 731 | } |
732 | 732 | |
733 | 733 | /** |
734 | - * Deletes all info in the table for an ident |
|
735 | - * |
|
736 | - * @return String success or false |
|
737 | - * |
|
738 | - */ |
|
734 | + * Deletes all info in the table for an ident |
|
735 | + * |
|
736 | + * @return String success or false |
|
737 | + * |
|
738 | + */ |
|
739 | 739 | public function deleteLiveSpotterDataByIdent($ident) |
740 | 740 | { |
741 | 741 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
742 | 742 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
743 | 743 | |
744 | - try { |
|
744 | + try { |
|
745 | 745 | |
746 | 746 | $sth = $this->db->prepare($query); |
747 | 747 | $sth->execute(array(':ident' => $ident)); |
@@ -753,17 +753,17 @@ discard block |
||
753 | 753 | } |
754 | 754 | |
755 | 755 | /** |
756 | - * Deletes all info in the table for an id |
|
757 | - * |
|
758 | - * @return String success or false |
|
759 | - * |
|
760 | - */ |
|
756 | + * Deletes all info in the table for an id |
|
757 | + * |
|
758 | + * @return String success or false |
|
759 | + * |
|
760 | + */ |
|
761 | 761 | public function deleteLiveSpotterDataById($id) |
762 | 762 | { |
763 | 763 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
764 | 764 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
765 | 765 | |
766 | - try { |
|
766 | + try { |
|
767 | 767 | |
768 | 768 | $sth = $this->db->prepare($query); |
769 | 769 | $sth->execute(array(':id' => $id)); |
@@ -776,11 +776,11 @@ discard block |
||
776 | 776 | |
777 | 777 | |
778 | 778 | /** |
779 | - * Gets the aircraft ident within the last hour |
|
780 | - * |
|
781 | - * @return String the ident |
|
782 | - * |
|
783 | - */ |
|
779 | + * Gets the aircraft ident within the last hour |
|
780 | + * |
|
781 | + * @return String the ident |
|
782 | + * |
|
783 | + */ |
|
784 | 784 | public function getIdentFromLastHour($ident) |
785 | 785 | { |
786 | 786 | global $globalDBdriver, $globalTimezone; |
@@ -806,14 +806,14 @@ discard block |
||
806 | 806 | $ident_result = $row['ident']; |
807 | 807 | } |
808 | 808 | return $ident_result; |
809 | - } |
|
809 | + } |
|
810 | 810 | |
811 | 811 | /** |
812 | - * Check recent aircraft |
|
813 | - * |
|
814 | - * @return String the ident |
|
815 | - * |
|
816 | - */ |
|
812 | + * Check recent aircraft |
|
813 | + * |
|
814 | + * @return String the ident |
|
815 | + * |
|
816 | + */ |
|
817 | 817 | public function checkIdentRecent($ident) |
818 | 818 | { |
819 | 819 | global $globalDBdriver, $globalTimezone; |
@@ -839,14 +839,14 @@ discard block |
||
839 | 839 | $ident_result = $row['flightaware_id']; |
840 | 840 | } |
841 | 841 | return $ident_result; |
842 | - } |
|
842 | + } |
|
843 | 843 | |
844 | 844 | /** |
845 | - * Check recent aircraft by id |
|
846 | - * |
|
847 | - * @return String the ident |
|
848 | - * |
|
849 | - */ |
|
845 | + * Check recent aircraft by id |
|
846 | + * |
|
847 | + * @return String the ident |
|
848 | + * |
|
849 | + */ |
|
850 | 850 | public function checkIdRecent($id) |
851 | 851 | { |
852 | 852 | global $globalDBdriver, $globalTimezone; |
@@ -872,14 +872,14 @@ discard block |
||
872 | 872 | $ident_result = $row['flightaware_id']; |
873 | 873 | } |
874 | 874 | return $ident_result; |
875 | - } |
|
875 | + } |
|
876 | 876 | |
877 | 877 | /** |
878 | - * Check recent aircraft by ModeS |
|
879 | - * |
|
880 | - * @return String the ModeS |
|
881 | - * |
|
882 | - */ |
|
878 | + * Check recent aircraft by ModeS |
|
879 | + * |
|
880 | + * @return String the ModeS |
|
881 | + * |
|
882 | + */ |
|
883 | 883 | public function checkModeSRecent($modes) |
884 | 884 | { |
885 | 885 | global $globalDBdriver, $globalTimezone; |
@@ -906,19 +906,19 @@ discard block |
||
906 | 906 | $ident_result = $row['flightaware_id']; |
907 | 907 | } |
908 | 908 | return $ident_result; |
909 | - } |
|
909 | + } |
|
910 | 910 | |
911 | 911 | /** |
912 | - * Adds a new spotter data |
|
913 | - * |
|
914 | - * @param String $flightaware_id the ID from flightaware |
|
915 | - * @param String $ident the flight ident |
|
916 | - * @param String $aircraft_icao the aircraft type |
|
917 | - * @param String $departure_airport_icao the departure airport |
|
918 | - * @param String $arrival_airport_icao the arrival airport |
|
919 | - * @return String success or false |
|
920 | - * |
|
921 | - */ |
|
912 | + * Adds a new spotter data |
|
913 | + * |
|
914 | + * @param String $flightaware_id the ID from flightaware |
|
915 | + * @param String $ident the flight ident |
|
916 | + * @param String $aircraft_icao the aircraft type |
|
917 | + * @param String $departure_airport_icao the departure airport |
|
918 | + * @param String $arrival_airport_icao the arrival airport |
|
919 | + * @return String success or false |
|
920 | + * |
|
921 | + */ |
|
922 | 922 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
923 | 923 | { |
924 | 924 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1053,10 +1053,10 @@ discard block |
||
1053 | 1053 | $arrival_airport_country = ''; |
1054 | 1054 | |
1055 | 1055 | |
1056 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1057 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1058 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1059 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1056 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1057 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1058 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1059 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1060 | 1060 | |
1061 | 1061 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
1062 | 1062 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -1066,14 +1066,14 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | $sth = $this->db->prepare($query); |
1068 | 1068 | $sth->execute($query_values); |
1069 | - } catch(PDOException $e) { |
|
1070 | - return "error : ".$e->getMessage(); |
|
1071 | - } |
|
1069 | + } catch(PDOException $e) { |
|
1070 | + return "error : ".$e->getMessage(); |
|
1071 | + } |
|
1072 | 1072 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1073 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1074 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1075 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1076 | - if ($globalDebug) echo $result.')'; |
|
1073 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1074 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1075 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1076 | + if ($globalDebug) echo $result.')'; |
|
1077 | 1077 | } |
1078 | 1078 | return "success"; |
1079 | 1079 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | //waypoint plotting |
29 | 29 | $output .= '{"type": "Feature",'; |
30 | - $output .= '"properties": {'; |
|
30 | + $output .= '"properties": {'; |
|
31 | 31 | $output .= '"name": "'.str_replace('"',"'",$spotter_item['name']).'",'; |
32 | 32 | $output .= '"city": "'.str_replace('"',"'",$spotter_item['city']).'",'; |
33 | 33 | $output .= '"country": "'.$spotter_item['country'].'",'; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | $output .= '"homepage": "'.$spotter_item['home_link'].'",'; |
51 | 51 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
52 | 52 | // $output .= '"photo": "'.$spotter_item['image_thumbnail'].'",'; |
53 | - $output .= '},'; |
|
54 | - $output .= '"geometry": {'; |
|
53 | + $output .= '},'; |
|
54 | + $output .= '"geometry": {'; |
|
55 | 55 | $output .= '"type": "Point",'; |
56 | 56 | $output .= '"coordinates": ['; |
57 | - $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
57 | + $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
58 | 58 | $output .= ']'; |
59 | - $output .= '}'; |
|
59 | + $output .= '}'; |
|
60 | 60 | $output .= '},'; |
61 | 61 | } |
62 | 62 | $output = substr($output, 0, -1); |